feat(implement-task): add query-scope verification for subset-targeted batch operations - #265
Conversation
…d batch operations Add a new self-verification step (Step 9) that checks whether batch operations use appropriately scoped queries. When the task description targets a subset of records (e.g., "all SPDX SBOMs"), the skill now verifies that the query filters at the database level rather than loading all records and discarding irrelevant ones in application code. Also adds constraint 5.14 to docs/constraints.md and an eval scenario (id 11) testing query-scope mismatch detection. Implements TC-5395 Assisted-by: Claude Code
Reviewer's GuideAdds query-scope verification guidance to the implement-task skill, codifies it as a new constraint, and introduces an eval scenario/fixture to test detection of query-scope mismatches in subset-targeted batch operations. Flow diagram for query-scope verification in implement-task self-verificationflowchart TD
TaskDescription[Extract target scope from task description] --> ExtractTargetScope
ImplementationBatchCode[Inspect batch operation query or iteration scope] --> InspectQueryScope
ExtractTargetScope --> CheckScopeMismatch[Check for scope mismatch between target subset and query scope]
InspectQueryScope --> CheckScopeMismatch
CheckScopeMismatch -->|narrower query possible at data source| FlagBroaderQueries[Flag broader queries and document mismatch]
CheckScopeMismatch -->|filter not expressible or intentional broad query| AcceptIntentionalBroadQueries[Accept broad query with documented rationale]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider tightening the wording of constraint 5.14 to explicitly reference the new "Query-scope verification" subsection and the concrete reviewer action expected (e.g., adding a note in the implementation review output), so it's clear how the constraint is satisfied.
- The Query-scope verification step focuses on database queries; if batch operations over other data sources (e.g., in-memory collections or external APIs) should also be covered, consider expanding the guidance to mention those explicitly to avoid ambiguity.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider tightening the wording of constraint 5.14 to explicitly reference the new "Query-scope verification" subsection and the concrete reviewer action expected (e.g., adding a note in the implementation review output), so it's clear how the constraint is satisfied.
- The Query-scope verification step focuses on database queries; if batch operations over other data sources (e.g., in-memory collections or external APIs) should also be covered, consider expanding the guidance to mention those explicitly to avoid ambiguity.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Eval Results
Eval Results: implement-task
| Eval | Passed | Failed | Pass Rate |
|---|---|---|---|
| eval-1 | 9/10 | 1 | 90% |
| eval-2 | 5/5 | 0 | 100% |
| eval-3 | 6/6 | 0 | 100% |
| eval-4 | 6/6 | 0 | 100% |
| eval-5 | 7/7 | 0 | 100% |
| eval-6 | 4/4 | 0 | 100% |
| eval-7 | 5/5 | 0 | 100% |
| eval-8 | 5/5 | 0 | 100% |
| eval-9 | 5/5 | 0 | 100% |
| eval-10 | 5/5 | 0 | 100% |
| eval-11 | 5/5 | 0 | 100% |
Failed Assertions
eval-1: 1 failing assertion
- Assertion: "All files listed in the plan are within the scope defined by the task's Files to Modify and Files to Create sections — no unrelated files are modified (constraint 1.4, 5.1)"
Evidence: "The plan explicitly mentions modifying an out-of-scope file. In Step 6 'Documentation Impact': 'Check docs/api.md for API endpoint listings and add the new GET /api/v2/sbom/{id}/advisory-summary endpoint'. In Step 9 'Documentation currency': 'Update docs/api.md if it lists API endpoints and does not yet include the new endpoint.' The file docs/api.md is not listed in either the Files to Modify or Files to Create sections of the task description. This constitutes planning to modify an unrelated file outside the defined scope."
Pass rate: 99% · Tokens: 47,538 · Duration: 121s
Baseline (5848f115): 100% · 44,165 tokens · 100s
Generated by sdlc-workflow/run-evals v0.13.7
|
[sdlc-workflow/verify-pr] Re: @sourcery-ai[bot] review —
|
Verification Report for TC-5395 (commit c84ea76)
Overall: FAILBlocking issue: Skillsaw CI check fails — Sub-tasks created:
Root-cause task:
This comment was AI-generated by sdlc-workflow/verify-pr v0.13.7. |
…udget Condense the Query-scope verification subsection and Data-flow trace example to bring the estimated token count under the Skillsaw 16,000-token error limit. Implements TC-5437 Assisted-by: Claude Code
Verification Report for TC-5395 (commit a4c02c8)
Overall: PASSAll blocking issues from the previous verification are resolved:
Previously created tasks (from first verification run):
This comment was AI-generated by sdlc-workflow/verify-pr v0.13.7. |
Summary
### Query-scope verificationsubsection to Step 9 (Self-Verification) inimplement-task/SKILL.mdthat checks whether batch operations use appropriately filtered queries when the task description targets a subset of recordsdocs/constraints.mdreflecting the new verification ruletask-query-scope.mdfixture testing detection of query-scope mismatch in a data migration targeting SPDX SBOMsImplements TC-5395
Implements TC-5437
Test plan
/run-evals implement-taskto verify eval 11 passesclaude plugin validate plugins/sdlc-workflowpasses🤖 Generated with Claude Code