Skip to content

refactor: retire internal/logger; route scan observations through diagnostics#49

Merged
fredbi merged 1 commit into
go-openapi:masterfrom
fredbi:feat/diagnostics-over-logger
Jun 21, 2026
Merged

refactor: retire internal/logger; route scan observations through diagnostics#49
fredbi merged 1 commit into
go-openapi:masterfrom
fredbi:feat/diagnostics-over-logger

Conversation

@fredbi

@fredbi fredbi commented Jun 21, 2026

Copy link
Copy Markdown
Member

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.

Change type

Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update

Short description

Fixes

Full description

Checklist

  • I have signed all my commits with my name and email (see DCO. This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change.

…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>
@fredbi fredbi changed the title refactor: retire internal/logger; route scan observations through dia… refactor: retire internal/logger; route scan observations through diagnostics Jun 21, 2026
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.66102% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.98%. Comparing base (795e662) to head (d406387).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
internal/builders/schema/schema.go 52.63% 8 Missing and 1 partial ⚠️
internal/builders/schema/allof.go 0.00% 2 Missing ⚠️
internal/builders/schema/embedded.go 75.00% 1 Missing ⚠️

❌ 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.
📢 Have feedback on the report? Share it here.

@fredbi fredbi merged commit b1ce919 into go-openapi:master Jun 21, 2026
20 of 21 checks passed
@fredbi fredbi deleted the feat/diagnostics-over-logger branch June 21, 2026 22:32
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