Repository navigation
Conversation
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | f7e81b7 | Jul 11 2026, 08:32 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | f7e81b7 | Jul 11 2026, 08:32 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-do | f7e81b7 | Jul 11 2026, 08:32 AM |
533c40e
into
feat/plugin-registry-labelling-service
There was a problem hiding this comment.
This is a focused, well-scoped implementation of the W3.1 identity and signing runtime for the registry labeler. The approach is sound: it keeps the public identity material in environment bindings, validates did:web host/origin agreement and a canonical P-256 Multikey, serves the DID document and moderation policy from well-known endpoints, and wires the secret into lazy historical re-signing so stale labels are only materialized when actually queried. The runtime checks (key/public-key agreement, exact DID/service matching, lazy signer factory) line up with the stated goals.
I did not find logic bugs, security issues, or broken contracts in the implementation code. The diff is careful about error handling, avoids leaking configuration details, and the fixture relocation is internally consistent with the imports.
I do have two suggestions. One is a performance/reliability observation: the handler re-validates the public identity on every single request, including cheap read-only endpoints, and the concurrent re-signing test looks like it depends on an ordering that Promise.all does not guarantee. Both are straightforward to harden without changing the public behavior.
Nice work overall — I would not block merge on these, but both are worth addressing before this code is load-bearing in production.
Findings
-
[suggestion]
apps/labeler/src/index.ts:22The fetch handler awaits
getLabelerIdentityConfig(env)for every request, includingGET /.well-known/did.jsonandGET /.well-known/emdash-labeler-policy.json. That function imports/de-exports the public Multikey and parsesLABELER_SERVICE_URL, so this is a non-trivial amount of repeated work for static worker bindings.Because
envis immutable for the lifetime of an invocation, the validated identity can be memoized per worker instance or at least resolved once and reused. Consider moving the validation behind the route switch, or caching the result keyed by the binding values, so identity errors are still surfaced but warm requests pay only once. -
[suggestion]
apps/labeler/test/service.test.ts:882-887This concurrent re-signing assertion depends on the direct
queryLabelscall committing itsUPDATEbefore theSELF.fetchhandler reads the same row. Both promises start together underPromise.all.If
SELF.fetchreads first, it sees the stalesigning_key_version = 'v1'row while the active signing state is'v2', and its runtime signer (using the workerenvprivate keyPRIVATE_KEY) does not match the active public key.resignStaleLabelsthen records aRESIGN_CONFIGURATION_MISMATCHalert and throws, soresponse.statuswould be503, not200.The test may happen to pass deterministically with the current miniflare scheduling, but it is not guaranteed. Consider serializing a deterministic re-sign step (
await queryLabels(..., signingRuntime)) and only then asserting onSELF.fetch(queryRequest()), or making the test explicitly exercise the race and assert a safe outcome rather than assuming a winner.
What does this PR do?
Implements W3.1 identity and signing runtime for the registry labeler:
did:webdocument with the P-256#atproto_labelmethod and#atproto_labelerservice.Part of umbrella PR #1909. Remote resource provisioning and deployment remain deferred.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (targeted labeler and registry-moderation tests)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
Non-visual Worker change. Verified with:
pnpm buildpnpm typecheckpnpm lint:jsonpnpm --filter @emdash-cms/labeler test(27 tests)pnpm --filter @emdash-cms/registry-moderation test(60 tests)git diff --check