Add boundary carry-in tests for /activity/stats and /activity/daily-status#797
Merged
Merged
Conversation
…tatus 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
Recurring test-enforcer maintenance run. Local suite was green at start (check ✓, unit 2281+232+51 ✓, E2E 168 pass/13 skip ✓), so this run closes the highest-value coverage gap identified by the prior run's
next_focus.handleStatsandhandleDailyStatusboth route throughloadScopedActivityEvents(apps/server/src/server/activity-query.ts), which merges an in-range query with aDISTINCT ON (agent_id) … WHERE created_at < rangeStart ORDER BY created_at DESCboundary query to carry in each agent's latest pre-range event, then clamps its duration to the range start. That carry-in logic had boundary coverage forworking-time-by-project(#787) but zero coverage for these two other consumers.Tests added (4)
doneaccrues 0)daily-statusassertions sum working duration across day buckets rather than asserting bucket keys, becausecomputeDailyStatusbuckets by server-local date — the summed clamped total is timezone-independent, avoiding CI flakiness.Validation
pnpm run check✓pnpm run test✓ — server 2285 pass (was 2281, +4), web 232, browser-ext 51, all greenpnpm run test:e2e✓ (baseline) — 168 pass / 13 skip; no product code changed so E2E is unaffectedTest-only change.
🤖 Generated with Claude Code