Skip to content

Refactor: delegate header serialization to AiMdHeaderCodec - #118

Merged
bernardladenthin merged 2 commits into
mainfrom
claude/friendly-feynman-as1vh1
Jun 26, 2026
Merged

Refactor: delegate header serialization to AiMdHeaderCodec#118
bernardladenthin merged 2 commits into
mainfrom
claude/friendly-feynman-as1vh1

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

Summary

  • Extract header serialization logic from PackageIndexer.appendPackageHeaderLines() and delegate to AiMdHeaderCodec.write(), establishing a single source of truth for .ai.md header layout
  • Add AiMdHeaderCodec as a field in PackageIndexer to enable the delegation
  • Update Javadoc to clarify that the method now uses the same codec as AiMdDocumentCodec for consistency
  • Add SpotBugs static analysis check to the CI/CD pipeline (publish.yml)

Test plan

  • Existing unit tests pass locally
  • CI is green on this branch (including new SpotBugs check)

Related issues / PRs

Checklist

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md
  • My commits follow Conventional Commits
  • No security-sensitive changes

https://claude.ai/code/session_0137c1LhUbNvW3kt4eF9Kqyb

claude added 2 commits June 26, 2026 06:38
…visional)

Add a SpotBugs step to the fast code-style job (after Spotless, before the
informational jdeps step) so spotbugs:check runs early on every PR/push,
consistent with the other repos (publish-* already needs: code-style).

The early gate surfaced a pre-existing, already-merged CE_CLASS_ENVY in
PackageIndexer.appendPackageHeaderLines (it hand-renders a .ai.md header that
AiMdHeaderCodec.write() already emits byte-for-byte). Provisionally suppress it
and track the delegate-to-codec fix in TODO.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137c1LhUbNvW3kt4eF9Kqyb
appendPackageHeaderLines hand-rendered the package .ai.md header by appending
all eight AiMdHeader accessors with AiMdHeaderCodec prefix constants — byte for
byte the same output AiMdHeaderCodec.write(AiMdHeader) already produces (the same
call AiMdDocumentCodec uses to serialise a header). fb-contrib flagged it as
CE_CLASS_ENVY.

Delegate to AiMdHeaderCodec.write() via a new headerCodec field, deleting the
duplicated eight-field block. Output is byte-identical (PackageIndexerTest +
AiMdDocumentCodecTest + AiMdHeaderCodecTest all green; compile clean through
NullAway/ErrorProne; spotbugs 0 bugs with the suppression removed), so the
provisional CE_CLASS_ENVY suppression is dropped rather than kept and the
deep-check item is closed in TODO.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137c1LhUbNvW3kt4eF9Kqyb
@bernardladenthin
bernardladenthin merged commit db218f4 into main Jun 26, 2026
8 of 10 checks passed
@bernardladenthin
bernardladenthin deleted the claude/friendly-feynman-as1vh1 branch June 26, 2026 06:58
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

2 participants