Repository navigation
feat: name the app's state machines and fix the shared patterns behind their bugs (2.36.0) - #286
Merged
Merged
Conversation
…d their bugs (2.36.0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
An audit of the whole repo found about 130 implicit state machines: lifecycles spread over booleans, nullables and flag combinations instead of one named state. They are now listed in
docs/STATE_MACHINES.mdwith their states, owner and known gaps. The real bugs came from a few repeated shapes, so the fixes are shared pieces used everywhere, not local patches._rollup_freshnessalso countsAnalyticsState.published_atpageStatus+RefreshFailedNotice: error only when a read has nothing to show, Retry refetches only failed readsuseStablePeriodDatanever commits a read that failed without dataConfirmDialogphases idle, pending, failed; callers pass the action promisemarkErrorReported; the global fallback waits one task and skips reported errorsnetworkMode: 'always'like queriesuseAiAvailabilityfor chat, Ask AI, weekly recap, Canvas; synchronous in-flight guard inuseChatledger-sync-authentryThe conventions are now a rule in
.claude/rules/shared-patterns.mdand a pointer inCLAUDE.md. No migration, no API shape change. Version 2.36.0.Verified
test_data_health.py), period retry (useStablePeriodData.test.tsx), demo persistence (authStore.test.ts), dialog pending and failed (ConfirmDialog.test.tsx), one toast per failure (queryClient.test.ts).vitest relatedon every changed source file: 85 files, 623 tests pass, plus 6 files, 32 tests after the follow-ups.tsc -b, eslint on all 110 files,pnpm build, pre-commit hooks: clean.Not verified
Held for a decision (listed in the doc)
Recording why a commitment is paused (needs a column), goal pause and cancel, AI funding after a key is removed, sweeping dead usage reservations, showing expired automation tokens.