fix: harden input parsing and special-path handling - #1
Conversation
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ade40decc1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| n = n | ||
| .checked_mul(10) | ||
| .and_then(|value| value.checked_add(digit)) | ||
| .ok_or_else(|| format!("replay: number {s:?} out of range"))?; |
There was a problem hiding this comment.
Preserve the minimum signed duration
For the valid input -9223372036854775808ns, the magnitude is one greater than i64::MAX, so this positive-only accumulator now returns an out-of-range error before the sign can be applied. The documented Go-duration behavior accepts this value as i64::MIN; parse the magnitude in an unsigned/wider representation or otherwise special-case the negative boundary, and add boundary coverage alongside the overflow tests.
AGENTS.md reference: AGENTS.md:L41-L42
Useful? React with 👍 / 👎.
| use super::*; | ||
|
|
||
| #[test] | ||
| #[test] |
There was a problem hiding this comment.
Register the porcelain status parser test
The second #[test] is attached to the preceding name-status test, causing that test to be registered twice, while porcelain_z_parser_preserves_special_paths_and_rename_target has no test attribute and never runs. Move this attribute to the following function so the changed-path parser actually receives the intended regression coverage.
AGENTS.md reference: AGENTS.md:L41-L42
Useful? React with 👍 / 👎.
Summary
Hardens input/parsing boundaries found during a repository-wide defect audit:
pack --diff, preserving spaces, tabs/newlines, backslashes, literal->text, and rename/copy pathsright, and preserve encoded commas inopenRegression coverage
Added focused tests for:
Verification
Verified on GitHub Actions against the PR merge ref:
rustfmt --checkcargo test --manifest-path crates/ctx-replay/Cargo.tomlcargo test --manifest-path crates/ctx-contract/Cargo.tomlcargo test --manifest-path crates/ctx-web/Cargo.toml --libcargo test --manifest-path crates/ctx-cli/Cargo.toml --bin ctxcargo clippyfor the affected cratespnpm install --frozen-lockfilepnpm checkpnpm buildThe repository has pre-existing Clippy warnings in unrelated code, so the verification run reports them without promoting all warnings to errors. All commands above completed successfully.
A temporary PR-only verification workflow was used to run this matrix and removed from the final diff.