Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ are scoped or reviewed.

### Fixed

- Advisory command strings emitted by `ripr` (first-PR packets, agent loop
commands, receipt commands, pilot commands) now encode every argument as a
single-quoted bash token instead of a double-quoted one. Double quotes do not
stop bash from expanding `$VAR`, `$(cmd)`, or `` `cmd` ``, and the previous
encoder additionally left a bare `\` unquoted and emitted the empty string as
nothing at all. A gap id shaped like `gap:pr:1 > file` could therefore open a
second redirect when the command was copied into a shell, truncating a file
the operator never named and changing the id the command received. Values made
only of unambiguous characters are still emitted unquoted, so ordinary
commands are unchanged; the published shape changes only where a value
actually needs quoting (#2347).

- Rust equality-boundary analysis now credits exact, source-ordered direct
field assignments from same-file literal constants and bounded `+/-` integer
offsets. Other owners, fields, similarly named constants, helper-only writes,
Expand Down
300 changes: 289 additions & 11 deletions crates/ripr/src/agent/loop_commands.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/ripr/src/app/agent_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ mod tests {
assert!(report.missing_commands.iter().any(|command| {
command.step == "agent_packet"
&& command.command
== "ripr agent packet --root \"repo root\" --seam-id 67fc764ba37d77bd --json > target/ripr/workflow/agent-packet.json"
== "ripr agent packet --root 'repo root' --seam-id 67fc764ba37d77bd --json > target/ripr/workflow/agent-packet.json"
}));

std::fs::remove_dir_all(&root).map_err(|err| format!("remove root: {err}"))?;
Expand Down Expand Up @@ -795,7 +795,7 @@ mod tests {
fn agent_status_quotes_paths_with_spaces() {
assert_eq!(
agent_packet_command("repo root", "seam-a", WORKFLOW_AGENT_PACKET_ARTIFACT),
"ripr agent packet --root \"repo root\" --seam-id seam-a --json > target/ripr/workflow/agent-packet.json"
"ripr agent packet --root 'repo root' --seam-id seam-a --json > target/ripr/workflow/agent-packet.json"
);
}
}
2 changes: 1 addition & 1 deletion crates/ripr/src/lsp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5744,7 +5744,7 @@ fn agent_loop_command_payloads_stay_workspace_relative_for_platform_roots() -> R
COPY_AFTER_SNAPSHOT_COMMAND,
"after_snapshot",
"target/ripr/pilot/after.repo-exposure.json",
"ripr check --root . --base \"origin/main with space\" --mode ready --format repo-exposure-json > target/ripr/pilot/after.repo-exposure.json"
"ripr check --root . --base 'origin/main with space' --mode ready --format repo-exposure-json > target/ripr/pilot/after.repo-exposure.json"
.to_string(),
),
(
Expand Down
4 changes: 2 additions & 2 deletions crates/ripr/src/output/first_pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,7 @@ mod tests {
);
assert_eq!(
packet["selected"]["next_command"],
"git -C . rev-parse --verify \"missing-head^{commit}\""
"git -C . rev-parse --verify 'missing-head^{commit}'"
);
cleanup(&repo)
}
Expand Down Expand Up @@ -3354,7 +3354,7 @@ mod tests {
"verification_commands": [
"jest tests/discount.test.ts"
],
"receipt_command": "ripr receipt write --gap gap:typescript:typescript_preview:2396aec1 --verify-cmd \"jest tests/discount.test.ts\" --out target/ripr/receipts/gap-typescript-typescript-preview-2396aec1.targeted-test-outcome.json"
"receipt_command": "ripr receipt write --gap gap:typescript:typescript_preview:2396aec1 --verify-cmd 'jest tests/discount.test.ts' --out target/ripr/receipts/gap-typescript-typescript-preview-2396aec1.targeted-test-outcome.json"
}
]
})
Expand Down
9 changes: 8 additions & 1 deletion crates/ripr/src/output/perl_gap_record_projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
//! the projection only ever produces `Some(record)` for synthetic test
//! findings. PR 16 lands the real Perl evidence path.

use crate::agent::loop_commands::shell_arg;
use crate::domain::{ExposureClass, Finding, LanguageId, LanguageStatus};
use crate::output::gap_decision_ledger::{
GapAnchor, GapRecord, GapRepairRoute, ProjectionEligibility,
Expand Down Expand Up @@ -255,8 +256,14 @@ pub(crate) fn perl_receipt_command(canonical_gap_id: &str, verify_command: &str)
.map(|c| if c == ':' || c == '/' { '_' } else { c })
.collect::<String>();
let receipt_path = format!("target/ripr/receipts/{slug}.targeted-test-outcome.json");
// Route both operator-supplied values through the shared bash encoder
// rather than wrapping them in double quotes here: a verify command
// containing `$`, a backtick, or a redirect would otherwise execute when
// this advisory string is copied into a shell (#2347).
format!(
"ripr outcome --before <baseline> --after <repair> --verify-cmd \"{verify_command}\" --out {receipt_path}"
"ripr outcome --before <baseline> --after <repair> --verify-cmd {} --out {}",
shell_arg(verify_command),
shell_arg(&receipt_path)
)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/ripr/src/output/receipt_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod tests {
"cargo xtask fixtures boundary_gap",
Some("target/ripr/receipts/gap-rust-pricing.json"),
),
"ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command \"cargo xtask fixtures boundary_gap\" --status not_run --out target/ripr/receipts/gap-rust-pricing.json"
"ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command 'cargo xtask fixtures boundary_gap' --status not_run --out target/ripr/receipts/gap-rust-pricing.json"
);
}

Expand All @@ -59,7 +59,7 @@ mod tests {
"cargo xtask fixtures boundary_gap",
None,
),
"ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command \"cargo xtask fixtures boundary_gap\" --status not_run"
"ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command 'cargo xtask fixtures boundary_gap' --status not_run"
);
}

Expand Down
9 changes: 8 additions & 1 deletion crates/ripr/src/output/typescript_packet_projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//! - No parallel TypeScript-specific completeness validator is introduced.
//! The only flip gate is `validate_agent_gap_record_packet(..) == Ok(())`.

use crate::agent::loop_commands::shell_arg;
use crate::domain::Finding;
use crate::output::gap_decision_ledger::{
GapAnchor, GapRecord, GapRepairRoute, ProjectionEligibility,
Expand Down Expand Up @@ -240,8 +241,14 @@ pub(crate) fn typescript_receipt_command(canonical_gap_id: &str, verify_command:
.map(|c| if c == ':' || c == '/' { '_' } else { c })
.collect::<String>();
let receipt_path = format!("target/ripr/receipts/{slug}.targeted-test-outcome.json");
// Route both operator-supplied values through the shared bash encoder
// rather than wrapping them in double quotes here: a verify command
// containing `$`, a backtick, or a redirect would otherwise execute when
// this advisory string is copied into a shell (#2347).
format!(
"ripr outcome --before <baseline> --after <repair> --verify-cmd \"{verify_command}\" --out {receipt_path}"
"ripr outcome --before <baseline> --after <repair> --verify-cmd {} --out {}",
shell_arg(verify_command),
shell_arg(&receipt_path)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"step": "before_snapshot",
"artifact": "target/ripr/workflow/before.repo-exposure.json",
"reason": "before snapshot artifact is missing",
"command": "ripr check --root \"repo root\" --mode draft --format repo-exposure-json > target/ripr/workflow/before.repo-exposure.json"
"command": "ripr check --root 'repo root' --mode draft --format repo-exposure-json > target/ripr/workflow/before.repo-exposure.json"
},
"surfaces": [
{
Expand All @@ -32,7 +32,7 @@
"state": "computed",
"status": "incomplete",
"required": true,
"summary": "0 required artifacts present, 6 missing, 0 warnings. Command: ripr agent status --root \"repo root\" --json > target/ripr/workflow/agent-status.json"
"summary": "0 required artifacts present, 6 missing, 0 warnings. Command: ripr agent status --root 'repo root' --json > target/ripr/workflow/agent-status.json"
},
{
"name": "agent_workflow",
Expand Down
2 changes: 1 addition & 1 deletion fixtures/evidence-promotion-honesty-corpus/corpus.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
"authority_boundary": "preview_advisory_only",
"repair_kind": "AddBoundaryAssertion",
"verify_command": "jest tests/discount.test.ts",
"receipt_command": "ripr outcome --before <baseline> --after <repair> --verify-cmd \"jest tests/discount.test.ts\" --out target/ripr/receipts/gap_typescript_typescript_preview_2396aec1.targeted-test-outcome.json",
"receipt_command": "ripr outcome --before <baseline> --after <repair> --verify-cmd 'jest tests/discount.test.ts' --out target/ripr/receipts/gap_typescript_typescript_preview_2396aec1.targeted-test-outcome.json",
"allowed_edit_surface": ["tests/discount.test.ts"],
"forbidden_files": ["src/discount.ts"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"commands": {
"agent_packet": "ripr agent packet --root fixtures/first_successful_pr/boundary-gap --gap-ledger inputs/reports/gap-decision-ledger.json --gap-id gap:pr:pricing:threshold-boundary --json > target/ripr/workflow/agent-packet.json",
"receipt": "ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command \"cargo xtask fixtures boundary_gap\" --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json",
"receipt": "ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command 'cargo xtask fixtures boundary_gap' --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json",
"regenerate_gap_ledger": "ripr reports gap-ledger --repo-exposure target/ripr/reports/repo-exposure.json --out inputs/reports/gap-decision-ledger.json --out-md inputs/reports/gap-decision-ledger.md",
"verify": "cargo xtask fixtures boundary_gap"
},
Expand Down Expand Up @@ -85,7 +85,7 @@
"language": "rust",
"language_status": "stable",
"missing_discriminator": "Equality-boundary assertion for the changed behavior.",
"receipt_command": "ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command \"cargo xtask fixtures boundary_gap\" --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json",
"receipt_command": "ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command 'cargo xtask fixtures boundary_gap' --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json",
"receipt_command_source": "first_pr.default_receipt_write_command",
"receipt_path": "target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json",
"receipt_state": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ State: actionable
- Missing discriminator: Equality-boundary assertion for the changed behavior.
- Focused proof intent: Add a focused boundary assertion in `tests/pricing.rs`: `assert_eq!(discount(100, 100), 90)`.
- Verify command: `cargo xtask fixtures boundary_gap`
- Receipt command: `ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command "cargo xtask fixtures boundary_gap" --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json`
- Receipt command: `ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command 'cargo xtask fixtures boundary_gap' --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json`
- Receipt path: `target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json`
- Boundary: static advisory evidence only; not runtime proof, coverage adequacy, mutation confirmation, gate approval, or merge approval.

Expand All @@ -36,7 +36,7 @@ Verify command:
`cargo xtask fixtures boundary_gap`

Receipt command:
`ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command "cargo xtask fixtures boundary_gap" --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json`
`ripr receipt write --gap gap:rust:pricing:discount:threshold-boundary --verify-command 'cargo xtask fixtures boundary_gap' --status not_run --out target/ripr/receipts/gap-pr-pricing-threshold-boundary.targeted-test-outcome.json`

Agent packet command:
`ripr agent packet --root fixtures/first_successful_pr/boundary-gap --gap-ledger inputs/reports/gap-decision-ledger.json --gap-id gap:pr:pricing:threshold-boundary --json > target/ripr/workflow/agent-packet.json`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"commands": {
"agent_packet": "ripr agent packet --root fixtures/first_successful_pr/output-contract-gap --gap-ledger inputs/reports/gap-decision-ledger.json --gap-id gap:pr:output:device-label --json > target/ripr/workflow/agent-packet.json",
"receipt": "ripr receipt write --gap gap:rust:output:device-label --verify-command \"cargo xtask goldens check\" --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json",
"receipt": "ripr receipt write --gap gap:rust:output:device-label --verify-command 'cargo xtask goldens check' --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json",
"regenerate_gap_ledger": "ripr reports gap-ledger --repo-exposure target/ripr/reports/repo-exposure.json --out inputs/reports/gap-decision-ledger.json --out-md inputs/reports/gap-decision-ledger.md",
"verify": "cargo xtask goldens check"
},
Expand Down Expand Up @@ -85,7 +85,7 @@
"language": "rust",
"language_status": "stable",
"missing_discriminator": "Checked output or golden proof for the changed text.",
"receipt_command": "ripr receipt write --gap gap:rust:output:device-label --verify-command \"cargo xtask goldens check\" --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json",
"receipt_command": "ripr receipt write --gap gap:rust:output:device-label --verify-command 'cargo xtask goldens check' --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json",
"receipt_command_source": "first_pr.default_receipt_write_command",
"receipt_path": "target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json",
"receipt_state": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ State: actionable
- Missing discriminator: Checked output or golden proof for the changed text.
- Focused proof intent: Add or update the output proof in `fixtures/device-labels/expected/human.txt` so `golden output contains APPLE_M3_AIR_DEVICE_LABELS_TEXT`.
- Verify command: `cargo xtask goldens check`
- Receipt command: `ripr receipt write --gap gap:rust:output:device-label --verify-command "cargo xtask goldens check" --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json`
- Receipt command: `ripr receipt write --gap gap:rust:output:device-label --verify-command 'cargo xtask goldens check' --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json`
- Receipt path: `target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json`
- Boundary: static advisory evidence only; not runtime proof, coverage adequacy, mutation confirmation, gate approval, or merge approval.

Expand All @@ -36,7 +36,7 @@ Verify command:
`cargo xtask goldens check`

Receipt command:
`ripr receipt write --gap gap:rust:output:device-label --verify-command "cargo xtask goldens check" --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json`
`ripr receipt write --gap gap:rust:output:device-label --verify-command 'cargo xtask goldens check' --status not_run --out target/ripr/receipts/gap-pr-output-device-label.targeted-test-outcome.json`

Agent packet command:
`ripr agent packet --root fixtures/first_successful_pr/output-contract-gap --gap-ledger inputs/reports/gap-decision-ledger.json --gap-id gap:pr:output:device-label --json > target/ripr/workflow/agent-packet.json`
Expand Down
14 changes: 14 additions & 0 deletions fixtures/ts_repair_packet_complete/expected/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,17 @@ Updated:
- `expected/check.json`
- `expected/human.txt`
- `expected/human-full.txt`

## Pending

Reason:
#2347: advisory command strings route every argument through the shared bash
argv encoder, so the TypeScript packet's receipt command now single-quotes the
verify command instead of double-quoting it.

Command:
`cargo xtask goldens bless ts_repair_packet_complete --reason "..."`

Updated:
- `expected/check.json`
- `expected/human-full.txt`
2 changes: 1 addition & 1 deletion fixtures/ts_repair_packet_complete/expected/check.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"Do not treat preview-language evidence as gate authority."
],
"owner": "applyDiscount",
"receipt_command": "ripr outcome --before <baseline> --after <repair> --verify-cmd \"jest tests/discount.test.ts\" --out target/ripr/receipts/gap_typescript_typescript_preview_2396aec1.targeted-test-outcome.json",
"receipt_command": "ripr outcome --before <baseline> --after <repair> --verify-cmd 'jest tests/discount.test.ts' --out target/ripr/receipts/gap_typescript_typescript_preview_2396aec1.targeted-test-outcome.json",
"repair_kind": "AddBoundaryAssertion",
"schema_version": "0.3",
"source": "typescript_preview_projection",
Expand Down
2 changes: 1 addition & 1 deletion fixtures/ts_repair_packet_complete/expected/human-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TypeScript repair packet (advisory)
oracle: expect(result).toBe(50)
edit surface: tests/discount.test.ts
verify: jest tests/discount.test.ts
receipt: ripr outcome --before <baseline> --after <repair> --verify-cmd "jest tests/discount.test.ts" --out target/ripr/receipts/gap_typescript_typescript_preview_2396aec1.targeted-test-outcome.json
receipt: ripr outcome --before <baseline> --after <repair> --verify-cmd 'jest tests/discount.test.ts' --out target/ripr/receipts/gap_typescript_typescript_preview_2396aec1.targeted-test-outcome.json
must not change:
- Do not edit production code unless the focused proof exposes a real product defect.
- Do not broaden the change beyond this GapRecord and its repair route.
Expand Down
1 change: 1 addition & 0 deletions policy/process_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ crates/ripr/src/app/pr_evidence.rs|use std::process::Command|1|pr-evidence|pr-ev
crates/ripr/src/app/ripr_plus.rs|Command::new|1|ripr-plus|Campaign 31 item 8f: ripr plus runs `git rev-parse HEAD` to stamp the receipt with the current commit. No subprocess to cargo.
crates/ripr/src/agent/artifact.rs|Command::new|1|repair-artifact-provenance|RIPR-SPEC-0134: artifact validation resolves the actual repository HEAD and tracked-worktree state through bounded git probes before accepting provenance-bound evidence; no arbitrary command execution.
crates/ripr/src/agent/artifact.rs|use std::process::Command|1|repair-artifact-provenance|RIPR-SPEC-0134: artifact validation imports Command for the bounded git provenance probes described above.
crates/ripr/src/agent/loop_commands.rs|Command::new|3|agent/advisory-commands|#2347: the bash argv encoder is proved by executing the encoded token in a real bash — a round-trip transcript over hostile values, a redirect-clobber guard, and a usability probe that rejects a WSL bash which cannot open host paths. Test module only; no production spawn.
crates/ripr/tests/perl_two_binary_harness.rs|Command::new|3|perl-two-binary-harness|Campaign 31 item 3: the perllsp-to-ripr two-binary proof harness spawns the external perllsp producer (run_producer), the worktree-absolute ripr binary under test (run_ripr), and the which()/where lookup (which). Producer is opt-in via PATH; the harness skips cleanly when perllsp is absent.
crates/ripr/tests/perl_two_binary_harness.rs|use std::process::Command|1|perl-two-binary-harness|The two-binary harness imports Command for the perllsp, ripr, and which/where spawns.
editors/vscode/src/client.ts|child_process|1|lsp/editor|VS Code client invokes ripr context through the resolved server command.
Expand Down
Loading