Skip to content

Add tests for the action record and time partition factories - #165

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/record-factory-tests
Nov 12, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/record-factory-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • ActionRecordFactoryTest is added, with four characterization tests. A record created from an actor is added to persistent data and to that actor. A record loaded from saved data is attached to its actor when the actor exists. A loaded record whose actor is gone is still kept in persistent data, but attached to no one, and nothing is thrown (the "fail silently, this actor is likely dead" branch). A record of a missing actor is not attached to any other actor.
  • TimePartitionFactoryTest is added, with four characterization tests. Both overloads (from a length and from saved data) append to persistent data, the length and timestamp survive the load, partitions keep their creation order, and getSecondsElapsed adds up the lengths of the partitions created.
  • No production code is changed. Neither factory had any direct tests before; other tests only used them as setup.

Work selection

All three open issues are waiting on owner decisions, so this cycle adds tests (Stage B) instead of implementing an issue:

No tracking issue: the coverage gap was found during triage.

Test plan

  • mvn clean test: 214 tests run, 0 failures, 0 errors, BUILD SUCCESS
  • ActionRecordFactoryTest (4) and TimePartitionFactoryTest (4) appear in the surefire output as run and passing
  • Browser build CI is green on this PR

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

ActionRecordFactory and TimePartitionFactory had no direct tests. The
new tests cover both overloads of each, including a loaded action record
whose actor is gone: it is kept in persistent data, attached to no one,
and nothing is thrown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dmccoystephenson

dmccoystephenson commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

Self-review rubric

  • Scope: PASS. The diff adds two new test files under src/main/java/dansapps/interakt/tests/ and nothing else (git diff --stat origin/main: 2 files, +150).
  • Tests-new: PASS (not applicable). No new public production methods were added. Every public method of both factories, all four overloads, is now called directly by a test.
  • Tests-fix: not applicable. No bug fix is in scope, and no production code is changed.
  • Sibling structure: PASS. Both files follow ActorFactoryTest and TimePartitionTest: same package, the factory under test held in a field, a class Javadoc describing the characterized behavior, org.junit.Assert, and no copyright header, like those siblings.
  • Sibling renames: not applicable. Nothing was renamed.
  • Docs: PASS. No doc lists the test classes (only target/surefire-reports mentions them), and no command, build step or licence text changes.
  • Issue resolution: not applicable. There are no Closes references. The PR body explains the gap and why the three open issues were skipped.
  • Local build and tests: PASS. mvn clean test ran 214 tests with 0 failures and 0 errors, and the new classes ran 4 and 4 tests. The Browser build CI check (mvn -B test plus the site build) is green on the PR head.
  • No stale mvn claim, no singleton reintroduction, help/commands parity: PASS (not applicable). pom.xml, compile.sh, README.md, the commands and PersistentData access are all unchanged. The tests build PersistentData with new and pass it to the factories through their constructors.
  • Licence header on new files: PASS. No header was added, so the stale Apache-2.0 text was not copied. The repo-wide header question stays with Per-file copyright headers cite Apache License 2.0 while LICENSE is Stephenson-NC #104.

Judgment notes, no change made

  • src/main/java/dansapps/interakt/tests/TimePartitionFactoryTest.java:57: the expected 4 relies on getSecondsElapsed dividing the 4100 ms total down to whole seconds. That is the current behavior, recorded on purpose, so a future change to rounding will fail this test.
  • src/main/java/dansapps/interakt/tests/TimePartitionFactoryTest.java:32: this overlaps a little with TimePartitionTest#testSaveAndLoadRoundTrip. It is kept because it checks the factory's own job, which is putting the loaded partition into persistent data.
  • src/main/java/dansapps/interakt/tests/ActionRecordFactoryTest.java:65: this pins the current silent handling of a record whose actor is missing. If saved records of dead actors should ever be pruned instead, this test is the one to update.

The tests are coverage only. The anchor is green both locally and in CI, and no do-not-auto-merge path is 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 86e5c27 into main Nov 12, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/record-factory-tests branch November 12, 2026 03:58
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