Skip to content

feat: surface classification_counts in quality and wire analyzer into /gaze report - #281

Merged
jflowers merged 5 commits into
unbound-force:mainfrom
jflowers:opsx/quality-classification-counts
Sep 25, 2026
Merged

jflowers merged 5 commits into
unbound-force:mainfrom
jflowers:opsx/quality-classification-counts

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

Closes #278 — surface the classify_signals classification in gaze quality and wire --analyzer into the default /gaze report.

External analyzers (e.g. Python via snake-eyes) emit classify_signals labels, but those labels were never surfaced: the /gaze Full Mode report derived its Classification Summary from the Go-only gaze analyze --classify, which does not register --analyzer/--language, so external-analyzer projects got a degraded classification section.

This change:

  • Adds an optional classification_counts object (contractual/incidental/ambiguous) to taxonomy.PackageSummary, populated only by the external-analyzer quality path.
  • Tallies side effects by classification label in adapter.BuildQualityFromMappings, deduplicating by side-effect ID.
  • Teaches the gaze-reporter agent to detect the analyzer/language (.gaze.yaml analyzers: map first, project-marker heuristic fallback) and pass --analyzer/--language to crap, quality, and docscan. Full Mode now sources the Classification Summary from classification_counts for external projects instead of the degraded proxy.
  • Makes gaze crap/gaze quality honor --language alone (tier-3 PATH-convention discovery), matching gaze docscan.
  • Declares classification_counts in the QualitySchema and documents it in docs/reference/json-schemas.md.

How to Test

  • go build ./...
  • go test -race -count=1 ./internal/adapter/... ./internal/taxonomy/... ./internal/report/... ./internal/quality/...
  • go test -race -count=1 -short ./cmd/gaze/...
  • go test -race -count=1 ./internal/aireport/... (verifies TestEmbeddedPromptMatchesScaffold — the third embedded prompt copy is byte-identical to the scaffold canonical)

Acceptance scenarios (from the OpenSpec delta):

  • TestCountClassifications — dedupe by ID (1/1/1), unclassified-ignored (1/0/0), nil-when-nothing.
  • TestBuildQualityFromMappings — classification counts 2/1/0 flow into the summary.
  • TestQualitySchema_ValidatesClassificationCounts — schema validates both presence and omission.
  • TestWriteJSON_Structure — Go-native JSON omits classification_counts.
  • TestCrapWithLanguageOnly_TriggersExternalPath — --language alone routes to the external path.

How to Demo

  1. Point gaze quality --analyzer <binary> --language python (or a .gaze.yaml with analyzers: {python: {command: snake-eyes, args: ["--stdio"]}}) at a project with an external analyzer that reports classify_signals.
  2. Inspect the JSON output: quality_summary now contains "classification_counts": {"contractual": N, "incidental": N, "ambiguous": N}.
  3. Run /gaze Full Mode on an external-analyzer project: the Classification Summary is now sourced from classification_counts rather than a Go-only fallback.

Key Files Changed

  • internal/taxonomy/types.go — ClassificationCounts struct + classification_counts,omitempty pointer field on PackageSummary.
  • internal/adapter/quality.go — countClassifications helper; BuildQualityFromMappings populates the summary.
  • internal/adapter/quality_internal_test.go — tally + summary tests.
  • cmd/gaze/main.go — runCrap/runQuality honor --language alone; language-specific initExternalSession error.
  • cmd/gaze/external_analyzer_test.go — --language-only external-path regression test.
  • internal/report/schema.go / internal/report/report_test.go — classification_counts schema property + validation test.
  • internal/quality/quality_test.go — Go-native omission assertion.
  • internal/scaffold/assets/agents/gaze-reporter.md, .opencode/agents/gaze-reporter.md, internal/aireport/assets/agents/gaze-reporter.md — analyzer/language detection + Full Mode classification sourcing (three byte-identical copies).
  • internal/scaffold/assets/commands/gaze.md, .opencode/commands/gaze.md — /gaze command description update.
  • docs/reference/json-schemas.md — classification_counts field documented.
  • openspec/changes/quality-classification-counts/ — proposal, design, spec, tasks.

Known Issues

The following findings from the review council were acknowledged but not resolved:

  • HIGH: Website Documentation Gate — a docs: issue must be filed in unbound-force/website for the classification_counts field and /gaze external-analyzer classification sourcing before this PR merges.
  • LOW: runReport (cmd/gaze/main.go) still gates external dispatch on --analyzer only (pre-existing, out of scope for this change).

