Skip to main content

Module stamp

Module stamp 

Source
Expand description

The merge-time stamp (increment-allocation track, Slice 1).

On merge, plan reads the pending files, assigns the next version(s) in merge order and the next ADR number(s), and apply materialises them: it runs scripts/bump-version.sh, inserts the changelog row(s), writes each design/decisions/NNNN-<slug>.md and its index row, and deletes the consumed pending files. Deleting what it consumes is what makes a re-run a no-op — which is why version assignment and ADR materialisation are one atomic pass (the entangled-by-delete finding, proposal #689 DECISION A).

The version bump is injected (see apply) so the whole flow is testable on a fixture tree without running the real, side-effect-heavy bump script.

Structs§

Plan
The full stamp plan for the pending files present.
Stamped
One pending increment stamped with the version it will ship as.
Version
A semantic version MAJOR.MINOR.PATCH.

Functions§

adr_file_contents
The design/decisions/NNNN-<slug>.md file contents: a # NNNN — <title> heading, a status line carrying the version, then the body verbatim.
apply
Apply plan to root: write ADR files + index rows, insert changelog rows, run bump for the final version, then delete the consumed pending files.
changelog_row
The changelog table row for a stamped increment.
index_row
The design/decisions/README.md index row for a materialised ADR.
insert_after_table_separator
Insert rows (already newest-first) immediately after the separator line of the table whose header row contains header_anchor (e.g. "| Version |"). Anchoring on the header — rather than the first separator in the file — keeps the insert correct if another table (a legend, say) is ever added above.
next_adr_number
The next free ADR number: one past the highest NNNN-*.md in design/decisions. Errors if the directory can’t be read — a swallowed failure would silently default to 1 and restart the ADR series.
parse_workspace_version
The [workspace.package] version = "X.Y.Z" from a Cargo.toml. Scoped to the [workspace.package] section: the first line-anchored version = "..." within that table, not a version under some other section (e.g. a stray top-level [package]) nor the inline version = "..." inside a dependency spec — the same value bump-version.sh rewrites.
plan
Build the plan for root: read the workspace version and the pending files, and assign each pending file (in filename order — a deterministic proxy for merge order) its own next version. Returns validation errors verbatim.
rule_ledger_rows
One design/greenfield-status-rules.md row per rule id inc closes — empty if inc.closes_rule is empty. pr renders as #NNNN, or the empty string when it couldn’t be recovered (kept as an empty cell, not a placeholder like "unknown", so the table stays a clean Markdown grid either way).