Repository navigation
[test] Add tests for delegation.validatePersistedState - #16675
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active issues were identified, and the focused table-driven tests cover successful validation, deterministic sorting, rejection paths, and duplicate identity detection.
No open issues 🎉
What changed in this PR
Adds focused unit coverage for internal/delegation.validatePersistedState, improving confidence in persisted delegation-state recovery validation without changing production behavior.
Changes:
- Covers successful validation and deterministic identity sorting.
- Covers version, generation, schema, and envelope-validation failures.
- Covers duplicate invocation keys, identity handles, and executor bearers.
| File | Description |
|---|---|
| internal/delegation/validate_persisted_state_test.go | Adds comprehensive table-driven tests for successful persisted-state validation, deterministic sorting, rejection paths, and duplicate identity detection. |
Review effort: Lite (adaptive)
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked. No destructive/irreversible operations were attempted.
|
Function Analyzed
internal/delegationvalidatePersistedStateWhy This Function?
validatePersistedStateis security-critical recovery logic that validates persisted delegation identities before any runtime indexes are rebuilt. The baseline report showed several untested duplicate-detection branches despite existing end-to-end recovery tests.Tests Added
Coverage Report
Test Execution
go test -count=1 -coverprofile=/tmp/gh-aw/agent/coverage-after.out ./...— passedgo test -count=1 ./internal/delegation -run 'TestValidatePersistedState' -v— passedmake agent-finished— Go formatting, build, lint fallback, unit tests, and integration tests passed; the Rust guard step was blocked because the runner could not download crates.io metadata due to an external TLS certificate mismatch, and golangci-lint was not installed.No production code was changed.
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.