Skip to content

Keep coverage tools available when the flag read fails - #303

Merged
BaaRai merged 3 commits into
BaaRai:mainfrom
Protonmatter:protonmatter/coverage-flag-error
Nov 17, 2026
Merged

BaaRai merged 3 commits into
BaaRai:mainfrom
Protonmatter:protonmatter/coverage-flag-error

Conversation

@Protonmatter

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • TestCoverageEnabledWithoutTask.
  • A failed coverage read during a planner round leaves record_coverage available.

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 BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

  1. Error paths. TestCoverageEnabledWithoutTask only covers taskID<=0, which returns before any query. Please cover sql.ErrNoRows returning (true, nil) (db/task_scope.go:309-311), a failing query returning (true, err) (db/task_scope.go:312-314), and coverageOn logging and returning true on that error (agent/coverage.go:17-19).

  2. record_coverage stays available. Please add a scenario test: when the flag read fails, the worker tool set still contains record_coverage and list_untested_assets, i.e. DropCoverageTools leaves them in (agent/tools.go:277-284).

  3. Auto-scope writes during an outage. The fail-open also turns on the persistent AddAutoScope writes (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 BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@BaaRai
BaaRai merged commit 4fb29fd into BaaRai:main Nov 17, 2026
5 checks passed
@BaaRai

BaaRai commented Nov 17, 2026

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants