Skip to main content

Crate xtask

Crate xtask 

Source
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, then body verbatim — and a decisions/README.md index row (**<title>** … <summary>), assigning NNNN at merge. title is required (the file heading and the index bold need it); summary defaults to title, status to Accepted.
Pending
A parsed, validated pending-increment file.

Enums§

Level
The bump level an increment declares. The stamp turns this into the next X.Y.Z in merge order; the format never carries a concrete number.

Functions§

check_all
Validate every *.md under pending_dir except README.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 s shaped like a greenfield-reference rule id — R followed by <digits>.<digits> (e.g. R2.3, R0.1)? Syntax only; whether the id actually exists in the reference is known_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’s closes_rule entries, separate from is_rule_id’s pure syntax check because it needs the repo root. Root-parameterised like stamp::next_adr_number, so a fixture tree can supply its own reference doc.
pending_dir
design/pending/ under repo_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, so xtask/src/main.rs’s pr_number_from_head (the only caller, which runs git log -1 --format=%s to get subject) 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_index uses).
validate
Validate a single pending file’s content. filename is 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 (skipping README.md), sorted by filename. Root-parameterised so the stamp — and its fixture tests — can target any tree; check_all is this over the real repo_root.