Extend browser workbench protocol#44
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughExtends the browser protocol and Go implementation with control/claim messages, richer frame/viewport/capture metadata, identity/evidence and identity-lifecycle messages, expanded user-input/ack schemas, sensitive-action approval fields with validation, envelope payload mappings, and tests. ChangesBrowser Protocol and Message Type Expansion
Sequence Diagram(s)sequenceDiagram
participant Client
participant ControlSvc as Control Service
participant Browser as Browser Host
participant Identity as Identity Store
Client->>ControlSvc: Send browserControlClaimRequest (claim + metadata)
ControlSvc->>Browser: Announce/assign control via browserControlState
Client->>ControlSvc: Send browserClaimAndInput (claim + BrowserUserInput)
ControlSvc->>Browser: Forward BrowserUserInput
Browser->>ControlSvc: Reply BrowserUserInputAck (accepted/denied/reason/safeRetry)
Browser->>Identity: Emit browserEvidenceCreated / browserDebugBundleCreated
Identity->>ControlSvc: Emit BrowserIdentitySaved / BrowserIdentityAvailable
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 6/10 reviews remaining, refill in 23 minutes and 7 seconds. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
messages_test.go (1)
15-277: 💤 Low valueConsider adding unknown/invalid field handling tests for new message types.
Per coding guidelines, tests should verify "unknown/invalid payload handling, and protocol compatibility behavior." The existing test suite has
TestBrowserEnvelopeIgnoresUnknownFieldsandTestBrowserEnvelopeRejectsInvalidFieldTypesfor other browser messages. The new control/identity/evidence messages would benefit from similar coverage to ensure forward compatibility and type safety.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@messages_test.go` around lines 15 - 277, Add tests that assert ParseEnvelope ignores unknown fields and rejects invalid field types for each new message struct (e.g., BrowserControlState, BrowserControlClaimRequest, BrowserClaimAndInput, BrowserEvidenceCreated, BrowserDebugBundleCreated, BrowserIdentityAvailable/Saved/Revoked/Used/Bind/Unbind/UseApproved, BrowserViewportSet, BrowserSensitiveActionRequest/Response). Mirror the patterns from TestBrowserEnvelopeIgnoresUnknownFields and TestBrowserEnvelopeRejectsInvalidFieldTypes: construct JSON for each message, inject an extra unknown field and assert ParseEnvelope still decodes the payload (using mustJSONMap/jsonEqual), and construct JSON with wrong types for required fields and assert ParseEnvelope returns an error; use ParseEnvelope and the existing helper functions to locate and validate behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@messages_test.go`:
- Around line 15-277: Add tests that assert ParseEnvelope ignores unknown fields
and rejects invalid field types for each new message struct (e.g.,
BrowserControlState, BrowserControlClaimRequest, BrowserClaimAndInput,
BrowserEvidenceCreated, BrowserDebugBundleCreated,
BrowserIdentityAvailable/Saved/Revoked/Used/Bind/Unbind/UseApproved,
BrowserViewportSet, BrowserSensitiveActionRequest/Response). Mirror the patterns
from TestBrowserEnvelopeIgnoresUnknownFields and
TestBrowserEnvelopeRejectsInvalidFieldTypes: construct JSON for each message,
inject an extra unknown field and assert ParseEnvelope still decodes the payload
(using mustJSONMap/jsonEqual), and construct JSON with wrong types for required
fields and assert ParseEnvelope returns an error; use ParseEnvelope and the
existing helper functions to locate and validate behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c024e038-f144-4cb9-9da9-c679514e178d
📒 Files selected for processing (4)
PROTOCOL.mdenvelope.gomessages.gomessages_test.go
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@messages_test.go`:
- Around line 311-339: Add a parallel test that verifies
BrowserSensitiveActionResponse.ValidateApprovalFields enforces the same required
fields as the request test: create a valid BrowserSensitiveActionResponse with
ApprovalID, Nonce, ParameterHash, ExpiresAt set (matching values used in
TestBrowserSensitiveApprovalValidation), assert no error from
ValidateApprovalFields(), then iterate the same table of mutations (setting
ApprovalID, Nonce, ParameterHash, ExpiresAt to empty) and assert each mutated
response returns an error; name the new test e.g.
TestBrowserSensitiveApprovalResponseValidation and call
BrowserSensitiveActionResponse.ValidateApprovalFields() to ensure parity with
BrowserSensitiveActionRequest.ValidateApprovalFields().
- Around line 279-309: Update TestBrowserUserInputAckCarriesReasonCode to
include compatibility cases for the new BrowserUserInputAck fields: add a
subtest that injects an invalid-type for ReasonCode (e.g. set "ReasonCode":
"invalid-string" in the raw JSON) and assert ParseEnvelope/raw-unmarshal
behavior matches the rest of this test file's compatibility expectations (i.e.
parsing fails/returns error or rejects the payload as the suite requires), and
add another subtest that adds an unknown extra field (e.g. "unknown_extra": 42)
to the JSON and assert ParseEnvelope still succeeds and the returned
env.Payload.(*BrowserUserInputAck) preserves the known fields (Type, BrowserID,
SafeRetry, etc.)—use the existing TestBrowserUserInputAckCarriesReasonCode,
BrowserUserInputAck struct, and ParseEnvelope helper to locate and implement
these checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Summary
Verification
Dependency order
Post-merge actions
Summary by CodeRabbit
New Features
Improvements
Tests