This PR was generated by /uf.finale (AI-assisted).

… /gaze report

- Add ClassificationCounts to taxonomy.PackageSummary (omitempty, external-only)
- Tally classification_counts in adapter.BuildQualityFromMappings (dedup by effect ID)
- Teach gaze-reporter analyzer/language detection and external classification sourcing
- Sync third embedded prompt copy and document the JSON schema field
- Dispatch crap/quality external path on --language alone, matching docscan

Assisted-by: deepseek-v4-pro
Generated with AI assistance (deepseek-v4-pro)
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:38 PM UTC · Completed 4:59 PM UTC

Commit: d0a4531 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $10.18

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Sep 24, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk, consistent with prior assessment. The raw file count (22) and lines changed (1013) appear elevated, but the effective footprint is smaller: 4 files are OpenSpec artifacts, 3 files are byte-identical copies of the same gaze-reporter prompt update, and ~190 lines are spec/documentation. The actual Go production code change is ~90 lines. cmd/gaze/main.go remains a high-churn hotspot warranting scrutiny, but the modifications are narrow. No protected paths, no CI/dependency changes, no security-sensitive files.

Previous run

Risk Assessment: moderate (2/5)

Details

Moderate risk, consistent with prior assessment. The raw file count (22) and lines changed (927) appear elevated, but the effective footprint is smaller: 4 files are OpenSpec artifacts, and 3 files are byte-identical copies of the same gaze-reporter prompt update. The actual Go production code change is ~80 lines. cmd/gaze/main.go remains a high-churn hotspot warranting scrutiny, but the modifications are narrow. No protected paths, no CI/dependency changes, no security-sensitive files.

Previous run (2)

Risk Assessment: moderate (2/5)

Details

Moderate risk. The raw file count (19) and lines changed (896) appear elevated, but the effective footprint is smaller: 5 files are OpenSpec artifacts, and 3 files are byte-identical copies of the same agent prompt update. The actual Go production code change is ~80 lines. cmd/gaze/main.go is a high-churn hotspot warranting scrutiny, but the modifications are narrow. No protected paths, no CI/dependency changes, no security-sensitive files.

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review

Findings

Medium

  • [stale-docs] docs/reference/cli/report.md:23 — The Flags table for gaze report does not document --analyzer or --language, even though the command registers both flags. This PR adds these flags to crap.md and quality.md flag tables but omits report.md, creating an inconsistency across the CLI reference docs.
    Remediation: Add --analyzer and --language rows to the docs/reference/cli/report.md flags table, matching the descriptions used in crap.md.

Low

  • [test adequacy] cmd/gaze/external_analyzer_test.go:498 — TestQualityWithExternalAnalyzer_RejectsTarget and TestQualityWithExternalAnalyzer_RejectsAIMapper only exercise the --analyzer path (analyzerFlag: "some-analyzer"). They do not test the --language-only path (languageFlag set, analyzerFlag empty) despite the error messages being updated to mention "--analyzer or --language". Since runQuality now dispatches to runQualityWithExternalAnalyzer when either flag is set, the rejection logic is reachable via --language alone but untested.
    Remediation: Add subtests or separate test cases that set languageFlag without analyzerFlag and verify the same rejection errors for --target and --ai-mapper.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run

Review

Findings

Medium

  • [stale-docs] docs/reference/cli/report.md:23 — The Flags table for gaze report does not document --analyzer or --language, even though the command registers both flags. This PR adds these flags to crap.md and quality.md flag tables but omits report.md, creating an inconsistency across the CLI reference docs.
    Remediation: Add --analyzer and --language rows to the docs/reference/cli/report.md flags table, matching the descriptions used in crap.md.

Low

  • [error message accuracy] cmd/gaze/main.go:1265 — The flag validation error messages in runQualityWithExternalAnalyzer say "not supported with --analyzer" but the function is now also reached when only --language is set. A user passing --language python --target MyFunc sees an error referencing --analyzer, which they never specified. The docs and README were updated to say "not available with --analyzer or --language" but the error messages were not.
    Remediation: Change the error messages to say "not supported with --analyzer/--language" or conditionally phrase them based on which flag is set.

  • [consumer completeness] cmd/gaze/main.go:2070 — runReport was not updated to honor --language alone for external dispatch, unlike runCrap and runQuality which now check p.analyzerFlag != "" || p.languageFlag != "". This is pre-existing behavior acknowledged in the PR body as out of scope for this change.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (2)

Review

Findings

Medium

  • [consumer completeness] cmd/gaze/main.go — runReport was not updated to honor --language alone for external dispatch. runCrap and runQuality now check p.analyzerFlag != "" || p.languageFlag != "" (matching runDocscan), but runReport still gates on p.analyzerFlag only at two sites (FindModuleRoot bypass and external pipeline dispatch). Direct CLI users running gaze report --language <lang> will hit a failure. The gaze-reporter agent is unaffected since it invokes crap/quality/docscan individually. This is pre-existing behavior acknowledged in the PR body as out of scope.

  • [stale-docs] docs/reference/cli/crap.md:22 — The Flags table does not document --analyzer or --language, even though both flags are registered on the crap command and this PR makes --language alone trigger the external path. Users consulting the CLI reference will not discover multi-language support for gaze crap.
    Remediation: Add --analyzer and --language rows to the Flags table.

  • [stale-docs] docs/reference/cli/quality.md:41 — The Note states Go-specific flags are "rejected when --analyzer is set," but after this PR --language alone also triggers the external path and the same rejection. A user passing --language python --target Foo will receive an error the docs do not explain.
    Remediation: Change "rejected when --analyzer is set" to "rejected when --analyzer or --language is set."

Low

  • [error-handling-idiom] cmd/gaze/main.go:654 — The two error messages in initExternalSession use different sentence structures: "analyzer %q not found" vs "no analyzer found for language %q". The asymmetry describes distinct failure modes (explicit binary lookup vs PATH-convention discovery), so the phrasing difference is arguably intentional.

  • [GoDoc comment format] internal/taxonomy/types.go:497 — The ClassificationCounts field comments say "classified contractual" — missing "as." Surrounding GoDoc uses complete grammatical constructions; "classified as contractual" would be more fluent.
    Remediation: Change to "classified as contractual," "classified as incidental."

  • [stale-docs] README.md:199 — The Multi-Language Support Note says Go-specific flags are "not available with --analyzer." After this PR, --language alone also triggers the external path and the same restriction.
    Remediation: Update the Note to mention --language alongside --analyzer.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@marcusburghardt marcusburghardt 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.

PR Review: #281 — feat: surface classification_counts in quality and wire analyzer into /gaze report

Verdict: COMMENT

Clean, well-scoped change that surfaces classify_signals classification counts through the external-analyzer quality path and wires analyzer/language detection into the gaze-reporter agent. The core implementation (countClassifications, BuildQualityFromMappings wiring, omitempty pointer design) is correct. All #278 acceptance criteria are satisfied. CI passes across Go 1.24 and 1.25.

Findings

# Finding Severity
1 CLI reference docs don't document --language alone as external-path trigger MEDIUM
2 runReport --language gap (documented D7 deferral, needs follow-up issue) MEDIUM
3 Missing TestQualityWithLanguageOnly_TriggersExternalPath regression test LOW
4 ClassificationCounts sub-type not defined in json-schemas.md LOW

See inline comments for details.

This review was generated by /uf.review-pr (AI-assisted).

Comment thread cmd/gaze/external_analyzer_test.go Resolved
Comment thread cmd/gaze/main.go Resolved
Comment thread docs/reference/json-schemas.md Resolved
…ionCounts sub-type

Addresses PR unbound-force#281 review feedback from @marcusburghardt and
@fullsend-ai-review[bot].

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
…on test

Mirrors TestCrapWithLanguageOnly_TriggersExternalPath to verify runQuality
dispatches to the external analyzer path when only --language is set.

Addresses PR unbound-force#281 review feedback from @marcusburghardt.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
… countClassifications coverage

Addresses PR unbound-force#281 review-council feedback from divisor-testing (The Tester).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:56 AM UTC · Completed 12:12 PM UTC

Commit: 447cf3c · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $9.15

fullsend-ai-review[bot]

This comment was marked as outdated.

fullsend-ai-review[bot]

This comment was marked as outdated.

… errors

Addresses PR unbound-force#281 review feedback from @fullsend-ai-review[bot].

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 1:23 PM UTC · Ended 1:39 PM UTC

Commit: 1bed451 · View workflow run →

@jflowers

Copy link
Copy Markdown
Collaborator Author

Addressed in 1bed451: updated the --target/--ai-mapper rejection errors to not supported with --analyzer or --language, matching the --language-only dispatch path (main.go:1192).

Re: runReport --language gap (finding 2) — pre-existing and out of scope for this PR, already tracked as follow-up issue #282.

@fullsend-ai-review fullsend-ai-review 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.

Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:

  • cmd/gaze/external_analyzer_test.go (file-level): Line 498 · [low] test adequacy

