Skip to content

docs: concurrency chapter + live verification record for smoke probe - #9

Merged
equationalapplications merged 3 commits into
mainfrom
docs/concurrency-and-smoke-live-verification
Aug 9, 2026
Merged

docs: concurrency chapter + live verification record for smoke probe#9
equationalapplications merged 3 commits into
mainfrom
docs/concurrency-and-smoke-live-verification

Conversation

@equationalapplications

Copy link
Copy Markdown
Owner

Docs-only change. No source, infra, or test files are touched.

Concurrency chapter

The README's "Concurrency Limitations & Scaling Up" section led with the split-brain risk and left the impression that the pattern is unsafe by default. It is not — the S3 conditional write (If-Match on the ETag we hydrated from) is what makes it safe, and that is a named, well-worn technique: optimistic concurrency control applied to a whole database file.

  • README section rewritten around the conditional write, with the honest caveat that this tutorial treats a 412 as an abort rather than rebasing — the Bedrock call and Discord post a losing tick already made are not rolled back. Unreachable on the fixed schedule with reservedConcurrentExecutions: 1; reachable the moment a second write path can race the loop.
  • New docs/10-concurrency.md carries the full treatment: master/sub-copy topology, 412 handling, rebase-and-retry, the SQS single-writer queue for high contention, and why EFS is not the multi-writer escape hatch it appears to be.

Live verification record

Closes the last open acceptance box in docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md (new §9.1), verified against the deployed us-east-1 stack.

The deployed Function URL turned out to still be AuthType: NONE — the merged IAM change had never been deployed. That made for a better test than intended: smoke.sh was run against it first and failed correctly with the "not enforcing AWS_IAM" message. The §4 regression row fired against a genuinely public URL, not a stub.

After deploying:

Check Result
Unsigned probe 403, body {"Message":"Forbidden"} — rejected at the AWS layer, never reaches the handler
Signed probe 200, exit 0
127 runs across 3 live ticks 127/127 unsigned 403; all signed runs ended 200; zero non-zero exits
429 retry path Caught live at 16:57:14ZAttempt 1: 429, Attempt 2: 200, correlating with the tick at 16:57:17Z that ran 2311 ms holding the reservedConcurrentExecutions: 1 mutex
Read-only invariant Exactly 3 fetch-length invocations in the window, one per scheduled tick — none from the 127 smoke runs

The contention window is only ~2.3 s per 300 s tick, so observing a 429 took repeated back-to-back runs; §9.1 notes this for anyone repeating the check.

Caveat, recorded in the spec: the empty-state branch (snapshotVersion: null) remains harness-only. The deploy landed on a bucket that already held memory.db, so the live runs exercised the populated branch. Observing empty state live would mean deleting the snapshot.

The EventBridge rule was left DISABLED after verification.

🤖 Generated with Claude Code

Replace the README's "Concurrency Limitations & Scaling Up" section with a
tighter framing built around what actually keeps the pattern safe: the S3
conditional write (If-Match on the hydrated ETag) as optimistic concurrency
control over a whole database file. Move the full treatment into a new
docs/10-concurrency.md covering the master/sub-copy topology, 412 handling,
rebase-and-retry, the SQS single-writer queue, and why EFS is not a
multi-writer escape hatch.

Also record the live post-deploy verification of the IAM-protected status
probe (spec 2026-08-09-smoke-status-iam-design, new section 9.1), checking
the last open acceptance box. Verified against the deployed us-east-1 stack:

- Pre-deploy, the URL was still AuthType: NONE and smoke.sh failed correctly
  with the "not enforcing AWS_IAM" message -- the regression gate firing
  against a genuinely public URL rather than a stub.
- Post-deploy: unsigned -> 403 (Forbidden at the AWS layer, never reaching
  the handler), signed -> 200, exit 0.
- 127 consecutive smoke runs across three live rate(5 minutes) ticks:
  127/127 unsigned 403, all signed runs ended 200, zero non-zero exits.
- The 429 retry path was caught live at 16:57:14Z (Attempt 1: 429,
  Attempt 2: 200), correlating with the tick at 16:57:17Z that ran 2311 ms
  while holding the reservedConcurrentExecutions: 1 mutex.
- Read-only invariant held: exactly three fetch-length invocations in the
  window, one per scheduled tick, none from the 127 smoke runs.

