refactor: retire internal/logger; route scan observations through diagnostics#49
Merged
Merged
Conversation
…gnostics
The legacy debug logger (internal/logger.DebugLogf / UnsupportedTypeKind) and
the dead slog logger on common.Builder predated the diagnostics system and were
strictly less useful than it: unstructured, position-less, and written to
stdout/stderr regardless of whether the caller wanted them.
This removes that machinery and folds its genuinely-useful output into the
single Options.OnDiagnostic surface:
- pure control-flow trace and totally-normal drops (unexported field,
swagger:ignore, anonymous field, untagged type) are deleted outright;
- "I dropped your config-filtered package/route" becomes a Hint
(scan.ignored-by-rules / scan.ignored-by-tag);
- "I cannot model this Go type" becomes a Warning
(validate.unsupported-go-type) — this closes a real gap, as those
warnings previously escaped OnDiagnostic entirely;
- four stray log.Printf("WARNING...") lines (DeclForType/PkgForType
defaults, swagger:model/response malformed names, swagger:enum with no
values) are likewise routed through diagnostics.
Production code now makes zero writes to stdout/stderr, keeping codescan
embeddable in a TUI or a WASI/WASM host.
Options.Debug is retained as a documented deprecated no-op for API
compatibility. The diagnostic surface needed by OnDiagnostic callers is
re-exported at the root (Diagnostic / Severity / Code aliases + Severity*
constants) so consumers need not import internal packages.
Zero golden drift: diagnostics never alter the emitted spec.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (79.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #49 +/- ##
==========================================
+ Coverage 81.89% 81.98% +0.09%
==========================================
Files 80 79 -1
Lines 7468 7440 -28
==========================================
- Hits 6116 6100 -16
+ Misses 1007 994 -13
- Partials 345 346 +1 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The legacy debug logger (internal/logger.DebugLogf / UnsupportedTypeKind) and the dead slog logger on common.Builder predated the diagnostics system and were strictly less useful than it: unstructured, position-less, and written to stdout/stderr regardless of whether the caller wanted them.
This removes that machinery and folds its genuinely-useful output into the single Options.OnDiagnostic surface:
Production code now makes zero writes to stdout/stderr, keeping codescan embeddable in a TUI or a WASI/WASM host.
Options.Debug is retained as a documented deprecated no-op for API compatibility. The diagnostic surface needed by OnDiagnostic callers is re-exported at the root (Diagnostic / Severity / Code aliases + Severity* constants) so consumers need not import internal packages.
Zero golden drift: diagnostics never alter the emitted spec.
Change type
Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update
Short description
Fixes
Full description
Checklist