Skip to main content

Module greenfield_status

Module greenfield_status 

Source
Expand description

cargo xtask greenfield-status — the probe harness (track doc §8, proposal #999).

Twenty-seven probes measuring the tree against design/bynk-greenfield-compiler.md: the twelve in track doc §8, emit_abi_shapes (ADR 0310’s probe, #999 Decision E — this slice measures the emit-ABI enumeration guard but does not wire it; wiring is packaging-track work), phase 7’s own four — ts_writes, ts_any, verbatim_origins, verbatim_sites (P7.0/#1296, P7.5/#1307 — see phase 7’s own closing summary in design/archive/retired-tracks.md) — and phase 8’s own two, incremental_query_types and keystroke_latency (P8.0/#1510, settled by #1509’s Q5/ADR 0414 — see design/tracks/incrementality.md §5), plus the IR cutover track’s own adoption probe, unconsumed_ir_items (Slice D3 of #1542 — the gate the 30 August 2026 post-restructuring review’s Part 5 §8 asked for), and the runtime-semantics track’s diagnostic_coverage (#1662, G2 of #1648), and the crate-hygiene track’s M-3 ratchet, model_readers_beyond_emit (B1, #2939), and its H-3 gate, unused_deps (A4, #2976).

Thirty-four are gated, committed and diffed: workspace_lints, fs_below_driver, options_sources, hoist_sinks, span_keyed_maps, emit_diagnostics, ide_emit_edge, ast_importers, emit_abi_shapes, ts_writes, ts_any, verbatim_origins, verbatim_sites, incremental_query_types, unconsumed_ir_items, diagnostic_coverage, model_readers_beyond_emit, unused_deps, explained_codes, ts_raw_sites_emit, ts_raw_sites_testgen, ts_text_idents, emit_thread_locals, emit_silent_fallbacks, emit_print_calls, testgen_print_calls, import_prediction_fns, node_builder_defs, deploy_kind_accessors, env_protocol_literals, tool_spawn_sites, deploy_ledger_writes, binding_kind_homes, wrangler_key_literals, cloudflare_client_sites. Ten of these are zero/closure-shaped — a boolean, or a count pinned at a small, argued floor (ast_importers = 5, emit_abi_shapes = 1). Phase 7’s own four are the same shape: each converged toward an argued floor over dozens of slices, the same trajectory ast_importers had throughout phase 6’s 59 — retired at ts_writes = 809, ts_any = 26, verbatim_origins = 1, verbatim_sites = 2 (phase 7’s own closing summary, design/archive/retired-tracks.md), none the literal 0 first proposed — gated throughout despite the churn that implies, a deliberate call argued in ADR 0389/ADR 0390 (review of #1297), not an oversight of #999 Decision D’s churn-avoidance principle. incremental_query_types is a different shape again — phase 8’s own probe reads a one-time existence proof, not a count trending toward a floor (settled §5/Q5, ADR 0414), re-settled by #1537 to certify that the two levels that never found a consumer stay deleted; see its own doc comment. A disagreement between a fresh run and the committed table fails greenfield_status_table_is_current (xtask/tests/greenfield_status.rs), which rides both the test job (cargo test --workspace, any Rust-touching PR) and the drift job’s existing cargo test -p xtask (pending/decisions-only PRs) — no new CI wiring (#999 Decision D, which also explains why a drift-job step would have been silently skipped on the PRs that move these probes most).

Two kinds of gate (#3679, amending ADR 0389/0390). Every gated probe is exact-match: a live reading that differs from its committed row fails unless a pending file names it in probes:. The GROWTH_PROBES (ts_writes, ts_any, emit_abi_shapes, verbatim_sites, ts_raw_sites_emit, ts_raw_sites_testgen, ts_text_idents, span_keyed_maps, emit_thread_locals, emit_silent_fallbacks, emit_print_calls, testgen_print_calls, import_prediction_fns, node_builder_defs, deploy_kind_accessors, env_protocol_literals, tool_spawn_sites, deploy_ledger_writes, binding_kind_homes, wrangler_key_literals, cloudflare_client_sites) are also directional: growth_probes_never_rise (xtask/tests/greenfield_status.rs) fails when the live leading count exceeds the committed one unless a pending file raises the probe with a reason (raises:), which the stamp then records in design/greenfield-status-raises.md. A fall needs only probes:. In CI the direction is also checked against the table at the PR’s base revision (greenfield-status --check-growth, check_growth), so hand-editing a committed growth row upward does not launder a rise.

A disagreement a pending file acknowledges (its probes key) does not fail the gate: the increment leaves the shared table alone and cargo xtask stamp --apply rewrites the gated rows on main in merge order (refresh_gated_rows). The acknowledgement still has to be written, and reviewed, in the PR — a gated probe still cannot move silently — but parallel PRs no longer conflict on these rows.

Who refreshes which rows. The stamp rewrites the gated rows only (it never pays for the trend probes’ workspace-wide clippy pass). The trend rows are rewritten by the weekly .github/workflows/greenfield-trends.yml, which runs cargo xtask greenfield-status --trend-only --apply (refresh_trend_rows) and opens one rolling PR from the bot branch bot/greenfield-trends; a person can run the same command locally. A full --apply still rewrites everything.

Six are count/ratio trend probes, recomputed and printed but never diffed: wildcard_arms, keep_in_sync, test_density, fixture_kinds, keystroke_latency, module_lines (production lines per source file, #3683). The first four, and module_lines too, move on nearly any ordinary Rust PR with no slice actively driving them toward a floor (§8 calls two of them “trends, not gates”); hard-gating them would make the committed table churn, and conflict, on routine work for no corresponding benefit. keystroke_latency moves on nothing yet — settled (Q3/ADR 0414) as staying “not measured” for phase 8’s own whole lifetime, since no scheduler ships this phase to produce a real number; reported anyway so the trajectory’s own §3.0 baseline has a live, CI-computed row.

Closes-Rule: rule-id provenance (#999 Decision B) is deferred to a follow-on slice — the committed table below carries no rule-citation column yet.

Structs§

GrowthRise
A growth probe whose live count exceeds the committed one.
Probe
One probe’s result. gated probes are diffed against the committed table by crate::greenfield_status::gated_disagreements; the rest are reported only.
Report

Constants§

GATED_PROBES
The gated probes’ names, in run_gated’s order — what a pending file’s probes key may cite. greenfield_status_table_is_current asserts this matches the probes run_gated actually returns, so the two cannot drift.
GROWTH_PROBES
The gated probes that only a reasoned, recorded raises: may increase (#3679, ADR 0389/0390 amended): ts_writes, ts_any, emit_abi_shapes, verbatim_sites, ts_raw_sites_emit and ts_raw_sites_testgen (the split of ts_raw_sites, #3681), ts_text_idents (#3681), span_keyed_maps, emit_thread_locals (1A.19), emit_silent_fallbacks (1A.34), emit_print_calls (1A.35b), testgen_print_calls (1B.2a), import_prediction_fns (1A.36a), node_builder_defs (1B.4a), deploy_kind_accessors (1D.1a), env_protocol_literals (1D.5a), tool_spawn_sites (1D.5b), deploy_ledger_writes (1D.2a), binding_kind_homes (1C.1b), wrangler_key_literals (1C.2), cloudflare_client_sites (1D.3a). Probes already at a zero or closure floor are excluded (their exact-match row pins them), as are verbatim_origins (an argued floor of 2) and model_readers_beyond_emit (which has the opposite direction). A subset of GATED_PROBES, pinned by a unit test.

Functions§

check_growth
The one growth-direction check, shared by growth_probes_never_rise (base = the working-tree table) and cargo xtask greenfield-status --check-growth (base = the table at the PR’s base revision, so a hand-edited row cannot launder a rise). Compares live’s growth probes with base_table’s rows and requires a pending file under root to raises: each rise.
committed_reading
The committed reading of gated probe name in the table text committed.
explained_codes_count
The leading count of an explained_codes reading (explained=N (of M)).
gated_disagreements
Every gated probe whose live reading disagrees with the committed table’s, as (probe name, committed, live). Trend probes are never compared, and never computed here — this only runs the twenty-one gated probes, so checking currency never pays for wildcard_arms’s workspace-wide clippy pass. For a caller that has already run the full report (e.g. to print it), use gated_disagreements_in instead so the twenty-one gated probes aren’t computed a second time.
gated_disagreements_in
Like gated_disagreements, but diffs probes (typically a Report’s .probes, already computed) instead of re-running the gated probes.
growth_rises
Every GROWTH_PROBES member whose live leading count in probes is higher than its committed row’s in committed (the table text). Err lists every growth probe whose live or committed reading is missing or has no leading integer: that is a hard failure, never a skip (a probe that stopped reporting a count must not quietly leave the ratchet). A growth probe with no row at all in committed is newly introduced and is skipped (#3681): it is checked from the first time its row exists.
leading_count
The leading integer of a reading such as 104 (bynk-browser.ts:Claim, …): the first whitespace-separated token, parsed. None if it is not an integer. The shared parser behind model_readers_count and growth_rises.
model_readers_count
The leading count of a model_readers_beyond_emit reading, which is what the floor test compares. None if the reading doesn’t start with a count.
refresh_for_stamp
The stamp’s refreshed table: refresh_gated_rows, but only if every gated probe whose live reading differs from committed is named by one of the increments being stamped (acknowledged — the union of their probes).
refresh_gated_rows
committed (the table’s current text) with every gated row’s reading replaced by probes’ live one; trend rows, prose and the rule-ledger pointer are left exactly as committed, so the stamp never pays for the trend probes’ workspace-wide clippy pass. Errors naming any gated probe with no row to rewrite — a table that has lost a row needs a full cargo xtask greenfield-status --apply, not a silent append.
refresh_trend_rows
committed (the table’s current text) with every trend row’s reading replaced by probes’ live one: the mirror of refresh_gated_rows. Gated rows, prose and the rule-ledger pointer are left exactly as committed, so the weekly trend-refresh workflow (.github/workflows/greenfield-trends.yml) and the stamp never write the same lines.
render_table
The committed table: a plain Markdown table, probe name → gated?/reads, plus a pointer to the rule ledger stamp::apply writes (#1001).
run
Run every probe against the tree rooted at root (the repo root). Used by the CLI’s full report; the gating test uses the twenty-one gated probes alone (gated_disagreements) so it never pays for a workspace-wide clippy pass (wildcard_arms) just to check the probes that are actually diffed.
run_gated
The thirty-four gated (zero/closure/ratchet) probes only — what gated_disagreements diffs.
run_trend
The six reported-only trend probes — never diffed, and notably including the one (wildcard_arms) that shells out to a full cargo clippy --workspace pass, which the gating test must not pay for on every run.
table_path
design/greenfield-status.md — the committed table this probe set regenerates.
unacknowledged
The disagreements no pending file acknowledges — what actually fails the gate.
unasserted_codes
#1662 (track #1648, G2). Registry codes that some test asserts, out of all bynk_syntax::diagnostics::REGISTRY codes, and the count no test asserts.
unraised
The rises no pending file raised — the ones that must fail the gate.