Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,21 @@ jobs:
shell: bash
run: |
set -euo pipefail
release_dir="${RUNNER_TEMP}/rate-limit-prepared"
pnpm run release:pack -- \
--require-clean \
--require-main-ancestor \
--require-release-tag \
--expected-release-commit "${RELEASE_COMMIT}"
manifest_digest="$(sha256sum .release/package-manifest.json | awk '{print $1}')"
--expected-release-commit "${RELEASE_COMMIT}" \
--output "${release_dir}"
manifest_digest="$(sha256sum "${release_dir}/package-manifest.json" | awk '{print $1}')"
printf 'manifest-digest=%s\n' "${manifest_digest}" >> "${GITHUB_OUTPUT}"

- name: Upload the prepared release
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: rate-limit-release-${{ github.run_id }}
path: .release/
path: ${{ runner.temp }}/rate-limit-prepared/
if-no-files-found: error
include-hidden-files: false
overwrite: true
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ in-memory tier and a durable storage-backed tier for expensive operations.

> [!IMPORTANT]
> Rate Limit is in early `0.x` development. Its public API is not stable.
> Current source is the **`0.3.1` candidate, not published**. Registry `latest`
> Current source is the **`0.3.2` candidate, not published**. Registry `latest`
> remains `0.2.0`, which
> predates the merged [PR #8 hardening](https://github.com/pegma-dev/rate-limit/pull/8)
> and the new bounded maintenance helper. The first advertised `0.1.0`
Expand All @@ -16,14 +16,20 @@ in-memory tier and a durable storage-backed tier for expensive operations.
> remains separate under `bootstrap`. pegma.dev composes the durable tier in
> its production Identity worker; this candidate is not a new host deployment.

The source behavior below describes the `0.3.1` candidate. Adoption waits for
The source behavior below describes the `0.3.2` candidate. Adoption waits for
its reviewed publication and the host's explicit configuration/storage transition.

The signed `v0.3.0` tag and GitHub release are retained history: their
preparation failed before packing, produced no release artifact, and did not
publish npm bytes. `0.3.1` corrects the packing checkout's SSH trust configuration
without changing the reviewed limiter API. See the
[failed preparation and patch-release record](docs/RELEASING.md#failed-030-preparation-and-031-candidate).
publish npm bytes. `0.3.1` fixed that trust configuration and passed packing,
but upload discovered no files beneath hidden `.release/`; no artifact was
retained and smoke/publication were skipped. Neither version is on npm.
The `0.3.2` candidate uses one nonhidden preparation/digest/upload directory,
with the limiter/helper API unchanged. See the
[failed upload and new candidate record](docs/RELEASING.md#failed-031-upload-and-032-candidate).
Hosts must wait for actual verified `0.3.2` publication before pinning the new
helper, including through an alias. Existing Identity/Support `0.2.0` imports
remain unchanged; no legacy data transition is automatic.

## Two tiers, no pretending

Expand Down
19 changes: 12 additions & 7 deletions docs/PROJECT_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Stage:** Phases 1, 2, and 4 are complete; Phase 3 has its first production
consumer. Registry `@pegma/rate-limit@0.2.0` is published, and pegma.dev composes
the durable tier for its Identity surface. Registry `latest` remains `0.2.0`.
Current source is the **`0.3.1`
Current source is the **`0.3.2`
candidate, not published**, retaining exact Storage Core `0.4.0`. Published
`0.2.0` predates the already-merged [PR #8 hardening](https://github.com/pegma-dev/rate-limit/pull/8)
for immutable policy descriptors, counter kind/configuration bindings, and
Expand All @@ -16,10 +16,15 @@ publication or host-adoption receipt.
Signed `v0.3.0` and its GitHub release remain immutable history. Their
preparation failed before packing because SSH trust was configured only in the
temporary verification repository, not the packing checkout. No release
artifact or npm `0.3.0` bytes were published. The `0.3.1` candidate corrects that
release configuration without changing the helper API; its own review, gates,
publication and registry verification remain required. See the
[failed-run receipt](RELEASING.md#failed-030-preparation-and-031-candidate).
artifact or npm `0.3.0` bytes were published. Signed `v0.3.1` corrected that
trust configuration and passed its gates/pack, then upload excluded hidden
`.release/`: zero artifacts were retained, smoke/publication were skipped, and
no npm `0.3.1` release exists. The `0.3.2` candidate uses one nonhidden
preparation/digest/upload directory, with the helper API unchanged. Its own
review, gates, publication and registry verification remain required. See the
[failed-upload receipt](RELEASING.md#failed-031-upload-and-032-candidate).
Hosts must await verified `0.3.2` publication before adopting the new helper,
including an alias; existing Identity/Support `0.2.0` imports stay unchanged.

The exact reviewed `0.0.0` package-name bootstrap remains published under
`bootstrap`. The first advertised `0.1.0` release was published from the
Expand Down Expand Up @@ -196,7 +201,7 @@ collection over an injected Store). The memory tier must remain importable
without a Store — a host wanting only abuse-dampening should not construct
storage. TypeScript, vitest, the ecosystem's standard layout.

## `0.3.1` bounded-maintenance source candidate
## `0.3.2` bounded-maintenance source candidate

`sweepDurableWindowsPage` is a root/durable export over the existing
`rate-limit-windows` collection. One call makes one physical global scan page,
Expand Down Expand Up @@ -227,7 +232,7 @@ retrying from the previous cursor can repeat work. The
define the interface; current-head gates, review, exact publication, and host
adoption remain release work.

Host aliases for this helper must pin `0.3.1` only after its actual verified
Host aliases for this helper must pin `0.3.2` only after its actual verified
registry publication. A signed tag or GitHub release alone is not publication.

Upgrading existing durable data is deliberate: use versioned policy names or
Expand Down
75 changes: 63 additions & 12 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ the hardened GitHub release workflow, npm trusted publishing, and provenance.
The completed one-time manual `0.0.0` ceremony below exists as an audit record:
npm could not configure a trusted publisher until `@pegma/rate-limit` existed.

As of 2026-11-08, npm `latest` is `0.2.0` and historical `bootstrap` is `0.0.0`.
Current source is the **unpublished `0.3.2` candidate**. The signed `0.3.0` and
`0.3.1` GitHub releases below did not publish npm versions; neither is a host
dependency or evidence of completed artifact/consumer verification.

## Release invariants

The release tool verifies the exact public workspace inventory, stable package
Expand All @@ -24,6 +29,8 @@ Normal preparation authenticates the stable signed tag in a temporary bare
repository before checkout. The packing checkout must also configure the same
approved SSH allowed-signers trust before the release tool independently checks
the signed tag; trust scoped to the temporary bare repository is not inherited.
Current preparation writes, hashes and uploads the same nonhidden
`${RUNNER_TEMP}/rate-limit-prepared` directory, with `include-hidden-files: false`.
The resulting artifact contains exactly two
regular files: the manifest and its named tarball. Consumer installation runs
in a separate job without publication authority. The environment-protected
Expand All @@ -32,10 +39,11 @@ checkout, verifies the preparation manifest digest and both tarball digests,
and invokes npm from a fresh directory with empty configuration files and an
allowlisted environment. It never executes repository code.

## Failed `0.3.0` preparation and `0.3.1` candidate
<a id="failed-030-preparation-and-031-candidate"></a>

## Failed `0.3.0` preparation

As of 2026-11-08, npm `latest` remains `0.2.0`; current source is the unpublished
`0.3.1` candidate. Protected signed annotated
Protected signed annotated
[`v0.3.0`](https://github.com/pegma-dev/rate-limit/releases/tag/v0.3.0), tag object
`9df80b019b8ed6e5b7fc0f5a8c7359ae4cae6486`, points to reviewed source
[`93c7a4207d493e10568b797bf7d5a402f446cc70`](https://github.com/pegma-dev/rate-limit/commit/93c7a4207d493e10568b797bf7d5a402f446cc70).
Expand All @@ -52,16 +60,59 @@ failure, not evidence that the protected signed tag was invalid.

Preserve the `v0.3.0` tag object, source commit, GitHub release and failed-run
record. Never move or replace that tag, reuse its version for changed source,
or treat the failed preparation as publication. The correction uses a reviewed
`0.3.1` patch and a new protected signed `v0.3.1` release identity after merge.
It adds explicit trust to the packing checkout; the limiter/helper API and
behavior remain unchanged. The full Node 22/24 gates and exact-artifact release
checks still apply to the new source.

Only after `0.3.1` actually publishes and its original prepared bytes and
or treat the failed preparation as publication. The correction used reviewed
`0.3.1` source and a new protected signed `v0.3.1` identity after merge. It
added explicit trust to the packing checkout without changing limiter/helper
behavior. Its later failure was a separate upload boundary, recorded next.

## Failed `0.3.1` upload and `0.3.2` candidate

The signed annotated
[`v0.3.1` release](https://github.com/pegma-dev/rate-limit/releases/tag/v0.3.1),
tag object `0b44be7a99771e92f5defc34ca408917c403f526`, points to reviewed source
[`b2f15e4a2a2937894ad90b623fee8914ba13ca31`](https://github.com/pegma-dev/rate-limit/commit/b2f15e4a2a2937894ad90b623fee8914ba13ca31).
[Run `42510458896`](https://github.com/pegma-dev/rate-limit/actions/runs/42510458896),
attempt 1, failed in
[prepare job `128822182349`](https://github.com/pegma-dev/rate-limit/actions/runs/42510458896/job/128822182349)
on 2026-11-08. Tag authentication, the checkout signing-trust helper, repository
gates, and preparation/sealing all passed. The packer produced its manifest and
tarball in the checkout's workspace-relative `.release/` directory.

Upload then failed at **2026-11-08T18:32:14Z**: its path was `.release/`, while
`include-hidden-files: false` excluded that hidden directory. Discovery found
zero files and upload failed closed. The run's artifacts API reports zero
retained artifacts; smoke and publish were skipped. The successful runner-local
pack is not a downloadable, independently verified release artifact. No npm
`0.3.1` publication occurred.

Preserve the signed `v0.3.1` tag, source and failed-run record alongside the
earlier `v0.3.0` history. Do not replace a tag, reuse either version for changed
source, or treat a GitHub release as npm availability.

The new `0.3.2` candidate keeps the limiter/helper API and signing correction
unchanged. Its producer uses explicit `--output` at the nonhidden
`${RUNNER_TEMP}/rate-limit-prepared` directory, computes the manifest digest
there, and uploads that same directory through `${{ runner.temp }}`. Hidden-file
exclusion remains enabled (`include-hidden-files: false`); recovery does not
broaden artifact collection.
Validate the actual YAML producer/digest/upload wiring and file discovery with
the pinned `@actions/glob@0.5.0` regression. The pinned upload action's
[package lock](https://github.com/actions/upload-artifact/blob/330a01c490aca151604b8cf639adc76d48f6c5d4/package-lock.json)
records that version with the same integrity as the
[registry artifact](https://registry.npmjs.org/@actions%2fglob/0.5.0).
Its [search implementation](https://github.com/actions/upload-artifact/blob/330a01c490aca151604b8cf639adc76d48f6c5d4/src/shared/search.ts)
defines the glob options and directory filtering used by the
[regression](../scripts/release-artifact-discovery.test.mjs). The test exercises
that public glob API and filtering only; it does not execute the vendored action
bundle or upload bytes. Current-head review, full Node 22/24
gates, the new signed release identity, retained exact artifact, isolated smoke,
publication and registry verification remain required for this candidate.

Only after `0.3.2` actually publishes and its original prepared bytes and
registry release are verified may a host pin it, including through an npm
alias. This does not migrate legacy `0.2.0` counters or change existing host
deployment state. No repeated bootstrap, token fallback or signature bypass is
deployment state; existing Identity/Support `0.2.0` imports remain unchanged.
No repeated bootstrap, token fallback or signature bypass is
part of this recovery.

## One-time `0.0.0` package-name bootstrap
Expand Down Expand Up @@ -245,4 +296,4 @@ npm dist-tag ls @pegma/rate-limit
For that ceremony the registry check had to report
`@pegma/rate-limit@0.1.0: exact`, with `latest` at `0.1.0` and `bootstrap` at
`0.0.0`. Current `latest` is `0.2.0`; do not retag an older release or repeat
the bootstrap to prepare the unpublished `0.3.1` candidate.
the bootstrap to prepare the unpublished `0.3.2` candidate.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
"release:pack": "node scripts/release-package.mjs pack",
"release:publish": "node scripts/release-package.mjs publish",
"release:registry:check": "node scripts/release-package.mjs registry-check",
"test": "pnpm run build && vitest run && node --test scripts/configure-release-signing.test.mjs scripts/release-workflow-signing.test.mjs"
"test": "pnpm run build && vitest run && node --test scripts/configure-release-signing.test.mjs scripts/release-workflow-signing.test.mjs scripts/release-artifact-discovery.test.mjs"
},
"devDependencies": {
"@actions/glob": "0.5.0",
"@azure/data-tables": "13.3.1",
"@pegma/storage-azure-tables": "0.4.0",
"@types/node": "26.1.1",
Expand Down
16 changes: 11 additions & 5 deletions packages/rate-limit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Two explicitly named application rate-limit tiers:
abuse-critical operations.

> [!IMPORTANT]
> Current source is the **`0.3.1` candidate, not published**. Registry `latest`
> Current source is the **`0.3.2` candidate, not published**. Registry `latest`
> remains `0.2.0`, which
> predates the merged descriptor/configuration hardening and the bounded
> global sweep described here. `0.1.0` was the first advertised release, published through
Expand All @@ -22,10 +22,16 @@ published version only after its release verification and an explicit host
storage/configuration transition.

The signed `v0.3.0` tag and GitHub release exist, but preparation failed before
packing: no release artifact or npm `0.3.0` bytes were published. The `0.3.1`
candidate fixes release-checkout SSH trust, with the reviewed limiter API
unchanged. The immutable failure history and new patch identity are recorded in
packing: no release artifact or npm `0.3.0` bytes were published. Signed
`v0.3.1` fixed checkout trust and passed its gates and pack, but upload excluded
hidden `.release/`, retained zero artifacts, and skipped smoke/publication.
There is no npm `0.3.1` release. The `0.3.2` candidate moves preparation,
digesting and upload to the same nonhidden directory without changing the
limiter/helper API. The immutable failure history and new candidate are recorded in
[release operations](https://github.com/pegma-dev/rate-limit/blob/main/docs/RELEASING.md).
No host should pin a new helper alias until actual `0.3.2` publication and
exact-artifact verification. Existing Identity/Support `0.2.0` composition and
legacy counter storage remain separate from that adoption.

There is no default tier and no automatic upgrade. This package is application
abuse control, not DDoS protection, HTTP middleware, or billing metering.
Expand Down Expand Up @@ -206,7 +212,7 @@ delete arbitrary malformed rows, or mistake the global sweep for a migration
of previously published `0.2.0` data.

A host adopting the new helper through an npm alias must wait for actual
`0.3.1` publication and registry verification before pinning that alias. Existing
`0.3.2` publication and registry verification before pinning that alias. Existing
`0.2.0` consumers and counters need their own deliberate migration; the new
release does not convert them automatically.

Expand Down
2 changes: 1 addition & 1 deletion packages/rate-limit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/rate-limit",
"version": "0.3.1",
"version": "0.3.2",
"description": "Explicit per-instance sliding-window and shared durable fixed-window rate limiters.",
"license": "MIT",
"type": "module",
Expand Down
53 changes: 53 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading