fix(test): guard default artifact run id path#71
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds ChangesArtifact default output path safety
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/commands/test.artifact-path.spec.ts (1)
31-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd the explicit
--outregression this issue calls for.These tests cover the defaulted-path rejection path well, but they do not lock in the counterpart requirement that path-like
runIdvalues remain allowed when--outis provided. A small test on theopts.out !== undefinedbranch would keep that acceptance criterion from regressing.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/test.artifact-path.spec.ts` around lines 31 - 56, The current test only verifies that unsafe default run IDs are rejected when no output path is provided; add a regression test around runArtifactGet that explicitly sets opts.out and confirms a path-like runId is still accepted. Use the existing runArtifactGet helper in src/commands/test.artifact-path.spec.ts, cover the opts.out !== undefined branch, and assert the command does not fail validation for a value like ../../outside when --out is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/test.ts`:
- Around line 6740-6750: The run-id validation in test.ts only rejects literal
“.” and “..”, so update the existing check around the runId guard to also catch
Windows-trimmed dot segments before building the default
.testsprite/runs/<runId> path. Normalize or trim the candidate segment in the
same validation path, then reject aliases like “. ” and “.. ” in the
localValidationError('run-id', ...) branch, and add regression coverage in the
test cases that exercise runId handling.
---
Nitpick comments:
In `@src/commands/test.artifact-path.spec.ts`:
- Around line 31-56: The current test only verifies that unsafe default run IDs
are rejected when no output path is provided; add a regression test around
runArtifactGet that explicitly sets opts.out and confirms a path-like runId is
still accepted. Use the existing runArtifactGet helper in
src/commands/test.artifact-path.spec.ts, cover the opts.out !== undefined
branch, and assert the command does not fail validation for a value like
../../outside when --out is present.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 02487068-f1d8-44f0-b619-439cdd7ea259
📒 Files selected for processing (2)
src/commands/test.artifact-path.spec.tssrc/commands/test.ts
Summary
run-idas one path-safe segment--outis omitted--outbehavior unchangedTesting
Fixes #45
Summary by CodeRabbit