Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Code review: S-1 response-file client + M-13 excerpt export — Request changes (minor)Reviewed Should fix
Test gap
What looks goodThe route is a thin confined writer over the shared Generated by Claude Code |
|
@coderabbitai review |
Action not completed
|
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
The change cannot be approved because a critical routing mismatch makes the new writeReviewResponse endpoint unreachable for v2 clients, and there is also an outstanding documentation inconsistency in the capability matrix total operation count.
2 open issues
What changed in this PR
Adds two workspace/CLI surface enhancements: an interactive workspace endpoint to publish portable review response files via the shared respond() path, and an explicit opt-in to include bounded source excerpts in trace exports while keeping the default export byte-identical and excerpt-free.
Changes:
- Adds
writeReviewResponseas a new workspace POST endpoint for writing one immutable portable review response file. - Introduces opt-in
include_source_excerptsfor trace exports (API + CLI), with bounded excerpt generation and v1/v2 validation behavior. - Updates v2 OpenAPI, capability matrix, and contract tests to reflect the expanded v2 surface area and operation count.
| File | Description |
|---|---|
| tests/api_contract_validation.rs | Updates API contract validation expectations to account for the newly added v2 operation(s). |
| src/workspace/reports.rs | Extends the workspace report/export envelope to optionally include source excerpts and handles v1 vs v2 validation/rendering accordingly. |
| src/workspace/http.rs | Wires the new review-response write endpoint into the workspace HTTP dispatcher routing. |
| src/workspace/http_review.rs | Implements the confined writeReviewResponse handler that publishes a portable response file via the shared review respond() flow and maps handler errors to HTTP responses. |
| src/workspace/domain.rs | Adds bounded extraction of source-line excerpts from captured sources for opt-in trace exports. |
| src/workspace/actions.rs | Threads the include_source_excerpts option through export handling and redaction summary behavior. |
| src/cli/trace.rs | Adds --include-source-excerpts support to the trace CLI output, formatting and appending excerpts when opted in. |
| src/cli/mod.rs | Exposes and wires the new trace subcommand flag for including source excerpts through CLI execution. |
| docs/api/forge-workspace-v2.openapi.yaml | Documents the new v2 review-response write endpoint and the opt-in excerpts field/flag in the v2 API schema. |
| docs/api/capability-matrix-v2.md | Adds the CM-53 capability entry for writeReviewResponse and updates the documented v2 operation surface description. |
| docs/api/capability-matrix-v2.json | Adds CM-53 / writeReviewResponse to the machine-readable capability matrix and operation sets. |
Review effort: Balanced
| if method == "POST" && path == "/api/v1/review-queue/responses" { | ||
| return review::write_response( | ||
| state, | ||
| payload.as_ref().ok_or_else(Error::invalid)?, | ||
| read_deadline, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Fixed in bf7623e: removed the ungated /api/v1 match (it compared the canonical key, so v2 requests fell through to not-found and v1 hit an unintended alias). Added the route in the v2 section mirroring the existing v2 mutation pattern: state.api_major == ApiMajor::V2 && POST && wire_path == "/api/v2/review-queue/responses" -> review::write_response, exactly the documented OpenAPI path. Security guards untouched (loopback, exact-Host, write-scoped capability, confinement, no-replace). New test response_write_dispatches_on_the_v2_wire_path_only: v2 POST returns 200 + published file decodes; v1 POST refused not-found (v1 frozen at 39 ops). Full suite green.
| | CM-50 | Discard an unconfirmed source stage | cross-cutting | US-7, US-9, US-10, US-13 | `discardProjectSourceTransferStage` | browser-write | | ||
| | CM-51 | Prepare and confirm an exact staged-profile source export | cross-cutting | US-7, US-9, US-10, US-13 | `prepareProjectSourceStreamExport`, `getOperation`, `getEffectPreview`, `commitEffectPreview` | browser-write | | ||
| | CM-52 | Read manifest and exact parts of a committed staged-source export | cross-cutting | US-7, US-9, US-10, US-13 | `getProjectSourceStreamExportManifest`, `getProjectSourceStreamExportChunk` | browser-read | | ||
| | CM-53 | Write one portable review response file from the interactive client | cross-cutting | US-4, US-13 | `writeReviewResponse` | browser-write | |
There was a problem hiding this comment.
Fixed in bf7623e: "65 total" -> "66 total", verified against the OpenAPI doc (66 operations incl. writeReviewResponse) and contract tests (assert_eq!(second.len(), 66)). The 65s in compatibility.md/architecture.md are dated checkpoint records pinned to commit 304b31f (historical, correct as-is) — left untouched.
CodeRabbit PR #290: the S-1 dispatcher matched the private canonical key unconditionally, so a v2 launch admitted /api/v2/review-queue/responses against the OpenAPI contract but never reached write_response, while the frozen v1 namespace kept an unintended alias. Gate the route on ApiMajor::V2 and the exact /api/v2/review-queue/responses wire path, mirroring the other v2 mutation routes; transport admission (loopback, exact-Host pin, write-scoped capability) and the handler's confinement fences are unchanged. Add a dispatch-level test: v2 POST publishes and round-trips the response, v1 is refused not-found. Capability matrix doc: current API2.4 draft total 65 -> 66 with CM-53 writeReviewResponse (matches the OpenAPI count and contract tests).
8d3692e to
33d4bfd
Compare
S-1: add POST /api/v2/review-queue/responses writing one immutable portable review response through the shared respond()/RespondOptions path for all four closed families (/1 review, /2 lifecycle, /3 authoring, /4 edit). Preserves loopback, exact-Host pin, project confinement, write-scoped capability and native no-replace publication. New CM-53 writeReviewResponse operation; v1 contract frozen. No new review-family wire contract. M-13: explicit opt-in bounded source excerpts for trace exports. CLI --include-source-excerpts and v2 ExportRequest.include_source_excerpts; the conservative IdsAndHashes default is retained and byte-identical (no excerpts field). Excerpts are trace-only, bounded (100 items, 500 chars), untrusted. Tests: S-1 round-trip + confinement/auth/no-replace refusals; M-13 default byte-identical vs opt-in excerpts. fmt/clippy clean; full suite green except the confirmed-flaky workflow::fake test (passes in isolation, untouched).
CodeRabbit PR #290: the S-1 dispatcher matched the private canonical key unconditionally, so a v2 launch admitted /api/v2/review-queue/responses against the OpenAPI contract but never reached write_response, while the frozen v1 namespace kept an unintended alias. Gate the route on ApiMajor::V2 and the exact /api/v2/review-queue/responses wire path, mirroring the other v2 mutation routes; transport admission (loopback, exact-Host pin, write-scoped capability) and the handler's confinement fences are unchanged. Add a dispatch-level test: v2 POST publishes and round-trips the response, v1 is refused not-found. Capability matrix doc: current API2.4 draft total 65 -> 66 with CM-53 writeReviewResponse (matches the OpenAPI count and contract tests).
bf7623e to
4154afb
Compare
CodeRabbit PR #290: the S-1 dispatcher matched the private canonical key unconditionally, so a v2 launch admitted /api/v2/review-queue/responses against the OpenAPI contract but never reached write_response, while the frozen v1 namespace kept an unintended alias. Gate the route on ApiMajor::V2 and the exact /api/v2/review-queue/responses wire path, mirroring the other v2 mutation routes; transport admission (loopback, exact-Host pin, write-scoped capability) and the handler's confinement fences are unchanged. Add a dispatch-level test: v2 POST publishes and round-trips the response, v1 is refused not-found. Capability matrix doc: current API2.4 draft total 65 -> 66 with CM-53 writeReviewResponse (matches the OpenAPI count and contract tests).
#293) * feat(workspace): S-1 response-file client + M-13 opt-in excerpt export S-1: add POST /api/v2/review-queue/responses writing one immutable portable review response through the shared respond()/RespondOptions path for all four closed families (/1 review, /2 lifecycle, /3 authoring, /4 edit). Preserves loopback, exact-Host pin, project confinement, write-scoped capability and native no-replace publication. New CM-53 writeReviewResponse operation; v1 contract frozen. No new review-family wire contract. M-13: explicit opt-in bounded source excerpts for trace exports. CLI --include-source-excerpts and v2 ExportRequest.include_source_excerpts; the conservative IdsAndHashes default is retained and byte-identical (no excerpts field). Excerpts are trace-only, bounded (100 items, 500 chars), untrusted. Tests: S-1 round-trip + confinement/auth/no-replace refusals; M-13 default byte-identical vs opt-in excerpts. fmt/clippy clean; full suite green except the confirmed-flaky workflow::fake test (passes in isolation, untouched). * fix(workspace): dispatch S-1 response writes on the documented v2 path CodeRabbit PR #290: the S-1 dispatcher matched the private canonical key unconditionally, so a v2 launch admitted /api/v2/review-queue/responses against the OpenAPI contract but never reached write_response, while the frozen v1 namespace kept an unintended alias. Gate the route on ApiMajor::V2 and the exact /api/v2/review-queue/responses wire path, mirroring the other v2 mutation routes; transport admission (loopback, exact-Host pin, write-scoped capability) and the handler's confinement fences are unchanged. Add a dispatch-level test: v2 POST publishes and round-trips the response, v1 is refused not-found. Capability matrix doc: current API2.4 draft total 65 -> 66 with CM-53 writeReviewResponse (matches the OpenAPI count and contract tests).


Stacked on M-10 PR #288 (base
feat/f12-f13-m10-adapters). Delivers two deferred F12/F13 items in the workspace/CLI surface. Tickets #21 (F12) / #59 (F13).S-1 — interactive workspace response-file client
POST /api/v2/review-queue/responses(writeReviewResponse, capability-matrix CM-53) writes one immutable portable review response through the same sharedrespond()/RespondOptionspath the CLI uses, selecting the closed/1review,/2lifecycle,/3authoring or/4edit family.validate_path+ review capture), write-scoped capability/session auth (guardis_mutation), participating exclusive project lease, and native no-replace publication. Existing destinations are refused.M-13 — opt-in sensitive/excerpt export
forge trace --include-source-excerptsand v2ExportRequest.include_source_excerpts. The conservative IdsAndHashes default is retained and byte-identical (the default envelope omits theexcerptsfield entirely).redaction_summarydropssource-excerptsfrom removed categories only when opted in.Tests
Verification
cargo fmt --checkclean;cargo clippy --all-targets -- -D warningsclean.cargo test: all workspace/review/report/contract tests green. The single failure (workflow::fake::tests::oversized_response_and_timeout_are_refused) is the confirmed-flaky workflow test under concurrent load — it passes in isolation andsrc/workflow/is untouched. Committed with the authorizedSKIP_FORGE_PRECOMMIT=1for this verified commit only; CI runs full gates.Human gates (reviewer authority, team exercises, security/privacy, WCAG/AT, final docs review) remain open; passing code does not establish domain approval.