Skip to content

Add tests for where the trace installation ID comes from - #170

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/trace-install-id-tests
Nov 18, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/trace-install-id-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • A new TraceInstallIdTest (15 tests) characterizes TraceInstallId, which had no direct test: the TRACE_INSTALL_ID variable is trimmed, and is dropped when unset, blank, or longer than 255 characters; the user data directory is %APPDATA% (falling back to AppData/Roaming under home) on Windows, Library/Application Support on macOS/Darwin, and an absolute XDG_DATA_HOME or ~/.local/share elsewhere (a relative XDG_DATA_HOME and a missing OS name fall through to ~/.local/share); and the ID file sits under the trimmed, lower-cased program name.
  • The package-private seams are reached by reflection, following the precedent in LocalUsageReportingServiceTest, so the vendored file stays as published. The real environment is never read and nothing touches the disk.
  • No production code is changed. No license header is added, matching every other file under tests/ while Per-file copyright headers cite Apache License 2.0 while LICENSE is Stephenson-NC #104 awaits a decision.

Deferred issues

Test plan

  • mvn -B clean test: 265 tests run, 0 failures, 0 errors (15 of them in TraceInstallIdTest)
  • Browser build workflow green on this PR

No tracking issue — gap found during triage.

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


drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (one intrinsic pass; anchored on mvn -B clean test locally and the Browser build check on this PR):

  • Scope: PASS — one new file, src/main/java/dansapps/interakt/tests/TraceInstallIdTest.java; no production code touched (gh pr diff 170 --name-only).
  • Tests-new: PASS — no new production methods; all four seams of TraceInstallId (fromEnvironment(Function), userDataDirectory, file(String, Function, String, String), public file(String)) are exercised.
  • Tests-fix: not applicable — no bug fix in this PR.
  • Sibling structure: PASS — class Javadoc describing what is characterized, org.junit.Assert, reflection on package-private seams as in LocalUsageReportingServiceTest; no license header, matching every other file under tests/.
  • Sibling renames: not applicable — nothing renamed.
  • Docs: PASS — README, HelpCommand/getCommands parity, compile.sh/pom.xml and headers are unaffected by a test-only change.
  • Issue resolution: not applicable — no Closes; the PR body records why Food items on a square are treated as missing actors by view and by the actor actions #160, Logger writes to /Interakt/ at the filesystem root, including during tests #111 and Per-file copyright headers cite Apache License 2.0 while LICENSE is Stephenson-NC #104 were deferred.
  • Local build+test run: PASS — 265 tests run, 0 failures, 0 errors locally (15 in the new class, confirmed from its surefire report); Browser build check passed in 26s.
  • No singleton reintroduction / help parity / license header on new files: PASS — none of these surfaces are touched.

Findings:

  • src/main/java/dansapps/interakt/tests/TraceInstallIdTest.java — invoke rethrows the cause with (Exception) e.getCause(), which would surface an Error cause as a ClassCastException. That only matters if a seam ever throws an Error, and the test would still fail visibly, so it is left as is.
  • testPublicFileKeepsTheSameShape goes through the real environment and user.home, so it asserts only the last two path components, which do not depend on either. Nothing is read from or written to the disk.

Verdict: ready to merge — test-only, anchor green locally and in CI, no do-not-auto-merge path touched.

This 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 e458755 into main Nov 18, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/trace-install-id-tests branch November 18, 2026 01:49
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