Skip to content

Pin how the server-id: line is matched, and a non-UTF-8 install ID file - #49

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/pin-server-id-line-and-non-utf8-install-id-file
Nov 15, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/pin-server-id-line-and-non-utf8-install-id-file

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Stage B unit-test expansion: two line-reader edges that no test exercised are now pinned. Only tests are added, and no production code is changed.

Summary

  • installId_theServerIdLineNeedsNoSpaceAroundItsColonAndIsCaseSensitive: SERVER_ID_LINE (^server-id\s*:(.*)$) takes its value straight after the colon (server-id:abc), allows whitespace before the colon and tabs around the value, and matches the name exactly (Server-Id:, server_id: and server-ids: are not the line). This differs from a tags: entry, where a:b is treated as a string rather than a pair, so the difference is now recorded by a test rather than left implicit.
  • installIdFile_aFileThatIsNotUtf8IsLeftAloneAndAnInMemoryIdIsUsed: an install ID file holding a valid ID line below an ISO-8859-1 comment fails to decode as UTF-8. build() does not throw, the client stays enabled with an in-memory UUID, the file is left byte for byte, and could not read install ID file is logged at FINE. The code comment in loadOrCreateInstallId names "not UTF-8" as one of the unreadable cases, and until now no test drove it. This is the same fail-to-decode behaviour that An enabled: false in a server-wide config that is not plain UTF-8 is ignored #40 describes for the server-wide file. Here it only costs a stable ID, not an opt-out, so no new issue is filed.

Test plan

  • mvn -B verify locally on Java 21: Tests run: 118, Failures: 0, Errors: 0, Skipped: 0, and both new tests appear in the surefire report
  • CI matrix build (8), build (17), build (21) green

Work selection

Every open issue (#13, #15, #27, #31, #39, #40, #42) is deferred because each asks for a maintainer decision on the opt-out contract, the wire format, or the "Opting out" README wording, which is on the do-not-auto-merge list. A Stage A documentation sweep of README.md, the class and method Javadoc, pom.xml and build.yml against the code found no drift, so this cycle falls back to test expansion.

No tracking issue: these gaps were found during triage.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (performed inline, anchored on CI run 43688279948):

  • Scope: PASS. git diff --stat origin/main shows one file, src/test/java/software/stephenson/trace/TraceClientTest.java, with +43 lines. Nothing under src/main, pom.xml or the README is touched.
  • Tests-new: N/A. No public member is added. The two new tests are characterization tests of existing behaviour.
  • Tests-fix: N/A. No production fix is included, so there is nothing to stash and revert.
  • Sibling structure: PASS. Both tests follow the subject_behaviourInPlainWords naming. The file test uses the existing @TempDir, uniquely named Logger, RecordingHandler and UUID_PATTERN pattern of installIdFile_aWriteThatFailsYieldsAnInMemoryIdAndIsLoggedFine. The parse test sits beside installId_anExistingServerIdIsUsedAndAnUnusableOneIsIgnored.
  • Sibling renames: N/A. Nothing is renamed.
  • Docs: PASS. No behaviour changes. The README claim "a file that exists but cannot be read is never overwritten" and the Javadoc of installIdFromFile are now backed by a non-UTF-8 case, and both still match.
  • Issue resolution: N/A. No Closes, and the gap was found during triage.
  • CI: PASS. build (8), build (17) and build (21) are all green on the PR head. Locally: mvn -B verify on Java 21, Tests run: 118, Failures: 0, and both new tests are listed in the surefire XML.
  • No dependencies / Single file / Java 8: PASS. pom.xml and src/main are unchanged. assertArrayEquals and StandardCharsets.ISO_8859_1 are both available on Java 8, and the build (8) leg confirms it.
  • Never throws / Non-blocking / Environment seam / Version agreement / Opt-out contract: PASS (not touched). No main code changed.

Judgment notes:

  • TraceClientTest.java (installId_theServerIdLineNeedsNoSpaceAroundItsColonAndIsCaseSensitive): server-id:abc is accepted as a value, but YAML would read that line as one plain scalar rather than a key and value. The test deliberately pins the current, lenient behaviour, so any later tightening shows up as a visible test change. Because the leniency only accepts an ID that an operator wrote on purpose, and never touches the opt-out, no issue is filed for it.
  • TraceClientTest.java (installIdFile_aFileThatIsNotUtf8IsLeftAloneAndAnInMemoryIdIsUsed): the test relies on Files.readAllLines using a reporting (not replacing) UTF-8 decoder, which the JDK specifies. If the production code ever moves to a lenient decoder, this test is expected to flip, which is the point.

Summary: a tests-only PR, CI green on all three legs, and nothing on the do-not-auto-merge list is touched.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 990ba7b into main Nov 15, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/pin-server-id-line-and-non-utf8-install-id-file branch November 15, 2026 07:05
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