Expand description
The pending-increment format validator (increment-allocation track, Slice 0).
A feature PR adds one design/pending/<slug>.md declaring its bump level, a
one-line changelog blurb, and — when it records a decision — one or more ADR
prose blocks. It writes no version and no ADR number: those are the two
serial counters that the merge-time stamp assigns on main, so that parallel
increments stop conflicting on them. See design/pending/README.md and
ADR 0206 (design/decisions/0206-allocation-on-main.md).
This module is the format contract between that human-authored file and the
future stamp. It is process tooling, not compiler behaviour, which is why it
lives in the unpublished xtask crate rather than in bynkc’s test suite.
check_all is exercised two ways: an integration test (tests/pending_files.rs)
runs it over the real design/pending/** as a drift guard, and the
check-pending binary subcommand exposes it for local runs.
Modules§
- greenfield_
status cargo xtask greenfield-status— the probe harness (track doc §8, proposal #999).- stamp
- The merge-time stamp (increment-allocation track, Slice 1).
Structs§
- Adr
- One ADR block. The stamp writes
design/decisions/NNNN-<slug>.md— a# NNNN — <title>heading, a status line, thenbodyverbatim — and adecisions/README.mdindex row (**<title>** … <summary>), assigningNNNNat merge.titleis required (the file heading and the index bold need it);summarydefaults totitle,statustoAccepted. - Pending
- A parsed, validated pending-increment file.
Enums§
- Level
- The bump level an increment declares. The stamp turns this into the next
X.Y.Zin merge order; the format never carries a concrete number.
Functions§
- check_
all - Validate every
*.mdunderpending_direxceptREADME.md(the format doc, excluded like the decisions index excludes its own README). Returns the number of pending files validated, or every error found across all files (each prefixed with its filename) so one run reports the whole picture. - is_
rule_ id - Is
sshaped like a greenfield-reference rule id —Rfollowed by<digits>.<digits>(e.g.R2.3,R0.1)? Syntax only; whether the id actually exists in the reference isknown_rule_ids’s job. - known_
rule_ ids - Every rule id (
R2.3, …) enumerated in the greenfield reference (design/bynk-greenfield-compiler.md) — the existence check for a pending file’scloses_ruleentries, separate fromis_rule_id’s pure syntax check because it needs the repo root. Root-parameterised likestamp::next_adr_number, so a fixture tree can supply its own reference doc. - pending_
dir design/pending/underrepo_root.- pr_
number_ from_ subject - The PR number a commit
subject(the first line of its message) names, if it ends in the(#NNNN)GitHub’s squash-merge appends to the PR title — pure and root-independent, soxtask/src/main.rs’spr_number_from_head(the only caller, which runsgit log -1 --format=%sto getsubject) stays a thin wrapper over this, and this half — the part with the interesting edge cases — is unit-testable without a git tree (#1001, caught by review as the one piece of new logic with no test coverage). - repo_
root - The repo root, resolved from this crate’s manifest dir so it’s independent
of the working directory (the same trick
decisions_indexuses). - validate
- Validate a single pending file’s
content.filenameis used to check the stem is a kebab-case slug. Returns every problem found (not just the first), so a malformed file reports completely. - validated_
pending_ in - Read and validate the pending files under
root/design/pending(skippingREADME.md), sorted by filename. Root-parameterised so the stamp — and its fixture tests — can target any tree;check_allis this over the realrepo_root.