Skip to content

Latest commit

 

History

History
3693 lines (3387 loc) · 211 KB

roadmap.md

File metadata and controls

3693 lines (3387 loc) · 211 KB

Netsuke roadmap

This roadmap tracks unfinished and future Netsuke work. Completed historical foundations live in docs/archive/roadmap-completed-foundations.md so the active roadmap can focus on remaining hypotheses without erasing prior implementation detail. The composition roadmap continues this document with phases 16 to 19 for includes and bundles. The architecture roadmap continues it with phases 26 to 29 for semantic hardening, application boundaries, architecture policy, and a bounded Paralegal experiment.

Task identifiers are globally unique across this document, the composition roadmap, the architecture roadmap, and the archive. When a completed task moves to the archive, it keeps its original number and is not repeated here. When a historical task is renamed under the command-line interface (CLI) redesign, the active task states the mapping explicitly. Phase numbers identify work; explicit dependencies, not numerical order, determine what must complete first.

How to read this roadmap

Each phase validates a product hypothesis:

  • Phase 3 validates that Netsuke can stay friendly for local human workflows while becoming predictable for automation and agents.
  • Phase 4 validates that the build compiler and its cross-platform behaviour can be specified and checked rigorously.
  • Phase 5 validates that repeated human, Continuous Integration (CI), editor, and agent usage improves through introspection, profiles, run history, delivery, and feedback.
  • Phase 6 validates that absorbing common manifest operations into the template standard library makes declarative build manifests markedly easier to write without weakening determinism or the capability boundary, including proportionate quality-gate selection from a deterministic Git changeset.
  • Phase 7 validates that Netsukefile authors adopt manifest-time testing when it is deterministic, mock-friendly, and runs through the same compiler as the build.
  • Phase 8 validates that one executable repository policy and bounded hostile- input fuzzing can close workflow drift and malformed-input failures.
  • Phase 9 validates that exact-commit evidence can make release publication fail closed without changing Netsuke's public or archive contracts.
  • Phase 10 validates that quantified, property-based observation of generated invocations and environments lets Netsukefile tests catch build-script generator regressions that fixed fixtures miss.
  • Phase 11 validates that structured commands can select a required shell dialect without granting Netsukefiles arbitrary interpreter authority or weakening Netsuke-managed process boundaries.
  • Phase 12 validates that argv-safe structured commands work through ordinary builds and persistent generated manifests without changing legacy recipes.
  • Phase 13 validates that explicit streams and pipelines preserve bytes, reject destructive file races, and clean up every owned process and relay.
  • Phase 14 validates that runtime discovery and private workspaces remain bounded, action-local, and incapable of forging directory authority.
  • Phase 15 evaluates deferred extensions only after the structured-command contract has demonstrated its value in real builds.
  • Phase 16 validates graph-preserving, deterministic local includes.
  • Phase 17 validates reusable local bundles with private interfaces and locks.
  • Phase 18 validates explicit external acquisition and cache-only builds.
  • Phase 19 evaluates composition and provenance extensions from canary evidence.
  • Phases 26 to 28 validate internal semantic hardening, application boundaries, and executable architecture policy.
  • Phase 29 evaluates a bounded, compatibility-gated Paralegal experiment.
  • Phase 30 validates that opt-in, immutable host facts can replace platform shell probes without weakening discovery privacy or Ninja invalidation.
  • Phase 31 validates that the manifest linter shipped as a v0.2.0 prototype earns the rule set, severities, and contracts it will have to keep.

Each phase carries one hypothesis, and Phase 6 is the capability track for template standard-library work. Phases 3 to 5 predate that separation: each mixes capability delivery with verification and consistency work under a single hypothesis, and they are not being re-partitioned. New template standard-library work belongs in Phase 6, while repository and release hardening belong in Phases 8 and 9, property-based test work belongs in Phase 10, and structured-command shell selection belongs in Phase 11. Phases 12 to 14 own the remaining RFC 0001 implementation; Phase 15 keeps its deferred extensions separate from the initial delivery contract. Phases 16 to 19 live in the composition roadmap, with local includes before local bundles and external acquisition only after both local layers. Phases 26 to 29 continue in the architecture roadmap. Phase 30 owns RFC 0029's host facts and follows phase 15 in this document. Phase 31 is the capability track for manifest linting behind netsuke check, and new lint work belongs there.

The roadmap keeps user-facing product grammar separate from implementation detail. Public tasks name Netsuke capabilities first. Implementation adapters, including OrthoConfig, appear only when they define ownership, dependency, or validation boundaries.

External dependencies

Netsuke depends on OrthoConfig for generic command/configuration/schema machinery. Netsuke tasks cover integration, product policy, validation, and local build-tool adaptation. They must not duplicate the shared infrastructure owned by OrthoConfig.

Relevant OrthoConfig roadmap dependencies:

  • OrthoConfig 5.2.3: consumer dependency boundaries for Netsuke and Weaver.
  • OrthoConfig 6.1.1 and 6.1.2: recursive command metadata extraction.
  • OrthoConfig 6.2.1 to 6.2.3: <tool> context --json schema, emission, and downstream command naming.
  • OrthoConfig 6.3.1 and 6.3.2: skill manifest metadata and validation.
  • OrthoConfig 7.1.1 to 7.1.3: vocabulary policy and canonical global option glossary.
  • OrthoConfig 7.2.1 to 7.2.7: non-interactive metadata, mutation metadata, dual-renderer output metadata, structured result classes, stream contracts, bounded-list metadata, and capability provenance.
  • OrthoConfig 7.3.1: shared exit-code and error-remediation metadata.
  • OrthoConfig 8.1.1 and 8.1.2: reference CLI structured result and enumerable-error behaviour.
  • OrthoConfig 9.1.1 to 9.1.3: profile metadata, redaction, and profile store helpers.
  • OrthoConfig 9.2.1 and 9.2.2: delivery-target parsing and feedback storage helpers.
  • OrthoConfig 9.3.1 to 9.3.3: execution-ledger metadata, run-ledger nouns, and run-ledger helper APIs.

Canonical public vocabulary

These command and flag spellings are the public grammar assumed by this roadmap. Examples must use this list unless a task explicitly extends it.

  • Top-level commands: build, check, clean, generate, graph, context, skill-path, runs, profile, feedback, and test.
  • Resource verbs: list, get, save, delete, add, send, and prune.
  • Structured output: --json.
  • Non-interactive execution: --no-input.
  • Destructive confirmation: --force.
  • Mutation preview: --dry-run.
  • Pagination: --limit and --cursor.
  • Output and delivery: --output and --deliver.
  • Display policy flags: --color auto|always|never, --emoji auto|always|never, --progress auto|always|never, and --accessibility auto|on|off.

Tasks 17.1.1 and 18.1.1 in the composition roadmap explicitly extend this vocabulary before bundle CLI implementation. RFC 0003's conceptual inspect spelling must reconcile with get; RFC 0004 reserves bundle fetch as the sole external acquisition command and requires explicit --update-lock for lock mutation. These planned commands are not claims of shipped support.

Historical task traceability

The following previous roadmap tasks were assessed during the CLI-roadmap rewrite:

  • 1.1.1 to 1.3.3, 2.1.1 to 2.3.2, and completed 3.x foundation tasks through 3.13.2 moved to the archive as completed foundations.
  • 3.4.5, 3.4.6, 3.8.3, 3.11.4, 3.12.3, 3.13.3, 3.14.1, 3.14.3 to 3.14.9, and 3.14.11 retain their existing numbers.
  • 3.14.10 is superseded, not completed: RFC 0001 structured commands replace the planned exec.program/exec.args surface. Phase 12 owns that delivery, and the old identifier remains reserved. Rich environment operations in 3.14.9 are separately deferred behind 15.1.1, not a prerequisite for RFC 0001's exact per-block overlays.
  • 3.14.2 was completed after restoring coverage for top-level action expansion and complementary command_available(...) branches.
  • 3.14.4 is complete; command_available(...) now has the documented non-throwing executable-probe contract and typed resolver boundary.
  • Issue #83 is complete; every non-empty UTF-8 NETSUKE_NINJA value is selected even if spawning later fails, while unset, empty, and non-UTF-8 values fall back to ninja with documented verbose and structured tracing.
  • Phase 4 remains active because none of its formal-verification work has been delivered yet.
  • New CLI-redesign work starts at 3.15 and Phase 5 so historical numbers are not reused.
  • Phase 6 is new and introduces the template standard-library expansion specified in RFC 0006. It reuses no historical numbers.
  • Git change-detection helper work follows the shared Phase 6 contract in the helper design.

Execution and composition RFC coverage

The following mapping identifies one implementation owner for each contract; shared integration work does not duplicate those implementations.

  • RFC 0001: phases 12 to 14, with deferred execution extensions in phase 15. Task 12.1.1 consolidated the amended contract in ADR-0043.
  • RFC 0002: phase 16 in the composition roadmap.
  • RFC 0003: phase 17, including canonical runtime-resource coverage, private exports, parameters, and locks.
  • RFC 0004: phase 18 after local include and bundle acceptance; deferred provenance policy in phase 19.
  • RFC 0009: 12.1.1 reconciled the path contracts in ADR-0043, 12.2.3 implements literal directories, 13.3.1 covers independent stage directories, and 17.4.4 covers fragment and bundle provenance without changing the importing-workspace anchor.
  • RFC 0010: step 13.2 owns stderr pipelines, steps 14.1 and 14.2 own runtime bindings and secure directories, and 14.3.1 plus 17.4.4 cover execution and composition matrices.
  • RFC 0011: phase 11 owns registry primitives and resolved-shell integration. Task 11.3.1 needs the codec and basic runner, not completed runtime bindings; 11.3.2 waits for the full pipeline and directory facilities it exercises. Task 12.1.1 reconciled RFC 0011 §6.2 and ADR-0019 with the other stream-path contracts in ADR-0043.
  • RFC 0026: phase 26 in the architecture roadmap owns trustworthy resolved build semantics, and phase 27 owns the application and diagnostic boundary.
  • RFC 0027: phase 28 owns executable architecture policy and governance, with its checked baseline established before required enforcement.
  • RFC 0028: phase 29 owns the bounded compatibility-gated Paralegal experiment, which may conclude without adoption.
  • RFC 0029: phase 30 owns opt-in host facts, shipping the platform-only slice before separately authorized distribution and kernel observations.

Task 17.4.4 joins the local-composition and structured-execution tracks for the combined migration canaries in issue #598. Local delivery through 16.3.3 and 17.4.3 does not depend on that join, and neither local delivery nor 14.3.3 requires external acquisition. These tasks cover the execution and composition parts of issue #593, not its unrelated OrthoConfig or Git-changeset work.

3. Friendly polish and agent-consistent CLI foundations

Hypothesis: Netsuke can keep a pleasant, accessible local command-line experience while making every command predictable for CI, editor integrations, and agents.

3.4. Graph and explanation work

  • 3.4.5. Extend the graph subcommand with an optional --html renderer.

    • Keep raw graph data available for automation.
    • Add --output <FILE> for file-based graph artefacts.
    • Document how graph --html --output graph.html differs from structured graph inspection.
  • 3.4.6. Evaluate whether netsuke explain <code> should exist.

    • Compare explain with richer diagnostics and documentation links.
    • Avoid adding the command unless it has a clear user-facing workflow.
    • If accepted, add explain to the canonical vocabulary before examples use it.

3.8. Accessibility verification

  • 3.8.3. Verify accessible output with assistive technology.
    • Test screen-reader behaviour for diagnostics, progress, and summaries.
    • Validate reduced-motion and no-colour modes.
    • Record findings in the accessibility documentation.

