Skip to content

[spec-enforcer] Enforce specifications for jsonutil, linters, logger#34416

Merged
pelikhan merged 1 commit into
mainfrom
enforce-specs-jsonutil-linters-logger-41530f1b3f2dd91e
May 24, 2026
Merged

[spec-enforcer] Enforce specifications for jsonutil, linters, logger#34416
pelikhan merged 1 commit into
mainfrom
enforce-specs-jsonutil-linters-logger-41530f1b3f2dd91e

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Specification Test Enforcement

This PR updates specification-driven tests for three packages drawn from the round-robin rotation (last_index=89, 10, 11).

Package Tests Changed Spec Sections Covered
pkg/jsonutil 0 (already complete) Public API, Usage Examples, Design Notes
pkg/linters 3 new + 2 updated Public API (Subpackages), Namespace exports, Usage Examples, Design Notes
pkg/logger 1 fixed assertion Public API, Usage Examples, Design Decisions, slog Integration, Thread Safety, Output Destination

Test Derivation

All tests are derived from each package's README.md specification, not from implementation source code. Only minimal source reading was performed — to confirm exported names and signatures.

Changes by Package

pkg/linters — the README documents five subpackages (excessivefuncparams, errormessage, largefunc, osexitinlibrary, ssljson) and a namespace-level compatibility alias (ErrorMessageAnalyzer). The previous spec tests only covered four subpackages and did not exercise the documented alias.

  • Added TestSpec_PublicAPI_ErrorMessageAnalyzer (validates errormessage.Analyzer per the Subpackages table).
  • Added TestSpec_PublicAPI_SSLJsonAnalyzer (validates ssljson.Analyzer per the Subpackages table — previously only indirectly exercised).
  • Added TestSpec_NamespaceExports_ErrorMessageAnalyzer (validates linters.ErrorMessageAnalyzer == errormessage.Analyzer per the Namespace exports table).
  • Extended TestSpec_UsageExample_AnalyzersUsable and TestSpec_DesignDecision_UniqueAnalyzerNames to include all five documented analyzers.

pkg/logger — fixed a tautological assertion in TestSpec_PublicAPI_Printf. The original assertion was:

assert.True(t, strings.HasSuffix(strings.TrimRight(output, "\n"), output[:len(output)-1]) || strings.Contains(output, "+"), ...)

The first half evaluates to HasSuffix(X, X), which is always true when output ends with a single newline, so the assertion never actually verified the documented +<timediff> format. Replaced with the direct check Contains(output, "+").

pkg/jsonutil — existing tests already cover the documented MarshalCompactNoHTMLEscape contract (HTML escaping disabled for &, <, >; trailing newline trimmed; GitHub Actions expression operators preserved). No changes needed.

Spec-Implementation Mismatches

None observed.

Round-Robin State

  • Run mode: round-robin
  • Packages processed this run: jsonutil, linters, logger
  • Next packages in rotation: parser, repoutil, semverutil
  • Total eligible packages: 26 (with README.md)

Auto-generated by Package Specification Enforcer workflow

References:

Generated by 📋 Package Specification Enforcer · ● opu47 13.4M ·

  • expires on May 27, 2026, 11:59 AM UTC

- linters: add spec tests for `errormessage.Analyzer`, `ssljson.Analyzer`,
  and the namespace-level compatibility alias `linters.ErrorMessageAnalyzer`
  documented in the README Subpackages and Namespace exports tables. Extend
  TestSpec_UsageExample_AnalyzersUsable and TestSpec_DesignDecision_UniqueAnalyzerNames
  to cover all five documented subpackages.
- logger: replace the tautological `HasSuffix(stripped, output[:len(output)-1])`
  clause in TestSpec_PublicAPI_Printf with a direct `Contains(output, "+")`
  check, which is what the spec's documented `+<timediff>` format actually
  requires.
- jsonutil: reviewed — existing spec_test.go already fully covers the
  documented `MarshalCompactNoHTMLEscape` contract; no changes needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pelikhan pelikhan merged commit 33fa7ca into main May 24, 2026
@pelikhan pelikhan deleted the enforce-specs-jsonutil-linters-logger-41530f1b3f2dd91e branch May 24, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant