fix: flag-gate ABv1 edit block behind deprecation flags [ACTION-5731] - #1292
Conversation
The ABv1 edit gate (BuilderEditBlockedState + disabled canvas interactions) was enforced purely from the x-is-org-admin / x-can-edit-agent request headers. Those headers have no producer yet, so in any cloud session both resolve false and canEditAgent becomes false for everyone — including org admins — blocking all editing. Gate the enforcement behind the existing ABv2 deprecation flags (beforeDeprecationCutoffAbv2 / afterDeprecationCutoffAbv2). When neither flag is active, editing is always permitted so the block cannot engage unintentionally (e.g. before the header producer ships). Once a deprecation flag is enabled, the existing permission logic applies as before. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughABv1 edit gating now checks deprecation cutoff feature flags before applying existing Writer Cloud, organization-admin, and application edit permissions. The mock core and Vitest tests cover inactive and active gating scenarios. ChangesABv1 edit gating
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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 |
Summary
The ABv1 edit block (
BuilderEditBlockedStateoverlay + disabled canvas interactions) is currently enforced purely from thex-is-org-admin/x-can-edit-agentrequest headers read inapp_runner.py. Those headers have no producer yet — nothing inbe.agent-manager, the platform gateway, orfe.web-appsets them (PR #1291 added only the reader and notes the agent-manager side is a follow-up).Because of that, in any Writer cloud session both headers resolve to
false, socanEditAgentbecomesfalsefor everyone — including org admins — which blocks all editing. That makes the framework unshippable ahead of the header producer.This PR gates the edit-block enforcement behind the existing ABv2 deprecation flags (
beforeDeprecationCutoffAbv2/afterDeprecationCutoffAbv2):canEditAgentis alwaystrue, so the block can never engage unintentionally (safe to deploy before the header producer ships, and for orgs not in the deprecation rollout).isOrganizationAdmin/canEdit) applies exactly as before.The banner and remigration dialog were already flag-gated; this brings the edit block in line with them.
Changes
core/index.ts:canEditAgentnow short-circuits totrueunless a deprecation flag is present.tests/mocks.ts: mockcanEditAgentmirrors the real gating so builder tests stay accurate.tests/canEditAgent.spec.ts: new spec covering the gating matrix (no flag → editable; flag + non-admin/no-edit → blocked; flag + admin or canEdit → editable).Design note
I gated behind either deprecation flag since the whole ABv1 edit-gating is part of the ABv2 deprecation rollout. If we'd rather only block editing post-cutoff (
afterDeprecationCutoffAbv2only) or introduce a dedicated flag for finer control, that's an easy change — happy to adjust.Test plan
vitest run src/tests/canEditAgent.spec.ts(6 passing)beforeDeprecationCutoffAbv2off: editing works normally (no block)Made with Cursor
Summary by CodeRabbit
Bug Fixes
Tests