fix(frontend): Show raw payload for commit deltas outside parameters - #5129
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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 ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
ChangesDelta Scope Validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/packages/agenta-entities/src/workflow/commitDiff/revisionDelta.ts (1)
100-107: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueReword the backend parity note.
_validate_delta_scopeis only used ontest_run, so this preview guard shouldn’t implycommit_revisionalready enforces the same scope rule.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 39404084-a4e2-4225-82f1-133cfdaeafd8
📒 Files selected for processing (2)
web/packages/agenta-entities/src/workflow/commitDiff/revisionDelta.tsweb/packages/agenta-entities/tests/unit/revision-delta.test.ts
… outside parameters The commit_revision friendly card previews only the parameters tree, but the backend deep-merges the delta onto the whole revision data (url, script, headers, ...). A mixed delta rendered its parameters half and silently hid the rest of the commit. Mirror the backend's test_run delta-scope rule: any set key besides parameters, or any remove path not under parameters., returns null so the ApprovalDock shows the exact payload instead.
d33bd58 to
43aaafd
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Railway Preview Environment
Updated at 2026-07-19T15:25:15.098Z |
Context
Follow-up to #5101 (friendly
commit_revisionapprovals), closing the one critical its review found. The backend deep-merges a revision delta onto the whole revision data tree, andWorkflowRevisionDatalegitimately carriesuri,url,headers,runtime,script, andschemasnext toparameters. The friendly approval card only previewsparameters. So an LLM-authored delta like{"set": {"parameters": {"agent": {"instructions": "..."}}, "url": "https://..."}}rendered a benign "Instructions edited" card while the
urlchange stayed invisible, and in chat mode the card fully replaces the raw payload. Approving it committed a change the user never saw.removepaths outsideparametershad the same hole: a silent no-op in the preview, a real deletion on the backend.Changes
classifyRevisionDeltaChangesnow returnsnullwhenever the delta reaches outsideparameters: any own key ondelta.setbesidesparameters, or anyremovepath that is notparametersor underparameters.. This is the same scope rule the backend's_validate_delta_scopealready enforces fortest_rundeltas. Returningnullroutes the card through its existing fallback, so the ApprovalDock shows the exact JSON payload instead of a partial summary.Deltas confined to
parameters(the shape the op description steers agents toward) render the friendly card exactly as before.Tests
parameters+url) returns null, set-only out-of-scope (script) returns null, out-of-scoperemovealongside a parameters edit returns null (including theparametersXprefix-boundary case), and parameters-scoped removes still produce a preview.@agenta/entitiesunit suite green (841 tests),tsc --noEmitand eslint clean._validate_delta_scopeinto thecommit_revisionpath so out-of-scope deltas are refused at the source, not just downgraded in the preview.What to QA
urlorscript: the approval shows the raw JSON payload card instead of the friendly card.