Repository navigation
feat(monitor): use the versioned monitor API and drop experimental - #91
sfc-gh-dlotfi wants to merge 2 commits into
Conversation
view, create, update, delete, enable and disable send Observe-Api-Version 2026-10-06 and use the generated MonitorResource, MonitorCreateRequest and MonitorUpdateRequest. On a 403 (the account does not have MonitorV2.restCrudApi yet) get, delete, enable and disable fall back to the unversioned request, as list does. create and update pick the request from the file: a definition or actionRules key is the legacy shape and goes unversioned; any other file is versioned, and a 403 on it says the versioned API is not enabled instead of retrying a body that cannot convert. Masked values (***REDACTED***) print as they came and are sent back unchanged on update, so the server keeps the stored value. create refuses a file that holds one, since a create cannot save a mask. list, view, create, update, delete, enable and disable are no longer experimental. README and AGENTS.md list them. Refs OB-69679 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| OSS Licenses | View in Orca | ||
| Malicious Packages | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
This PR touches 63 CLI command surface(s), 7 with a contract change. Advisory only: nothing is gated yet; under the eval gate each would need eval coverage.
|
The versioned-to-legacy fallback now triggers only when the 403 is the feature gate (type feature_not_enabled, or the gate's "currently not accessible" message). A permission 403 is shown as it is instead of being retried on the legacy endpoint. update refuses a legacy-shaped file that holds ***REDACTED***, since the legacy endpoint would save the mask as the value. updateMonitor takes the patch as its own argument, so file keys never reach the SDK call. README notes that view --json prints the native shape on accounts with the versioned API. Refs OB-69679 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Automated Code Review
Summary
Moves monitor view, create, update, delete, enable and disable to the versioned monitor API (Observe-Api-Version: 2026-10-06) and the generated MonitorResource/MonitorCreateRequest/MonitorUpdateRequest types. When the account's feature gate is closed (a 403 of type feature_not_enabled or one whose message contains "currently not accessible"), view, delete, enable, disable and shared-key updates fall back to the unversioned request. Create and update pick the request from the file's shape: a definition or actionRules key means the legacy shape. Files that hold the ***REDACTED*** mask are refused on create and on a legacy-shape update, and are passed through on a versioned update so the server keeps the stored secret. The experimental flag comes off all seven monitor commands, and the help text, README and AGENTS.md are updated.
Problem fit: solves — Move monitor view/create/update/delete/enable/disable to the versioned monitor API with a 403 legacy fallback, handle masked secrets, and drop experimental.
Not needed for the stated problem
- src/lib/format-error.ts: any 403 whose text contains 'currently not accessible' now maps to the generic not-enabled message for every command
Suggested review order — 5 stop(s)
-
src/rest/monitor/versioned.ts:25Core: shape detection (
isLegacyBody,isVersionedOnlyBody) andwithLegacyFallback. Every command routes through these. -
Gate detection: fallback keys on a message substring, and the change affects
formatApiErrorfor every REST command. Check its scope and how brittle it is. -
src/rest/monitor/update-monitor.ts:48Three-way choice: legacy, versioned with fallback, or versioned-only error. Check that shared-key patches fall back and others report not-enabled.
-
src/commands/monitor/update.ts:72Command layer: mask refusal for legacy files and patch shaping. A versioned file is sent whole as a merge patch.
-
src/commands/monitor/view.ts:127Consumer: new versioned text view.
Object.keysonsharedActions/inlineActionsassumes both are always present.
Risk: high (floor high, model medium)
- Removing
experimentalexposes the commands by default to accounts that rely on the legacy fallback - The fallback depends on the server's 403 text "currently not accessible" in
isFeatureNotEnabled update/createsend whole versioned files and rely on the server ignoring read-only fields
Review effort: high (floor high, model high)
- 27 files, ~570 non-test lines across the command and REST layers
- Two body shapes, mask policy and fallback rules interact in
create,updateandupdateMonitor - Server behaviour (gate wording, merge-patch semantics, masks) cannot be checked from the client code
Review by aspect — 0 finding(s) in 0 aspect(s), 27 file(s) analyzed, 0 inline comment(s)
- ✅ Bug Detection — 0 found, 2 below threshold
- ✅ Security — no issues
- ✅ Design — 0 found, 1 below threshold
- ✅ Performance — no issues
- ✅ Error Handling — 0 found, 1 below threshold
- ✅ Maintainability — 0 found, 3 below threshold
- ✅ Test Coverage — no issues
- ✅ Project Standards — no issues
Analyzed 27 file(s). Posted 0 inline comment(s).
Refs OB-69679. First of three PRs: this one is the versioned CRUD; monitor actions and unmute, then preview, follow.
What
monitor view,create,update,delete,enableanddisablesendObserve-Api-Version: 2026-10-06and use the generatedMonitorResource,MonitorCreateRequestandMonitorUpdateRequest.MonitorV2.restCrudApi), view, delete, enable and disable fall back to the unversioned request, asmonitor listdoes.createandupdatechoose by file shape. AdefinitionoractionRuleskey is the legacy shape and goes unversioned (works everywhere). Any other file is versioned; a 403 on it reports that the versioned API is not enabled, because a versioned body cannot be converted to the legacy one.***REDACTED***prints as it came and is sent back unchanged on update, so the server keeps the stored value.createrefuses a file holding a mask, since the API says a create cannot save one. Help text says so.updateno longer lets anidinside the file override theidargument.list,view,create,update,delete,enableanddisableloseexperimental: true. README and AGENTS.md list them.Notes
forbidden, notfeature_not_enabled, so the fallback keys on the status likelistdoes; the legacy request then reports a real permission error itself.Tests
bun test src/commands/monitor src/rest/monitor: 147 pass. New cases cover the versioned header, the 403 fallback for get, delete, enable/disable and update, the versioned-only 403 error on create and update, non-403 errors not falling back, masked values on view, update and create.🤖 Generated with Claude Code