Skip to content

[spec-enforcer] Enforce specifications for logger, parser, repoutil - #31935

Merged
pelikhan merged 1 commit into
mainfrom
spec-enforcer-logger-parser-repoutil-20260513-e716c3165fb441d6
May 13, 2026
Merged

pelikhan merged 1 commit into
mainfrom
spec-enforcer-logger-parser-repoutil-20260513-e716c3165fb441d6

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Specification Test Enforcement

This PR refreshes specification-driven tests for the next packages in the round-robin rotation. All tests are derived from each package's README.md — implementation source was only consulted to confirm exact function signatures and observable contract.

Package Tests Added Tests Updated Spec Sections Covered
logger 0 0 Public API, slog Integration, Thread Safety, Design Decisions
parser 4 1 Public API, Inline Sub-Agents
repoutil 0 0 Public API

Test Derivation

All tests are derived from README.md specifications, not from implementation source code.

  • pkg/logger/spec_test.go — already covers the documented surface (New, Printf, Print, Enabled, NewSlogHandler, NewSlogLoggerWithHandler) plus the documented design decisions (enabled-state-at-construction, stderr output destination, thread-safety). The README does not document any additional public functions. No changes needed.
  • pkg/parser/spec_test.go — expanded coverage to four additional documented functions and recorded a new spec mismatch:
    • TestSpec_PublicAPI_ExtractMarkdownSection: validates documented behavior — extracts a named ## section from markdown; returns an error when the section is missing; stops at the next same-or-higher level heading.
    • TestSpec_PublicAPI_IsWorkflowSpec: validates documented behavior — owner/repo/path[@ref] is a workflowspec; local relative paths (.github/...), shared/ prefixed paths, and single-segment paths are not.
    • TestSpec_InlineSubAgents_GetEngineSubAgentDir: validates documented mapping — claude → .claude/agents, codex → .codex/agents, gemini → .gemini/agents, others → .github/agents.
    • TestSpec_InlineSubAgents_GetEngineSubAgentExt: validates documented mapping — claude/codex/gemini → .md, others → .agent.md.
    • TestSpec_PublicAPI_ExtractFrontmatterFromContent: added a SPEC_MISMATCH note — the README usage example reads result.MarkdownBody, but the actual FrontmatterResult field is Markdown. The observable contract is unchanged; the test continues to target Markdown.
  • pkg/repoutil/spec_test.go — already covers the single documented function (SplitRepoSlug) including all documented error cases (missing separator, empty owner, empty repo, too many separators). No changes needed.

Spec-Implementation Mismatches

New mismatch recorded:

  • parser.FrontmatterResult.MarkdownBody — README usage example references result.MarkdownBody, but the actual struct field is named Markdown. Either the README example should be corrected to result.Markdown or the field could be renamed for consistency.

Preserved mismatches from previous runs apply to packages not touched in this run (notably gitutil.FindGitRoot).

Round-Robin State

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

Auto-generated by Package Specification Enforcer workflow §25798013859

Generated by Package Specification Enforcer · ● 15.7M · ◷

  • expires on May 16, 2026, 12:15 PM UTC

…lowSpec, sub-agent helpers

Derived from pkg/parser/README.md. Adds TestSpec_PublicAPI_ExtractMarkdownSection,
TestSpec_PublicAPI_IsWorkflowSpec, TestSpec_InlineSubAgents_GetEngineSubAgentDir,
and TestSpec_InlineSubAgents_GetEngineSubAgentExt. Also records SPEC_MISMATCH
note on ExtractFrontmatterFromContent (README example uses MarkdownBody, actual
struct field is Markdown).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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