Skip to content

Test UsageReportingService's value handling and no-home path - #76

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/usage-reporting-service-tests
Nov 17, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/usage-reporting-service-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

This is a Stage B (unit-test expansion) cycle. Only characterization tests are added. No production code is changed.

  • Enabled values: only false (any case, with surrounding spaces trimmed) turns reporting off. no, 0, off, disabled and true leave it on, which is what COMMANDS.md documents for USAGE_REPORTING_ENABLED ("Any other value ... leaves reporting on").
  • Version: versionOrUnknown trims the value. null, an empty value, a blank value or the unfiltered @project.version@ placeholder is sent as unknown.
  • Installation ID file: installIdFile resolves to trace-install-id next to the notice marker and returns null when there is no marker.
  • No usable home: defaultNoticeMarker() returns null when user.home is blank or unset. With no marker, there is no installation ID and no first-run notice, but the startup event is still sent, with only the version tag.
  • A CHANGELOG.md [Unreleased] entry is added, following the convention of earlier test-expansion PRs.

The new tests follow UsageReportingServiceTest's existing descriptive naming and stub-server pattern. Its methods don't use the test<Method>_<Scenario> naming, so mixing the two styles in one file was avoided.

Finding filed separately

The no-home test shows that reporting runs with no first-run notice in that case. CONFIG.md/README.md say the notice is always logged on first run. Per the characterization rule, production code is left unchanged and the discrepancy is filed as #75.

Triage and skip reasons

  • README links to a LICENSE file that does not exist #8 (missing LICENSE) is skipped again because choosing a license and copyright holder is a maintainer decision.
  • A Stage A documentation sweep found no drift. README.md, COMMANDS.md, CONFIG.md and USER_GUIDE.md were checked against BackupCommandLineRunner, BackupController, BackupRequest, BackupService, ScheduledBackupService, GitHubService, RateLimitNoticeHandler, UsageReportingService and the application*.properties files. Stage B was chosen instead.

Test plan

  • mvn test -Dtest=UsageReportingServiceTest: 14 run, 0 failures, 0 skipped (5 of them new)
  • mvn test: 235 run, 0 failures, 0 errors, 1 skipped (the skip predates this change)
  • CI Build green on the PR head

No tracking issue: this gap was 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

Lock in that only "false" turns reporting off (any case, trimmed) while
values such as "no", "0" and "off" leave it on, as COMMANDS.md documents;
that the version is trimmed and a blank or missing one becomes "unknown";
that the installation ID file sits next to the notice marker; and that
without a usable home directory no marker, installation ID or first-run
notice exists while the startup event is still sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson
dmccoystephenson merged commit 711c101 into main Nov 17, 2026
2 checks passed
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