Skip to content

feat(leave): add bounded leave timer state machine - #21

Draft
Hylfrd wants to merge 1 commit into
masterfrom
codex/prep/prep-leave-timer
Draft

Hylfrd wants to merge 1 commit into
masterfrom
codex/prep/prep-leave-timer

Conversation

@Hylfrd

@Hylfrd Hylfrd commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Scope

Reconstructs the pure leave-timer domain from archived commit 1481ae285ecaeaeddad43df7a76b47d3c99ead39, whose parent is the requested base �c069ea1a159bc439440dee78ec45530cf9b5713.

The state machine provides:

  • monotonic countdown aging through failsafe and other-feature gates
  • active macro generation fencing and fail-closed stale/inactive handling
  • ordered macro-stop then fixed 500 ms disconnect grace period
  • explicit stop/restart cancellation, retryable action-port failures, and idempotent terminal behavior
  • injected clock, status source, and disconnect port for pure tests

Client wiring, settings UI, shared config, antistuck/desync work, and infrastructure files are intentionally outside this product-prep slice.

Upstream anchors

From �acb323fbde3eff94d4f2ee7baacb059d84b8e3a at src/main/java/com/jelly/farmhelperv2/feature/impl/LeaveTimer.java:

  • countdown: original line 57, leaveClock.schedule(FarmHelperConfig.leaveTime * 60 * 1000L)
  • status gates: original lines 86-87, failsafe and other-feature early returns
  • expiry/stop: original lines 88-91, passed check, timer reset, macro disable
  • disconnect: original lines 92-99, 500 ms delayed closeChannel with reason The timer has ended

Verification

  • LeaveTimerTest: 7 tests, 0 failures/errors
  • full est: BUILD SUCCESSFUL
  • full �uild: BUILD SUCCESSFUL
  • dependency provenance: 3 runtime dependencies, 1 platform dependency, Loom 1.17.17

All verification used a worktree-local GRADLE_USER_HOME, --no-daemon, plain console, and warmed offline dependencies.

Composition notes

The future client adapter must supply one coherent status snapshot per tick and enforce the expected macro generation in stopMacro. This PR contains no client integration and is prepared for the D003 merge hold.

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