Skip to content

fix(implement-task): add symbol dedup and null guard guidance - #269

Open
ruromero wants to merge 1 commit into
RHEcosystemAppEng:mainfrom
ruromero:TC-5516
Open

fix(implement-task): add symbol dedup and null guard guidance#269
ruromero wants to merge 1 commit into
RHEcosystemAppEng:mainfrom
ruromero:TC-5516

Conversation

@ruromero

@ruromero ruromero commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add Symbol deduplication subsection to Step 6 — requires searching the target package for existing constants, enums, and type aliases before declaring new ones
  • Add Defensive property access on external data bullet to Code quality practices — requires null/undefined guards when consuming data from external modules
  • Add eval cases 12 and 13 with fixture files to cover the new behaviors

Implements TC-5516

Summary by Sourcery

Strengthen implement-task workflow guidance around reusing existing symbols and defensively handling external data, and add eval coverage for these behaviors.

Documentation:

  • Add symbol deduplication guidance requiring searches for existing constants, enums, and type aliases before introducing new declarations.
  • Document defensive property access expectations when consuming nullable or optional data from external modules or APIs.

Tests:

  • Add new implement-task eval scenarios, with synthetic Jira task fixtures, to validate symbol deduplication and defensive handling of external ingest results.

…access guidance

Add two new quality guidelines to Step 6:

- Symbol deduplication: search the target package for existing constants,
  enums, and type aliases before declaring new ones to prevent duplication
  across sibling modules.
- Defensive property access: add null/undefined guards when consuming data
  from external modules, using language-idiomatic patterns.

Add eval cases 12 and 13 with fixtures to cover the new behaviors.

Implements TC-5516

Assisted-by: Claude Code
@sourcery-ai

sourcery-ai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds new guidance to the implement-task skill for symbol deduplication and defensive handling of external data, and extends the eval suite with two synthetic tasks that validate these behaviors.

Flow diagram for symbol deduplication guidance

flowchart TD
  A[Need new constant/enum/type alias] --> B[Search target package for symbol using find_symbol / search_for_pattern / Grep]
  B --> C{Existing definition found?}
  C -->|Yes| D[Import and reuse existing symbol]
  D --> E[If not exported, decide to export or inline per reuse_over_duplication]
  C -->|No| F[Declare new symbol in shared utilities/constants or local file]
Loading

File-Level Changes

Change Details Files
Add explicit symbol deduplication guidance to the implement-task workflow.
  • Introduce a new "Symbol deduplication" subsection under Step 6 that describes searching the target package for existing constants/enums/type aliases before adding new ones.
  • Specify concrete search tools and patterns (find_symbol, search_for_pattern, grep) and name/value variations to consider.
  • Clarify reuse vs. declaration behavior when an existing symbol is found or not found, including where new symbols should live.
  • Provide an inline example around reusing an existing SEVERITY_ORDER constant instead of redefining it.
plugins/sdlc-workflow/skills/implement-task/SKILL.md
Strengthen code quality guidance around defensive property access on external data.
  • Add a new bullet under code quality practices requiring null/undefined guards when accessing nested properties from external modules or APIs.
  • Tie the guidance directly to module boundaries and evolving schemas, highlighting risk of partial/nullable data.
  • Give language-specific idiomatic guard patterns (JS/TS optional chaining, Rust Option handling, Python getattr with default).
  • Include a concrete example of guarding access to a nullable cves array before using its members or length.
plugins/sdlc-workflow/skills/implement-task/SKILL.md
Extend implement-task evals with new synthetic tasks covering symbol deduplication and defensive external data handling.
  • Add eval case describing a task that consumes nullable Option-based fields from an ingestor output, requiring defensive handling and sensible defaults.
  • Add eval case describing a task that must reuse an existing SEVERITY_ORDER constant from a sibling advisory module rather than redefining it.
  • Define repository, target branch, files to modify/create, implementation notes, acceptance criteria, and test requirements for both tasks to drive automated evaluation of the new guidance.
evals/implement-task/evals.json
evals/implement-task/files/task-external-data.md
evals/implement-task/files/task-symbol-dedup.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In the new “Symbol deduplication” section, consider clarifying what constitutes the “target package” (e.g., crate, npm package, monorepo subtree) so users know the exact search scope for find_symbol/grep.
  • For the “Defensive property access on external data” guidance, it may help to explicitly distinguish between data crossing module boundaries inside the same repository versus true external APIs, as the level of required defensiveness can differ and this nuance could avoid over-guarding internal, well-typed interfaces.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the new “Symbol deduplication” section, consider clarifying what constitutes the “target package” (e.g., crate, npm package, monorepo subtree) so users know the exact search scope for `find_symbol`/grep.
- For the “Defensive property access on external data” guidance, it may help to explicitly distinguish between data crossing module boundaries inside the same repository versus true external APIs, as the level of required defensiveness can differ and this nuance could avoid over-guarding internal, well-typed interfaces.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Eval Results

implement-task Eval Results

Skill version: 0.13.8

Per-Eval Results

Eval Name Assertions Passed Failed Pass Rate
1 Standard task 10 9 1 90.0%
2 Incomplete task 5 5 0 100.0%
3 Task with reuse 6 6 0 100.0%
4 Adversarial task 6 6 0 100.0%
5 Feature branch 7 7 0 100.0%
6 Digest match 4 4 0 100.0%
7 Digest mismatch 5 5 0 100.0%
8 Private reuse 5 5 0 100.0%
9 Dead parameter 5 5 0 100.0%
10 Sibling override 5 5 0 100.0%
11 Query scope 5 5 0 100.0%
12 Symbol dedup 5 5 0 100.0%
13 External data 5 5 0 100.0%

Failed Assertions

Eval 1 — Standard task (1 failed)

Assertion: The plan mentions checking for a description digest comment (Step 1.5) and notes that when no digest is found, it proceeds with a warning rather than blocking execution (backward compatibility per shared/description-digest-protocol.md)

Evidence: plan.md Step 1.5 mentions checking for a description digest: 'Would fetch issue comments via jira.get_issue_comments(TC-9201) and look for digest comment starting with [sdlc-workflow] Description digest:'. However, the plan does NOT note the backward-compatible behavior of proceeding with a warning when no digest is found. It only says '(Skipped per eval instructions -- no external tool calls.)' without describing the fallback behavior. The assertion requires the plan to explicitly state that missing digest results in a warning rather than blocking, which is absent.

Aggregate

Metric Mean Stddev
Pass rate 0.992 0.027
Time (seconds) 133.35 43.89
Tokens 39,599 2,899

Baseline Comparison

Baseline: 0adea80

Metric Baseline Current Delta
Pass rate 0.943 0.992 +0.049 (+5.2%)
Time (seconds) 93.63 133.35 +39.72 (+42.4%)
Tokens 31,348 39,599 +8,251 (+26.3%)

Note: The baseline had 7 evals; this run has 13 evals (6 new eval cases added). Time and token increases are expected due to the expanded eval suite. Pass rate improved from 94.3% to 99.2%.


Generated by sdlc-workflow v0.13.8

@ruromero

ruromero commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

[sdlc-workflow/verify-pr] Re: @sourcery-ai[bot] review — Classified as suggestion (2 items):

  1. "Clarify target package scope" — this proposes a documentation clarification. CONVENTIONS.md has no convention requiring term definitions in SKILL.md files, and no codebase pattern establishes this as a required practice. No sub-task created.

  2. "Distinguish internal vs external module boundaries" — this proposes refining the defensiveness guidance scope. CONVENTIONS.md has no convention about distinguishing internal vs external boundaries. No sub-task created.

@ruromero

ruromero commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Verification Report for TC-5516 (commit d9d5df8)

Check Result Details
Review Feedback PASS 2 suggestions from sourcery-ai[bot]; no code change requests
Root-Cause Investigation N/A No sub-tasks created
Scope Containment WARN 3 eval files out-of-scope (evals/implement-task/*) but justified as test coverage for the new SKILL.md guidance
Diff Size PASS 168 insertions across 4 files; proportionate for 2 guidance subsections + eval fixtures
Commit Traceability PASS Commit d9d5df8 references "Implements TC-5516"
Sensitive Patterns PASS No secrets detected in 176 added lines
CI Status PASS All 5 checks passed (Eval PR Run, Plugin Validation, Skill Lint, Sourcery review, Trigger Eval Dispatch)
Acceptance Criteria PASS 2/2 criteria met
Test Quality PASS Eval Quality: 98.7% (77/78 assertions); eval-1 failure is pre-existing/stochastic (baseline grading.json shows 10/10); new evals 12-13 at 100%
Test Change Classification N/A No test files in PR
Verification Commands N/A None specified in task

Overall: WARN

Scope Containment is WARN due to 3 eval files not listed in the task's Files to Modify section. These files (evals.json, task-symbol-dedup.md, task-external-data.md) are eval fixtures that directly test the new SKILL.md guidance and were added per user request during implementation. No task-specified files are missing.


This comment was AI-generated by sdlc-workflow/verify-pr v0.13.8.

@ruromero
ruromero requested a review from mrizzi August 5, 2026 09:24
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.

1 participant