Skip to content

fix(indieauth,microsub,vc,conformance-target,examples): close LOW findings from issue #474 audit - #481

Merged
davidwkeith merged 2 commits into
mainfrom
claude/agents-workers-474-dokgjf
Aug 4, 2026
Merged

fix(indieauth,microsub,vc,conformance-target,examples): close LOW findings from issue #474 audit#481
davidwkeith merged 2 commits into
mainfrom
claude/agents-workers-474-dokgjf

Conversation

@davidwkeith

Copy link
Copy Markdown
Owner

Summary

Closes #474. All HIGH and MEDIUM findings from the Workers-best-practices audit were already fixed by #477; this closes the 7 remaining LOW-severity findings:

  • indieauth: createIndieAuth's route dispatch is now wrapped in try/catch — an unexpected exception (e.g. a D1 failure) returns a structured server_error OAuth response instead of crashing unhandled. Also added a runtime shape guard (isProfileInfo) so parseProfile no longer blind-casts the stored profile JSON column to ProfileInfo.
  • microsub: handleFollow's poll-priming MICROSUB_QUEUE.send now runs via ctx.waitUntil instead of blocking the HTTP response — it's a cache-priming nicety, not something the client needs to wait on.
  • vc: the signer cache (signerCache) is now scoped to each createVc() instance instead of a module-level global, so independently configured instances in the same isolate no longer silently share cache state — matching the composition contract's "instantiate multiple times, tested in isolation" rule.
  • conformance-target: the request.body.cancel() floating promise in fetch() is now backgrounded via ctx.waitUntil; wrangler.jsonc's compatibility_date bumped from 2025-01-01 (~19 months stale) to 2026-07-01, matching the sibling examples/deploy-to-cloudflare/wrangler.jsonc.
  • examples/deploy-to-cloudflare: the starter's fetch() routing dispatch is now wrapped in try/catch, since this file is copied wholesale into real deployed Workers (its own doc comment says as much) and previously had no crash guard at all.

Also updated issue #474's checklist to reflect the already-merged HIGH/MEDIUM items from #477 and check off the LOW items closed here.

Packages affected

@dwk/indieauth, @dwk/microsub, @dwk/vc, @dwk/conformance-target (private, no changeset), examples/deploy-to-cloudflare (private, no changeset)

Checklist

  • Read the relevant spec(s) under spec/packages/ and updated them if
    behaviour changed — not applicable, all changes are internal
    robustness/isolation fixes with no observable protocol/behavior change
  • Added/updated colocated tests (src/*.test.ts)
  • Ran the local CI gate: pnpm lint && pnpm format:check && pnpm typecheck && pnpm build && pnpm test
  • Added a changeset (pnpm changeset) if this touches a publishable
    package
  • Updated catalog.json / conformance/status.json — not applicable, no new mountable worker or conformance-status change

Generated by Claude Code

…dings from issue #474 audit

Closes the 7 remaining LOW-severity findings from the Workers-best-practices
audit (issue #474); all HIGH/MEDIUM findings were already closed by #477.

- indieauth: wrap route dispatch in try/catch (structured server_error
  instead of an unhandled crash); shape-guard the stored profile JSON
  before trusting it as ProfileInfo instead of blind-casting it.
- microsub: background the follow poll-priming queue send via ctx.waitUntil
  instead of blocking the response.
- vc: scope the signer cache to each createVc() instance instead of a
  module-level global shared across instances.
- conformance-target: background the request-body-cancel floating promise
  via ctx.waitUntil; bump the ~19-month-stale compatibility_date.
- examples/deploy-to-cloudflare: wrap routing dispatch in try/catch, since
  this starter file is copied wholesale into real deployed Workers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@davidwkeith davidwkeith left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against CONTRIBUTING.md. Overall this is solid, low-risk hardening work — each fix is scoped to exactly what its changeset describes, and the return await fixes in indieauth/handler.ts and examples/deploy-to-cloudflare/src/index.ts are correct and necessary (without the explicit await, a rejection from the wrapped call would escape the enclosing try rather than being caught, since return promise inside a try doesn't implicitly await before leaving the block).

CONTRIBUTING.md conformance

  • PR opened from the template with Summary / Packages affected / Checklist headings intact — good.
  • Checklist: unticked items ("spec update", "catalog/status.json") each carry the required one-line reason instead of being deleted — good.
  • Changesets: present for all three publishable packages touched (indieauth, microsub, vc); conformance-target and examples/deploy-to-cloudflare are correctly left out since both are private — good.
  • Commit/PR title: fix(indieauth,microsub,vc,conformance-target,examples): … — lowercase type, no trailing period, comma-separated scopes. One minor nit: the scope convention is "package name minus the @dwk/ prefix"; conformance-target maps cleanly (@dwk/conformance-target), but examples doesn't correspond to any @dwk/-prefixed package (the folder's own package.json name is dwk-discovery-starter). Not worth blocking on — the meaning is still discoverable — but flagging in case the maintainer wants a more precise scope token for this repo's convention going forward.

Code — one inline suggestion

  • packages/microsub/src/handler.ts:353 — the poll-priming queue send is now backgrounded via ctx.waitUntil but not .catch()'d, so a send failure is silently swallowed instead of logged (see inline comment for a concrete fix using the emit seam already used elsewhere in this handler). Not blocking.

Everything else — the indieauth shape guard (isProfileInfo), the per-instance vc signer cache, and the conformance-target wrangler.jsonc compatibility-date bump — looks correct and matches the composition contract's per-instance isolation rule. New tests look well-targeted (signer-cache isolation across two createVc() instances, malformed stored-profile shapes, the non-blocking follow-response test with an explicit waited array).

Note: CI (build-test, integration) was still in progress at review time — worth confirming green before merge.


Generated by Claude Code

Comment thread packages/microsub/src/handler.ts Outdated
…wing it

Per review on #481: now that the send is backgrounded via ctx.waitUntil, a
rejection (e.g. the queue is unavailable) would otherwise be silently
swallowed instead of surfacing as it did when the send was awaited inline.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

ghost commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

The build-test failure was @dwk/activitypub's mastodon-api.test.ts > publishStatus() escapes HTML metacharacters in both content and the CW summary — an assertion on a queued-delivery row count (expected +0 to be 1). This PR never touches activitypub/mastodon-api, and running that test 5× locally reproduces the failure ~1-in-5 with zero changes on my branch — it's a pre-existing flaky test (likely a timing/ordering issue in delivery queuing under load), not a regression from this PR. Re-ran the failed job (rerun_failed_jobs on run 30941737888); will keep watching.


Generated by Claude Code

@davidwkeith
davidwkeith merged commit b1e0fc4 into main Aug 4, 2026
@davidwkeith
davidwkeith deleted the claude/agents-workers-474-dokgjf branch August 4, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workers best-practices audit: remaining findings across 12 packages

2 participants