3.11. Configuration precedence verification

  • 3.11.4. Add OrthoConfig precedence-ladder regression tests.

    • Explicit config-path selector precedence (--config > NETSUKE_CONFIG) verified by exhaustive rstest cases and a proptest property test (PR #327, closes #291).

    • Depend on OrthoConfig 5.2.3 for consumer boundary guidance. OrthoConfig 5.2.3 is an upstream OrthoConfig roadmap identifier, not a crate version; Netsuke stays pinned at ortho_config = "0.9.0" until that guidance ships. Blocked on upstream; no Cargo.toml change.

    • Preserve Netsuke-specific precedence expectations for manifest path, display policies, and locale across the two-selector ladder (--config > NETSUKE_CONFIG > automatic discovery), where the discovered rung is a single exclusive winner among system scope, user scope, and defaults. When a user-scope configuration wins over the system scope, system-only fields are not merged through and fall back to their defaults (regression tests added in issue #385).

    • Preserve Netsuke-specific precedence expectations for profile selection (deferred to 5.3.1, when the --profile flag lands).

    • Verify that CLI flags override environment, project, user, system, and default configuration layers for scalar fields (manifest path, display policies, locale, jobs) in issue #385.

    • Verify that CLI flags override the profile configuration layer (deferred to 5.3.1, when the --profile flag lands).

    • Note: OrthoConfig automatic discovery is exclusive: one discovered file wins, so system-only fields are absent when a user-scope file is selected (user-over-system and system-only merge-through cases are covered by the regression tests added in issue #385).

  • 3.11.5. Retire EnvLock rather than harden its synchronization tests.

    • Ensure production environment-variable callers accept injected mockable::Env seams.
    • Ensure tests use mockable::MockEnv or isolated child processes.
    • Ensure CWD-only callers use the existing working-directory seam, absolute paths, or -C/--directory.
    • Migrate the remaining callers under issue #491.
    • Migrate the remaining callers under issue #492.
    • Migrate the remaining callers under issue #493.
    • Remove EnvLock under issue #494 after every remaining EnvLock caller has migrated.
    • See ADR-0008.

3.12. Terminal rendering verification

  • 3.12.3. Add terminal rendering regression tests.
    • Verify --color auto|always|never policy behaviour.
    • Verify --emoji auto|always|never policy behaviour.
    • Verify --progress auto|always|never policy behaviour.
    • Verify --accessibility auto|on|off behaviour. See ADR-0072 and the terminal-rendering tests.

3.13. CI guidance

  • 3.13.3. Revise CI-focused guidance for the canonical CLI.
    • Replace legacy diagnostics-only examples with --json --no-input.
    • Include check --json --no-input and build --json --no-input.
    • Keep examples friendly for humans who maintain CI scripts.

3.14. Conditional action planning

  • 3.14.1. Record manifest-time condition semantics for actions and targets. See netsuke-design.md §2.5.
    • State that foreach and when are evaluated before typed Abstract Syntax Tree (AST) deserialization, intermediate representation (IR) generation, and Ninja execution.
    • Document that build-time branching belongs in recipes unless a future runtime-condition feature is designed.
  • 3.14.2. Apply foreach and when expansion to top-level actions. Depends on archived task 2.2.3. See netsuke-design.md §2.5.
    • Preserve the existing implicit phony: true action behaviour after expansion.
    • Support complementary branches such as when: command_available(...) and when: not command_available(...).
  • 3.14.3. Lower target and action deps into implicit IR and Ninja dependency edges. Requires archived tasks 1.2.2 and 1.3.2. See netsuke-design.md §§2.4 and 5.3.
    • Keep sources in the explicit recipe-input class used for ins and $in.
    • Add a separate implicit dependency class for deps so they affect ordering and rebuild decisions without appearing in recipe arguments.
    • Align cycle detection, generated Ninja output, and user-facing dependency documentation.
    • Add dependency_order: serial for direct action and target deps. Staged Ninja dyndep lowering preserves declaration order, failure short-circuiting, shared-work reuse, and unrelated-branch concurrency; ADR-0011 records the path-scoped guarantee and generated-state contract.
  • 3.14.4. Add command_available(name, **kwargs) as a non-throwing executable probe. Depends on archived task 3.5.1. See executable discovery.
    • Reuse the which resolver and cache.
    • Return false for absent commands instead of raising netsuke::jinja::which::not_found.
    • Preserve argument validation diagnostics for invalid options.
  • 3.14.5. Add regression coverage for conditional action dependency manifests. Depends on 3.14.2, 3.14.3, and 3.14.4.
    • Test action-level when and action-level foreach.
    • Test complementary nextest and legacy branches select exactly one action.
    • Test absent-command fallback without invoking shell().
    • Test deps lowering in the IR and emitted Ninja build statements.
  • 3.14.6. Add rule-level deps_from for compiler dependency imports. Requires 3.14.3. See netsuke-design.md §2.3.
    • Parse deps_from.format and deps_from.depfile without accepting rule-level deps as an alias.
    • Validate the initial gcc and msvc dependency formats.
    • Lower deps_from into the IR action depfile and Ninja deps attributes.
    • Add parser, IR, Ninja output, and user-guide coverage once the feature is implemented.
    • Note: the IR sink already exists but is unwired. Action.depfile and Action.deps_format are defined in src/ir/graph/mod.rs and emitted by src/ninja_gen.rs; only manifest parsing and population from deps_from remain.
  • 3.14.7. Escape backend dollar syntax after Netsuke placeholder lowering. This task depends on archived task 1.3.2. See netsuke-design.md §§2.6 and 5.4.
    • Preserve shell variables such as $PATH, ${CARGO:-cargo}, and $RUSTFLAGS in generated Ninja by emitting literal dollars as $$.
    • Keep the IR free of Ninja-specific dollar escaping.
    • Add command and script regression tests that distinguish Netsuke markers, internal tokens, shell variables such as $in / $out, and unrelated identifiers such as $input.
  • 3.14.8. Make Jinja command helpers match the documented ergonomics. Depends on archived task 2.2.4 and 3.14.4. See netsuke-design.md §§4.4 and 4.5 and ADR-0041.
    • Add env(name, default=...) without changing the existing missing and invalid UTF-8 diagnostics.
    • Implement or remove the documented shell_escape helper so the user guide and code agree.
    • Add shell_join and compact helpers for deliberate shell recipes.
    • Add documentation and tests showing optional RUSTFLAGS construction without shell parameter expansion.
    • Note: env(name) shipped with a default= kwarg that is consulted only for a missing variable: a non-Unicode value and a policy-denied name are still errors, and a non-string default is rejected rather than stringified. The shell_escape helper was superseded, not implemented: shell_quote takes its place, with shell_join beside it and compact in the collection filters. The two shell filters each take a dialect of sh or powershell, defaulting to the dialect implied by the active recipe shell, and are correct only in unquoted argv position. The design and user guides no longer name shell_escape; the tested RUSTFLAGS example lives in docs/stdlib-yaml-and-jinja-guide.md and asserts one shell-quoted RUSTFLAGS assignment with the variable both set and unset.
  • 3.14.9. Add structured recipe environment mappings. Requires 3.14.7, 3.14.8, and the follow-on design decision in 15.1.1. See netsuke-design.md §2.6.
    • Parse rule, target, and action env mappings with value, default, prepend, append, and unset operations.
    • Merge rule-level and target/action-level environment bindings during IR generation.
    • Emit backend-specific environment setup without exposing Ninja variable syntax in the manifest contract.
    • Test platform path-list separators for prepend and append.
    • Note: this enclosing, object-valued surface is deferred by RFC 0001 §11.4. It does not block the exact command-block overlay delivered by 12.2.2.

Historical task 3.14.10 proposed exec.program and exec.args. RFC 0001 supersedes that surface with structured command blocks; tasks 12.1.2 to 12.3.4 carry its schema, argv, execution, and documentation requirements. The identifier remains reserved, not checked off as implemented.

  • 3.14.11. Surface selected conditional actions without recipe echo. Requires 3.14.2 and 3.14.4. See netsuke-design.md §2.6.
    • Add target/action description as discovery metadata and list it with netsuke help targets.
    • Keep target/action descriptions as discovery metadata; they do not override the referenced rule description for Ninja progress.
    • Keep normal Ninja progress for named-rule recipes sourced from the referenced rule description; do not report target/action descriptions there.
    • In verbose mode, report why manifest-time when branches were included or skipped.
    • Do not add generic debug, info, or warn manifest keys unless a later diagnostics design defines severity semantics.
    • Note: target/action description remains discovery metadata rendered by netsuke help targets. Named-rule descriptions remain authoritative for Ninja progress; inline recipes use generated edge descriptions as recorded in ADR-0060. This does not complete the outstanding when-branch work. Target/action environment mappings remain future work under 3.14.9.

3.15. Canonical CLI redesign

  • 3.15.1. Replace the pre-0.1.0 command surface with canonical names.

    • Rename manifest to generate.
    • Remove build --emit; use generate --output.
    • Add check, context, skill-path, runs, profile, and feedback.
    • Rename --file to --manifest, keeping -f as an intentional shorthand.
    • Depend on OrthoConfig 7.1.1 to 7.1.3 for shared vocabulary policy and global option glossary.
  • 3.15.2. Add non-interactive and mutation-safety guarantees.

    • Add root --no-input.
    • Make prompts impossible unless a future explicit interactive mode is added.
    • Require --force for destructive operations.
    • Require or support --dry-run for consequential operations.
    • Make bare clean fail fast with a corrective hint.
    • Depend on OrthoConfig 7.2.1, 7.2.2, and 8.1.1 for shared non-interactive and mutation metadata.
  • 3.15.3. Replace diagnostics-only JSON with canonical structured output.

    • Remove --diag-json and --output-format.
    • Add root --json.
    • Emit exactly one JSON result document on successful JSON-mode commands.
    • Emit exactly one JSON diagnostic document on failing JSON-mode commands.
    • Suppress progress, colour, emoji, tracing, and timing text in JSON mode.
    • Snapshot the help targets --edges graph schema as a v1 JSON schema.
    • Snapshot every v1 JSON schema.
    • Depend on OrthoConfig 7.2.3 to 7.2.5, 7.3.1, 8.1.1, and 8.1.2 for shared result, stream, exit-code, and enumerable-error metadata.
  • 3.15.4. Replace legacy output preferences with canonical policy flags.

    • Replace --colour-policy with --color auto|always|never.
    • Replace --spinner-mode and boolean --progress with --progress auto|always|never.
    • Replace --no-emoji with --emoji auto|always|never.
    • Add --accessibility auto|on|off.
    • Update OrthoConfig field integration, environment names, config examples, localization keys, and tests.
    • Depend on OrthoConfig 7.1.2, 7.1.3, and 7.2.3 for shared flag vocabulary and dual-renderer metadata.
  • 3.15.5. Add stable exit codes and enumerable errors.

    • Define the Netsuke exit-code taxonomy in the design docs.
    • Ensure every enum-like failure lists valid values.
    • Add tests for CLI enums, config enums, manifest enums, stdlib options, delivery schemes, profile names, and run states.
    • Depend on OrthoConfig 7.3.1 and 8.1.2 for shared exit-code and enumerable-error metadata.
  • 3.15.6. Bound every large response.

    • Add --limit and --cursor where lists can grow.
    • Add --target and --depth to graph inspection.
    • Add truncation hints to JSON and human output.
    • Bound build-log previews in JSON mode and reference log files.
    • Depend on OrthoConfig 7.2.6 for bounded-list metadata.
  • 3.15.7. Add CLI vocabulary linting.

    • Generate a command inventory from the real command surface.
    • Fail CI on banned verbs and flags.
    • Snapshot the canonical command surface.
    • Keep the lint aligned with OrthoConfig 7.1.1 to 7.1.3.

4. Formal verification and property testing

Hypothesis: Netsuke can state and check its core compiler invariants strongly enough that future features do not erode deterministic build behaviour. This phase preserves the detailed formal-verification workload from the previous roadmap rather than compressing it into broad strategy items.

Objective: To add bounded formal verification and generated testing where the repository's semantic risk is highest, while keeping the existing build, lint, and test workflow intact. See formal-verification-methods-in-netsuke.md.

4.1. Verification tooling and gating

4.2. Intermediate representation verification

  • 4.2.1. Add Kani harnesses for manifest-to-IR safety checks. Requires 4.1.1. See formal-verification-methods-in-netsuke.md §Kani for the IR core. See also execplan 4.2.1 and ADR-0047.
    • Prove duplicate-output rejection on bounded manifests. Kani covers the accepted small-N proof boundary; 4.3.1 closes the larger-N Proptest coverage. Discharged: OBL-DUP in execplan 4.3.1.
    • Prove empty-rule, multiple-rule, and missing-rule error selection.
    • Prove self-edge and small bounded multi-node cycle rejection. Kani covers the accepted small-N proof boundary; 4.3.1 closes the larger-N Proptest coverage. Discharged: OBL-CYCLE in execplan 4.3.1.
    • Prove missing dependencies do not create false cycles.
    • Record the implementation decision to keep the public netsuke::ir API unchanged and place Kani-only verification support behind cfg(kani).
    • Record the implementation decision to use a private IrHashMap compatibility layer for proof builds rather than a public verification collection port.
    • Verify the final harness inventory: nine IR harnesses covering duplicate-output discovery, rule-shape error selection, self-cycle and two-node-cycle detection, and missing-dependency false-cycle rejection.
    • Validate the final branch with make check-fmt, make lint, make test, make markdownlint, make nixie, and make kani-ir. make kani-ir reported nine successfully verified harnesses and zero failures.
    • Record the review observation that repeated coderabbit review --agent attempts reached preparing_sandbox and emitted no findings or rate-limit notice.
  • 4.2.2. Add Kani harnesses for cycle canonicalization. Requires 4.2.1. See formal-verification-methods-in-netsuke.md §Optional Verus proof kernel. Kani proves the private production canonicalize_cycle_by kernel over distinct u8 cycles for N=2, N=3, and N=4. A direct adapter harness checks the Utf8PathBuf wrapper connection for two-node path cycles, and the existing Proptest suite continues to cover larger path-bearing cycles. Direct Utf8PathBuf property harnesses for N=2 through N=4 were measured and rejected under the 8 GiB cap.
    • Prove preserved length and closed-cycle output.
    • Prove the interior node multiset is preserved.
    • Prove the selected start node is stable under the current ordering rule.
    • Record the implementation decision to prove a private production-owned canonicalize_cycle_by kernel rather than a direct path-bearing Kani proof or a duplicated Kani-only model.
    • Validate the final branch with make check-fmt, make lint, make test, make markdownlint, make nixie, and capped make kani-ir. make kani-ir reported thirteen successfully verified harnesses and zero failures.
    • Record the mutation and review evidence: the three canonicalization mutation patches fail their matching harnesses, and coderabbit review --agent returned zero findings.
  • 4.2.3. Add Kani harnesses for command interpolation. Requires 4.1.1. See formal-verification-methods-in-netsuke.md §Kani for command interpolation.
    • Prove $in and $out rewrite only at valid token boundaries. An eight-character Kani window is complete for the sigil matcher; Proptest covers templates up to 256 characters with at most 8 placeholders.
    • Prove POSIX placeholders in backtick-delimited regions are rejected through independent scanner-specification Proptest coverage.
    • Prove unmatched backticks are rejected after substitution through adversarial Proptest coverage.
    • Prove successful results satisfy the current shlex guard by checking its outcome and returned command against the substituted command.
    • Kani verifies the sigil and marker kernels; capped make kani-ir completed 15 harnesses with zero failures.
    • Mutation evidence rejects all five new Kani and Proptest mutations, and coderabbit review --agent returned zero findings at each milestone.

4.3. Determinism and manifest property testing

  • 4.3.1. Add Proptest coverage for deterministic Ninja emission. Requires 4.1.1. See the Proptest section.
    • Prove Ninja output is stable across equivalent insertion orders (generated graphs bounded to 50 actions and 100 edges).
    • Prove default target ordering is stable.
    • Prove path_key is invariant for equivalent output sets. Completed: execplan 4.3.1 delivers the suites under src/ninja_gen/determinism/property_tests/ and publishes the contract in ADR-030. The larger-N hand-off from 4.2.1 is discharged, and each ordering rule is demonstrated by a committed mutation patch that a named property fails. The real-ninja arm, OBL-NINJA, now passes on its own terms. The emitter reveals a relay phony per staged serial dependency, which avoids the upstream iterator-invalidation defect ninja-build/ninja#2662; see ADR-0058. The directed regression for the measured crashing shape is src/ninja_gen/determinism/property_tests/ninja_oracle/relay_regression.rs, and the historical seed that reproduced the crash is not committed.
  • 4.3.2. Add Proptest coverage for manifest expansion invariants. Requires 4.1.1. See the Proptest section.
    • Prove foreach preserves non-control fields.
    • Prove when is removed after evaluation.
    • Prove item and index are injected correctly for each expansion.
    • Prove static targets still honour when.
  • 4.3.3. Add Proptest coverage for render stability. Requires 4.3.2. See the Proptest section.
    • Prove rendering is idempotent after Jinja syntax is exhausted.
    • Prove variable rendering uses the intended snapshot semantics.

4.4. Contract documentation and optional proof kernels

  • 4.4.1. Document the command placeholder contract in the README. Requires 4.2.3. See formal-verification-methods-in-netsuke.md §Command placeholder contract.
    • Add a "Security and command interpolation" section to the README.
    • State the supported placeholders explicitly.
    • State the current backtick-handling boundary explicitly.
    • State whether shlex::split is part of the semantic acceptance contract. Completed: ADR-0027 records the contract; the English README and all six translations carry it, with executable examples and regression tests.
  • 4.4.2. Document which dependency kinds participate in cycle detection in the user guide. Requires 4.2.1. See formal-verification-methods-in-netsuke.md §Cycle-participation contract.
    • Decide whether order-only dependencies participate.
    • Decide whether implicit outputs participate.
    • Document the chosen rule in the user guide's dependency and build-graph semantics chapter.
    • Align implementation, tests, and documentation with the chosen rule. Completed: ADR-0068 records that every prerequisite kind participates in whole-manifest cycle detection and that explicit and implicit output aliases name their producing edge; unit, property, BDD, end-to-end, and Kani coverage enforce the rule.
  • 4.4.3. Evaluate a minimal Verus proof kernel for cycle canonicalization. Requires 4.2.2 and 4.1.3. See formal-verification-methods-in-netsuke.md §Optional Verus proof kernel.
    • Keep the proof outside Cargo.
    • Use proof-specific model types rather than production HashMap structures.
    • Accept the proof only if it remains narrower and cheaper than the Kani equivalent.

Success criterion: Netsuke ships bounded Kani smoke checks for the IR core, generated property tests for deterministic emission and manifest semantics, and documented verification contracts that keep optional Verus work narrow and defer Stateright until the architecture justifies model checking.

5. Agent-consistent compounding features

Hypothesis: Netsuke becomes more valuable across repeated invocations when humans, CI systems, editors, and agents can discover its surface, reuse local configuration, inspect run history, route artefacts, and report friction.

5.1. Context and schema generation

  • 5.1.1. Implement netsuke context --json.

    • Emit compact versioned JSON by default.
    • Include commands, flags, enums, exit codes, result schemas, diagnostics schema, config schema, manifest schema, and stdlib metadata.
    • Add --detail for expanded descriptions.
    • Depend on OrthoConfig 5.2.3, 6.1.1, 6.1.2, 6.2.1, 6.2.2, 6.2.3, and 7.2.7.
  • 5.1.2. Add Netsuke-specific manifest and build-plan context.

    • Include bounded target, default-target, graph, and stdlib previews.
    • Include truncation hints for omitted manifest-derived detail.
    • Keep implementation-adapter names out of public command examples.
  • 5.1.3. Implement netsuke skill-path.

    • Add docs/skills/netsuke/SKILL.md.
    • Validate the skill manifest against netsuke context --json.
    • Depend on OrthoConfig 6.3.1 and 6.3.2.
  • 5.1.4. Add schema and description-budget validation.

    • Snapshot compact and detailed context output.
    • Enforce description-size budgets in CI.
    • Fail validation when the command surface and context drift.

5.2. Run ledger

  • 5.2.1. Define the Netsuke run record model.

    • Record run ID, command, targets, manifest fingerprint, status, exit code, timings, artefacts, and log paths.
    • Keep runs as the public noun to avoid collision with build-job parallelism.
    • Depend on OrthoConfig 9.3.1 and 9.3.2.
  • 5.2.2. Persist Netsuke run records.

    • Store project-local records under .netsuke/runs/.
    • Recover cleanly from interrupted runs.
    • Treat run persistence as product state, not generic configuration.
    • Depend on OrthoConfig 9.3.3 where its helper APIs are available.
  • 5.2.3. Implement runs list, runs get, and runs prune. Requires: 5.2.1, 5.2.2.

    • Support --json on all run commands.
    • Bound list output with --limit and --cursor.
    • Require --force for pruning.
    • Include recovery hints for interrupted builds.
  • 5.2.4. Add run-ledger validation and documentation. Requires: 5.2.3.

    • Test interrupted writes and corrupted record recovery.
    • Test human and JSON rendering.
    • Document run history for local users, CI, and agents.

5.3. Profiles

  • 5.3.1. Integrate named profiles with Netsuke configuration.

    • Add root --profile <name>.
    • Apply precedence: defaults < system config < user config < project config < profile < environment < CLI.
    • Surface available profiles in context --json.
    • Depend on OrthoConfig 9.1.1.
  • 5.3.2. Define profile redaction and secret handling.

    • Avoid storing secrets by default.
    • Redact sensitive values from human output and context --json.
    • Depend on OrthoConfig 9.1.2.
  • 5.3.3. Implement profile commands.

    • Add profile save, profile list, profile get, and profile delete.
    • Require --force for destructive profile deletion.
    • Depend on OrthoConfig 9.1.3; if unavailable, implement only the Netsuke-local adapter and mark the helper dependency as outstanding.
  • 5.3.4. Add profile validation and documentation.

    • Test every precedence boundary.
    • Test missing, invalid, and redacted profile values.
    • Document local and CI profile workflows.

5.4. Delivery and feedback

  • 5.4.1. Add structured delivery for Netsuke-owned artefacts.

    • Support --deliver=stdout, --deliver=file:<path>, and --deliver=webhook:<url> where applicable.
    • Write file deliveries atomically.
    • Surface webhook HTTP status in JSON results.
    • Require explicit authenticated endpoint configuration for deliver:webhook, including supported authentication schemes and required configuration fields.
    • Bound webhook timeouts and retry behaviour with documented maximum retry counts, backoff strategy, and backoff limits.
    • Enforce strict TLS and certificate authority validation by default, document any override options, and specify certificate pinning behaviour.
    • Redact webhook secrets from logs and JSON diagnostics, including headers, tokens, credentials, and query parameters.
    • Link implementation acceptance to security-network-command-audit.md so deliver:webhook code paths cannot ship before meeting these requirements.
    • Depend on OrthoConfig 9.2.1 for generic delivery-target parsing.
  • 5.4.2. Keep delivery scoped to product-owned artefacts.

    • Support generated manifests, graph output, reports, and JSON result envelopes.
    • Do not promise arbitrary build-output delivery until manifest artefact ownership is modelled.
    • Enumerate valid delivery schemes on error.
  • 5.4.3. Implement local-first feedback.

    • Add feedback add, feedback list, and feedback send.
    • Store feedback as JSON Lines locally by default.
    • Require explicit upstream configuration and feedback send --force for network submission.
    • Depend on OrthoConfig 9.2.2 for generic feedback storage helpers.
  • 5.4.4. Add delivery and feedback validation.

    • Test atomic file writes, webhook status reporting, and invalid schemes.
    • Test local feedback storage and upstream-disabled behaviour.
    • Surface delivery and feedback capabilities in context --json.

5.5. Agent-facing validation and documentation

  • 5.5.1. Integrate the CLI vocabulary lint.

    • Fail CI on banned verbs and flags.
    • Check examples in docs as well as the command inventory.
    • Depend on OrthoConfig 7.1.1 to 7.1.3.
  • 5.5.2. Add non-interactive and stream-purity tests.

    • Verify commands do not wait for stdin.
    • Verify successful JSON mode writes exactly one stdout document and empty stderr.
    • Verify failing JSON mode writes empty stdout and exactly one stderr diagnostic document. For netsuke test this means a command failure, not a completed run reporting failed cases; see invariant I8 and 6.6.2.
    • Depend on OrthoConfig 7.2.1, 7.2.5, and 8.1.1.
  • 5.5.3. Add error-remediation and exit-code tests.

    • Verify enum-like failures enumerate valid values.
    • Verify stable exit classes for usage, manifest, not-found, external tool, delivery, and interruption failures.
    • Depend on OrthoConfig 7.3.1 and 8.1.2.
  • 5.5.4. Update user and contributor documentation.

    • Add automation examples that use only canonical vocabulary.
    • Keep human-first local examples beside automation examples.
    • Cross-link the archive so reviewers can trace where historical work moved.

6. Template standard-library expansion

Hypothesis: Netsuke manifests currently fall back to shell() whenever they need structured data, mapping composition, pattern matching, or version comparison; if the template standard library absorbs those operations as pure, bounded, capability-classified helpers, manifests become markedly easier to write, the generated graph stays byte-for-byte reproducible, and netsuke help targets can answer more questions without executing anything.

Kind: capability. Value is measured by the manifest operations that no longer require a subprocess, not by name parity with Ansible.

Scope: the accepted set in RFC 0006. Every task in this phase targets a release after v0.1.0 final and must not widen the hardening release defined by issue #594. Candidates that RFC 0006 §10 rejects must not be reintroduced by a later task, and candidates it defers are gated behind step 6.10. The bounded Git change-detection capability in step 6.11 is outside RFC 0006's Ansible-derived candidate set, but follows the same shared contract and capability boundary.

6.1. Settle the standard-library contract before the volume arrives

This step answers whether one shared contract, covering canonical equality, checked bounds, typed localized diagnostics, and an enumerated manifest-query boundary, can carry every later helper, or whether each capability group needs its own. Its outcome decides whether steps 6.2 to 6.9 can be reviewed as ordinary additions or need individual design passes. See RFC 0006 §§6 and 14.1.

  • 6.1.1. Split the RFC 0006 accepted set into focused child RFCs and accompanying roadmap tasks.
    • See RFC 0006 §14 and the execplan.
    • Give each RFC the full cross-cutting contract from RFC 0006 §6 rather than a reference to Ansible. Discharging each clause for the RFC's own helpers satisfies this; citing §6 without discharging it does not.
    • Record a release target of v0.1.x or later for each RFC.
    • Track delivery through the roadmap tasks in steps 6.2 to 6.9 rather than through separate issues, so progress stays in committed documentation.
    • Success: every accepted capability in RFC 0006 §7 is covered by exactly one child RFC and by at least one accompanying roadmap task, and every deferred or rejected candidate is covered by neither. A capability may be named by more than one roadmap task, as product already is by 6.4.2 and 6.4.5, so only the RFC count is exactly one.
  • 6.1.2. Implement the canonical value key and equality relation.
    • See RFC 0006 §6.7.
    • Derive the key with the existing serde_json_canonicalizer dependency and reject value kinds that have no canonical form.
    • Provide an order-preserving deduplication helper keyed on it.
    • Success: property tests show the relation is reflexive, symmetric, and transitive; that deduplication preserves first appearance; and that no public helper exposes a hash-map iteration order.
  • 6.1.3. Implement the shared bounded-materialization helper. Requires 6.1.2.
    • See RFC 0006 §6.8 and table 3.
    • Cover input length, nesting depth, checked combinatorial cardinality, and match counts.
    • Success: cardinality is rejected before allocation, and the diagnostic names both the computed cardinality and the ceiling.
    • Canonical admission already applies its own occurrence, depth, and byte ceilings for the shared-graph hazard (ADR-0085, issue #972). That work does not satisfy this task: it bounds one traversal and does not provide the shared helper the combinatorial filters need, and it carries no localized diagnostic. The checkbox stays open.
  • 6.1.4. Establish the stdlib domain-error and diagnostic-code scaffolding.
    • See RFC 0006 §6.9 and the stdlib resolver-boundary conventions in developers-guide.md.
    • Follow the existing ResolveError boundary: one domain error enum per capability group with a single From conversion, not ad hoc Error::new calls in leaf helpers.
    • Register netsuke::jinja::<module>::<reason> codes with Fluent keys under stdlib.<module>.<condition>.
  • 6.1.5. Close the manifest-query disclosure gaps.
    • See RFC 0006 §§3.3 and 6.2.
    • Localize manifest_query_operation_error through a Fluent key instead of building it with format!.
    • Add explicit failing stubs for every full-environment helper currently absent from the manifest-query environment, all of which vanish rather than explaining the restriction: the filters realpath, expanduser, size, linecount, hash, and digest; which, as both a filter and a function; the functions command_available and now; and the file tests dir, file, symlink, pipe, block_device, char_device, and device.
    • Success: no helper registered in the full environment is silently absent from the manifest-query environment.
  • 6.1.6. Add the manifest-query registration contract test. Requires 6.1.5.
    • See RFC 0006 §6.2.
    • Assert dispositions by exercising each registration rather than by differencing name sets. Task 6.1.5 keeps every non-pure helper registered as a stub, so both environments hold the same names and the difference is always empty.
    • For every helper in the inventory, check that the name resolves in both environments, that a pure helper evaluates normally under the manifest-query registration, and that a non-pure helper raises the restriction diagnostic there.
    • Success: a helper absent from the inventory, or one whose manifest-query registration neither evaluates nor raises the restriction diagnostic, fails the suite, so a non-pure helper cannot be added without deciding its query disposition.
  • 6.1.7. Publish the maintained standard-library inventory.
    • See RFC 0006 §§11 and 14.1.
    • Distinguish MiniJinja built-ins, existing Netsuke extensions, adopted Ansible-inspired helpers, and deliberately unsupported Ansible helpers with the Netsuke spelling to use instead.
    • Record each collision resolution at both colliding entries, covering hash against text_hash, groupby against group_by, unique against uniq, items against dict2items, in against contains, and the abs filter against the abs test.
    • Success: a test asserts that every registered name appears in the inventory, so the table cannot drift.

6.2. Read structured data without a subprocess

This step answers whether a manifest can consume compiler metadata, package manifests, and generated configuration fragments directly, or whether jq, yq, and a scripting runtime remain unavoidable host assumptions. Its outcome determines how much surrounding toolchain a Netsukefile still has to assume. See RFC 0006 §8.1, delivered by RFC 0013, and adr-0001-replace-serde-yml-with-serde-saphyr-for-yaml-parsing-in-netsuke.md.

  • 6.2.1. Add from_json with duplicate-key rejection and source offsets. Requires 6.1.3 and 6.1.4.
    • See RFC 0006 §8.1 and RFC 0013 §7.
    • Preserve object order and report line, column, and byte offset on failure.
    • Success: a document with a repeated object key fails naming the key and the offset of its second occurrence, rather than silently keeping the last value.
  • 6.2.2. Add from_yaml and from_yaml_all over the existing safe YAML stack. Requires 6.2.1.
    • See RFC 0006 §8.1 and RFC 0013 §§5.8 and 7.
    • Reject non-standard tags, duplicate keys, and merge keys, and materialize the multi-document result rather than exposing a lazy iterator.
    • Establish whether serde-saphyr can bound alias expansion; if it cannot, reject aliases outright and record that in the standard-library guide.
    • Success: an alias-expansion bomb fails with a bounded-resource diagnostic instead of exhausting memory.
  • 6.2.3. Add the deterministic to_yaml and to_nice_json serializers. Requires 6.2.2.
    • See RFC 0006 §§6.3 and 8.1, and RFC 0013 §§5.3, 5.7, and 8.
    • Pin key ordering, indentation, scalar quoting, line endings, and trailing-newline behaviour, quoting every scalar that could be read back as a boolean, null, number, or timestamp.
    • Resolve RFC 0006 §16 question 1 before registering: either reject to_nice_yaml outright or register it solely to raise a diagnostic naming to_yaml(indent=4).
    • Success: property tests show that to_yaml with from_yaml and to_nice_json with from_json round-trip under canonical equality, and that the YAML 1.1 yes, no, on, and off spellings cannot reach a generated file unquoted.

6.3. Make configuration layering expressible

This step answers whether the mapping transforms remove the merge and re-index loops that vars, foreach, and per-entry overrides currently force manifest authors to write by hand. Its outcome informs how much of the platform and toolchain configuration problem the template layer can own. See RFC 0006 §8.2, delivered by RFC 0014.

  • 6.3.1. Add combine with explicit recursion and list policies. Requires 6.1.2 and 6.1.4.
    • See RFC 0006 §8.2 and RFC 0014 §§5.3, 5.8, and 7.
    • Support recursive and the replace, keep, append, and prepend list policies, enumerating them on an unknown one.
    • Preserve first-appearance key order, updating an overridden key in place.
    • Add a regression test for the recursive non-associativity counterexample in RFC 0006 §8.2: with a = {'x': {'a': 1}}, b = {'x': 0}, and c = {'x': {'b': 2}}, grouping to the left yields {'x': {'b': 2}} and grouping to the right yields {'x': {'a': 1, 'b': 2}}.
    • Success: property tests show that an empty mapping is the identity under every policy, that self-merge idempotence holds under replace and keep with or without recursive, that associativity holds when recursive=false under replace and keep, and that the result is independent of hash iteration order. Associativity is not asserted for recursive=true, and neither law is asserted for the accumulating append and prepend policies.
  • 6.3.2. Add dict2items and items2dict with an explicit duplicate policy. Requires 6.3.1.
    • See RFC 0006 §8.2 and RFC 0014 §§5.7 and 5.10.
    • Reject equal key_name and value_name, and reject missing fields naming the element index.
    • Success: dict2items followed by items2dict is the identity, and a duplicate derived key fails by default rather than silently collapsing.
  • 6.3.3. Add extract with explicit missing-value behaviour. Requires 6.3.2.
    • See RFC 0006 §8.2 and RFC 0014 §5.6.
    • Keep the key as the filter subject so the filter composes with map.
    • Reject negative sequence indices, and treat traversal into a non-container as an error even when default is given.
    • Success: a missing key errors naming the failing step of the path unless default is given; the filter never yields undefined.
  • 6.3.4. Add subelements and rekey_on_member. Requires 6.3.3.
    • See RFC 0006 §8.2 and RFC 0014 §§5.5 and 5.6.
    • Keep skip_missing scoped to absence only; a value present at the path but not a sequence is always an error.
    • Accept sequences only for rekey_on_member, rejecting the mapping-of-mappings form that silently discards keys.
  • 6.3.5. Add an end-to-end layered-configuration manifest example. Requires 6.3.4.
    • See RFC 0014 §§5.11 and 7.
    • Cover defaults, a platform overlay, and a per-target overlay composed with combine, dict2items, and extract.
    • Add the example to stdlib-yaml-and-jinja-guide.md with a tested-example marker so the documentation harness executes it.
    • Success: the example builds in an isolated workspace and its generated Ninja is byte-identical across two runs.

6.4. Make build matrices expressible with stable ordering

This step answers whether ordered collection algebra can replace both hand-expanded target matrices and Ansible's set-backed filters without introducing a single unstable ordering. Its outcome is the strongest test of the determinism claim in RFC 0006 §6.3. See RFC 0006 §§8.3 and 8.8, delivered by RFC 0015.

  • 6.4.1. Add the ordered set algebra. Requires 6.1.2.
    • See RFC 0006 §8.3 and RFC 0015 §§5.3, 5.7, and 7.
    • Implement union, intersect, difference, and symmetric_difference with first-appearance ordering and canonical-key deduplication.
    • Success: property tests show idempotence, the documented ordering, and that reordering an input's duplicate positions does not change the result.
  • 6.4.2. Add the bounded combinatorial filters. Requires 6.1.3.
    • See RFC 0006 §§6.8 and 8.3 and RFC 0015 §§5.6 and 5.8.
    • Implement product, combinations, and permutations with checked cardinality and the lower ceiling for permutations.
    • Report the computed cardinality and the ceiling as two distinct codes, so an overflowing count does not read as an over-large one.
    • Success: an over-large request fails naming the computed cardinality and the ceiling, without allocating the result.
  • 6.4.3. Add zip_longest with a required fill value. Requires 6.4.1.
    • See RFC 0006 §8.3 and RFC 0015 §§5.6 and 5.9.
    • Omitting fill_value is an error, so a silent none cannot enter a build graph.
  • 6.4.4. Add the collection and truth predicates. Requires 6.1.2.
    • See RFC 0006 §8.8 and RFC 0015 §§5.7, 5.8, and 5.10.
    • Implement any, all, subset, superset, contains, truthy, and falsy.
    • Restrict convert_bool to the closed eight-spelling vocabulary, erroring on anything else rather than reproducing Ansible's permissive fallback.
    • Success: truthy and falsy are exact complements wherever both succeed, and contains is documented against MiniJinja's in at both entries.
  • 6.4.5. Add the matrix-determinism end-to-end suite. Requires 6.4.2 and 6.4.4.
    • See RFC 0015 §§5.3, 5.11, and 7.
    • Compile a representative target matrix built from product, the set algebra, and selectattr with contains, twice from the same inputs.
    • Add a property test that holds the logical input order fixed while varying the internal hash state of the mappings the helpers consume, for example by building equal mappings through different insertion and reservation histories.
    • Do not permute logical input order. RFC 0006 §8.3 makes first-appearance order observable, so a different input order may legitimately produce different output, and requiring otherwise would contradict the contract.
    • Success: both runs emit byte-identical Ninja, and the property test fails if any helper is reimplemented over a hash set.

6.5. Make text and version conditions expressible

This step answers whether a coherent, bounded Netsuke regular-expression dialect and a strict version predicate can replace the shell() calls that manifests currently use to inspect --version output and filter path lists. Its outcome determines whether conditional flag selection can be expressed at manifest time. See RFC 0006 §§8.4 and 8.5, delivered by RFC 0016.

  • 6.5.1. Establish the netsuke-regex-v1 dialect and the bounded pattern cache. Requires 6.1.3 and 6.1.4.
    • See RFC 0006 §8.4 and RFC 0016 §§5.3 and 5.8.
    • Add the regex dependency, name the supported and unsupported constructs in the standard-library guide, and enforce the compiled-pattern size limit and least-recently-used cache from RFC 0006 table 3.
    • Success: an unsupported construct such as a look-ahead produces a typed localized diagnostic naming the construct and offset, not a generic parse failure.
  • 6.5.2. Add regex_replace with dollar-form replacements. Requires 6.5.1.
    • See RFC 0006 §8.4 and RFC 0016 §§5.6 and 5.9.
    • Support count and mandatory_count, and reject a Python-style \1 or \g<name> replacement with a diagnostic pointing at the $1 form.
    • Success: a replacement pasted from an Ansible playbook fails loudly rather than emitting the literal text \1.
  • 6.5.3. Add regex_search, regex_findall, and regex_escape. Requires 6.5.2.
    • See RFC 0006 §8.4 and RFC 0016 §§5.6, 5.7, 5.8, and 5.9.
    • Return none for a non-match, keep the regex_findall return shape dependent only on the arguments, and accept only the netsuke escape dialect.
    • Success: regex_findall returns a sequence of strings whether the pattern has zero, one, or several capture groups.
  • 6.5.4. Add the match, search, and regex tests. Requires 6.5.1.
    • See RFC 0006 §8.4 and RFC 0016 §§5.6 and 5.9.
    • Support match_type values search, match, and fullmatch, enumerating them on an unknown value.
  • 6.5.5. Add the version test over the existing semver dependency. Requires 6.1.4.
    • See RFC 0006 §8.5 and RFC 0016 §§5.9 and 8.
    • Make operator required, accept the six symbolic and six mnemonic forms, and accept only semver for scheme.
    • Resolve RFC 0006 §16 question 3 on whether a v prefix is tolerated before registering the test.
    • Success: parse failure names which operand failed and the offending text, and the guide states that build metadata is ignored for comparison.

6.6. Compose path text for a platform other than the host

This step answers whether one uniform dialect mechanism can serve cross-compilation better than a family of Windows-specific filter names, and whether lexical normalization can be offered without weakening the capability boundary. Its outcome informs how Netsuke describes any future cross-platform surface. See RFC 0006 §8.6, delivered by RFC 0017.

  • 6.6.1. Add the dialect argument and its host, posix, and windows path parsers. Requires 6.1.4.
    • See RFC 0006 §8.6 and RFC 0017 §§5.2 and 5.5.
    • Extend the existing basename and dirname filters additively, so omitting dialect preserves current behaviour.
    • Success: a Unix host parses a Windows path identically to a Windows host, with no host-native fallback.
  • 6.6.2. Add path_join, normpath, and splitext. Requires 6.6.1.
    • See RFC 0006 §8.6 and RFC 0017 §§5.6 and 5.9.
    • Reject an absolute component after the first position in path_join, and reject empty components.
    • Document the single-suffix splitext rule against the existing with_suffix filter.
    • Success: ['/safe/root', '/etc/passwd'] | path_join fails naming the index rather than yielding /etc/passwd.
  • 6.6.3. Add commonpath, relpath, and splitdrive. Requires 6.6.2.
    • See RFC 0006 §8.6 and RFC 0017 §§5.5 and 5.6.
    • Compare component-wise, reject mixed absolute and relative inputs, and reject differing drives or UNC roots under the windows dialect.
    • Contrast relpath with the stricter existing relative_to in the guide.
  • 6.6.4. Add the abs test as a pure lexical predicate. Requires 6.6.1.
    • See RFC 0006 §8.7 and RFC 0017 §§5.2 and 8.
    • Resolve RFC 0006 §16 question 2 on the name before registering.
    • Success: abs is registered in the read-only manifest-query environment, unlike the filesystem predicates in step 6.7.
  • 6.6.5. Add the combinatorial path-dialect suite. Requires 6.6.3 and 6.6.4.
    • See RFC 0017 §§5.5 and 5.11.
    • Cross every lexical path helper with all three dialects and both host platforms, including drive-relative paths, UNC roots, trailing separators, and leading .. components.
    • Success: the suite fails if any helper reaches for host-native parsing when an explicit dialect was supplied.

6.7. Probe host state through injected, query-gated seams

This step answers whether existence probing and environment expansion can be added without a second ambient-authority path and without any helper silently disappearing from a manifest query. Its outcome is the practical test of the capability contract in RFC 0006 §6.4. See RFC 0006 §§8.6 and 8.7, delivered by RFC 0018.

  • 6.7.1. Add the exists and link_exists tests. Requires 6.1.6.
    • See RFC 0006 §8.7 and RFC 0018 §§5.4 and 5.11.
    • Route both through the injected cap_std workspace handle, and treat a path outside the capability boundary as an error rather than false.
    • Success: a dangling symbolic link is false for exists and true for link_exists.
  • 6.7.2. Add the same_file and mount tests. Requires 6.7.1.
    • See RFC 0006 §§6.5 and 8.7 and RFC 0018 §§5.5 and 5.6.
    • Compare file identity rather than path spelling, and error on a missing operand rather than reporting false.
    • Qualify mount explicitly per platform; an unsupported platform errors rather than returning a plausible false.
    • Success: the platform contract for both tests is stated in the guide and exercised on Unix and Windows continuous integration.
  • 6.7.3. Add the files_only option to the existing glob function. Requires 6.7.1.
    • See RFC 0006 §8.7, RFC 0018 §§5.3, 5.8, and 8, and adr-0010-scope-the-glob-metadata-capability-to-the-literal-prefix.md.
    • Leave the existing capability scoping, ordering, and observability contracts unchanged, and do not introduce a second glob implementation.
    • Settle RFC 0018 §8's files_only default conflict before the option registers, and enforce the 100000-match ceiling section 5.8 assigns to files_only=false.
  • 6.7.4. Add expandvars through an injected environment reader. Requires 6.1.5 and 6.6.1.
    • See RFC 0006 §8.6, RFC 0018 §§5.2 and 5.9, and adr-0008-environment-seam-taxonomy.md.
    • Support missing values error, empty, and preserve, defaulting to error, and reject malformed references rather than passing them through.
    • Exclude it from the read-only manifest-query registration exactly as env is excluded, so every read-only generation caller is covered, not just netsuke help targets.
    • Success: no leaf helper reads the environment ambiently, and the manifest-query stub explains the restriction.

6.8. Generate file text and stable identities

This step answers whether Netsuke can produce comment banners, encoded payloads, quoted shell words, human-readable sizes, and content-derived identifiers without either a subprocess or a second quoting implementation. See RFC 0006 §8.9, delivered by RFC 0019.

  • 6.8.1. Add b64encode, b64decode, and urldecode. Requires 6.1.3 and 6.1.4.
    • See RFC 0006 §8.9 and RFC 0019 §§5.6, 5.9, and 5.11.
    • Add the Base64 dependency, support both alphabets and configurable padding, and default urldecode to plus=false so it round-trips with MiniJinja's urlencode.
    • Success: property tests show both Base64 alphabets and the URL codec round-trip, and invalid input errors naming the offset.
  • 6.8.2. Add to_uuid over a documented Netsuke namespace. Requires 6.1.4.
    • See RFC 0006 §8.9 and RFC 0019 §§5.3 and 5.6.
    • Use the frozen namespace recorded in the RFC, accept an explicit namespace, and record why UUID version 5 does not fall under the legacy-digests policy.
    • Success: the default namespace is Netsuke's, not Ansible's, and the guide records both its derivation and its literal value.
  • 6.8.3. Add shell_quote over the existing quoting machinery. Requires 3.14.8 and 6.1.4.
    • See RFC 0006 §8.9 and RFC 0019 §§5.5 and 5.10.
    • Adopt shell_quote as the canonical name that resolves the documented but unimplemented shell_escape helper, and add the dialect argument with an enumerated value set.
    • Note: 3.14.8 delivered the canonical name, the dialect argument, and the single implementation in src/shell_word.rs, so what remains here is the wider RFC 0006 dialect set beyond sh and powershell — bash in particular, which 3.14.8 deliberately refuses. See ADR-0041. The registry row in RFC 0019 §5.1 records the capability as New because the coverage contract classifies a renamed capability as new, not because the implementation is absent.
    • Success: the user guide and the registered surface agree, and no second quoting implementation is introduced.
  • 6.8.4. Add comment with a closing-marker guard. Requires 6.1.4.
    • See RFC 0006 §8.9 and RFC 0019 §§5.4 and 5.9.
    • Support the three line styles, the two block styles, and an explicit prefix, emitting no trailing whitespace.
    • Success: a block style whose input already contains the closing marker fails, so comment text cannot escape into a generated file as live syntax.
  • 6.8.5. Add human_readable and human_to_bytes. Requires 6.1.3.
    • See RFC 0006 §8.9 and RFC 0019 §§5.3 and 5.8.
    • Pin locale-independent output, parse case-insensitively, select bits by keyword rather than by letter case, and use checked integer arithmetic.
    • Success: overflow and non-integral results error rather than truncating, and unknown units are rejected with the valid set enumerated.
  • 6.8.6. Add text_hash without disturbing the existing hash contract. Requires 6.1.4.
    • See RFC 0006 §§8.9 and 11.1 and RFC 0019 §§5.6 and 5.10.
    • Reuse the existing legacy-digests gating for sha1 and md5, and register neither hash_text nor checksum.
    • Success: hash continues to hash the file at the supplied path, and the inventory states the distinction at both entries.

6.9. Convert explicit timestamps without reading the clock

This step answers whether timestamp parsing and formatting can be added as pure helpers over the existing now() value, leaving clock access as the only host-observing time operation. See RFC 0006 §8.10, delivered by RFC 0020.

  • 6.9.1. Add the shared conversion-specifier set and strftime. Requires 6.1.4.
    • See RFC 0006 §8.10 and table 12 and RFC 0020 §§5.3 and 5.9.
    • Pin the invariant C locale for the name-producing specifiers, and reject every specifier outside the accepted set with the supported set enumerated.
    • Accept the now() timestamp value and integer epoch seconds; reject floats.
    • Success: identical manifests produce identical text on machines with different locales.
  • 6.9.2. Add to_datetime. Requires 6.9.1.
    • See RFC 0006 §8.10 and RFC 0020 §§5.6 and 5.11.
    • Accept UTC and fixed offsets for timezone, rejecting IANA zone names so no time-zone database is required.
    • Success: a property test shows that to_datetime followed by strftime round-trips for every lossless format.

Both filters extend the existing stdlib.time.* family rather than founding a namespace, and neither observes the clock: only now keeps a refusing stub in the manifest-query registration. See RFC 0020 §§5.2 and 5.9 and adr-0008-environment-seam-taxonomy.md.

6.10. Decide the deferred candidates on evidence rather than parity

This step answers whether the capabilities RFC 0006 deliberately withheld are actually wanted once the accepted set is in use. Its outcome either closes them permanently or produces a specification with a named consumer, so neither is adopted for name parity alone. See RFC 0006 §9.

  • 6.10.1. Evaluate seeded shuffle and random. Requires steps 6.1 to 6.9.
    • See RFC 0006 §9.1.
    • Adopt only with a named consumer, a required seed, and a pinned seed-to-stream mapping recorded as a compatibility contract.
    • Unseeded forms remain permanently rejected.
  • 6.10.2. Evaluate log, pow, root, and checked integer exponentiation. Requires 6.10.1.
    • See RFC 0006 §9.2.
    • Adopt only against a real Netsukefile requirement, and specify the floating-point domain, signed-zero, and rounding behaviour before registering anything.
  • 6.10.3. Evaluate type_debug. Requires 6.10.1.
    • See RFC 0006 §9.3.
    • Adopt only if a recorded diagnostic session shows MiniJinja's debug, pprint, and type tests do not expose the relevant value kind.

Success criterion: Netsuke's template standard library covers the accepted RFC 0006 set behind one shared contract; every helper carries a purity label, an enumerated manifest-query disposition, checked resource bounds, and a typed localized diagnostic; the maintained inventory names every registered helper and every deliberately unsupported Ansible spelling; and a representative matrix manifest compiles twice to byte-identical Ninja.

6.11. Select proportionate quality gates from Git changes

This step asks whether Netsuke can expose deterministic commit-range paths as typed template data and compose them with a pure glob predicate, so manifests can omit irrelevant expensive gates without inheriting shell quoting, path parsing, or platform differences. It does not add working-tree inspection, untracked-file discovery, or per-linter file selection.

  • 6.11.1. Implement the strict commit-range parser and feature-private Git repository port.
    • Accept exactly non-empty A..B and A...B forms, resolve both endpoints to commits, and require a unique merge base for three-dot ranges.
    • Keep the port private to stdlib::change_detection, inject scripted responses in tests, and prohibit caller-selected Git flags or pathspecs.
    • See git-change-detection-helpers-design.md §§4 and 7.
    • Success: generated and example-backed cases reject malformed ranges and option-like endpoints before Git starts, while valid two-dot and three-dot ranges select the designed commits and assert the complete operation and resolved-ID sequence. Fixed rev-parse and merge-base vectors must use Git's top-level --no-lazy-fetch option.
  • 6.11.2. Register git_changed_files() with bounded path decoding and impurity tracking. Requires 6.11.1.
    • Run fixed rev-parse, merge-base, and diff argument vectors in the configured workspace, honouring the injected command PATH and requiring Git's top-level --no-lazy-fetch option on each vector.
    • Parse NUL-delimited output, reject non-UTF-8 names, normalize separators, sort and de-duplicate paths, disable rename and external-diff processing, and apply the configured capture limit.
    • Install the named manifest-query rejection and mark ordinary rendering impure immediately before Git execution.
    • Reserve git_changed_files against manifest-variable shadowing.
    • Add localized, bounded diagnostics and low-cardinality operation telemetry.
    • Add a partial-clone integration case with an instrumented remote proving a missing promisor object fails locally without remote contact.
    • See git-change-detection-helpers-design.md §§5, 8, and 9.
    • Follow ADR-0015.
    • Success: temporary-repository cases preserve newline-bearing paths, represent renames as old plus new paths, reject oversized and malformed output, and demonstrate the specified purity transitions.
  • 6.11.3. Implement the pure variadic matches_glob() collection filter. Requires 6.11.2.
    • Require a sequence of string paths and at least one string pattern; reject invalid patterns and validate every path member before returning a Boolean, even when an earlier path would match.
    • Enforce fixed v1 preflight limits of 64 supplied patterns and 65,536 aggregate UTF-8 pattern bytes before compiling or allocating compiled patterns; duplicate patterns count towards both limits.
    • Reuse or extract GlobPattern::new preprocessing before compiling each distinct pattern once, then return true when any path matches any pattern using case-sensitive, literal-separator, leading-dot, and recursive ** semantics aligned with glob().
    • Test escaped metacharacters, separator normalization, invalid braces, exact-boundary acceptance, count and byte overages, duplicate-pattern accounting, and rejection before compiling or allocating compiled patterns.
    • Register the filter in ordinary and manifest-query environments and add it to the standard-library filter inventory.
    • See git-change-detection-helpers-design.md §§3 and 6.
    • Success: property-generated path and pattern collections agree with a simple any-to-any reference predicate, invalid input fails closed, and over-limit pattern sets report observed values with their applicable fixed ceiling and are rejected before compilation or allocation.
  • 6.11.4. Validate and document change-aware manifest gates. Requires 6.11.3.
    • Add an end-to-end manifest matrix spanning two-dot and three-dot ranges, additions, modifications, deletions, renames, submodule changes, matches, and misses.
    • Assert operation and resolved-ID sequences for both range forms, including unique, multiple, and absent three-dot merge bases.
    • Add a runnable Rust-quality-gate example to the standard-library guide and align the core design, developer guide, localized diagnostics, and stdlib metadata with the public contract.
    • Verify Linux and Windows separator behaviour without mutating the process environment or relying on developer-installed commands.
    • See git-change-detection-helpers-design.md §§10 and 12.
    • Success: the documented example omits its Rust target for a Python-only changeset, includes it for every Rust path class, and passes the repository documentation and behavioural gates.

7. Netsukefile testing framework

Hypothesis: Netsukefile authors adopt manifest-time testing when it is deterministic, mock-friendly, and runs through the same compiler pipeline as the build.

Objective: deliver the netsuke test command and YAML test dialect specified in RFC 0007, the UX and semantic design, and the technical design.

7.1. Seams and loader options

  • 7.1.1. Add the clock provider seam to the stdlib time module. See technical design §5.2.

    • Register now() through an injected ClockProvider closure held in StdlibConfig.
    • Preserve current behaviour when no provider is supplied.
    • Test an injected provider value, repeated now() calls returning it, and the ambient fallback when no provider is configured, all registered through StdlibConfig.
    • Record the seam classification per ADR-0008.
  • 7.1.2. Introduce the options-carrying manifest loader entry point. See technical design §4.3.

    • Add ManifestLoadOptions and TemplateOverlays, with existing entry points as thin wrappers.
    • Extend StdlibRegistration with a Test mode beside Full and ManifestQuery rather than adding a parallel boundary mechanism.
    • Reuse the manifest_query_operation_error diagnostic shape and disabled_env_reader established by netsuke help targets.
    • Register overlays after stdlib and manifest macros and before foreach expansion.
    • Add differential tests showing the build path is unchanged (invariants I4 and I7).
  • 7.1.3. Spike MiniJinja overlay shadowing for macro substitution. Requires: 7.1.2. See technical design §5.4.

    • Pin add_function replacement semantics with a test.
    • Rewrite the MACRO_IMPORTS_GLOBAL prelude for substituted names; add_function alone is shadowed by the generated {% from ... import %} statement at render time.
    • Pin runner-side handle capture for spy passthrough.
    • Fall back to filtered macro registration if shadowing fails.
  • 7.1.4. Dogfood the seams before dialect work begins. Requires: 7.1.1, 7.1.2, 7.1.3.

    • Run the differential fidelity suite over the repository's example manifests.
    • Record the evidence in the RFC before starting 7.2.

7.2. Test dialect parsing and discovery

  • 7.2.1. Add the optional tests block to the manifest schema. See UX design §3.

    • Keep deny_unknown_fields semantics for the block itself.
    • Verify build-path neutrality with differential snapshots.
    • Document the minimum-version consequence for older parsers.
  • 7.2.2. Implement the test-suite AST and parser. See technical design §6.

    • Partition known keys from dynamic test_* keys.
    • Enforce the closed-schema and nearest-known-key diagnostics.
    • Enforce the expression/template field split at parse time.
    • Enforce the netsuke_test_version contract from RFC 0007: accept the supported major and a minor at most the supported minor, with tests for missing, malformed, unsupported-major, and newer-minor values.
  • 7.2.3. Implement discovery and imports. Requires: 7.2.1, 7.2.2.

    • Resolve tests.root, include and exclude patterns, and support files.
    • Confine imports to the test tree.
    • Fail empty selections without --allow-empty.

7.3. Mock engine

  • 7.3.1. Implement doubles, matchers, and the journal. Requires: 7.1.2. See UX design §8 and technical design §7.

    • Implement stub, mock, and spy kinds with first-match-wins entries.
    • Compile the closed matcher vocabulary at parse time.
    • Journal every call with per-case isolation (invariants I1 and I3).
  • 7.3.2. Implement verification and reporting hooks. Requires: 7.3.1.

    • Fail unmet mock expectations at end of case.
    • Warn on unused doubles with the lenient opt-out.
    • Render unmatched-call reports with suggested YAML entries.
  • 7.3.3. Implement macro substitution doubles. Requires: 7.1.3, 7.3.1.

    • Register journalling wrappers over compiled stand-in macros.
    • Journal calls under substitutes.<name>.

7.4. Fixture engine

  • 7.4.1. Add sandbox-rooted glob(), file-test, and file-reading filter adapters for the test registration. Requires: 7.1.2. See technical design §5.5.

    • Resolve relative glob patterns against the case sandbox rather than the process working directory.
    • Resolve file-test paths through the sandbox handle instead of open_ambient_dir, rejecting escapes.
    • Resolve the contents, size, linecount, hash, digest, and realpath filters through the sandbox handle instead of the process working directory, rejecting escapes and keeping the bounded-read limits.
    • Leave the build path's ADR-0010 behaviour unchanged.
  • 7.4.2. Implement the fixture lifecycle. See UX design §9 and technical design §8.

    • Resolve uses dependencies with a topological sort.
    • Run structured filesystem actions inside a cap-std sandbox.
    • Guarantee reverse-order teardown on every exit path (invariant I2, property-tested).
  • 7.4.3. Implement sandbox retention. Requires: 7.4.2.

    • Support --keep for failing cases and print retained paths.

7.5. Actions, assertions, and result views

  • 7.5.1. Implement pipeline actions. Requires: 7.1.2. See technical design §9.

    • Compose load_manifest, build_graph, and generate_ninja from public library functions.
    • Accumulate results across the case in execution order so assertions can compare stages.
    • Deny network, commands, and ambient environment under test (invariant I5).
  • 7.5.2. Implement the case supervisor and frame protocol. Requires: 7.4.3, 7.5.1. See technical design §9.1.

    • Run each case in a killable child process, keeping discovery, scheduling, and reporting in the parent.
    • Enforce the deadline with wait_timeout, then kill and reap, reusing the pattern in src/stdlib/command/execution.rs.
    • Carry CaseResult over length-prefixed serde_json frames versioned like src/json_envelope.rs; add no new dependency.
    • Synthesize an errored result with a timeout diagnostic when no complete frame arrived, preserving any partial journal.
    • Assign teardown ownership per the design's table, retain timed-out sandboxes, and reap every child including on interrupt.
    • Test a deliberately non-cooperative template expression, termination, timeout reporting, fixture cleanup, child reaping, and single-document --json output (invariant I10).
  • 7.5.3. Confine subject-manifest paths. Requires: 7.5.1. See UX design §10 and technical design §8.

    • Resolve and validate the action manifest argument, given.subject, and case-level subject after template evaluation and before open_manifest_workspace.
    • Reject absolute paths and sandbox escapes, including through existing symlinked components.
    • Admit the enclosing project's Netsukefile read-only, without granting write access to the project root.
    • Keep valid relative fixture paths working.
    • Test every path source — the action manifest argument, given.subject, and case-level subject — against an absolute path and a traversal path such as ../../outside/Netsukefile.
    • Test a symlink escape, gated on the platform supporting symbolic links.
    • Test that a valid relative fixture manifest still resolves, and that the enclosing-project Netsukefile is admitted read-only.
  • 7.5.4. Implement result views. Requires: 7.5.1.

    • Expose manifest, graph, and Ninja views with the documented helper surface.
    • Keep views stable across internal IR changes.
  • 7.5.5. Implement assertion evaluation. Requires: 7.5.4.

    • Normalize scalar and structured assertions.
    • Distinguish failures from errors end to end.
    • Implement expect_failure with named diagnostics.
    • Render failing expressions with substituted actual values.

7.6. Command, localization, and reporting

  • 7.6.1. Wire the test subcommand. Requires: 7.2.3, 7.4.3, 7.5.2, 7.5.3, 7.5.5. See UX design §12.

    • Add filters, tags, --list, --fail-fast, --timeout, --keep, and --allow-empty; consume the global --json and --jobs.
    • Map exit codes 0 to 3 and 130 as specified.
    • Implement per-case timeouts, interrupt handling, and case-conservation reporting (invariant I9).
  • 7.6.2. Localize and report. Requires: 7.6.1.

    • Add Fluent keys for report lines, diagnostics, and warnings.
    • Emit one JSON document per run under the stream-purity contract (invariant I8).
  • 7.6.3. Document the framework. Requires: 7.6.1.

    • Add a users' guide chapter for authoring and running tests.
    • Document the --accessibility output contract for test in the users' guide, covering how case results, failure diagnostics, and the run summary render under --accessibility on.
    • Record the accessibility findings for test output in the accessibility documentation, cross-referencing 3.8.3.
    • Update contents.md, the quickstart, and context --json follow-on notes.
    • Validate the documentation updates: check the users' guide and accessibility entries against the shipped output, and keep the documented contract in step with the display-policy behaviour.

Success criterion: a Netsukefile author can write the worked example from UX design §14.2 and run it to a green result on a machine with no compiler, no network, and a fixed clock.

8. Executable repository policy and hostile-input hardening

Idea (hardening): if Netsuke expresses repository policy through one deterministic inventory and exercises hostile inputs at pure library boundaries, then workflow drift, stale exceptions, and malformed-input failures can be closed without displacing the fast checks required for pull-request review.

This phase implements RFC 0008. It establishes the deterministic policy spine before adding scheduled coverage-guided depth, so the repository can distinguish blocking contract failures from longer-running health signals.

8.1. Establish one inventory and health-policy authority

This step tests whether one typed inventory and one health registry can describe the repository's workflows, references, tiers, and exceptions without duplicating the gates they govern. Its outcome defines the stable input boundary for the blocking validator and later scheduled jobs.

  • 8.1.1. Ratify the health-tier and exception-registry contracts.
    • Decide the registry format, schema version, tier vocabulary, ownership fields, event or schedule fields, failure meanings, and escalation rules.
    • Require each exception and allowlist entry to name one rule-specific subject, one narrow scope, one owner, one rationale, one issue or pull request, and creation and expiry dates. For external references, the subject identifies the approved owner, repository, exact action or workflow reference, and pinned SHA where applicable.
    • Protect the checked-in tier, exception, and external-source allowlist registries with CODEOWNERS and branch rules, or require independent protected approval before a registry change can affect blocking results.
    • Record the chosen boundary and reuse policy in an Architectural Decision Record (ADR) and the developer documentation before implementation.
    • See RFC 0008 §Health tiers and exception/allowlist registry and §Open questions.
    • Success: the registry has one documented schema and cannot represent an ownerless, unscoped, non-expiring, or subjectless exception, nor accept an unprotected policy change.
  • 8.1.2. Implement the repository reference inventory.
    • Keep rule evaluation pure over a typed inventory; isolate YAML parsing and capability-scoped repository reads behind narrow adapters.
    • Inventory tracked workflows, jobs, needs edges, permissions, triggers, action and reusable-workflow references, Make targets, nextest profiles, scripts, configuration paths, and health producers.
    • Return stable source locations and identifiers so each diagnostic names a file, YAML path, rule, and remediation.
    • See RFC 0008 §Repository-wide workflow-policy validator and §Gate self-consistency contracts.
    • Success: a clean checkout produces a deterministic inventory without GitHub credentials, network access, or process-global environment mutation.
  • 8.1.3. Run the inventory and registry in report-only mode.
    • Requires 8.1.1 and 8.1.2.
    • Classify every finding as a policy defect, repository defect, or explicit expiring exception; do not create a permanent baseline file.
    • Correct the known formal-verification documentation drift while preserving the existing Proptest, Kani, coverage, mutation, and no-blanket-retry contracts.
    • See RFC 0008 §Phase 1: Inventory and report.
    • Success: every reported finding has an owner and disposition, and the clean checkout has no unexplained inventory or tier mismatch.
  • 8.1.4. Validate protected policy-input changes.
    • Requires 8.1.1 and 8.1.2.
    • Treat tier, exception, and external-source registry edits as policy changes; require CODEOWNERS and branch protection, or independent protected approval, before their contents affect blocking results.
    • Test acceptable protected changes and reject direct, unprotected modifications before exception evaluation.
    • See RFC 0008 §Health tiers and exception/allowlist registry.
    • Success: a registry change cannot relax a blocking rule without the required protected approval, and validation identifies the protected input.

8.2. Make deterministic policy violations block pull requests

This step tests whether complete workflow and reference policy can remain fast, actionable, and fixture-driven enough to block ordinary review. Its results decide which checks belong in the per-pull-request tier rather than on a schedule.

  • 8.2.1. Enforce repository-wide workflow security rules.
    • Requires 8.1.2 and 8.1.3.
    • Reject mutable external references, sources outside the approved owner/repository allowlist, fork-only SHAs, implicit or excessive permissions, unsafe pull_request_target or privileged workflow_run execution, contradictory concurrency policy, and health checks masked by job- or step-level continue-on-error without a valid exception. For workflow_run, reject untrusted checkout content, unverified artefacts, and untrusted pull-request data reaching shell commands unless the required controls are enforced.
    • Preserve full lower-case commit-SHA pins and test each rule with valid and invalid YAML fixtures, including quoted and multiline values, allowlist and fork-provenance cases, both continue-on-error scopes, both privileged triggers, untrusted checkout and artefact-provenance cases, and pull-request data flowing to shell commands.
    • See RFC 0008 §Repository-wide workflow-policy validator.
    • Success: every security-policy class has a stable failing fixture and an actionable rule identifier, including allowed-source and declared-repository SHA provenance, both continue-on-error scopes, pull_request_target, and privileged workflow_run coverage for untrusted checkout content, verified artefact provenance, and pull-request data reaching shell commands, while all tracked workflows pass.
  • 8.2.2. Enforce gate, reference, and documentation consistency.
    • Requires 8.1.2 and 8.1.3.
    • Resolve local workflows and actions, Make targets, effective nextest profiles, scripts, configuration and artefact paths, job dependencies, and health producers against their owning contracts. Accept nextest's default and reserved built-in profiles through its own resolution, require literal profile sections only for repository-defined profiles, and reject missing or empty referenced tool-version files.
    • Check documentation links and current claims about gates and tools without rewriting prose automatically. Keep the blocking validator repository-only and network-free: it validates external URL syntax, not reachability.
    • Make focused workflow-contract tests consume the shared inventory where it removes duplicate parsing, while preserving their domain-specific assertions.
    • See RFC 0008 §Gate self-consistency contracts and §Documentation consistency.
    • Success: every tracked workflow and indexed documentation reference resolves, or is explicitly marked as historical under the documented rule; the blocking validator requires no network access.
  • 8.2.3. Enforce tier and exception hygiene through the canonical gate.
    • Requires 8.1.1, 8.1.4, 8.2.1, and 8.2.2.
    • Reject missing producers, contradictory blocking status, expired or duplicate entries, unknown rules, missing or malformed rule-specific subjects, empty or unbounded scopes, unsupported globs, invalid owners, references, or calendar dates, and inline bypasses without a registry entry.
    • Add the validator to a canonical Make target and the per-pull-request CI path without weakening existing gates or adding blanket retries.
    • See RFC 0008 §Health tiers and exception/allowlist registry and §Phase 2: Block deterministic contracts.
    • Success: twenty measured runs on the standard CI runner complete in under two minutes each and produce the same classifications for the same tree; every accepted exception has one valid subject, owner, reference, rationale, creation date, and later expiry date.
  • 8.2.4. Add an end-to-end workflow-policy regression corpus.
    • Requires 8.2.3.
    • Cover mutable and unallowlisted references, fork-only SHAs, permission escalation, unsafe pull_request_target and workflow_run, both continue-on-error scopes, missing local references, broken tiers, invalid exceptions, shell quoting, comments, and multiline commands in combination.
    • Exercise every tracked workflow through the same command that CI invokes.
    • See RFC 0008 §Acceptance criteria.
    • Success: each policy class fails independently and in representative combinations, while the repository corpus passes without allowlist drift.
  • 8.2.5. Report external-link reachability outside blocking validation.
    • Requires 8.2.2.
    • Add a scheduled, non-blocking external-link check with a 10-second per-URL timeout and a 10-minute job limit. Classify DNS, connection, TLS, redirect, HTTP-status, and timeout failures without changing PR results.
    • See RFC 0008 §Documentation consistency.
    • Success: a temporarily unavailable external URL is reported with its classified failure while the repository-only blocking validator still completes deterministically.

8.3. Add bounded coverage-guided fuzzing at compiler boundaries

This step tests whether hostile byte streams can exercise the manifest-to-Ninja pipeline through deterministic, offline library seams. The results establish which short corpora are suitable for pull requests and which campaigns must remain scheduled.

  • 8.3.1. Establish the fuzz workspace and bounded harness contract.
    • Pin the supported cargo-fuzz and toolchain inputs, decide corpus storage, and record the fixed per-target budget: 1 MiB input, 4 MiB output, 64 recursion frames, 64 MiB temporary storage, 256 MiB corpus, a one-second watchdog per input, and a 10-minute watchdog per job.
    • Forbid shell or Ninja execution, network access, unbounded recursion and output, and writes outside a capability-scoped temporary directory.
    • Document the harness ownership and composition rules before extracting any new shared boundary.
    • See RFC 0008 §Scheduled cargo-fuzz targets and §Open questions.
    • Success: a fixed input always yields the same bounded value or typed error, the registry publishes every fixed budget, watchdog expiry is an explicit timeout result, and a harness defect cannot invoke user commands or escape its test root.
  • 8.3.2. Implement the manifest_yaml fuzz boundary.
    • Requires 8.3.1.
    • Exercise arbitrary bytes, invalid UTF-8, malformed YAML, nesting pressure, valid minimal manifests, and current parser limits.
    • Check in minimized valid, malformed, and boundary smoke inputs.
    • See RFC 0008 §Scheduled cargo-fuzz targets.
    • Success: bounded parsing returns a typed result without panic, timeout, or uncontrolled filesystem access.
  • 8.3.3. Implement the jinja_expansion fuzz boundary.
    • Requires 8.3.1.
    • Exercise undefined values, malformed templates, nested control flow, expansion-size pressure, and the current control-key and binding rules.
    • Check in minimized valid, malformed, and boundary smoke inputs.
    • See RFC 0008 §Scheduled cargo-fuzz targets.
    • Success: expansion is bounded and deterministic and preserves current semantics without panic.
  • 8.3.4. Implement the command_interpolation fuzz boundary.
    • Requires 8.3.1.
    • Exercise placeholder boundaries, quoting, backticks, repeated substitutions, unmatched delimiters, and malformed UTF-8.
    • Preserve the current whole-placeholder rewriting contract.
    • Check in minimized valid, malformed, and boundary smoke inputs.
    • See RFC 0008 §Scheduled cargo-fuzz targets.
    • Success: the target produces a deterministic typed result without panic, timeout, or command execution.
  • 8.3.5. Implement the path_processing fuzz boundary.
    • Requires 8.3.1.
    • Exercise malformed UTF-8, absolute and parent paths, separators, NUL, and deep paths within the current capability boundary.
    • Preserve capability-root confinement and current path classifications.
    • Check in minimized valid, malformed, and boundary smoke inputs.
    • See RFC 0008 §Scheduled cargo-fuzz targets.
    • Success: the target produces a deterministic typed result without panic, timeout, uncontrolled filesystem access, or path escape.
  • 8.3.6. Implement the ninja_emission fuzz boundary.
    • Requires 8.3.1.
    • Exercise valid and rejected intermediate representation values, hostile names and commands, ordering variation, and output-size limits.
    • Check in minimized valid, malformed, and boundary smoke inputs.
    • See RFC 0008 §Scheduled cargo-fuzz targets.
    • Success: equivalent input produces deterministic output accepted by the renderer contract, or a typed error, without running Ninja.
  • 8.3.7. Integrate fuzz smoke checks, scheduled campaigns, and crash promotion.
    • Requires 8.2.3, 8.3.2, 8.3.3, 8.3.4, 8.3.5, 8.3.6, and bounded Proptest suites for input, output, recursion, temporary-storage, corpus, fuel, and operation limits; workflow references and job graphs; exception subjects, scopes, globs, owners, references, and dates; limit-edge cases; the 256-case bound; and retained regressions. Bound those suites to 10,000 fuel units per input, 1,000,000 per job, 32 jobs, 64 graph edges, 40-character SHAs, 32 exception entries, eight scopes per entry, and 128-character fields.
    • Run only measured, deterministic smoke corpora on pull requests; run longer budgeted campaigns on a scheduled workflow.
    • Promote a fuzz target only after deterministic fuel and operation properties cover those invariants and retained regression inputs; use watchdog elapsed time only to report an explicit harness timeout.
    • Publish target, corpus revision, execution budget, and crash result, retain failure artefacts, and minimize each crasher.
    • Require a deterministic regression test before deleting or quarantining a crasher, and do not use blanket retries.
    • Open or update an owned investigation for each scheduled failure. Treat a timeout, out-of-memory result, or uncontrolled filesystem access as a harness defect that blocks promotion; correct validator false positives with a fixture and rule change rather than a broad allowlist.
    • See RFC 0008 §Phase 3: Add scheduled fuzzing.
    • Success: every target has a passing smoke corpus and bounded properties cover the range invariants, resource and operation limits, validator graph and exception-schema boundaries, limit edges, the 256-case bound, and retained regressions before promotion; any scheduled failure remains visible until its minimized regression test passes.

8.4. Ratchet health signals from measured evidence

This step tests whether the new signals are stable, affordable, and owned after real operation. Its outcome determines promotion to blocking status and removes temporary exceptions instead of normalizing them.

  • 8.4.1. Measure policy and fuzz evidence.
    • Requires 8.2.4 and 8.3.7.
    • Record at least twenty consecutive policy runs and twenty consecutive scheduled fuzz runs with revisions, budgets, outcomes, crash regressions, coverage trends, mutation survivors, and exception age.
    • Distinguish tool or runner outages from product and policy failures.
    • See RFC 0008 §Phase 4: Ratchet and review.
    • Success: the evidence has no unexplained missing run, hidden retry, stale crasher, or ownerless exception.
  • 8.4.2. Promote only stable signals and reconcile documentation.
    • Requires 8.4.1.
    • Promote a scheduled signal only when its measured cost and stability fit the per-pull-request budget; otherwise keep its scheduled failure response explicit.
    • Remove resolved exceptions, review unmaintained entries, and align the tier registry, workflows, Make targets, developer guide, and formal verification guide.
    • See RFC 0008 §Compatibility and migration.
    • Success: the registry and documentation agree with every producing job, and each surviving exception remains narrow, owned, justified, and current.

9. Exact-commit release integrity and admission

Idea (hardening): if Netsuke binds release-mode invariants, security and dependency policy, and archive checks to deterministic evidence for the exact tag commit, then publication can fail closed before an invalid or under-evidenced artefact becomes a release.

This phase implements RFC 0005. It keeps measurement separate from enforcement, then makes the existing publication job consume one read-only admission decision without changing public command or archive naming contracts.

9.1. Settle the release evidence and operating contracts

This step tests whether the release candidate, its policy inputs, and its artefacts can be described by one deterministic evidence contract. The outcome fixes the decisions that profile measurement, security scans, and publication must share.

  • 9.1.1. Ratify release measurement, waiver, and retention policy.
    • Inventory production debug_assert sites, supported targets, release command paths, runner classes, archive and sidecar names, publication permissions, and current gate producers.
    • Decide representative workloads, history-scan freshness, waiver approval authority and maximum duration, notice retention or embedding, and whether first-version evidence needs external attestation.
    • Record substantive decisions as ADRs and update release architecture and developer documentation.
    • Decide the release policy boundary: frozen slotted records at every external-shape seam, with domain-shaped mappings retained. See ADR-0074.
    • See RFC 0005 §Open questions and §Phase 1: Measure and inventory.
    • Success: every threshold, freshness rule, waiver, and retained artefact has one documented owner and source of truth.
  • 9.1.2. Define and validate the release-evidence manifest schema.
    • Requires 9.1.1.
    • Bind the tag, exact commit, repository, pinned Rust toolchain, policy-tool versions and data state, approved workflow run, immutable producer job or artefact identities, every producer's checked-out release SHA, gate result and log identities, profile measurements, scan freshness, policy results, and every archive's target, byte size, and SHA-256 digest.
    • Reject unknown, missing, stale, malformed, duplicated, or contradictory evidence and require exactly one sidecar per archive.
    • See RFC 0005 §Release-admission evidence.
    • Success: schema fixtures prove every required field, exact-commit relation, producer provenance binding, and malformed or mismatched identity case without granting publish permissions.
  • 9.1.3. Capture reproducible release-profile baselines.
    • Requires 9.1.1.
    • Measure the current profile on the pinned toolchain, supported targets, runner classes, build flags, and representative workloads selected by 9.1.1.
    • Record stripped and unstripped binary sizes and representative-workload timings with the evidence inputs needed to reproduce them.
    • See RFC 0005 §Release-mode invariants.
    • Success: five repeated baseline runs per supported target are retained and identify their exact commit and build inputs.

9.2. Enable and exercise release-mode invariants

This step tests whether overflow checks and debug assertions can remain enabled for all supported release targets without violating valid command behaviour or the accepted size and performance budgets.

  • 9.2.1. Enable explicit release overflow checks and debug assertions.
    • Requires 9.1.3.
    • Add one workspace release profile with overflow-checks = true and debug-assertions = true, and prove packaging jobs do not override it.
    • Preserve the pinned nightly toolchain, Polonius, Kani, and existing all-target and all-feature gates.
    • See RFC 0005 §Release-mode invariants.
    • Success: every supported target builds with both invariants enabled and no release path silently restores Cargo defaults.
  • 9.2.2. Add end-to-end release-path invariant coverage.
    • Requires 9.2.1 and bounded Proptest suites for release arithmetic, digest and commit binding, freshness, archive cardinality, size and performance limits, limit-edge cases, the 256-case bound, and retained regressions.
    • Generate arithmetic values immediately below, at, and above each boundary; measurement pairs from zero through twice the baseline; archive sets from zero through one above the permitted cardinality; and timestamps around the freshness boundary. Bound command inputs to 64 KiB, staged archive bytes to 64 MiB, and every property run to 256 cases; retain each counterexample as a checked-in regression that the blocking suite replays.
    • Exercise every supported command path that can reach the seven production debug_assert* sites in src/ir/cycle/support.rs, src/ir/cycle/detector.rs, src/ir/cmd_interpolate/mod.rs, src/stdlib/time/format.rs, src/stdlib/command/quote.rs, src/ninja_gen/mod.rs, and src/cli/discovery/layers.rs, plus selected arithmetic boundaries, valid inputs, and intentionally rejected inputs.
    • Cover NamedAction::write_into for Recipe::Rule: assert the debug-assertion panic in its applicable profile and NinjaGenError::UnsafeNinjaValue without debug assertions.
    • Run the bounded property cases before release admission, including the 256-case bound and regression inputs retained from prior failures.
    • Require supported failures to remain typed, documented errors rather than assertion failures or arithmetic panics.
    • See RFC 0005 §Measurable acceptance criteria.
    • Success: every named assertion site, the Recipe::Rule profile-dependent rejection, and selected overflow boundaries are covered across supported targets without weakening an invariant. Bounded properties cover release arithmetic, digest and commit binding, freshness, archive cardinality, size and performance limits, limit edges, the 256-case bound, and retained regressions before admission.
  • 9.2.3. Enforce release-profile size and performance budgets.
    • Requires 9.1.2, 9.1.3, and 9.2.2.
    • Run five candidate measurements with the same inputs as the baseline and retain both result sets in release evidence.
    • Fail when any target's median representative workload is more than 5% slower or its stripped binary is more than 10% larger; retain unstripped size as a diagnostic.
    • See RFC 0005 §Measurable acceptance criteria.
    • Success: repeated measurements are reproducible, exact-commit-bound, and fail closed when either budget is exceeded.

9.3. Enforce secret, dependency, and licence policy

This step tests whether pinned, versioned security and supply-chain checks can block release candidates without exposing secret material or converting temporary waivers into permanent trust.

  • 9.3.1. Add pinned working-tree secret scanning.
    • Requires 8.2.3 and 9.1.1.
    • Scan tracked, staged, and developer-local untracked candidate files with a local hook or command before submission.
    • Run a blocking CI scan over checkout-tracked files and untracked files generated by the runner on pull requests, pushes, and release candidates, using a SHA-pinned action or verified pinned executable.
    • Keep every checkout and scanning action, and every newly introduced release-hardening download, pinned to an immutable commit SHA or verified pinned executable; reject an unpinned action tag or download URL.
    • Redact findings and require false-positive suppressions to identify the pattern, path, reviewer, rationale, and expiry without disabling the repository scan.
    • See RFC 0005 §Secret scanning.
    • Success: a synthetic secret fails each candidate event without printing secret material, while an unpinned scanner or broad suppression fails policy validation.
  • 9.3.2. Add scheduled reachable-history secret scanning.
    • Requires 8.2.3, 9.1.2, and 9.3.1.
    • Use a tag-triggered or tag-ref full-history producer for each release, record the release tag or ref and its resolved commit SHA, and publish commit-bound scan evidence. Keep the recurring scan schedule and freshness window machine-readable.
    • Require the admission manifest to consume a successful, freshness-valid result whose resolved SHA matches the exact release-tag commit.
    • Treat a late, missing, unavailable, or newly failing scan as unknown or failed, never passed.
    • See RFC 0005 §Secret scanning.
    • Success: release evidence rejects stale history scans and identifies a finding without disclosing its content.
  • 9.3.3. Add versioned advisory and dependency policy.
    • Requires 8.2.3, 9.1.1, and 9.1.2.
    • Pin and run cargo-audit and cargo-deny against the committed lockfile and versioned policy files.
    • Fail on unwaived vulnerabilities or unsoundness, banned crates or sources, and denied or unknown licences.
    • Require waivers to name the advisory, dependency, reason, owner, approval, and expiry; generated output cannot waive a failed policy.
    • See RFC 0005 §Dependency and licence policy.
    • Success: clean policy output is reproducible from the committed lockfile, tool versions, registry state, and policy files, and every advisory, source, ban, and licence negative fixture fails closed.
  • 9.3.4. Add versioned notice and unmaintained-dependency policy.
    • Requires 8.2.3, 9.1.1, 9.1.2, and 9.3.3.
    • Pin and run cargo-about and the selected cargo-unmaintained advisory against the committed lockfile and versioned policy files.
    • Fail on incomplete or unrenderable notices and newly unmaintained direct dependencies; report transitive findings for owned review.
    • Require each exception to name the dependency, reason, owner, approval, and expiry; generated output cannot waive a failed policy.
    • See RFC 0005 §Dependency and licence policy.
    • Success: the notice inventory is complete and reproducible, and each unmaintained finding has the blocking or review outcome defined by policy.

9.4. Make exact-commit evidence a publication prerequisite

This step tests whether publication can consume one read-only admission result and remain impossible for stale, incomplete, or mismatched evidence. Its dry runs prove the failure boundary before any job receives release permissions.

  • 9.4.1. Produce exact-commit evidence for every required gate.

    • Requires 9.2.3, 9.3.1, 9.3.2, 9.3.3, and 9.3.4.
    • Collect formatting, lint, tests, rustdoc, Whitaker, Kani, profile measurements, secret scans, dependency and licence policy, notices, and archive checksum results under the schema from 9.1.2.
    • Bind every producer to the tag commit, approved workflow run, and exact checked-out release SHA; record tool versions, policy inputs, and immutable producer, log, and artefact identities or digests.
    • See RFC 0005 §Release-admission evidence.
    • Success: a candidate has exactly one successful, reproducible, provenance-bound result for every required gate, target, archive, and checksum sidecar.
  • 9.4.2. Add the read-only release-admission job.

    • Requires 8.2.3, 9.1.2, and 9.4.1.
    • Give admission no publication permission, require it to validate the exact tag-to-commit binding, approved workflow run, producer checkout SHA, and all evidence, and make the publication job depend on its success.
    • Recompute every staged archive SHA-256 from its bytes, then compare it with its matching .sha256 sidecar and evidence-manifest digest; reject any filename, cardinality, sidecar, commit, result, provenance, or digest mismatch.
    • Preserve existing archive names, target coverage, checksum sidecars, cargo-binstall resolution, action SHA pins, and release staging policy.
    • Instrument the RFC 0005 gate with bounded gate and operation metrics, retain the JSONL metrics file as a workflow artefact, and expose the final outcome in the job summary. The workflow now enforces the gate on publishing runs and observes it on pull-request dry runs, and every job that writes depends on the gate's success. Publication is therefore refused until a real evidence producer (#598) both uploads the manifest the gate verifies and attests that upload: an enforcing run reports a missing manifest as missing_evidence and an unattributable one as untrusted_evidence. See ADR-0020 and the release-admission observability guidance.
    • See RFC 0005 §Phase 4: Turn on admission.
    • Success: no job with publication permission can run before successful exact-commit admission, and no archive is admitted without three-way byte-derived digest agreement.
  • 9.4.3. Add end-to-end release-admission dry-run coverage.

    • Requires 9.4.2.
    • Exercise clean evidence and missing, stale, malformed, failed, contradictory, wrong-commit, wrong-workflow, wrong-producer-SHA, provenance-identity, duplicate-sidecar, missing-sidecar, and checksum-mismatch combinations without publishing assets.
    • Prove tool outages and expired waivers remain unknown or failed, and prove a dry run cannot bypass admission for a real publication event.
    • See RFC 0005 §Failure modes and mitigations and §Measurable acceptance criteria.
    • Success: every invalid matrix case blocks before upload, while clean evidence preserves the established archive and sidecar contract.
  • 9.4.4. Enable publication admission and document rollback.

    • Requires 9.4.3.
    • Enable the dependency only after all supported-target dry runs pass, retain the evidence manifest with the workflow run, and update release operator guidance.
    • Limit rollback to disabling publication while retaining checks and evidence; do not remove release invariants or widen thresholds to clear a failed release.
    • See RFC 0005 §Compatibility and migration.
    • Success: a real release is publishable only from the admitted exact tag commit, and its retained evidence reproduces the admission decision.

10. Property-based testing of generated build scripts

Hypothesis: Netsukefile authors trust the generated build script when the test dialect can quantify over families of manifests and observe invocations and environments structurally, rather than asserting on single fixtures and raw Ninja text.

Objective: deliver the result.actions view, the declarative forall generation block, the metamorphic mutations vocabulary, and the coverage lint specified in RFC 0012, extending the phase 7 framework without reopening its closed dialect.

10.1. Structured observation of invocations and environments

This step answers whether plan-mode projections can expose command lines and constructed environments host-independently. Its outcome fixes the assertion surface that every later property builds on. See RFC 0012 §1 and §2.

  • 10.1.1. Pin the recipe shell for plan-mode projections.
    • Requires 7.5.1.
    • Add the from_manifest_for_shell constructor anticipated by the technical design §9, leaving the host-default build path unchanged.
    • Success: identical manifests project identical recipe text across supported hosts, shown by a differential test over pinned shells.
  • 10.1.2. Implement the result.actions view.
    • Requires 7.5.4 and 10.1.1.
    • Project each build edge's rule, tokenized argv, environment map, inputs, outputs, and working-directory, pool, depfile, and dyndep bindings per RFC 0012 Table 1.
    • Add the action, actions_for_rule, and has_action helpers, keeping the view additive-only and decoupled from internal IR types.
    • Success: every Table 1 field and helper is observable in plan mode, and identical manifests produce byte-identical, canonically ordered views under the RFC 8785 canonical JSON contract of RFC 0006 §6.7, regardless of declaration or IR iteration order.
  • 10.1.3. Implement quantified assertions.
    • Requires 7.5.5 and 10.1.2.
    • Add for_all_actions and for_all_targets, evaluated by the existing MiniJinja engine, reporting the falsifying binding with substituted actual values under the established FAIL and ERROR taxonomy.
    • Success: quantified action results follow the canonical projection order, keep the constructed environment available to assertion evaluation, expose only redacted environment keys and values in diagnostics, rendered action views, and persisted regression artefacts, and preserve the established FAIL versus ERROR outcomes for passing, failing, and erroneous assertions.

10.2. Declarative bounded generation

This step answers whether a closed domain vocabulary with deterministic expansion is expressive enough for real Netsukefile properties, informing whether further constructors are warranted before the dialect stabilizes. See RFC 0012 §3 and §5.

  • 10.2.1. Parse the forall block and domain vocabulary.
    • Requires 7.2.2.
    • Compile the closed constructors of RFC 0012 Table 2 at parse time with nearest-known-key diagnostics, matching the mock matcher convention.
    • Raise netsuke_test_version to 1.1 and gate the new keys on it, so 1.0 runners fail closed under the RFC 0007 version contract.
    • Success: version 1.1 files parse every Table 2 constructor, version 1.0 runners reject the new keys, and malformed constructors receive the nearest-known-key diagnostic.
  • 10.2.2. Implement deterministic expansion, sampling, and replay.
    • Requires 10.2.1 and 7.5.2.
    • Enumerate exhaustively at or below the expansion ceiling; above it, sample from the proptest generator with fixed default seed 0; name the seed in every failure report and honour netsuke test --seed.
    • Persist regression tuples under the test tree, replay them before fresh generation, and delta-reduce failing tuples towards domain minima.
    • Success: repeated default runs are byte-identical, and a reported failure replays only when both its reported seed and generated tuple inputs are supplied through the persisted regression artefact.

10.3. Metamorphic relations, coverage, and adoption

This step answers whether built-in two-run relations catch generator regressions that authors would not have written down as fixtures. See RFC 0012 §4 and §6.

  • 10.3.1. Implement the mutations vocabulary.
    • Requires 10.1.2 and 10.2.2.
    • Implement permute_declarations, insert_irrelevant_target, rename_target, and remove_declared_input per RFC 0012 Table 3, running base and mutant pipelines inside the case sandbox and asserting the named relation.
    • Success: seeded regression suites demonstrate each mutation detecting a deliberately introduced generator defect.
  • 10.3.2. Implement the coverage completeness lint.
    • Requires 10.3.1.
    • Report rules that interpolate commands or construct environments without property coverage; keep the report advisory by default and promote it to a failure under --strict-coverage.
    • Success: an uncovered command or environment produces an advisory report by default, the same fixture fails under --strict-coverage, and covered fixtures produce neither report.
  • 10.3.3. Dogfood the property dialect on example manifests.
    • Requires 10.3.2.
    • Add property suites over the repository's example manifests covering the order-invariance, locality, and environment-closure relations end to end.
    • Scope boundary: change only property suites and their example-manifest fixtures; do not add constructors, alter the dialect, or update docs.
    • Success: the example-manifest suites pass for order invariance, locality, and environment closure, and record the measured expansion ceiling and case count used by each relation.
  • 10.3.4. Document the adopted property dialect and measurements.
    • Requires 10.3.3.
    • Update the users' guide testing chapter, docs/contents.md, and the RFC 0012 open questions with the measured expansion-ceiling evidence from 10.3.3, including links to the example-manifest relations.
    • Scope boundary: change documentation only; do not change the property implementation, suites, dialect, or measured results.
    • Success: all three documents state the same measured expansion ceiling, identify the order-invariance, locality, and environment-closure example suites, and link readers to the adopted property dialect.

Success criterion: the worked examples in RFC 0012 §§3-4 run to a green result deterministically on a machine with no compiler and no network, and a seeded property failure replays identically from its reported seed and tuple inputs.

11. Allow-listed structured-command shell selection

Hypothesis: a structured command can select a required shell dialect portably without giving Netsukefiles arbitrary interpreter authority or moving working directories, streams, pipelines, and failure handling back into shell text.

This phase is governed by ADR-0019 and RFC 0011. It extends the structured-command design in RFC 0001. Primitive work can precede that design's AST; core integration requires 12.3.1. The full interaction matrix in 11.3.2 waits for 12.3.3, 13.2.3, and 14.2.3. This separates basic shell selection from the later facilities whose shared semantics it verifies. Issue #593 remains the broader feature umbrella; 17.4.4 validates composed recipes without creating another shell registry or changing its authority.

11.1. Settle the contract before implementation

This step makes the interpreter vocabulary and authority boundary reviewable before any schema or runtime code exists.

  • 11.1.1. Define named structured-command shell selection.
    • Accept the governing ADR before implementation and record the built-in names, supported hosts, executable resolution, fixed arguments, configuration ownership, validation, lowering, diagnostics, safety model, and distinct script boundary.
    • Amend RFC 0001 so shell is a Boolean | ShellName, false stays direct, true keeps the platform default, and a string selects an allow-listed name.
    • Record the schema, compatibility, implementation phases, and test strategy in RFC 0011 without changing runtime code.
    • See ADR-0019, RFC 0001 §Shell mode, and RFC 0011.
    • Success: accepted architecture and proposed schema documents define every required decision, while the production source tree remains unchanged.

11.2. Resolve trusted shells without expanding manifest authority

This step builds data and resolution primitives independently of the future structured-command AST. Each task keeps configuration and ambient host input outside the execution domain.

  • 11.2.1. Add the manifest-facing shell selection vocabulary.

    • Requires 11.1.1.
    • Add the finite BuiltInShell enum with sh, bash, pwsh, and powershell, plus a validated ShellName registry-name type capable of retaining configured names such as dash. Include host availability, fixed arguments, parsing, and a host-default mapping modelled on RecipeShell and DependencyOrder.
    • Add a Boolean-or-name selection type whose three variants preserve direct, platform-default, and named manifest intent; reject every other YAML type.
    • Keep the types data-only and do not wire them into a structured-command AST that RFC 0001 has not yet implemented.
    • Success: unit and serialization tests prove the finite built-in names, configured-name retention, host rules, fixed invocations, and exact false, true, and string mappings without changing command execution.
  • 11.2.2. Add trusted configured shell definitions.

    • Requires 11.2.1.
    • Add append-merged CliConfig shell definitions with validated name, executable, and fixed args, reserving built-in names and rejecting duplicate merged names.
    • Require the trusted operator invariant that args is a complete fixed prefix: appending exactly one rendered source argument must invoke the executable's source evaluator. Structural validation cannot infer the executable-specific switch, so a violation is a trusted operator policy error.
    • Perform field-local checks during deserialization and collision checks in PostMergeHook; keep definitions out of Netsukefiles and command-line flags. System and user operator configuration are trusted registry sources. Automatically discovered project .netsuke.toml is never trusted for definitions, and --config or another explicit config selection alone does not grant that authority. Project configuration may select existing registry names only; project-owned definitions require a separate explicit trust mechanism. Treat configured definitions as host-eligible and let resolution decide their availability.
    • Add commented sample configuration and document any new OrthoConfig merge behaviour in the configuration guide.
    • Success: configuration and post-merge tests cover valid entries, invalid names, executable shapes, argument bounds, reserved names, duplicates, untrusted project definitions, and layered composition with actionable configuration-key errors.
  • 11.2.3. Resolve selections into a complete execution value.

    • Requires 11.2.1 and 11.2.2.
    • Build a feature-private registry from CliConfig and resolve bare executables from trusted host PATH and Windows PATHEXT through mockable::Env, before applying a command environment overlay.
    • Before invoking which, reject every empty or non-absolute trusted PATH component. Never convert a rejected component relative to the current directory or pass it to which; reject with a typed trusted-environment misconfiguration naming only a bounded component index. Reuse executable probing where appropriate, but disable current-directory and workspace fallback so repository content cannot replace an allow-listed shell.
    • On Windows, read PATHEXT through mockable::Env. An unset value uses the fixed default .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC. A present value must be non-empty, valid Unicode, and NUL-free. Split it on ;, reject empty or whitespace-only entries, and trim ASCII spaces and tabs before requiring the raw grammar \.?[A-Za-z0-9]+. Lowercase each entry, add its leading dot, and deduplicate while preserving first order. Reject malformed entries rather than skipping them or using the default.
    • For a bare executable, try extensions in normalized PATHEXT order within each absolute PATH directory in PATH order, selecting the first regular executable. An already extended executable receives no PATHEXT suffix. Reject malformed PATH or PATHEXT before invoking which, with no fallback or skip. Report typed trusted-environment misconfiguration with the variable and only a bounded entry or component index; retain distinct unknown, unsupported, unavailable, and misconfigured outcomes.
    • Add deterministic MockEnv and probe acceptance cases for ordered matching, duplicate and first-order preservation, the fixed unset default, already extended executables, empty and invalid PATHEXT, and all existing PATH rejection cases on Unix-like and Windows paths. Include a repository-local candidate beneath a relative component and assert it is never probed.
    • Classify unknown, unsupported, unavailable, and misconfigured outcomes in a crate-internal typed error, convert it to user diagnostics once, and carry only the resolved name, executable, and fixed arguments into the execution value.
    • Success: injected-environment and probe tests cover each failure class, host-default and named resolution, absolute and bare configured executables, bounded diagnostics, and resistance to command PATH and workspace replacement. Deterministic MockEnv and probe tests run on Unix-like and Windows paths and include a repository-local candidate below a relative PATH component.
  • 11.2.4. Property-test shell selection invariants.

    • Requires 11.2.1, 11.2.2, and 11.2.3.
    • Generate valid and invalid registry names and Boolean-or-string YAML values, merged definitions with bounded fixed-argument lists, and injected PATH and PATHEXT states.
    • Check that direct, platform-default, and named selections lower to their respective invariants, including rejection of empty and relative trusted PATH components without probing repository-local candidates.
    • Success: bounded property runs reproduce failures from their seeds and prove that configured names remain representable while built-in names stay finite, reserved, and host-aware.

11.3. Carry named shells through structured execution boundaries

This step integrates the trusted value after RFC 0001 supplies the command AST, resolved process value, and action-plan codec. Core integration can land before stream and runtime-binding completion; the later cross-platform matrix proves that all completed facilities use the same path and authority boundary.

  • 11.3.1. Lower named shells through structured commands.
    • Requires 11.2.3 and 12.3.1.
    • Accept Boolean | ShellName in singular blocks, heterogeneous sequence items, and pipeline stages; resolve each stage independently before constructing the IR. Reject execution of variants not yet supported by the staged runner rather than ignoring their fields.
    • Carry the complete resolved shell through versioned action plans and the Ninja adapter without another configuration or environment lookup; reject unknown persisted variants. Later stream, capture, and directory delivery must reuse this path rather than add shell-specific execution facilities.
    • Preserve each implemented block's environment, working directory, standard streams, and failure semantics; keep legacy commands, rule references, and shebang-based scripts distinct. Task 11.3.2 owns the complete runtime interaction matrix once its prerequisites land.
    • See RFC 0011 §§4-6 and 9.
    • Success: unit and behavioural tests prove identical implemented outer semantics for direct and named-shell blocks, while selected shell source receives only the rendered invoke text after fixed arguments.
  • 11.3.2. Exercise the cross-platform shell-selection matrix.
    • Requires 11.3.1, 12.3.3, 13.2.3, and 14.2.3.
    • Add Unix-like and Windows end-to-end coverage for absent, false, true, every supported built-in, configured names, unsupported names, unavailable executables, and invalid configuration.
    • Exercise named shells as singular blocks, sequence items, and first, middle, and final pipeline stages with independent working directories, stream bindings, both capture modes, and temporary-directory lifetimes. Apply the consolidated stream-path decision from 12.1.1 in every mode.
    • Prove that direct mode retains argv-boundary protection while both Boolean and named shell modes continue to treat invoke as shell source. Bindings, command overlays, and source placement must not replace the resolved shell.
    • See RFC 0011 §§5-11, RFC 0009 §19, and RFC 0010 §17.
    • Success: the supported-host matrix passes in CI, every invalid case fails before execution with its typed diagnostic class, and existing true and false compatibility snapshots remain unchanged.
  • 11.3.3. Publish configuration, architecture, and security guidance.
    • Requires 11.3.1 and 11.3.2.
    • Document shell definitions and selection near the users' guide's legacy recipe and safety-boundary sections, warning that named shells do not gain direct-mode injection guarantees.
    • Document the registry, CliConfig authority, environment port, resolver, typed diagnostic boundary, and selection-to-IR conversion near the developers' guide's command-lowering architecture.
    • Update the security audit with the interpreter allow-list as partial hardening, but keep the unrestricted MiniJinja shell() and grep() command-capability finding open until its separate remediation lands.
    • Success: user, operator, developer, sample-configuration, and security guidance agree with ADR-0019 and make the Netsukefile-versus-CliConfig authority boundary explicit.

12. Argv-safe commands in ordinary builds

Hypothesis: an author can replace a shell-string recipe with a structured command, preserve argument boundaries through Ninja, and keep existing legacy recipes unchanged without learning a second quoting language.

This phase begins the implementation of RFC 0001.

Its amendments include

Phases 12 to 14 cover the structured-command portion of issue #593; the composition roadmap owns includes and bundles. Phase 11 retains ownership of named-shell selection, with core integration at 11.3.1 and the complete runtime matrix at 11.3.2. Task 17.4.4 joins the execution and composition tracks without making either local foundation wait for the other's implementation.

The RFCs remain proposed until their acceptance work completes. Task 12.1.1 settled their conflicting text; implementation follows ADR-0043 rather than the superseded paragraphs of any single amendment. Intermediate slices must reject unsupported forms rather than ignore fields or fall back to legacy execution. Task 14.3.3 gates publication of the complete amended schema. Every delivery task includes unit and behavioural coverage, with properties and bounded proofs at pure boundaries and cross-feature suites at integration boundaries.

12.1. Fix command structure before evaluating template values

This step asks whether one closed command grammar can preserve source identity and argv boundaries through typed interpolation. Its outcome fixes the compiler contract before any new command can execute.

  • 12.1.1. Consolidate and ratify the amended execution contract. Ratified by ADR-0043; see that record for the decision and its rationale.
    • Reconcile RFC 0001 §§9 and 12.1, RFC 0009 §§5 and 11, and RFC 0011 §6.2 on absolute cwd, capability confinement, and workspace-relative versus cwd-relative stream paths. Include ADR-0019 in the decision, updating any affected accepted architecture through its documented decision process, and align every RFC example before implementation.
    • Distinguish ephemeral capture_stdout from stdout: { env: NAME }, and per-stage temp_dir variable overrides from cwd: { tempdir: {} } directory selection. Record whether both spellings remain and how their combinations validate, without losing either amendment's requirements.
    • Record acceptance, the next available manifest minor version, action-plan versioning, and bounded termination and stale-plan cleanup policies. Keep the trust boundary from ADR-0019 and defer the extensions in phase 15. Coordinate schema allocation with 16.1.1 and 17.1.1 without requiring their implementations to complete first.
    • See RFC 0001 §§19 and 23, RFC 0009 §§5 and 11, RFC 0010 §§7 and 10, and RFC 0011 §6.2.
    • Success: one accepted contract and consistent examples define every disputed case, including temporary-directory precedence and lifetime; direct, default-shell, and named-shell implementations share one path contract rather than selecting contradictory paragraphs.
    • Outcome: relative stream paths resolve against the block's resolved cwd, and RFC 0009 §11's contrary summary of RFC 0001 §12.1 is corrected as a drafting error rather than a competing design. An absolute cwd is rejected in the initial surface, resolving RFC 0001 §9 against RFC 0009 §5 in favour of confinement. Both capture spellings remain and are mutually exclusive per stage: capture_stdout is an ephemeral raw-byte sink, and stdout: { env: NAME } commits a sequence-local UTF-8 binding. Both temporary-directory spellings remain and may combine: the tempdir cwd form sets the working directory, and temp_dir binds TMPDIR, TMP, and TEMP to a separate per-stage directory. Manifest minor version 1.1.0 is reserved for the shared mapping schema, persisted plans are versioned independently by the variants they contain, and bounded termination and bounded stale-plan cleanup are now defined in RFC 0001 §13.3 and §17.4.
  • 12.1.2. Add the closed structured-command AST and schema version gate.
    • Requires 12.1.1 and 11.2.1.
    • Extend the reader gate in ADR-0075 by admitting ADR-0043's 1.1, implementing rejection rungs 2 and 2b, and reserving the D-8 command discriminators in the closed AST.
    • Follow up the help-targets graph export with structured-command recipe variants after the AST and schema version gate are defined.
    • Preserve scalar commands and all-string lists; accept an invoke mapping or a non-empty heterogeneous list containing strings, structured blocks, single-key rule references, and single-key script items. Retain source spans and command-list identity through expansion and deserialization.
    • Validate unknown and duplicate keys, mutually exclusive recipe forms, required values, Boolean-or-name shell intent, and amendment field types; reject unsupported syntax before Ninja or a user command starts.
    • See RFC 0001 §§6, 15, and 17.1.
    • Success: positive and negative schema fixtures cover every recipe shape, singular-versus-list restrictions, minimum versions, and actionable source-local errors while existing manifest fixtures retain their meaning.
  • 12.1.3. Compile argv templates without rendering their expressions.
    • Requires 12.1.2.
    • Use MiniJinja-aware expression boundaries and typed expression nodes; tokenize only literal command structure into words and fragments. Preserve empty quoted words, expression evaluation inside either quote style, Unicode, Windows backslashes, and the specified double-quote escapes.
    • Reject malformed expressions, unmatched quotes, whitespace-only commands, unquoted shell operators, and standalone direct-mode $in or $out with corrective diagnostics; do not add shell expansion or comment syntax.
    • See RFC 0001 §7.
    • Success: grammar fixtures and bounded generated templates cover all quote, escape, delimiter, and expression-boundary cases without sentinel leakage or reparsing rendered values as command structure.
  • 12.1.4. Render typed argv values and splice ordered argument lists.
    • Requires 12.1.3.
    • Implement deterministic scalar conversion and sole-unquoted-expression sequence splicing, including empty sequences and typed ins and outs. Reject nested sequences, quoted or composite sequence positions, unsupported values, NUL, and an absent or empty final program.
    • Preserve literal fragments and scalar values exactly; keep legacy and shell-mode interpolation on their existing, separate rendering path.
    • See RFC 0001 §§8 and 21.
    • Success: property tests show hostile scalar text never changes argument count, valid splices preserve element order and identity, and malformed values fail before execution; retain every generated regression.

12.2. Execute isolated commands without losing legacy sequence semantics

This step asks whether structured processes, legacy shell groups, scripts, and referenced rules can share a fail-fast runner without sharing unintended process state. It supplies the execution boundary needed by Ninja and streams.

  • 12.2.1. Normalize recipes into typed, source-preserving execution units.
    • Requires 12.1.4.
    • Add direct, shell, script, legacy-group, pipeline, and rule-sequence IR distinctions without backend escaping. Group contiguous legacy strings in one fail-fast shell, preserve their internal state, and retain boundaries between source lists when expanding rule references.
    • Detect unknown rules and reference cycles before execution, preserve both reference-site and definition-site provenance, and stop later units after failure without flattening away future binding scopes.
    • See RFC 0001 §§6.3, 14, 15, and 17.3.
    • Success: normalization snapshots and bounded properties preserve lexical order, legacy state sharing, boundary isolation, and deterministic cycle diagnostics for nested rules and mixed command lists.
  • 12.2.2. Spawn direct commands with isolated exact environment overlays.
    • Requires 12.2.1.
    • Pass program and arguments separately through a narrow process adapter; render and validate exact string overlays, including duplicate rendered names and Windows case collisions. Use injected environment access and never modify the parent environment or manifest-time env() view.
    • Resolve bare executables using the effective child PATH; reject resolved cmd.exe, .bat, and .cmd targets in Windows direct mode with an explicit-shell remedy. Reuse one helper executable that reports argv, environment, working directory, bytes, and requested exit status in tests.
    • See RFC 0001 §§9, 11, and 21.
    • Success: observed child arguments and overlays match the plan on supported hosts, including spaces, empty arguments, metacharacters, and Unicode; subsequent units and the parent retain their original environment.
  • 12.2.3. Apply capability-scoped literal working directories at spawn.
    • Requires 12.1.1 and 12.2.2.
    • Follow up the help-targets graph export with literal per-command cwd fields after this milestone defines their manifest and execution contract.
    • Implement the consolidated RFC 0009 contract: normalize literal cwd against the effective workspace after -C, reject text escapes, and revalidate directory existence and type immediately before spawning.
    • Resolve separator-containing relative executable paths from that directory to capability-checked absolute paths before configuring the child; preserve arguments, stream-path bases, and independent per-unit placement. Do not mutate the parent directory or treat source-file placement as directory authority; composed-recipe integration belongs to 17.4.4.
    • See RFC 0009 §§5-15 and 19.
    • Success: direct-process tests and bounded path properties cover missing, non-directory, permission, lexical and symlink escape, spaces, Unicode, Windows path forms, and source-fragment-independent resolution.
  • 12.2.4. Run explicit default shells through the same process boundary.
    • Requires 12.2.3 and 11.2.3.
    • Render shell invoke as one source argument after the resolved fixed prefix; carry the complete shell value in the IR without another lookup. Apply environment and working directory through process APIs, not shell prefixes, and keep shebang scripts and legacy shell groups distinct.
    • Preserve direct mode for absent or false shell; leave named-selector integration to 11.3.1 rather than introducing another registry.
    • See RFC 0001 §§10 and 17.3 and ADR-0019.
    • Success: Unix-like and Windows tests observe the specified default-shell invocation, directory isolation, and fail-fast behaviour, without claiming direct-mode injection protection for rendered shell source.

12.3. Carry structured commands through build and generate workflows

This step asks whether Ninja can invoke structured recipes without putting user arguments into a second shell command line. It also establishes whether saved Ninja manifests remain usable after the generating process exits.

  • 12.3.1. Add the versioned action-plan codec and hidden action runner.
    • Requires 12.2.4.
    • Serialize fully rendered typed units, limits, selectors, and provenance; validate version, unknown variants, structure, and opaque action identity before execution. Keep process and filesystem adapters outside the codec.
    • Add bounded typed failures with action, item, stage, and source context; render human and JSON diagnostics through the established boundary with environment values, sensitive arguments, and private paths redacted.
    • See RFC 0001 §§16, 17.3, and 17.4.
    • Success: codec round-trips and hostile-plan fixtures either preserve the exact execution value or fail closed before spawning; diagnostics never dump the plan or use arbitrary arguments and paths as metric labels.
  • 12.3.2. Lower structured builds to private leased action plans.
    • Requires 12.3.1.
    • Route an entire recipe containing structured, rule-reference, or script items through the runner; retain the pure-legacy fast path. Emit only the Netsuke executable, private plan location, and opaque action identifier in Ninja commands, with backend escaping confined to the adapter.
    • Fingerprint fully rendered execution plans deterministically. Keep build sidecars outside the workspace, owner-private, and leased until Ninja and owned runner descendants finish; implement bounded stale-plan cleanup.
    • See RFC 0001 §§17.4 and 20.
    • Success: end-to-end builds preserve argv through Ninja, equivalent plans have stable fingerprints, changed execution data invalidates the action, and success, failure, and interruption release only owned sidecars.
  • 12.3.3. Publish persistent plans with generated Ninja manifests.
    • Requires 12.3.2.
    • Give generate --output persistent private sidecars, an exclusive output lease, and a versioned manifest-local index. Publish a complete new set atomically while leaving the previous valid generation intact on failure.
    • Confine action identifiers to their sidecar set and bound replacement, deletion, and stale-state cleanup; do not reuse ephemeral build leases.
    • See RFC 0001 §17.4.
    • Success: saved manifests execute after the generator exits; interrupted publication, concurrent generation, unknown schemas, and escaping action identifiers cannot expose partial plans or remove another generation.
  • 12.3.4. Validate and document the first structured-build slice.
    • Requires 12.3.2, 12.3.3, and 11.3.1.
    • Add an end-to-end compatibility matrix for scalar commands, all-string lists, mixed lists, nested rules, scripts, direct argv, Boolean and named shells, overlays, literal cwd, and build-versus-generate execution.
    • Document the working slice in the users' and developers' guides, replace the planned exec.program/exec.args sketch, and explain argv safety versus callee-language interpretation and the explicit shell escape hatch.
    • See RFC 0001 §§18-21.
    • Success: the matrix passes on supported hosts, legacy snapshots remain unchanged except intentional version metadata, and every documented example executes through the same public workflow it describes.

13. Shell-free streams and fail-fast process composition

Hypothesis: explicit stream sinks and pipeline edges can replace redirection and pipe syntax while preserving arbitrary bytes, detecting file aliasing before truncation, and leaving no owned process or relay behind on failure.

This phase extends the usable runner from phase 12 rather than creating a parallel shell-based backend. It implements RFC 0001's stream and pipeline contract, including the standard-error selection refined by RFC 0010. Path bases follow the consolidated decision in 12.1.1, not whichever original RFC paragraph an implementation happens to encounter first.

13.1. Bind streams without corrupting aliased or replaced files

This step asks whether redirection can reject conflicting destinations and filesystem races before destructive operations. Its result supplies safe file handles to individual commands, tee relays, and complete pipelines.

  • 13.1.1. Validate typed stream selections before execution.
    • Requires 12.1.2 and 12.3.1.
    • Lower input, output, error, tee, ephemeral capture, and selected pipe variants into mutually exclusive bindings. Validate rendered scalar paths, NUL, capture bounds, competing sinks, and predecessor-input conflicts.
    • Keep stream paths out of inferred graph dependencies and outputs; apply the agreed path base independently of source-file or bundle placement.
    • See RFC 0001 §§12, 15, and 17.
    • Success: schema fixtures and bounded exclusivity properties reject every conflicting sink combination before opening a file or starting Ninja.
  • 13.1.2. Open provisional stream handles without truncation.
    • Requires 13.1.1 and 12.2.3.
    • At each execution-unit start, record identities or explicit absence for every configured destination, including all stages of one pipeline. Open inputs read-only and existing outputs without following replacements or truncating; create absent outputs atomically and exclusively.
    • Reject EEXIST after recorded absence rather than reopening the path, do not create missing parent directories, and close provisional handles on failure through a narrow capability-scoped filesystem adapter.
    • See RFC 0001 §12.1.
    • Success: deterministic barrier tests cover disappearance, replacement, and absent-to-created races, proving that competing files retain their bytes and no rejected path receives a truncating or fallback open.
  • 13.1.3. Bind streams only after complete handle-identity validation.
    • Requires 13.1.2.
    • Compare each fresh path identity with its retained handle and initial state, then compare every pair of handles, including inputs and outputs across pipeline stages. Reject aliases formed by alternate relative-path, symbolic-link, and hard-link spellings wherever platform identity information supports detection. Allow relative paths resolved against the agreed path base.
    • Truncate and bind only the validated handles after all checks pass; never reopen by path. Start a fresh validation set for each sequential unit so a later unit can consume an earlier unit's output.
    • See RFC 0001 §§12.1 and 12.4.
    • Success: a valid relative-path fixture resolves against the agreed base, while alias and replacement fixtures fail before truncation or spawn; sequential output reuse succeeds, and tests assert the complete open, identity-check, truncate, bind, and close ordering.
  • 13.1.4. Add byte-preserving tee relays with owned failure handling.
    • Requires 13.1.3 and 12.3.2.
    • Drain standard output continuously into the validated file and inherited output, preserving arbitrary bytes. Make read, file-write, and inherited- output failures fail the unit even when the child exits successfully.
    • Own relay handles and join completion with child completion; do not detach relays or retain unbounded buffers while a destination applies pressure.
    • See RFC 0001 §§12.3, 12.5, and 13.2.
    • Success: binary and high-volume fixtures reproduce both destinations byte-for-byte, and injected read or write failure stops execution and leaves no relay or child running.
  • 13.1.5. Add bounded ephemeral standard-output capture.
    • Requires 13.1.1 and 13.1.4.
    • Implement capture_stdout as a raw-byte sink with the agreed non-negative bound, including zero. Count before retention, terminate and reap on overflow, and discard the result at unit completion without publishing a runtime binding or silently truncating successful output.
    • Keep capture diagnostics bounded and redacted; reserve the distinct named UTF-8 capture contract for 14.1.2.
    • See RFC 0001 §§12.3, 16, and 21.
    • Success: zero, exact-limit, and one-byte-over cases have the specified result and bounded memory, including binary output and child failure.

13.2. Run pipelines with explicit byte flow and complete ownership

This step asks whether concurrent stages can preserve stream topology without deadlock or ambiguous success. Its outcome defines the lifecycle that runtime captures and temporary-directory preparation will extend.

  • 13.2.1. Form maximal pipelines without crossing source boundaries.
    • Requires 12.2.1 and 13.1.1.
    • Normalize false, true, stdout, and stderr into typed stream selections; connect only immediately adjacent structured blocks in the same source list. Reject terminal pipes, competing input sources, and pipes into or out of legacy groups, scripts, or rule-reference boundaries.
    • Preserve independent directories and unselected streams for every stage, including stdout tee or capture alongside a stderr pipe.
    • See RFC 0001 §13.1 and RFC 0010 §8.
    • Success: generated topology cases and bounded Kani checks over the pure normalization kernel preserve stage order and prove one selected stream per edge and at most one predecessor per input.
  • 13.2.2. Start all pipeline stages and drains before waiting.
    • Requires 13.2.1, 13.1.3, 13.1.4, and 13.1.5.
    • Prepare operating-system pipes and every unit-wide stream destination, then start each stage and required drain before waiting for completion. Transfer only assigned endpoints and promptly close unused parent and duplicated handles so downstream readers can observe end-of-file.
    • Transfer raw bytes for either selected stream; do not decode, prefix, normalize, merge, or implicitly duplicate standard error.
    • See RFC 0001 §13.2 and RFC 0010 §§8.1 and 8.3.
    • Success: three-stage pipelines exceed pipe-buffer capacity without hanging on supported hosts, preserve binary bytes, and observe timely end-of-file.
  • 13.2.3. Supervise pipeline status, cancellation, and partial startup.
    • Requires 13.2.2.
    • Require every stage and relay to succeed, report failed stage statuses in lexical order, and stop subsequent sequence units after pipeline failure.
    • On spawn, directory, pipe, relay, tee, cancellation, or timeout failure, close endpoints, apply the agreed bounded process-group or job-object termination policy, reap started children, and join every owned relay. Preserve the primary error and any secondary cleanup failures.
    • See RFC 0001 §§13.2-14 and 21.
    • Success: injected first, middle, and final stage failures, failed later spawns, broken pipes, and interruptions produce deterministic diagnostics without orphaned children, detached relays, or an unbounded wait.

13.3. Validate stream composition through real manifests

This step asks whether the filesystem and process guarantees survive their interaction through Ninja rather than only isolated adapters. Its evidence sets the baseline for adding action-local state in phase 14.

  • 13.3.1. Add the cross-platform stream and failure interaction suite.
    • Requires 12.3.3, 13.1.5, and 13.2.3.
    • Cross direct and Boolean-shell stages with independent cwd, both pipe streams, file input, final sinks, tee, capture, and mixed-list boundaries; include binary data, large output, sequential reuse, and cross-stage aliases.
    • Exercise deterministic replacement and exclusive-create races together with partial startup, failed relays, cancellation, and saved-plan execution using helper processes and synchronization barriers rather than sleeps.
    • See RFC 0001 §21, RFC 0009 §19, and RFC 0010 §17.
    • Success: the supported-host matrix preserves bytes and existing files, reports the correct item and stage, and demonstrates zero surviving owned children, relays, or leased build sidecars after every completion path.
  • 13.3.2. Document shell-free stream workflows and inspectable plans.
    • Requires 13.3.1.
    • Add executed examples for file redirection, byte-preserving tee, stdout and stderr pipelines, independent directories, and explicit graph inputs and outputs. Explain strict pipeline failure and why stderr piping is not a replacement for merged 2>&1 semantics.
    • Expose bounded, redacted execution-unit and stream-topology inspection without leaking private plan paths or coupling consumers to internal IR; keep phase 10's result.actions implementation owned by 10.1.2.
    • See RFC 0001 §§16, 19-21.
    • Success: examples run through Ninja, inspection snapshots explain each unit's topology, and the guides agree with the tested path and exit policy.

14. Action-local discovery and private execution workspaces

Hypothesis: bounded runtime bindings and runner-owned directories can replace shell command substitution and temporary-directory scripts without making manifest compilation stateful or allowing captured text to grant filesystem authority.

This phase completes the runtime facilities in RFC 0010, using the consolidated capture and temporary-directory distinctions from 12.1.1. Runtime bindings stay within one action-runner sequence; they do not become graph outputs, cache keys, or manifest-time Jinja variables.

14.1. Pass validated discovery results to later execution units

This step asks whether action-local values can flow in lexical order without mutating global state or exposing uncommitted pipeline output. It establishes the text-versus-capability distinction used by directory consumers.

  • 14.1.1. Add typed sequence-local bindings and producer validation.
    • Requires 12.3.1 and 13.2.3.
    • Extend AST and plan variants with bounded named captures and directory selectors; reserve literal portable producer names, reject duplicates under host case rules, and keep text and directory capabilities distinct.
    • Construct child environments as inherited base, committed bindings, then explicit overlay. Pass bindings to later scripts and legacy groups, but not across rule-reference or independent action boundaries; reject a stage consuming another stage's uncommitted execution-produced binding.
    • See RFC 0010 §§5, 6, 12, and 13.
    • Success: scope and precedence properties cover producer collisions, shadowing, rule boundaries, and fresh concurrent action contexts without parent-environment mutation or runtime values entering persisted plans.
  • 14.1.2. Capture bounded UTF-8 stdout and commit only successful results.
    • Requires 14.1.1 and 13.1.5.
    • Add stdout: { env, chomp, max_bytes } with the 65,536-byte default and positive limits up to the portable 16 MiB maximum. Count raw bytes before strict UTF-8 decoding and NUL rejection; remove at most one final CRLF or LF when chomp is enabled, preserving other whitespace and empty results.
    • Commit only after complete unit or pipeline success; on overflow, invalid text, cancellation, execution failure, or cleanup failure before commit, terminate and reap as needed and publish nothing. Allow capture with no pipe or a stderr pipe, never a stdout pipe.
    • See RFC 0010 §§5.4 and 7.
    • Success: limit-edge, UTF-8, NUL, newline, and pipeline-failure fixtures observe exact values only after success, and human and JSON diagnostics never expose captured contents by default.
  • 14.1.3. Resolve environment-selected directories without forging authority.
    • Requires 14.1.1, 14.1.2, and 12.2.3.
    • Resolve cwd: { env: NAME } from the effective child environment; require present, non-empty, valid UTF-8, NUL-free text and apply workspace confinement to inherited, explicit-overlay, and captured text alike.
    • Retain authority only for a runner-owned directory binding. An overlay shadow resolves as ordinary text even when its spelling matches the directory path; an absolute captured path never manufactures a capability.
    • See RFC 0010 §9.
    • Success: all text sources reject absolute and symlink escapes before spawn, injected directory capabilities retain their identity, and overlay shadowing removes that authority without changing the stored binding.

14.2. Own temporary-directory authority and lifetime explicitly

This step asks whether scratch directories can remain private from creation through cleanup while supporting both isolated stages and cooperating units. Its outcome determines whether temporary execution is safe to expose at all.

  • 14.2.1. Implement owner-private temporary-directory leases.
    • Requires 12.1.1, 12.2.3, and 13.2.3.
    • Freeze the trusted temporary-root capability at the composition boundary; atomically create unpredictable, non-reused directories with Unix owner- only permissions or a restricted Windows access-control list before child access. Reject unexpected symlinks and non-directory objects.
    • Remove through retained capabilities without following symlinks, after owned processes and relays finish, with the root removed last. Cleanup failure fails otherwise successful execution or attaches a secondary cause to an existing failure; never silently retain sensitive temporary data.
    • See RFC 0001 §11.3 and RFC 0010 §10.
    • Success: permission and fault-injection tests cover every creation and removal boundary, prove privacy before spawn, and reject attempts to redirect the root through command overlays or captured values.
  • 14.2.2. Integrate stage-local and sequence-local temporary execution.
    • Requires 14.2.1 and 14.1.3.
    • Implement the consolidated per-stage temp_dir mode and its TMPDIR/TMP/TEMP precedence separately from unnamed unit-scoped and named sequence-scoped cwd: { tempdir: ... } directories. The latter selects cwd without implicitly rewriting conventional environment keys.
    • Publish named directory capabilities for current and later children, preserve their sequence lifetime, and exclude generated paths and captured values from serialized plans, graph fingerprints, and telemetry labels.
    • See RFC 0001 §11.3 and RFC 0010 §§6.4, 10, and 12.
    • Success: end-to-end sequences distinguish both temporary modes, reuse only named directory capabilities, and clean the correct lifetime after success, failure, interruption, timeout, or spawn error.
  • 14.2.3. Prepare pipeline directory capabilities before any stage starts.
    • Requires 14.2.2 and 13.2.3.
    • Reserve every directory producer, create and validate all required directories, and atomically publish the pending capability map only after complete preparation. Let concurrent stages consume prepared directory bindings while keeping execution-produced text captures uncommitted.
    • On preparation failure, publish nothing, start no stage, and clean all prepared directories. Preserve bounded teardown after later execution failures and diagnose incompatible detached descendants explicitly.
    • See RFC 0010 §§5.4, 10.3, 10.5, and 10.6.
    • Success: barrier-controlled concurrent-stage cases and preparation-failure injection prove all-or-nothing visibility, zero premature spawns, complete cleanup, and retained primary and secondary failure categories.

14.3. Prove the amended contract in downstream-style builds

This step asks whether the complete structured surface removes real shell wrappers without weakening compatibility or hiding runtime state. Its evidence gates the manifest-version promise rather than merely a parser milestone.

  • 14.3.1. Add the full execution-context interaction matrix.
    • Requires 13.3.1, 14.1.2, 14.2.3, and 11.3.2.
    • Exercise capture-to-cwd, explicit overlay shadowing, named temporary workspace sharing, stdout capture beside stderr piping, independent stage directories, and direct, Boolean-shell, and named-shell execution through ordinary builds and persistent generated plans.
    • Cross these with first, middle, and final failures, invalid capture text, limit overflow, failed capability preparation, cancellation, timeout, cleanup errors, and concurrent independent actions. Verify source-aware redacted human and JSON diagnostics and no runtime-state persistence.
    • See RFC 0001 §21 and RFC 0010 §17.
    • Success: the supported-host matrix demonstrates no cross-action binding leaks, forged directory authority, orphaned owned processes, or silent cleanup failures, with deterministic replay of each injected failure.
  • 14.3.2. Publish migration examples and record structured-command canaries.
    • Requires 12.3.4, 13.3.2, 14.3.1, and 11.3.3.
    • Execute the RFC coverage example and migrations for literal cd, bounded discovery capture, stderr normalization, and shared private fixtures; preserve legacy groups whenever shell state must persist.
    • Exercise the structured-command portion of at least two downstream migration canaries tracked by issue #598, without making include or bundle implementation a prerequisite. Task 17.4.4 later joins the tracks. Update user, design, developer, repository-layout, and security guidance with the tested scope.
    • See RFC 0001 §§18-21 and RFC 0010 §§11 and 16.
    • Success: canary evidence records equivalent successful outputs and intended failure behaviour, and documentation states capability limits, byte/text distinctions, cleanup guarantees, and the absence of child sandboxing.
  • 14.3.3. Enable the complete amended manifest contract.
    • Requires 14.3.1 and 14.3.2.
    • Finalize the minor-version gate selected in 12.1.1. Named shells share the first structured-command minor, so confirm at release time that both structured-commands and named-shells are admitted before any tag carries minor 1.1; a tag that would freeze either feature out of the shared reservation waits instead. Reject unsupported persisted schemas rather than ignoring fields, and keep legacy manifests supported without automatic semantic migration.
    • Run the repository's formatting, lint, documentation, unit, behavioural, property, and bounded proof gates on the supported target matrix; retain compatibility, deterministic plan, and cleanup evidence with the change.
    • See RFC 0001 §§19-21 and RFC 0011.
    • Success: every in-scope RFC requirement maps to a passing acceptance case, the released version advertises no incomplete variant, and generated manifests remain reproducible and runnable with the matching runner.

15. Evidence-led extensions after structured-command adoption

Hypothesis: once the amended structured-command contract works in real builds, remaining shell escape hatches can identify worthwhile extensions without expanding the initial grammar or authority boundary speculatively.

These are deferred decisions, not prerequisites for 14.3.3 or promises to implement every alternative. A decision may retain explicit shell mode or reject an extension. RFC 0001's non-goals remain out of the initial release.

15.1. Evaluate additional argument and environment surfaces

This step asks which remaining authoring problems need new schema rather than better examples. Its outcomes either authorize focused follow-on RFCs or keep the existing surface deliberately small.

  • 15.1.1. Decide whether enclosing and object-valued environments are needed.
    • Requires 14.3.3.
    • Use canary evidence to scope rule, target, action, and command precedence, plus default, prepend, append, and unset, before authorizing the previously planned implementation in 3.14.9. Keep exact per-block overlays independent of this decision.
    • See RFC 0001 §§11.1, 11.4, and 23.
    • Success: a follow-on RFC defines ordered merges and portable path-list operations, or a recorded rejection leaves 3.14.9 deferred.
  • 15.1.2. Decide whether an explicit argv escape hatch earns its complexity.
    • Requires 14.3.3.
    • Compare real unresolved authoring cases with the existing argv-template grammar; do not revive exec.program/exec.args or add args by default.
    • See RFC 0001 §§22 and 23.
    • Success: a documented decision names a consumer and compatibility contract for any proposed new form, or explicitly retains the current grammar.

15.2. Gate broader stream and process authority behind separate designs

This step asks whether additional process composition justifies a wider safety contract. Its outcomes must preserve the shipped argv, lifecycle, and capability guarantees before any new execution path can land.

  • 15.2.1. Triage advanced stream and execution capabilities from canaries.
    • Requires 14.3.3.
    • Keep append mode, stderr teeing, merged streams, rule-boundary pipelines, trusted Windows batch opt-ins, external text-selected directories, cross-action runtime outputs, and temporary retention outside the initial contract; select only evidenced candidates for independent RFCs.
    • See RFC 0001 §§4 and 23, RFC 0009 §20, and RFC 0010 §§3.2 and 10.
    • Success: every candidate has an explicit defer, reject, or separately specified disposition, with no relaxation hidden inside an implementation task for phases 12 to 14.

Phases 16 to 19 continue in the composition roadmap, and phases 26 to 29 continue in the architecture roadmap.

30. Opt-in host facts without hidden discovery

Hypothesis: manifests can replace uname probes and environment conventions with one immutable, opt-in host snapshot without weakening non-disclosing target discovery, cross-compilation correctness, or Ninja work invalidation.

This phase implements RFC 0029. The platform-only slice in step 30.2 is independently useful; distribution and kernel observations in step 30.3 need explicit selection and an operator grant. The phase depends on neither external bundles, remote execution, a resource scheduler, nor the complete RFC 0006 filter programme, and it adds no v0.1.0 release gate. Phase 30 sits above phases 20 to 25 in the progressive-enhancement roadmap and phases 26 to 29 in the architecture roadmap.

30.1. Settle the host-facts contract before collecting anything

This step asks whether field meanings, opt-in, authority, and privacy can be fixed before implementation choices harden them. Its outcome gates every later task in this phase.

  • 30.1.1. Accept RFC 0029 and record its public-surface decisions.
    • Settle host.arch against the longer process_arch, the inspection command and query-consent spellings, the platform naming catalogue for less common targets, and the safe native adapter dependencies.
    • Record the substantive decision in an ADR referenced from the design document, and allocate the additive manifest-format version without coupling it to the schedules of 12.1.1 or 16.1.1.
    • See RFC 0029 §§4, 5, 13.1, and 14.
    • Success: the RFC is accepted with no open review decision, and the ADR names the schema version, field spellings, and adapter choices.
  • 30.1.2. Define the owned snapshot, request, grant, and diagnostic types.
    • Requires 30.1.1.
    • Add HostFactsSnapshot, validated requests, operator grants, group outcomes, and the stable diagnostic categories with localized messages.
    • Add the HostFactsProvider seam with disjoint field ownership, treating a duplicate contribution as an internal contract error, and a FixedHostFactsProvider with no fallback to real host APIs.
    • See RFC 0029 §§6.4, 11, and 12.
    • Success: property tests over bounded requests and grants prove strict request-and-grant intersection and preserve null versus empty values.

30.2. Ship the platform-only slice end to end

This step asks whether an opted-in manifest can branch on the planner process platform with no filesystem, environment, subprocess, or network access while existing manifests keep their meaning. Its outcome decides whether optional groups are worth adding at all.

  • 30.2.1. Parse the host_facts opt-in and enforce the authority ceiling.
    • Requires 30.1.2.
    • Accept only literal schema and gather, defaulting to [platform]; reject unknown keys, versions, and groups, duplicates, wildcards, Jinja, and a selection omitting platform. Older formats reject the field.
    • Resolve host_fact_policy.allowed_groups through the shared OrthoConfig metadata path with provenance; denials outrank project requests, and no environment variable overrides fact values.
    • See RFC 0029 §§5.1 and 5.2.
    • Success: denied and invalid requests fail before any provider call, and the unchanged quickstart and an existing vars.host manifest render byte-for-byte as before without opt-in.
  • 30.2.2. Collect platform facts once and inject an immutable host.
    • Requires 30.2.1.
    • Implement the platform provider from std::env::consts and target configuration; fail with unsupported_host_platform rather than guessing. Freeze one snapshot at the application boundary and share it with every render environment through StdlibConfig or the evaluation context.
    • Reject host shadowing at every binding site and any item or attribute mutation. Report host_fact_not_collected and unknown_host_fact, including inside default expressions.
    • See RFC 0029 §§5.3, 6.1, 6.4, 7.1, 7.2, and 11.
    • Success: fixed Linux, macOS, Windows, and other-platform snapshots render identical results on every runner, and a counting provider observes one collection per invocation however many fields templates read.
  • 30.2.3. Bind the facts digest into plan identity and Ninja invalidation.
    • Requires 30.2.2.
    • Compute the versioned digest over schema, selected groups, normalized values, and semantic outcomes, fingerprinting every selected group and excluding timing, paths, localization, and diagnostic text.
    • Carry the digest in generated-plan identity and per-edge command signatures, check reused-plan context with host_plan_context_mismatch, and document the native Ninja bypass of that check.
    • See RFC 0029 §§9.1-9.3.
    • Success: property tests show digests are deterministic across insertion order and change for altered semantic facts, and real Ninja runs prove no-op reuse, rebuilds, removal of deselected edges, and reused-plan rejection.
  • 30.2.4. Keep target discovery non-disclosing and add explicit consent.
    • Requires 30.2.2.
    • Install the unavailable sentinel in register_manifest_query, returning host_facts_disabled_in_query without guessing or hiding targets.
    • Add the per-invocation consent flag settled in 30.1.1; it reuses the planning provider, renders no recipes, and enables no env(), which(), command, or network helper. Project settings cannot enable it.
    • See RFC 0029 §8.1.
    • Success: discovery without consent makes zero provider calls, and with consent recipe-only fact references remain unevaluated.
  • 30.2.5. Add the standalone facts inspection command.
    • Requires 30.2.2.
    • Integrate the command with the canonical command tree, requiring no Netsukefile and reading only trusted operator configuration. --gather selects collection; exact --filter values select output only.
    • Emit the JSON envelope and escaped human output through the existing CLI metadata, localization, and JSON conventions; the schema-description option collects nothing. Update the users' guide.
    • See RFC 0029 §§8.2 and 8.3.
    • Success: snapshot tests fix human and JSON output under fixed providers, keep empty, null, and unsupported values distinct, and show filters never widen collection.

30.3. Add separately authorized distribution and kernel observations

This step asks whether richer observations can be read from untrusted system data within fixed bounds, without blocking, executing text, or fabricating values. Its outcome decides which optional groups each platform supports.

  • 30.3.1. Implement the bounded os-release distribution provider.
    • Requires 30.2.1 and 30.2.3.
    • Open only the two approved paths through a narrow system-file capability, with a non-blocking open and a type check on the opened handle; a non-regular handle, including a FIFO, is a collection error.
    • Parse without a shell within the byte, string, and identifier bounds, applying duplicate-key precedence and never merging the two files. Non-Linux platforms report unsupported.
    • See RFC 0029 §§6.2, 7.1, and 12.
    • Success: the RFC's parser corpus passes, a FIFO at either path fails promptly, and bounded fuzzing from a finite seed corpus finds no panic or unbounded read.
  • 30.3.2. Implement kernel facts through reviewed safe native adapters.
    • Requires 30.1.1 and 30.2.1.
    • Read uname-equivalent fields without executing uname, and use documented Windows APIs rather than parsing ver or PowerShell output. Populate native_arch only when its meaning is established.
    • Preserve forbid(unsafe_code) by selecting a reviewed safe adapter or proposing the dependency change explicitly.
    • See RFC 0029 §§6.3 and 11.
    • Success: translated fixtures report a process architecture distinct from the native one, unknown native architecture stays null, and denied or unselected groups perform zero native or filesystem operations.

30.4. Prove host facts across composition, fixtures, and real platforms

This step asks whether the contract survives contact with includes, bundles, manifest tests, runtime bindings, and native execution. Its evidence decides whether the facts surface is ready to document as supported.

  • 30.4.1. Add typed host fixtures to manifest tests.
    • Requires 30.2.2 and 7.3.1.
    • Register a typed host fixture in the manifest-test mock registry and validate it against the fact schema. Synthetic facts may render and inspect a graph but never authorize execution or widen capabilities.
    • See RFC 0029 §11 and RFC 0007.
    • Success: a fixture selecting an unavailable group fails instead of reading the developer's machine, and no ordinary build flag overrides host values.
  • 30.4.2. Share one snapshot across includes and bundle instances.
    • Requires 30.2.2, 16.2.2, and 17.1.2.
    • Reject collector requests in included files; let bundles declare static requirements for already selected groups without widening the root request or operator grant; keep bundle and host provenance separate.
    • See RFC 0029 §7.3.
    • Success: missing required facts fail before bundle rendering, and nested fragments observe the importing planner's snapshot.
  • 30.4.3. Add the host-facts interaction and native smoke matrix.
    • Requires 30.2.3, 30.2.4, 30.2.5, 30.3.1, and 30.3.2.
    • Cross group selections and grant states with when, variables, recipes, consented and unconsented discovery, and inspection; show child overlays, temporary directories, and captures cannot mutate facts.
    • Run native smoke jobs on Linux, macOS, and Windows, including Git Bash and WSL launches, and model-check the collect-once and query-consent state machine against the production validation functions.
    • See RFC 0029 §§4.2, 7.2, and 13.2.
    • Success: the matrix records fixture rendering separately from native execution, and no case collects twice, collects without consent, or leaks identifying inventory into JSON, diagnostics, or telemetry labels.
  • 30.4.4. Publish migrations and record downstream canaries.
    • Requires 30.4.1 and 30.4.3.
    • Publish Linux, macOS, and Windows migration examples and exercise the Repovec Appliance, MXD, and OrthoConfig canaries without changing their release ownership. Update the users' guide, design document, and developers' guide.
    • See RFC 0029 §§13.1 and 13.3.
    • Success: canary evidence keeps target selection and build budgets as explicit inputs, the quickstart stays byte-for-byte unchanged, and no simulated snapshot counts as a native smoke test.

30.5. Keep deferred host observations out of the initial contract

This step asks which deferred observations earn separate designs once the initial facts surface has shipped. Its outcomes are dispositions, not implementation promises.

  • 30.5.1. Decide whether resource or capability facts need their own RFC.
    • Requires 30.4.4.
    • Keep CPU, memory, load, filesystem features, libc compatibility, and tool presence out of the schema unless canary evidence justifies a group that separates physical resources, effective constraints, and approved budgets.
    • See RFC 0029 §10 and RFC 0024.
    • Success: a follow-on RFC or a recorded rejection exists, and neither -j, Ninja pools, nor contention classes change as a side effect.
  • 30.5.2. Triage persistent reuse, dependency tracking, and remote facts.
    • Requires 30.4.4.
    • Assess persistent snapshot reuse, per-field dependency tracking, static listing of unresolved discovery conditions, and remote execution-context facts against evidence from the shipped slice.
    • See RFC 0029 §§8.1, 9.1, 9.3, and 14.5.
    • Success: each candidate has an explicit defer, reject, or separately specified disposition, with no relaxation hidden in phase 30 tasks.

31. Manifest linting

Hypothesis: the v0.2.0 linter is a prototype whose rule set was chosen from the evidence available before anyone had used it; if that prototype is exercised against real manifests and the findings are fed back into the rules, their severities, and their prose, netsuke check earns a rule set worth freezing, and the contracts it then fixes — identifiers, output schema, and suppression grammar — can be relied on rather than merely published.

Kind: capability, in a deliberately provisional state. Value is measured by findings that changed a manifest, not by the number of rules registered.

Scope: everything behind netsuke check. The manifest linter design is a living document and ADR-056 records the decisions it currently rests on; both are expected to change under this phase, and a task that supersedes either must say so. The v0.2.0 rule identifiers are already treated as permanent, so a rule withdrawn here keeps its name reserved.

Two decisions are explicitly provisional and are settled by steps in this phase: which rules deserve their default severity, and whether rule prose stays in the registry. Nothing else in the linter's contract should be treated as frozen until step 31.4 completes.

31.1. Learn what the prototype actually finds

This step answers whether the shipped rules fire on defects that authors then fix, or on constructs they consider correct. Its outcome decides which rules graduate unchanged, which change default severity, and which are withdrawn, so it gates the freeze in step 31.4. Until it completes, a rule's default severity is a proposal rather than a contract.

  • 31.1.1. Lint a corpus of real manifests and record every finding.
    • Cover Netsuke's own examples, the manifests in downstream repositories, and any manifest supplied through issue reports.
    • Record, per rule, how many findings were acted on, dismissed as correct, or judged unclear.
    • Success: every shipped rule has a recorded outcome from at least one manifest its authors did not write.
  • 31.1.2. Classify each rule's evidence and propose a disposition. Requires 31.1.1.
    • Propose one of: keep, change default severity, narrow the detection, convert to opt-in, or withdraw.
    • A rule whose findings were mostly dismissed is a candidate for opt-in or withdrawal, not for a better message.
    • Success: every rule carries a written disposition citing the evidence behind it.
  • 31.1.3. Apply the dispositions and record them in the design document. Requires 31.1.2.
    • A withdrawn rule keeps its name reserved and its reference section states that it was withdrawn and why.
    • Success: the registry, the rule reference, and the design document agree, and the contract tests still bind them.

31.2. Localize lint output

This step answers how far the linter's text can move into the localization catalogues without letting the emitted text and the rule reference drift apart, which is the risk ADR-056 cited when it deferred the work. It is sequenced after step 31.1 so the prose being translated is prose the rules have earned.

Rule identifiers stay untranslated. A rule name, its category name, its severity name, and its diagnostic code are values a user types into a configuration file or a suppression comment and a machine matches exactly; the translators' guide already covers that class. Only the prose is localized.

  • 31.2.1. Move rule summary, rationale, and remediation into the localization catalogues, keyed by the rule's stable name. Requires 31.1.3.
    • Key each message as lint.rule.<name>.summary, .rationale, and .remediation so the key follows the rule rather than its category.
    • Keep the registry's English text as the fallback, so a catalogue gap degrades to the source locale rather than to an empty diagnostic.
    • Success: netsuke --locale <tag> check reports a finding's message and remediation in that locale, while its rule, category, severity, and code fields are byte-identical across locales.
  • 31.2.2. Localize the framing text --explain prints. Requires 31.2.1.
    • Cover the catalogue's column headings and the single-rule reference layout.
    • Keep the machine-readable --explain --json catalogue in the source locale, so an editor building a rule picker gets stable text.
    • Success: --explain prose is localized and --explain --json is not.
  • 31.2.3. Bind the rule reference to the source catalogue. Requires 31.2.1.
    • Extend the reference contract test to compare against the source-locale messages rather than the registry constants.
    • Success: a rule whose catalogue text changes fails the contract test until its reference section is updated.
  • 31.2.4. Translate the rule messages for every shipped locale. Requires 31.2.1.
    • Follow the localization glossary and style guide.
    • Leave manifest identifiers such as order_only_deps, {{ outs }}, and dependency_order verbatim.
    • Success: the build-script localization audit passes with no catalogue carrying an untranslated copy of a rule message.

31.3. Close the gaps the prototype left open

This step answers whether the analysis can reach the constructs it currently cannot see, and whether its diagnostics can point at them. Each task is independent, so the step can be delivered incrementally, but all of it precedes the freeze in step 31.4.

  • 31.3.1. Give expanded manifest and graph findings exact source spans.
    • Thread provenance through foreach expansion so a generated target's finding points at the declaration that generated it.
    • Success: a manifest whose targets all come from foreach reports no finding without a span.
  • 31.3.2. Add rules for the constructs v0.2.0 structured commands make expressible. Requires the structured command syntax.
    • Give the shell-oriented rules a structured remediation target rather than an ordered command list.
    • Success: bashism, background-job, and command-chain-not-list name the structured form in their remediation.
  • 31.3.3. Extend undeclared-target-input using git-aware change detection. Requires the v0.3.0 change-detection work.
    • Report a recipe that reads a tracked file the graph does not declare, not only one that reads another target's output.
    • Success: a recipe reading an undeclared tracked source is reported, and a recipe reading a generated file already in the dependency closure is not.
  • 31.3.4. Add rules for dependency and provider configuration. Requires the v0.3.0 dependency and provider work.
    • Cover the ambiguous and weakly reproducible provider configurations that the manifest cannot yet express.
    • Success: every provider configuration the design names as ambiguous has a rule, and each cites the design section that defines it.

31.4. Freeze the contracts the linter publishes

This step answers whether the linter's published surfaces are stable enough to promise. It is last because every earlier step can still change them, and its completion is what turns the prototype into a supported feature.

  • 31.4.1. Snapshot the netsuke check JSON documents as v1. Requires 31.1.3 and 31.2.1.
    • Cover the result document, the threshold diagnostic, and the --explain catalogue.
    • Depend on roadmap task 3.15.3, which snapshots every v1 JSON schema.
    • Success: a field added, renamed, or removed in any of the three documents fails a snapshot test.
  • 31.4.2. Give lint failures their own exit class. Requires 31.4.1.
    • Distinguish "findings reached the threshold" from "the manifest could not be analysed", which currently share exit code 1.
    • Depend on roadmap task 3.15.5, which defines the exit-code taxonomy.
    • Success: a CI script can tell a lint failure from a broken manifest without parsing output.
  • 31.4.3. Publish the rule-stability policy. Requires 31.1.3.
    • State what a rule name guarantees, what may change within a name, and what requires a new one.
    • Record it in the users' guide beside the suppression grammar, so an author writing a directive can see the promise it rests on.
    • Success: the policy is published and the rule reference links to it.
  • 31.4.4. Make netsuke check standard by removing the lint feature gate.
    • Delete every #[cfg(feature = "lint")] and #[cfg(not(feature = "lint"))] twin.
    • Make granit-parser a normal dependency and drop the feature.
    • Delete tests/check_command_absent_tests.rs.
    • Collapse the help snapshots back to one set.
    • Retire the default-features CI lane or repoint it at the next gated feature, updating its workflow contracts.
    • Update the users' guide, README, changelog, and ADR-056.
    • Success: a default cargo build ships netsuke check, and release binaries list it in --help.

31.5. Pay down the prototype's structural debt

This step answers whether the linter's internals can carry a growing rule set and a production workload, as distinct from whether the rules themselves are right. Each task is a refactor of code the prototype already ships, so none changes a finding, an identifier, or an output schema; they are separated from steps 31.1 to 31.4 because they are reviewable independently and none blocks the freeze.

  • 31.5.1. Move the miette dependency out of the lint core into an adapter.
    • src/lint currently converts its own Span and Severity into miette types, implements Diagnostic on its finding projection, and owns a NamedSource, so the core cannot be used without the reporting framework.
    • Keep findings, spans, severities, reports, and policy framework-free, and convert them at the runner boundary where the diagnostics are rendered.
    • Success: src/lint names no miette type, and the JSON and human output are byte-identical to their current snapshots.
  • 31.5.2. Add runner-boundary telemetry for netsuke check.
    • The command loads a manifest, builds a graph, indexes the source, and runs every rule without emitting a metric or a span, unlike its sibling commands.
    • Record a bounded invocation counter and a duration histogram labelled by outcome and a finite error category, following the pattern in src/runner/help/telemetry/mod.rs.
    • Keep labels low-cardinality: no rule names, manifest paths, or finding text.
    • Success: a check run emits one counter and one histogram observation, and the label vocabulary is enumerated in a test.
  • 31.5.3. Scan each recipe once when matching graph outputs.
    • undeclared-target-input rebuilds the shell-active mask for every (recipe, output) pair, so its cost grows with targets multiplied by outputs.
    • Extract each recipe's shell-active words once, then intersect them with an indexed output set.
    • Success: the rule reports exactly what it does now on the example manifests, and its cost grows with the manifest's size rather than with its square.

Success criterion: every shipped rule has a recorded disposition drawn from manifests its authors did not write; a finding's prose is localized while its identifiers are not; findings from expanded manifests carry source spans; the lint core names no reporting framework and the command reports its own telemetry; and the JSON documents, exit classes, and rule-name guarantees are snapshotted, published, and stable enough that a downstream consumer can depend on them.