The empty-state branch (snapshotVersion: null) remains harness-only -- the
deploy landed on a bucket that already held memory.db, so the live runs
exercised the populated branch.

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

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 39 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7783a7a-e6af-4118-8454-1db386111826

📥 Commits

Reviewing files that changed from the base of the PR and between 3273707 and ef6eeb2.

📒 Files selected for processing (2)
  • README.md
  • docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md
📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added guidance on optimistic concurrency control for SQLite snapshots stored in S3, including ETag-based writes, 412 aborts, and related 404/409 conflicts.
    • Documented retained external side effects, rebase-and-retry options, high-contention recommendations, alternative storage systems, and EFS limitations.
    • Updated the documentation index with the new concurrency guide.
    • Recorded live verification results for IAM enforcement, signed status reads, retry handling, read-only behavior, and retry timing.

Walkthrough

The PR documents S3 ETag-based optimistic concurrency for SQLite snapshots, including conflict behavior, retry and queue-based scaling options, storage limitations, and live smoke-test verification.

Changes

S3 concurrency documentation

Layer / File(s) Summary
Concurrency model and conflict lifecycle
README.md, docs/10-concurrency.md
The documentation explains ETag tracking, conditional S3 writes, stale-writer rejection, conflict handling, discarded database work, and retained external side effects.
Retry and scaling guidance
docs/10-concurrency.md
The documentation describes bounded rebase-and-retry, single-writer SQS/Lambda coordination, alternative storage systems, and EFS limitations.
Live verification record
docs/superpowers/specs/.../2026-08-09-smoke-status-iam-design.md
The specification records live verification for IAM enforcement, signed status reads, retry handling, read-only behavior, and empty-state limitations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit checks the ETag line,
“If-Match guards this snapshot fine.”
Stale paws stop at four-one-two,
Queues arrange the work anew.
Smoke tests shine; the docs take flight.
Hop, hop, concurrency right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both primary documentation changes: the concurrency chapter and the live smoke-probe verification record.
Description check ✅ Passed The description accurately explains the documentation updates, live verification results, observed limitations, and validation performed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/10-concurrency.md`:
- Around line 23-42: Add the text language identifier to the fenced code blocks
containing the ASCII diagrams in the concurrency documentation, including both
diagram sections referenced by the comment. Keep the diagram contents unchanged.
- Around line 50-63: Update the documented conflict contract so the concurrency
explanation treats HTTP 404 and 409 responses as equivalent abort conditions
alongside 412, matching the PreconditionFailedError mapping in src/store/s3.ts.
Apply this clarification in docs/10-concurrency.md lines 50-63 and README.md
lines 150-152; both sites require direct documentation updates.
- Around line 76-90: Revise the concurrency guidance around “Adding
rebase-and-retry” to state that moving Bedrock and Discord side effects before
or after S3 publication does not provide atomicity and only changes the failure
mode. Require idempotency keys or a durable outbox with idempotent consumers
when coordinating these effects, while preserving the existing retry guidance.

In `@docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md`:
- Line 227: Update the smoke-status acceptance criterion near the
live-verification note to limit the claim to observed populated-response and
429-retry paths. Explicitly state that the snapshotVersion: null empty-state
branch remains harness-only, and remove any wording implying live verification
covered that branch.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a576383-e271-4673-a97d-90270b975cb7

📥 Commits

Reviewing files that changed from the base of the PR and between dc2aeb2 and d6782cc.

📒 Files selected for processing (3)
  • README.md
  • docs/10-concurrency.md
  • docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md

Comment thread docs/10-concurrency.md Outdated
Comment thread docs/10-concurrency.md
Comment thread docs/10-concurrency.md Outdated
Comment thread docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md Outdated
- Add text language to fenced ASCII diagrams (markdownlint MD040)
- Document 404 NoSuchKey and 409 ConditionalRequestConflict alongside
  412 as equivalent abort conditions (matches src/store/s3.ts mapping)
- Replace 'move side effects' wording with a coordinator/outbox requirement
  so it does not read as an atomicity guarantee
- Limit live-verification claim on spec §9 to the populated-response and
  429-retry paths; the snapshotVersion: null empty-state branch stays
  harness-only per §9.1 caveat
@equationalapplications

Copy link
Copy Markdown
Owner Author

/fix-pr follow-up

Commit: 3273707

Review resolution

  • Markdown lint MD040 on ASCII diagrams (docs/10-concurrency.md L23-42, L99-112)Fixed: added text language identifier to both fenced diagram blocks; diagrams unchanged.
  • Document 404/409 alongside 412 as equivalent abort conditions (docs/10-concurrency.md L50-63, README.md L150-152)Fixed: new paragraph in §"The topology" names all three S3 errors and points to src/store/s3.ts; README summary picks up the same 404/409 equivalence in a parenthetical.
  • Side-effect ordering guidance (docs/10-concurrency.md L76-90)Fixed: replaced "either serialize them ahead of the write or move the side effects after a successful publish" with "serialize them through one coordinator, or use a durable outbox with idempotent consumers. Moving side effects before or after a successful publish only changes which failure loses work; it does not make the operations atomic." Existing retry guidance preserved.
  • Limit live-verification claim (docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md L227)Fixed: the bullet now names the populated-response and 429-retry paths as observed, and explicitly states the snapshotVersion: null empty-state branch remains harness-only per the §9.1 caveat.

Verification

  • typecheck — pass (npm run typecheck)
  • tests — pass (16 files / 137 tests, npm test)
  • build not re-run — docs-only change, no TS/infra touched

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates project documentation to better explain the tutorial’s concurrency model (optimistic concurrency control via S3 conditional writes) and records a live, post-deploy verification log for the IAM-protected smoke status probe.

Changes:

  • Rewrites the README concurrency section to emphasize S3 conditional writes (ETag-based If-Match) and links to the new extended chapter.
  • Adds a new docs/10-concurrency.md chapter covering topology, 412 handling, rebase-and-retry, and a single-writer queue approach.
  • Extends the smoke probe IAM design spec with a live verification record and updates the implementation status line.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
README.md Reframes concurrency guidance around S3 conditional writes and points to the new chapter.
docs/10-concurrency.md Adds a detailed concurrency/scaling chapter for the S3-rehydrated SQLite pattern.
docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md Updates spec status and appends live verification record / acceptance checklist updates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md Outdated
Comment thread docs/superpowers/specs/2026-08-09-smoke-status-iam-design.md Outdated
- README: distinguish bootstrap conditional (If-None-Match: "*") from
  update conditional (If-Match: <ETag>) so the concurrency story is
  accurate from the first write, matching src/store/s3.ts.
- Spec: merge the two overlapping 'npm run smoke' acceptance bullets into
  one, scoping live verification to populated-response and 429-retry
  paths and keeping the empty-state branch clearly harness-only.

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

Copy link
Copy Markdown
Owner Author

/fix-pr follow-up

Commit: ef6eeb2

Review resolution

  • Copilot README.md bootstrap conditional (If-None-Match: "*" on first write)Fixed. README.md now distinguishes the bootstrap conditional (If-None-Match: "*", conditional create when no object exists) from the update conditional (If-Match: <ETag>, conditional update after hydration), matching src/store/s3.ts line 97.

  • Copilot spec 2026-08-09-smoke-status-iam-design.md line 227 (overlapping npm run smoke bullets + empty-state scope)Fixed. Merged the two overlapping - [x] bullets into one, with harness and live verification described together and the live scope explicitly limited to populated-response and 429-retry paths (empty-state branch called out as harness-only).

  • CodeRabbit thread 3744571837 (markdownlint MD040 on diagram blocks) — Already addressed in 3273707.

  • CodeRabbit thread 3744571845 (404/409 mapped to PreconditionFailedError) — Already addressed in 3273707.

  • CodeRabbit thread 3744571848 (side-effect ordering ≠ atomicity) — Already addressed in 3273707.

  • CodeRabbit thread 3744571849 (limit live-verification scope in spec) — Already addressed in 3273707.

Verification

  • typecheck — pass (npm run typecheck)
  • build — pass (npm run build)
  • tests — pass (npm test, 16 files / 137 tests)

@equationalapplications
equationalapplications merged commit 5efbcee into main Aug 9, 2026
1 check passed
@equationalapplications
equationalapplications deleted the docs/concurrency-and-smoke-live-verification branch August 9, 2026 17:29
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.

3 participants