Repository navigation
[test] Add tests for delegation.loadStoreAt - #16934
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed changes are limited to focused recovery-path tests, with no production behavior changes or unresolved problems identified in the supplied evidence.
No open issues 🎉
What changed in this PR
This PR adds focused recovery-path tests for internal/delegation.loadStoreAt without changing production behavior.
Changes:
- Tests invalid envelope handling during initialization.
- Tests non-
ENOENTstate-file read failures using a directory path. - Verifies failed recovery is marked incomplete and leaves all identity indexes empty.
| File | Description |
|---|---|
| internal/delegation/recovery_test.go | Adds tests covering envelope validation failures and fail-closed recovery when the state path cannot be read. |
Review effort: Lite (adaptive)
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write of any kind leaked through in this run. Part B is INCONCLUSIVE because the gateway's GitHub MCP tool catalog exposes only 23 read-only tools (no write tools present at all), so refusals reflect backend/toolset configuration (
|
Function Analyzed
internal/delegationloadStoreAtWhy This Function?
The repository-wide baseline was 97.7%. The only function below 50% was an intentional no-op logger, so it was excluded.
loadStoreAtwas the lowest-coverage substantive recovery coordinator and had two untested, security-relevant failure paths: invalid envelope initialization and non-ENOENTstate-file read errors.Tests Added
Coverage Report
Test Execution
go test ./internal/delegation -run TestLoadStoreAt_FailsClosedOnInitializationAndReadErrors -v— passedgo test -race ./internal/delegation -run TestLoadStoreAt_FailsClosedOnInitializationAndReadErrors— passedgo test ./internal/delegation -coverprofile=...— passed; target at 100.0%go test -coverprofile=... ./...— passed; overall 97.7%go vet ./...— passedmake agent-finished— Go format/build/lint-stage/unit/integration checks passed; Rust guard tests were blocked because the sandbox cannot fetch the uncachedserdecrate due the crates.io certificate mismatch, and offline mode confirmed it is not cached.No production code or behavior 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.