Repository navigation
[test] Add tests for delegation.validatePersistedState - #16715
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active issues were identified, and the change is limited to focused unit tests covering validation gates, duplicate detection, and deterministic ordering without modifying production behavior.
No open issues 🎉
What changed in this PR
Adds focused unit coverage for validatePersistedState in internal/delegation, exercising validation gates, duplicate detection, and deterministic ordering without changing production behavior.
Changes:
- Adds valid-state and deterministic sorting tests.
- Covers unsupported versions, generation mismatches, schema-hash errors, and invalid identities.
- Covers duplicate invocation keys, handles, and executor bearers.
| File | Description |
|---|---|
| internal/delegation/validate_persisted_state_test.go | Adds comprehensive table-driven tests for persisted delegation-state validation, duplicate detection, and deterministic identity ordering. |
Review effort: Lite (adaptive)
This comment has been minimized.
This comment has been minimized.
|
@copilot merge main and resolve conflicts |
…e-persisted-state-d558f5800133c36b # Conflicts: # internal/delegation/validate_persisted_state_test.go Co-authored-by: copilot-swe-agent[bot] <[email protected]>
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked through mcpg. Part B is INCONCLUSIVE because all 6 target write tools were entirely absent from the backend's exposed catalog (gh-aw's
|
Function Analyzed
internal/delegationvalidatePersistedState(internal/delegation/recovery.go:231)Why This Function?
The repository-wide coverage scan found only trivial functions below 50%. Among meaningful under-tested functions,
validatePersistedStatehad important duplicate-detection branches that were not executed. Existing recovery fixtures omittedRequestedTTL, so they failed during identity validation before reaching duplicate invocation-key, handle, and executor-bearer checks. The new tests construct valid restored identities and exercise the target function directly.Tests Added
Coverage Report
Test Execution
go test -count=1 -coverprofile=/tmp/gh-aw/agent/after-coverage.out ./...— passedgo test -count=1 -coverprofile=/tmp/gh-aw/agent/target-coverage.out ./internal/delegation -run TestValidatePersistedState -v— passedmake agent-finished— Go formatting, build, vet, and all Go unit/integration tests passed. The Rust guard step could not fetchserdebecause the configured crates.io certificate failed validation; offline mode confirmed the dependency is not cached.golangci-lintwas unavailable and was skipped by the repository Makefile.No production behavior changes are included.
Warning
Firewall blocked 4 domains
The following domains were blocked by the firewall during workflow execution:
example.comnonexistent.localslow.example.comthishostdoesnotexist12345.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.