Skip to content

129 · T114 — wire the existing precedence into the run path - #139

Merged
athvin merged 5 commits into
mainfrom
feat/t114-wire-precedence-into-the-run-path
Aug 8, 2026
Merged

athvin merged 5 commits into
mainfrom
feat/t114-wire-precedence-into-the-run-path

Conversation

@athvin

@athvin athvin commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Ticket: T114 — docs/implementation/129-T114-wire-precedence-into-the-run-path.md

Summary

Wires the existing flag > env > default runtime-knob precedence into the run path. Per-flag scanners in crates/cli/src/config.rs share one parse_valued_flag body and are sequenced by a new resolve_run_config in registry.rs (parse_cli untouched); the resolver pool probe engages only when a pin or explicit headroom is supplied, preserving the tri-state and the no-knob defaults byte-for-byte. Adds DAGR_STORE (arch.md store sentence restored plus its C26 table row), ADR 089 duration bounds enforced at the boundary (grace ≥ 1 ms, teardown ≥ 1 s, out-of-range → BootstrapFailure naming the source), and RunToStoreError::Config. The ADR 128 file(profile) tier is deliberately left to T115 — this ticket only wires what already exists.

Tests-first

Confirmed — failing tests committed first in cc03ff7.

Definition of done

  • Runtime-knob precedence wired into the run path (c36b99b), covered by wire_precedence_run_path (11/11) and env_fallbacks_and_headroom (21/21)
  • No-knob defaults unchanged — byte-identical fixture test enforces it
  • Duration bounds implemented and aligned across arch.md C26 and code (d80014d)
  • Env-name constants test covers every knob including DAGR_METASTORE/DAGR_STORE
  • Local gate GATE=PASS (39 checks; the single artifact-suite failure on the first run was a local syspolicyd first-exec stall, re-verified 8/8 green with no change)
  • Scope check IN_SCOPE (independent reviewer over the full diff vs the ticket's Out of scope and the permanent non-goals)
  • CI green on this PR — pending

Open questions resolved

  • Flag-parsing location: per-flag scanners over the shared parse_valued_flag body, sequenced by resolve_run_config; parse_cli untouched — recorded in the ticket file's Open questions.
  • Pool pins on the run path: yes, with the probe engaged only when a pin or explicit headroom is supplied — tri-state preserved, no-knob default stays unconstrained — recorded in the ticket file.
  • ADR 089 duration bounds: implemented (grace ≥ 1 ms, teardown ≥ 1 s, OutOfRange → BootstrapFailure naming the source) — recorded in the ticket file.
  • docs/tasks.md has no T114 entry, so no Q: items existed — noted in the ticket file.

Deviations

None.

athvin and others added 5 commits August 7, 2026 08:54
… the run path

Ten red, one guard green:

* DAGR_GRACE / --grace / DAGR_TEARDOWN_DEADLINE reach a real `dagr run`'s
  shutdown-budget banner, flag beating env (subprocess over the one_dag
  example, env set per-command).
* Loud failures with the documented exit-code split: DAGR_GRACE=nonsense →
  InvalidUsage naming the variable and value (and no run directory left
  behind); DAGR_HEADROOM=1.5 → BootstrapFailure; DAGR_GRACE=0 /
  DAGR_TEARDOWN_DEADLINE=0 → BootstrapFailure naming the >= 1 ms / >= 1 s
  bounds (the settled duration-bound decision: implement, not strike).
* DAGR_STORE relocates the run store; --store still wins and the env
  directory stays untouched.
* dagr run --dagr.metastore-store ./x.db etl selects etl (the
  flag_takes_value regression).
* DAGR_FAILURE_MODE=stop-on-first-failure + DAGR_POOL_MEMORY through a real
  registry run: the pinned pool holds the sibling pending and the stop
  settles it cancelled — terminal states read from the on-disk stream.
* run_to_store resolves the env tier too (a bad DAGR_GRACE fails loudly).
* Guard (green before and after): with nothing set, the wired path's stream
  is byte-identical to the historical minimal RunConfig construction
  (wall stamps scrubbed — they vary between any two runs).

Also extends the env-name constants unit test to cover every shipped knob
including DAGR_METASTORE, which it omitted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The shipped run path now resolves every documented knob flag > env > default
before the store is opened, through the helpers that previously had zero
non-test callers:

* config.rs grows the reserved-flag scanners (--grace, --teardown-deadline,
  --failure-mode, the three --dagr.pool.* pins, --dagr.headroom-fraction,
  --store) over the shared parse_valued_flag body, the DAGR_STORE constant
  and resolve_store_base (flag > DAGR_STORE > the unchanged default), the
  documented duration bounds (GRACE_MIN 1 ms, TEARDOWN_DEADLINE_MIN 1 s)
  with their OutOfRange→BootstrapFailure validator, and resolve_pool_sizing
  + PoolSizing: the probe is engaged iff a pin or an explicit headroom was
  supplied — pins verbatim, un-pinned pools detected (the tri-state), and
  the no-knob run keeps its historical unconstrained capacities.
* registry.rs run_selected_flow resolves the knobs before minting the run
  id or opening the sink (a bad value leaves no run directory behind), maps
  scanner errors to InvalidUsage and resolver errors through their own
  parse/out-of-range exit-code split, and feeds grace/teardown/failure-mode
  through the RunConfig env-fallback builders. RunConfig::new stays
  infallible and env-free.
* run_to_store resolves the same env tier (no argv, so the flag tier is
  empty) and gains a RunToStoreError::Config variant naming the offending
  variable.
* grace_from_env / teardown_deadline_from_env enforce the >= 1 ms / >= 1 s
  bounds the tables always documented, naming whichever source supplied the
  value.
* flag_takes_value learns dagr.metastore-store, so its path value is never
  mistaken for the flow name.

The byte-identical guard fixture is a single source: the admission
interleaving of two independent ready nodes is timing-dependent (identically
so on both paths) and is not what the guard measures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ecord the resolutions

* arch.md's run-store sentence again says the base is supplied by flag or
  environment variable, naming --store and its new DAGR_STORE fallback —
  the claim the M10 truth pass had to delete is true now, so it returns.
* The C26 knob table gains the --store / DAGR_STORE row and carries the
  >= 1 ms / >= 1 s duration bounds, matching ADR 089's table and the code
  (the bounds are implemented, not struck).
* C26's precedence paragraph states that the shipped run path resolves the
  table at bootstrap (the claim stops describing an unused library
  surface), that the builders remain opt-in for hand-wired callers, and
  that admission pools stay unconstrained until a pool knob engages the
  probe.
* The ticket file records every open-question resolution: the scanner
  location, the pool-pin wiring with its supplied-knob probe gate, the
  implemented duration bounds, and the absence of tasks.md Q items.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… under the line budget

The knob resolution and RunConfig construction move into one helper returning
(base, config); run_selected_flow keeps only its dispatch shape. Behaviour and
diagnostics unchanged; clippy::too_many_lines stays denied rather than excepted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@athvin
athvin merged commit 2cab6c4 into main Aug 8, 2026
16 checks passed
@athvin
athvin deleted the feat/t114-wire-precedence-into-the-run-path branch August 8, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant