Skip to content

doctor: scope agnix lint to canonical content - #117

Merged
yourconscience merged 1 commit into
mainfrom
fix/doctor-external-lint
Jul 17, 2026
Merged

doctor: scope agnix lint to canonical content#117
yourconscience merged 1 commit into
mainfrom
fix/doctor-external-lint

Conversation

@yourconscience

@yourconscience yourconscience commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Residual from the v0.3.1 funnel retest: fresh-install doctor still exited 1 because agnix linted the fetched external/ upstream clone (mattpocock/skills) alongside canonical content.

doctor now drops agnix findings under external/ and recomputes the summary from the kept diagnostics, noting how many upstream findings were ignored. External sources keep their own dedicated audit check. With this, a brand-new user's first dotagents doctor is green.

Summary by Sourcery

Scope agnix lint results in dotagents doctor to canonical repository content and ignore issues from external upstream clones.

Bug Fixes:

  • Prevent fresh dotagents doctor runs from failing due to agnix findings in fetched external/ upstream clones rather than local content.

Enhancements:

  • Filter agnix diagnostics to exclude files under external/ and recompute summary counts based only on canonical content, while annotating how many external findings were ignored in the doctor output.

Tests:

  • Add unit test verifying that agnix diagnostics from external/ clones are ignored and summary counts are recomputed from remaining findings.

@sourcery-ai

sourcery-ai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

Scopes agnix lint diagnostics in dotagents doctor to canonical repo content by filtering out findings from external/ upstream clones, recomputing the summary, and adding tests around the new behavior and messaging.

Sequence diagram for agnix lint scoping in dotagents doctor

sequenceDiagram
    participant Doctor
    participant agnix
    participant scopeAgnixToCanonical

    Doctor->>agnix: runAgnix(repoRoot)
    agnix-->>Doctor: agnixReport bytes
    Doctor->>Doctor: parseAgnixReport(out)
    Doctor->>scopeAgnixToCanonical: scopeAgnixToCanonical(report)
    scopeAgnixToCanonical-->>Doctor: agnixReport, ignored
    Doctor->>Doctor: agnixDetail(report)
    alt report.Summary.Errors > 0
        Doctor-->>Doctor: return checkResult fail with detail
    else report.Summary.Errors == 0
        Doctor-->>Doctor: return checkResult pass with detail
    end
Loading

Flow diagram for scopeAgnixToCanonical filtering of external diagnostics

flowchart TD
    A[agnixReport input] --> B[iterate diagnostics]
    B --> C{file path
    starts with external/ or
    contains /external/}
    C -->|yes| D[ignored++]
    D --> B
    C -->|no| E[append to kept]
    E --> F{diagnostic level}
    F -->|error| G[summary.Errors++]
    F -->|warning| H[summary.Warnings++]
    F -->|other| I[summary.Info++]
    G --> B
    H --> B
    I --> B
    B --> J[replace report.Diagnostics with kept]
    J --> K[set report.Summary from summary]
    K --> L[return report, ignored]
Loading

File-Level Changes

Change Details Files
Scope agnix lint results to canonical content and adjust doctor check behavior and messaging.
  • Stop treating runAgnix errors as a direct failure trigger; rely on parsed report for status evaluation.
  • Filter agnix diagnostics to exclude files under external/ clones and recompute summary counts from the remaining diagnostics.
  • Augment the agnix check detail message to note how many findings from external/ were ignored and clarify that upstream sources are audited separately.
  • Base pass/fail solely on the recomputed error count, returning a pass result when only external findings were present.
cmd/dotagents/doctor.go
Add unit test coverage for scoping agnix diagnostics away from external clones.
  • Construct an agnixReport containing both external/ and canonical files.
  • Assert that diagnostics from external/ paths are dropped while canonical diagnostics are retained.
  • Verify that the recomputed summary counts and ignored-count match the expected values.
cmd/dotagents/doctor_test.go

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

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 checkAgnix, the error from runAgnix is now ignored, which means genuine failures (e.g., agnix crashing) are treated the same as a clean run; consider preserving or surfacing that error separately from lint findings.
  • The scopeAgnixToCanonical path check only matches external/ and /external/, so files under paths like ./external/... or other variations might slip through; consider normalizing and stripping leading ./ or using a more robust path prefix check.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `checkAgnix`, the error from `runAgnix` is now ignored, which means genuine failures (e.g., agnix crashing) are treated the same as a clean run; consider preserving or surfacing that error separately from lint findings.
- The `scopeAgnixToCanonical` path check only matches `external/` and `/external/`, so files under paths like `./external/...` or other variations might slip through; consider normalizing and stripping leading `./` or using a more robust path prefix check.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d50a4b9716

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/dotagents/doctor.go
Comment on lines +342 to +344
if strings.HasPrefix(normalized, "external/") || strings.Contains(normalized, "/external/") {
ignored++
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep linting delivered direct external skills

When a user still has a non-materialized external skill, which this repo keeps supported via TestLegacyDirectExternalSourceRemainsDeliverableWithoutMaterialization, and the config root is the documented in-place ~/.agents checkout, that delivered skill lives under repoRoot/external/...; this filter drops every agnix diagnostic for it even though expectedSkills still includes non-materialized sources and sync symlinks them into harness skill dirs. The separate external audit only checks risky regex patterns, not agnix’s syntax/frontmatter rules (upstream JSON mode exits nonzero when summary.errors > 0), so malformed direct external skills can now make doctor pass instead of failing.

Useful? React with 👍 / 👎.

@yourconscience
yourconscience merged commit 57d27d6 into main Jul 17, 2026
4 checks passed
@yourconscience
yourconscience deleted the fix/doctor-external-lint branch July 17, 2026 11:06
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