Repository navigation
Keep coverage tools available when the flag read fails - #303
Conversation
A missing task stays enabled. A database error is returned to the caller and logged, instead of being treated as a reason to hide the tools.
BaaRai
left a comment
There was a problem hiding this comment.
Thanks for making the fail-open explicit and logged.
Looks good. A missing row and a query error both still mean "enabled" (db/task_scope.go:303-316), the error is now logged by coverageOn (agent/coverage.go:12-22), and the three call sites use the helper (agent/mainagent.go:121, agent/planner.go:476, agent/worker.go:415).
Three test requests (non-blocking):
-
Error paths.
TestCoverageEnabledWithoutTaskonly coverstaskID<=0, which returns before any query. Please coversql.ErrNoRowsreturning(true, nil)(db/task_scope.go:309-311), a failing query returning(true, err)(db/task_scope.go:312-314), andcoverageOnlogging and returningtrueon that error (agent/coverage.go:17-19). -
record_coveragestays available. Please add a scenario test: when the flag read fails, the worker tool set still containsrecord_coverageandlist_untested_assets, i.e.DropCoverageToolsleaves them in (agent/tools.go:277-284). -
Auto-scope writes during an outage. The fail-open also turns on the persistent
AddAutoScopewrites (agent/worker.go:477-481) while the database is failing, including for a task whose coverage is turned off. Please add at least one test for that path, so the behaviour is deliberate rather than a side effect.
…writes. A missing task and a query error both leave the flag on. The worker keeps the coverage tools and still records auto scope when the stored flag is off.
BaaRai
left a comment
There was a problem hiding this comment.
Thanks, the three test requests are covered: the error path returns (true, err), ErrNoRows returns (true, nil), the worker keeps record_coverage and list_untested_assets, and the auto-scope write is pinned on the outage path. Extracting writeIntentAutoScope keeps the behaviour identical. Approved.
list_untested_assets is a planner tool, not a worker tool; the fail-open assertion can only be made against PlannerTools.
|
Merged as 4fb29fd. Thanks for the rework: the three test requests are covered. I pushed one commit to your branch so list_untested_assets is checked on PlannerTools, the set that actually carries it, while record_coverage stays on WorkerTools. |
Summary
CoverageEnabledreturns the read error instead of swallowing it.Test plan
TestCoverageEnabledWithoutTask.record_coverageavailable.