TestQualityWithExternalAnalyzer_RejectsTarget and TestQualityWithExternalAnalyzer_RejectsAIMapper only exercise the --analyzer path (analyzerFlag: "some-analyzer"). They do not test the --language-only path (languageFlag set, analyzerFlag empty) despite error messages being updated to mention "--analyzer or --language". Since runQuality now dispatches to runQualityWithExternalAnalyzer when either flag is set, the rejection logic is reachable via --language alone but untested.

Suggested fix: Add subtests or separate test cases that set languageFlag without analyzerFlag and verify the same rejection errors for --target and --ai-mapper.

@fullsend-ai-review fullsend-ai-review 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.

See the review comment for full details.

@fullsend-ai-review

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:23 PM UTC · Completed 1:39 PM UTC

Commit: 1bed451 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $6.24

@jflowers
jflowers merged commit f3d4dd3 into unbound-force:main Sep 25, 2026
35 checks passed
jflowers added a commit that referenced this pull request Sep 25, 2026
…ionCounts sub-type

Addresses PR #281 review feedback from @marcusburghardt and
@fullsend-ai-review[bot].

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
jflowers added a commit that referenced this pull request Sep 25, 2026
…on test

Mirrors TestCrapWithLanguageOnly_TriggersExternalPath to verify runQuality
dispatches to the external analyzer path when only --language is set.

Addresses PR #281 review feedback from @marcusburghardt.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
jflowers added a commit that referenced this pull request Sep 25, 2026
… countClassifications coverage

Addresses PR #281 review-council feedback from divisor-testing (The Tester).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
@fullsend-ai-retro

fullsend-ai-retro Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 1:44 PM UTC · Completed 1:57 PM UTC

Commit: 1bed451 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $2.17

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #281 — feat: surface classification_counts in quality and wire analyzer into /gaze report

Workflow Overview

PR #281 was a human-authored PR by @jflowers addressing issue #278 — surfacing classify_signals classification counts in gaze quality and wiring --analyzer/--language into the default /gaze report. The PR touched 22 files (+933/−80), including Go production code, OpenSpec artifacts, agent prompts, documentation, and tests. It was merged in ~21 hours after 5 commits and 3 review agent cycles.

Timeline

  1. Sep 24 16:37 — PR opened with initial commit (d0a4531)
  2. Sep 24 16:38–16:59 — Review agent Run 1 ($10.18): CHANGES_REQUESTED with 6 findings (3 medium stale-docs, 3 low)
  3. Sep 24 17:09 — @jflowers responds: declines 2 low-severity style nits as intentional
  4. Sep 25 09:57 — @marcusburghardt posts COMMENT review via /uf.review-pr with 4 findings (2 medium, 2 low)
  5. Sep 25 11:42–11:53 — @jflowers pushes 3 commits addressing marcusburghardt's findings: docs updates (7f3bc36), regression test (14fd0e7), classification counts tests (447cf3c)
  6. Sep 25 11:56–12:12 — Review agent Run 2 ($9.15): CHANGES_REQUESTED with 3 findings (reduced from 6)
  7. Sep 25 13:20 — @jflowers pushes fix for error message accuracy (1bed451)
  8. Sep 25 13:23–13:39 — Review agent Run 3 ($6.24): CHANGES_REQUESTED with 2 findings (1 medium report.md docs, 1 low test adequacy)
  9. Sep 25 13:42 — @jflowers merges PR with outstanding CHANGES_REQUESTED

What Went Well

  • Review quality was strong. The review agent found real documentation gaps (report.md inconsistency), test coverage issues (--language-only rejection path), and error message inaccuracies. All findings were substantive — no false positives wasted human time.
  • Human-triggered and automated reviews were complementary. marcusburghardt's /uf.review-pr review found 4 findings that overlapped with but didn't duplicate the agent's. Both systems converged on the same documentation and test gaps.
  • Human response was thorough. @jflowers addressed 4 of 6 initial agent findings across 4 commits, including a follow-up issue (gaze report: honor --language alone for external analyzer dispatch #282) for the out-of-scope runReport gap.
  • Cost decreased per iteration ($10.18 → $9.15 → $6.24), suggesting the agent worked more efficiently on familiar code.
  • CI passed consistently across all commits — Go 1.24 and 1.25 unit/integration tests, E2E tests, and MegaLinter all green.

Evidence for Existing Issues

Proposals filed

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

Labels

risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surface classify_signals classification in gaze quality and wire --analyzer into the default /gaze report

2 participants