Skip to content

Measure Lapse/Hackatime overlap with Hackatime; keep untracked Lapse time out - #358

Merged
Heliodex merged 7 commits into
prodfrom
main
Nov 24, 2026
Merged

Heliodex merged 7 commits into
prodfrom
main

Conversation

@Heliodex

Copy link
Copy Markdown
Member

Promotes `main` to `prod`.

  • Lapse recordings that name a Hackatime project now have their Hackatime time measured by Hackatime itself, per recording window, clipped to the link's week, and cached on `hackatime_link.cachedOverlap`. The local span intersection is removed.
  • A recording with no project, or another project's name, no longer deducts from a link.
  • A recording on a tracked or deleted entry takes its Hackatime time out without adding journal hours.
  • Migration `20261123T2354_hackatime_overlap` is additive (three nullable columns on `hackatime_link`). The old span columns stay in place.
  • Overlap measurements are empty until the 15-minute hackatime-sync warms them. Until then, affected links report the overlap as unchecked.

Checks run on `main`: `tsc --noEmit`, `bun test src/lib` (779 pass), `verify-contracts` (all pass), biome and oxlint on changed files. `verify-store` (DB-backed) was not run.

Say that only prod auto-deploys in CI comments and audit notes
A journal recording was subtracted from every link in its own phase
whatever project it named, and a recording that named no project at
all was treated the same way. So a devlog with an unnamed timelapse
cancelled Hackatime time on a link it had nothing to do with, and a
recording of one project cancelled another project's time in the same
phase.

windowsForLink now takes only the recordings that name the link's
project, whichever phase or week they were journalled in. A recording
without a project is tracked through its journal entry and is not
deducted from Hackatime. The ledger, the cache warmers and the
contract checks all share that rule.
The overlap between a Lapse recording and a Hackatime link is now measured by Hackatime's own stats for each recording window, instead of by intersecting its spans locally. These columns hold that measurement. The span columns are left in place for the additive-migration rule and are no longer read or written.
…pse time out

A Lapse recording of a sitting names the Hackatime project it was filmed
under. Its Hackatime time is now measured by Hackatime itself: one stats
request per merged recording window, clipped to the week the link counts,
cached per window on hackatime_link.cachedOverlap. The local span
intersection and the span cache are gone.

Which recordings take Hackatime time out has changed:

- Every recording that names a link's project takes its Hackatime time
  out of that link, whatever its entry is: a live devlog, a tracked
  entry, or a deleted one.
- Only a live devlog also claims the sitting's hours in the journal. A
  recording on a tracked or deleted entry therefore removes Hackatime
  time without adding any, because tracked time has to be shown with a
  devlog.
- A recording with no project, or another project's name, touches only
  its own entry.

makerRecordings and recordingsByOwner are the one source for those
recordings, and every total, trail, profile and admin report reads them.
The sync warms the measurements in batches, and attaching a recording
measures it straight away.

The old span columns stay in place (additive migrations), and
no longer read or written.
The sync batch read the week for every project and phase before checking
whether any of its links had a recording to measure. It is now read on
first use, once per batch, so a batch of links with nothing to measure
costs no week lookups.
@Heliodex
Heliodex merged commit bc340d2 into prod Nov 24, 2026
14 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