Plan: Add Kani harnesses for command interpolation (4.2.3) - #564
Draft
leynos wants to merge 5 commits into
Draft
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueWarning Your free Security trial is over. An organization admin can activate billing to continue. Comment |
Contributor
Reviewer's GuideExecution-plan-only PR adding a detailed ExecPlan document for Kani harnesses around command interpolation, plus specifying a minimal future production seam and a cfg(kani) helper; no Rust code changes yet but the plan itself is dense with design decisions, verification obligations, and process steps that need conceptual review. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
leynos
force-pushed
the
4-2-3-kani-harnesses-for-command-interpolation
branch
from
August 16, 2026 23:42
8188fef to
81ab29b
Compare
leynos
force-pushed
the
4-2-3-kani-harnesses-for-command-interpolation
branch
from
August 16, 2026 23:53
81ab29b to
945a959
Compare
This was referenced Aug 24, 2026
Add the execution plan for roadmap item 4.2.3, which adds bounded model-checking coverage to `src/ir/cmd_interpolate.rs`. The plan covers all four roadmap sub-items: - `$in` and `$out` rewrite only at valid token boundaries - backtick-delimited regions are preserved - unmatched backticks are rejected - successful results satisfy the current `shlex` guard Key design points: - The production change is a three-line `substitute_chars(&[char], ..)` seam plus a `cfg(kani)` `CommandBindings` constructor. Symbolic UTF-8 across the `&str` boundary is the dominant solver cost. - `RM-4.2.3.a` is discharged by a window-completeness argument rather than a large bound: the sigil decision reads at most six characters of context, so an eight-character window with a symbolic offset covers strings of any length. - `RM-4.2.3.d` is reformulated as a guard-placement biconditional. The literal wording restates the branch condition and cannot fail. - A new contract test validates the mutation-evidence patches, which no gate currently checks. Three decisions require maintainer acceptance before their milestones start; they are marked in the Decision log.
Rebase onto `origin/main` at 7e5c267 ("Add target descriptions and netsuke help targets") shifted line numbers in several documents the plan cites. Refresh references into `docs/roadmap.md`, `docs/developers-guide.md`, `Cargo.toml`, and `src/ir/from_manifest.rs`, and add a note that such numbers drift, so an anchor should be verified by heading or symbol name before the number is trusted. That commit introduces nothing this branch must adopt. Its only change under `src/ir/` is a comment recording that target descriptions are discovery metadata and never take part in recipe resolution, which reinforces the boundary this plan verifies. The assessment is recorded in the Decision log.
Both observations recorded in `Surprises & discoveries` now have tracking issues, so the trail survives beyond this branch. - #585: nothing validates the Kani mutation-evidence patches, and the 4.2.2 adapter harness has none. - #586: ExecPlan status fields are stale and use an inconsistent vocabulary.
All three decisions marked "requires maintainer acceptance" are ratified: the 4.2.3.d reformulation as a guard-placement biconditional, harness-local oracles, and a string-level bound below the roadmap's stated 256/8. The bound decision was accepted in advance, so EP-M0 no longer sets the plan to BLOCKED on a string-level shortfall. It records the achieved bound, the residual gap, and the Proptest hand-off, then continues. The mechanical stop for a sigil-shape shortfall below an 8-character window is unchanged, since that would undermine the plan's premise rather than narrow its reach. Also correct the planning dates from 2026-08-17 to 2026-08-24. The plan stays DRAFT pending approval to begin implementation.
Rebase onto `origin/main` at aa93ef8 brought nine commits, including serial dependency ordering, config-load caching, a Windows CI job, and a large restructuring of the developers' guide. Nothing this plan depends on changed. A semantic diff over `src/ir` reports a new `DependencyOrder` enum and one added `BuildEdge` field; `cmd_interpolate` does not appear. The harness count is still thirteen, the patch count still twelve, and `kani-smoke` keeps its shape, cache key, and 20-minute cap. Convert Markdown citations from line numbers to section headings. Two consecutive rebases have now moved them, and the numbers cannot be kept true. Line numbers are retained only for code, where `src/ir/cmd_interpolate.rs` has been stable throughout. Record two operational notes in Risks: `main` has edited the Makefile, so the Kani cache is cold and the next timing will be pessimistic; and a merge-gating Windows job now runs alongside `kani-smoke`.
leynos
force-pushed
the
4-2-3-kani-harnesses-for-command-interpolation
branch
from
August 24, 2026 16:57
5b45e2e to
c75a2fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the execution plan for roadmap item 4.2.3, which brings bounded formal verification to
src/ir/cmd_interpolate.rs— the command-interpolation stage that substitutes$inand$outinto recipe templates and rejects commands whose shell syntax the substitution has damaged.This pull request contains the plan only. No implementation, and the plan must be approved before implementation starts.
docs/execplans/4-2-3-kani-harnesses-for-command-interpolation.mdWhat the plan delivers
Five Kani harnesses covering all four roadmap sub-items, plus a contract test:
sigil_placeholder_match_is_exactmarker_token_match_is_exactsubstitute_agrees_with_specodd_backticks_are_rejectedguard_applies_to_substituted_commandThe production change is deliberately tiny: a three-line
substitute_chars(&[char], ..)seam plus a#[cfg(kani)]CommandBindingsconstructor. Nothing else.Design points worth a reviewer's attention
The roadmap's literal 4.2.3.d wording is vacuous, and the plan says so.
interpolate_command_with_bindingsreturnsOkonly after testingshlex::split(..).is_some(), so asserting that on theOkbranch restates the branch condition and cannot fail for any implementation. The plan reformulates it as a guard-placement biconditional with a mutation patch that moves the guard onto the template. This deviates from the roadmap wording and needs acceptance.The 256-character bound largely dissolves for 4.2.3.a.
find_substitutionreads at mostchars[pos - 1 ..= pos + 4], so an eight-character window with a symbolic offset is complete for the sigil contract at any string length, not merely bounded. Where a genuine bound remains (the string-level and guard harnesses) the plan measures it in a spike and hands the residual range to Proptest, following the precedent ADR-004 set for 4.2.1.Nothing currently validates the mutation-evidence patches, and there are twelve patches for thirteen harnesses. The plan adds
tests/mutation_evidence_tests.rstomake test. The missing patch belongs to 4.2.2's adapter harness and is raised rather than absorbed here.Two latent behaviours are pinned, not changed.
$$insubstitutes (yielding$<ins>) even though$$is Ninja's escape for a literal dollar, andx__NETSUKE_INS_PLACEHOLDER__is rewritten because marker forms carry no boundary rule. Both may be defects; both are out of scope under the no-behaviour-change constraint. The plan asks for a classification.Decisions requiring maintainer acceptance
odd_backticks_are_rejectedwould comparehas_unmatched_backticksagainst itself and its mutation would flip both sides.Review process
Revision 1 was rewritten after a six-lens design review. The review withdrew a proposed fixed-capacity scanning kernel (it would have introduced a capacity bound into unbounded security-sensitive code), corrected a mutation patch whose sign was backwards, found that the original alphabet made
try_match_tokenstructurally unreachable, and replaced guessed budgets with measured ones. TheRevision noteat the foot of the plan records the full list.Validation
make markdownlintpasses. No code changes, so the Rust gates are unaffected.References
docs/roadmap.md§4.2.3docs/formal-verification-methods-in-netsuke.md§Kani for command interpolationdocs/adr-004-bound-kani-ir-harnesses-to-small-n.md🤖 Generated with Claude Code
Summary by Sourcery
Approve a staged plan for adding bounded formal verification to command interpolation without changing production behaviour.
Enhancements:
Documentation: