Add boundary-merge tests for working-time-by-project#787
Merged
Conversation
Four integration tests for the previously smoke-tested boundary-merge path in handleWorkingTimeByProject: range-start clamping, DISTINCT ON picking the latest pre-range event, per-agent merge of interleaved events, and project_dir precedence over agent cwd. Co-Authored-By: Claude Fable 5 <[email protected]>
selfcontained
force-pushed
the
agt_8f52ea2ee777/job-test-enforcer-1b021f03
branch
from
July 17, 2026 02:37
bd0ccc6 to
497e437
Compare
selfcontained
added a commit
that referenced
this pull request
Jul 19, 2026
…tatus (#797) Both handleStats and handleDailyStatus route through loadScopedActivityEvents (apps/server/src/server/activity-query.ts), which merges an in-range query with a `DISTINCT ON (agent_id) ... WHERE created_at < rangeStart ORDER BY created_at DESC` boundary query to carry in each agent's latest pre-range event. That carry-in + range-start clamping logic already had coverage for working-time-by-project (PR #787) but zero coverage for the two other consumers. Adds 4 tests mirroring the working-time-by-project boundary pattern (same fixed Jan-2026 UTC range): - stats: clamps a pre-range working session to the range start (30 min, not 150) - stats: carries in the latest pre-range event, not the earliest (done -> 0) - daily-status: same clamp, asserted by summing working across buckets - daily-status: completed pre-range session accrues no time daily-status assertions sum working duration across day buckets rather than asserting bucket keys, because computeDailyStatus buckets by server-local date; the summed clamped total is timezone-independent, avoiding CI flakiness. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.
Summary
Adds 4 integration tests for the
GET /api/v1/activity/working-time-by-projectboundary-merge path (handleWorkingTimeByProject, apps/server/src/routes/activity.ts), which was previously only smoke-tested:DISTINCT ON ... ORDER BY created_at DESCboundary query)project_dirover agentcwdfor boundary events (COALESCE)Tests use fixed Jan-2026 timestamps and explicit start/end params so agent-creation events at "now" can't contaminate the strict assertions. Also extends the
seedEventhelper with an optionalprojectDirparam.Note: this PR originally also fixed the
prepare-releaseinstall gap, but #786 landed the same fix first, so that hunk was dropped after rebasing.Validation
pnpm run check✅pnpm run test✅ (server 2268 passed, web 224, browser-extension 51)pnpm run test:e2e✅ (168 passed, 13 skipped on full re-run)🤖 Generated with Claude Code