Skip to content

feat(issues): let a re-prioritisation be expressed through the ledger writer (#313) - #1905

Merged
BigSimmo merged 3 commits into
mainfrom
claude/issues-writer-pri-flag
Aug 13, 2026
Merged

feat(issues): let a re-prioritisation be expressed through the ledger writer (#313)#1905
BigSimmo merged 3 commits into
mainfrom
claude/issues-writer-pri-flag

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • Re-prioritising is the mutation triage performs most often, and it was the one mutation the ledger tooling could not express.AGENTS.md and the ledger both require mutating rows only through the writer — precisely because hand-authored rows produced the width, escaping and wrong-table failures the writer exists to stop — so every demotion had to take the forbidden path. npm run issues:update -- '#151' --pri P3 now works.
  • The gap was three layers deep, and each looked fine while the others were broken:
    1. scripts/outstanding-issues.mjsupdateIssue's editable map had no pri entry, so the Pri cell was unreachable.
    2. scripts/ledger-inbox.mjscreateRequest — the update payload was built from summary/detail/source only, so even once updateIssue accepted pri, the CLI could not emit it.
    3. scripts/ledger-inbox.mjsvalidateRequest — required one of summary/detail/source, so a pri-only request was rejected before reaching either of the above. A re-prioritisation with no prose change is a legitimate triage edit and now counts on its own.
  • Values are validated against the same P1/P2/P3 set add uses, at both the request boundary and the writer, and rejected before the guarded write so a bad value reports itself rather than surfacing as a gate refusal about a malformed row.
  • Deliberately per-row — no bulk re-prioritise mode, because a sweep that moves many rows at once should be visible row by row in review.

No canonical ledger edit. This is scripts-only and fully compatible with the inbox/reconcile architecture: ledger-inbox.mjs delegates to updateIssue, so the fix lands on the live path rather than a superseded one.

Verification

  • npm run verify:pr-localcompleted: check:runtime, check:installed-lock-parity, format:changed, lint, typecheck, test, check:rag:fixtures, check:medication-interactions, check:medication-lexicon-report · failed: (none). Build skipped by the runner: "no build-affecting source, config, package, or container changes detected."
  • node scripts/outstanding-issues.mjs --self-test and node scripts/ledger-inbox.mjs --self-test both pass
  • End to end through the real CLI:npm run issues:update -- '#090' --pri P3Queued update request at docs/outstanding-issues-inbox/<uuid>.json. It is merge-safe; run npm run issues:reconcile after this PR lands. (the artifact was removed before commit — landing one demotion in isolation would be arbitrary)
  • Mutation-tested at all three layers, so the assertions are known to catch what they are for rather than merely known to pass:
    • remove pri from the writer's editable map → the writer throws pass at least one of --pri, --summary, --detail, --source on a pri-only request
    • drop the createRequest passthrough → the CLI rejects with update requires pri, summary, detail, or source
    • drop pri from validateRequest → the inbox self-test fails
  • The writer self-test additionally pins that only the Pri cell moves — an off-by-one there would write a priority over the ID or Type cell and still produce a structurally valid row — plus both directions (promote and demote) and the combined --pri --detail call.

UI verification not run: no UI surface is touched; the change is two Node scripts and their self-tests.

Risk and rollout

  • Risk: Low. Additive to a validated path; every write still runs through guarded(), which re-runs the ledger gate against its own output before writing. An invalid priority is rejected at two independent points.
  • Rollback:git revert on the single commit. No ledger state changes, so nothing to unwind.
  • Provider or production effects: None.

Notes

Provenance: this work was originally done on claude/ledger-tasks-fable-xhl7xb (PR #1890). That PR was closed without merging and its branch deleted, so none of it reached main — I confirmed that directly (git show origin/main:scripts/outstanding-issues.mjs | grep -c 'pri: 1' → 0, and none of the sweep's rows are archived on main). This PR carries only the code, re-verified against current main, and drops the ledger edits that made #1890 unlandable under the new write-discipline gate.

The #313 tracking row does not exist on main — it was only ever in the closed PR's ledger, so there is no row to close here. Same for #314/#316. The findings they recorded are preserved in this PR body and in PR #1902's; re-filing them belongs in a reconciliation pass rather than a scripts PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DuYJz8hauCsCdx8r4fXiZU


Generated by Claude Code

… writer (#313)
Re-prioritising is the mutation triage performs most often, and it was the one
mutation the ledger tooling could not express. AGENTS.md and the ledger both
require mutating rows only through the writer — precisely because hand-authored
rows produced the width, escaping and wrong-table failures the writer exists to
stop — so every demotion had to take the forbidden path.
npm run issues:update -- '#151' --pri P3
The gap turned out to be three layers deep, and each one looked fine while the
others were broken:
1. scripts/outstanding-issues.mjs — updateIssue's editable map had no `pri`
entry, so the Pri cell was unreachable.
2. scripts/ledger-inbox.mjs createRequest — the update payload was built from
summary/detail/source only, so even once updateIssue accepted pri, the CLI
could not emit it.
3. scripts/ledger-inbox.mjs validateRequest — required one of
summary/detail/source, so a pri-only request was rejected before it reached
either of the above. A re-prioritisation with no prose change is a
legitimate triage edit and now counts on its own.
Values are validated against the same P1/P2/P3 set `add` uses, at both the
request boundary and the writer, and rejected before the guarded write so a bad
value reports itself rather than surfacing as a gate refusal about a malformed
row. Deliberately per-row: no bulk re-prioritise mode, because a sweep that
moves many rows at once should be visible row by row in review.
Every assertion here was mutation-tested rather than merely observed passing.
Removing `pri` from the editable map makes the writer throw on a pri-only
request; dropping the createRequest passthrough makes the CLI reject it;
dropping it from the validator fails the inbox self-test. The writer's own
self-test additionally pins that ONLY the Pri cell moves — an off-by-one there
would write a priority over the ID or Type cell and still produce a
structurally valid row.
Verified end to end through the real CLI: `issues:update '#90' --pri P3` queues
a valid merge-safe request.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DuYJz8hauCsCdx8r4fXiZU
@supabase

supabaseBot commented Aug 13, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitaiBot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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:46 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c17bbf18-fd49-4501-ab19-4d376df560dd

📥 Commits

Reviewing files that changed from the base of the PR and between b164241 and 5f1ca7d.

📒 Files selected for processing (3)
  • docs/branch-review-records/030a97d72473027a1c1c9c5225c2280b0d0be17d76059d345a74eccd10daa29d.record.md
  • scripts/ledger-inbox.mjs
  • scripts/outstanding-issues.mjs

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

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DuYJz8hauCsCdx8r4fXiZU
@BigSimmo
BigSimmo enabled auto-merge August 13, 2026 09:15
@BigSimmo
BigSimmo merged commit a6ca363 into mainAug 13, 2026
24 checks passed
@BigSimmo
BigSimmo deleted the claude/issues-writer-pri-flag branch August 13, 2026 09:19
Sign up for freeto 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.

2 participants

@BigSimmo@claude