Repository navigation
fix: Nickel strings stay literal; a manifest lookup error is not an absent manifest - #303
Conversation
…bsent manifest Two findings from the CodeRabbit review of #302, both checked against nickel 1.18.0 and Rust std before fixing. - nickel_escape_string used JSON quoting. Nickel interpolates %{…}, so a report string such as the path /tmp/%{true} exported as /tmp/true. JSON's \b, \f and \u001f escapes are not Nickel escapes at all, so a control character made the file unparseable ("invalid escape sequence"). The escaper now writes \% for every %, \" \\ \n \r \t, and \u{XX} for other control characters. Test: a round trip through `nickel export` returns each tricky string unchanged. - Manifest::default_path and load_if_exists used Path::exists(), which turns any metadata error (a self-referential symlink, a permission error) into false, so the CLI silently used the defaults. They now use try_exists(): only a definite absence gives the defaults, and an undeterminable path is an error that the startup warning reports. Test: a self-referential 0-AI-MANIFEST.deed is an error, not the defaults. The unused serde_json import in formatter.rs goes with the old escaper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136P7ZoBy5xGnGDLk7wQ8jC
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |



Summary
This follows up the two CodeRabbit findings on #302, which landed after #302 merged. I checked both against nickel 1.18.0 and Rust std before fixing them.
1. Nickel string escaping (
src/report/formatter.rs)nickel_escape_stringused JSON quoting, which is wrong for Nickel in two ways:nickel exportresult/tmp/%{true}"/tmp/%{true}""/tmp/true": interpolateda\u{1f}b"a\u001fb"invalid escape sequencea\u{8}b"a\bb"invalid escape sequenceThe escaper now writes:
\%for every%(Nickel reads it back as%);\",\\,\n,\rand\t;\u{XX}for any other control character.The manifest export (
src/a2ml) and the assault-report writer share this escaper, so both are fixed.2. Manifest lookup (
src/a2ml/mod.rs)Manifest::default_pathandload_if_existsusedPath::exists(). That turns every metadata error (a self-referential symlink, a permission error) intofalse, so the CLI quietly fell back to the defaults. Both now usetry_exists():Tests
nickel_strings_stay_literal: five tricky strings make the round trip throughnickel exportunchanged, and three exact-output assertions pass.load_if_exists_reports_a_symlink_loop_instead_of_defaulting(unix): a self-referential0-AI-MANIFEST.deedis an error, not the defaults.Checks run locally
cargo build: 0 warnings. Theserde_jsonimport informatter.rswas unused after the rewrite and is gone.cargo test: 818 passed, 0 failed.cargo test --features http: 885 passed, 0 failed.cargo clippy --locked --all-targets --features http,sarif,signing -- -D warnings: clean.cargo fmt --check: exit 0.git diff --summary: no mode changes.Generated by Claude Code