Track idle attribution provenance - #3
Merged
Air000000 merged 11 commits intoSep 11, 2026
Conversation
Air000000
marked this pull request as ready for review
September 11, 2026 13:57
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.
Scope
Completes the approved compact Idle attribution design on top of
chore/harden-project-showcasewithout changing its core classification semantics.Behavior
Continue <App>preserves that app's existingLEARN / REST / IGNORErule;LEARN / REST / IDLEvirtual-segment fallbacks when the user cannot reliably attribute the interval to an app;Continue <App> / Away / Other…;Learn / Break / Away;Decide lateris a secondary text action rather than an equal-weight primary button in both the inline prompt and Focus Guard queue.Provenance
app_usage_logsnow stores explicit evidence source:FOREGROUND— observed foreground sampling;IDLE_CONFIRMED— a user-confirmed idle correction, including app attribution and generic Learn/Break/Away decisions.Fresh schemas default new usage rows to
FOREGROUND. Existing databases receive a one-timesourcemigration; known historical idle virtual rows andIdle Confirmed · Previous Approws are backfilled toIDLE_CONFIRMED. Once the column exists, initialization does not rescan or reclassify historical rows.Foreground segment coalescing now requires source equality, so a later observed foreground sample cannot erase the evidence boundary by merging into an adjacent user-confirmed segment.
TDD evidence
The first valid provenance RED reached runtime assertions after fixing an unrelated test-helper lifetime mistake:
IDLE_CONFIRMEDboundary.After the minimum migration/write-boundary implementation, CI #133 passed.
A second RED pinned migration idempotency:
The migration now returns immediately when the
sourcecolumn already exists.Final verification
Current PR HEAD:
7567e02804dbffbe5dbe64e007bb2ea994dc1849CI #137 passed on Windows:
pnpm install --frozen-lockfile✅pnpm run typecheck✅pnpm run build:check✅cargo check --all-targets✅cargo test✅Known pre-existing warnings remain for unused
ForegroundSnapshotin a foreground test import and unusedManagerinlib.rs; this PR does not claim a warning-free build.No independent GitHub review has been submitted yet.
Integration
This PR deliberately targets
chore/harden-project-showcase, notmain. It should only be folded into the parent hardening branch after explicit approval. Parent PR #2 remains Draft and still requires real Windows interactive smoke before any merge tomain.