Repository navigation
feat(rules): issue/PR state as transitions, dense numbering, monotonic check runs (shared vectors) - #155
Conversation
…ream numbers, with shared vectors Adds rules::transition (Rust) and lib/rules/transition.ts: the delta table, legal moves, state codes, the repo count formulas of STATE-COUNTS §4, the dense next number and the 10422 dense refusal. The issue/PR folds take the state code and fold only labels, assignees and the base ref from events; a merge is the chain fact and carries mergeOnBase for the reader label (D-9). allocate_number__* retire; fold vectors move to transitions or sums; transition__, dense_number__ and upstream_number__ vectors are new. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…shared vectors check_run_write / checkRunWrite decide create or replace and the times a report sets so the forge-community checkRun rules hold (D-5): startedAt on the first non-queued report, completedAt on the first completed one, never before the start, a stored time never changed, a backwards move or changed conclusion is a re-run. 13 check_run_write__ vectors. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…l ids, parity edges next_transition takes Member/Author/Other (a stranger gets no move); check_run_write enforces conclusionIfDone/doneIfConclusion, carries conclusion and externalId (a changed externalId is a re-run); an empty merge oid is unknown in both ports; saturating counts; denseNumber >= 1; STATUS_RANK is a Map; vector names in the docs follow the reshape; review_kinds vector keeps threadResolve. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The Both already fail on 🤖 Posted autonomously by Claude on behalf of pasta. |
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
What
This PR adds the shared pure rules for the fresh beta.7 registration (WIPE-PLAN §2.5–§2.7) and their shared conformance vectors. The Rust and TypeScript ports stay in lockstep. It targets the integration branch
wipe/beta7, not master.It carries merges of
wipe/beta7into this branch: master'sdg ci(#148), import fidelity (#147) and the beta.7 SDK (#153).wipe/beta7was fast-forwarded to master first so the §2.7 work could build ondg ci. The web PR and the CLI/import/relay PR stack on this one.The code review's findings are addressed in f6be5e6.
rules::transition(Rust) /lib/rules/transition.ts(TS)This is the state machine of STATE-COUNTS §2.1. Every state change is a
transitionwhose per-targetdeltasum is the state code: 0 open, 1 closed, 2 merged, 8 draft, 9 closed draft.next_transition(target, code, action, actor, number): the one legal move for close, reopen, merge, draft or ready from a given code.actorisMember,AuthororOther. It returns the kind,delta,targetKind,asAuthor(0 for a member, else the target number) and the code after. It returnsNonefor a stranger (40120) and wherever the contract'sc1–c5orf_authorNoMergerules would refuse.status_of_code,state_code,merge_transition.repo_counts: the open, closed, merged and draft totals from the three proved counts of STATE-COUNTS §4, saturating at 0.dense_number,names_dense_rule: the dense next number (§2.6), and recognising a 10422 refusal that names thedenserule.rules::v2issue_state_v2/pr_state_v2: state comes from the code, while labels, assignees and the base ref still come from member events. State kinds carried on events are inert.PrState.merge_on_basetells a reader whether the merge oid was a valid base tip. When it isfalse, readers label the PR "merge commit not found on the base".trusted_upstream_number:upstreamNumberis trusted only from the repo owner or a current member (D-2, ISS-02).check_run_write(D-5): decides create or replace for a report, and whichstartedAt,completedAt,conclusionandexternalIdit sets, so the forge-communitycheckRunrules hold (conclusionIfDone,doneIfConclusion,startedIfRunning,runningIfStarted,completedAtIfDone,doneIfCompletedAt).None.startedAtis set on the first report that is not queued, andcompletedAton the first completed one, never before the start.externalIdbecomes a new run.The retired functions (
fold_*_state_v2,allocate_number) stay for now so their callers compile. They are removed in the consumer PRs (web, CLI/import/relay).Vectors
allocate_number__*(15); 10 fold vectors whose inputs consensus now refuses (author merge, author label, stranger author events, merge after close)fold_issue_v2__*andfold_pr_v2__*: inputs are now{transitions | sum (+mergeOid), events, base…}transition__*(14): every action from every code for a member, the author and a stranger, the state codes, sums, and the count formulasdense_number__*(5)upstream_number__*(5)check_run_write__*(18)Expected values were generated by a third, independent Python model of the rules. Both harnesses refuse unknown keys.
Tested offline
cargo test -p forge-core --lib rules: conformance plus unit tests, on the beta.7 tag.cargo clippy -p forge-core --all-targets -D warnings.vitest lib/rules: 359 tests.Totals, proofs and fees are not testable offline; they are listed as live checks in WIPE-PLAN §3.
🤖 Generated with Claude Code