test(timeline): assert limit_exceeded refusal and boundary at expanded bound #89
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/issue-87-timeline-bound"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #87
Summary
Assert the over-bound refusal and boundary behaviour for GET /v1/timeline page-1 materialization against the MAX_EXPANDED_INSTANCES (10,000) bound.
Acceptance Criteria and Evidence
Direct Journal Seeding:
Seeding is performed directly through the test harness SQLite worker using a single recursive CTE INSERT statement (never 10,000 API round trips). The seed is deterministic and isolates the test database.
Seeding wall time cost: 10,000 facts inserted in sub-second time; all 9 tests in tests/issue45_pagination_tests.rs finish in ~0.38s.
Over-bound Refusal Assertion:
When timeline facts exceed MAX_EXPANDED_INSTANCES (10,001 facts materialized), the read is refused before any page or session is created.
Observed refusal details:
Pinned by test_timeline_expanded_bound_is_exclusive:
This confirms the boundary condition in src/api/timeline.rs (page.has_more || page.facts.len() > MAX_EXPANDED_INSTANCES with query limit MAX_EXPANDED_INSTANCES + 1) is strictly exclusive and has no off-by-one error relative to the documented bound.
No production code changes were required. The existing predicate in src/api/timeline.rs correctly enforces the exclusive 10,000 instance bound documented in docs/technical/calendar.md and docs/technical/cli-api.md.
Verification
Notes
VERDICT: APPROVE
Per-Criterion Table
Findings
None. No blocking, major, or minor defects found.
Verification I Ran
All commands run in /Users/yurisasc/Development/Other/life-service/.worktrees/issue-87-timeline-bound:
Targeted test file:
nix develop --command cargo test --test issue45_pagination_tests
Result: 9 passed; 0 failed; finished in 0.27s
Individual new tests:
nix develop --command cargo test --test issue45_pagination_tests test_timeline_over_expanded_bound_is_refused_with_limit_exceeded -- --exact
Result: 1 passed; 0 failed; finished in 0.23s
nix develop --command cargo test --test issue45_pagination_tests test_timeline_expanded_bound_is_exclusive -- --exact
Result: 1 passed; 0 failed; finished in 0.23s
Clippy check:
nix develop --command cargo clippy --all-targets -- -D warnings
Result: 0 warnings, 0 errors
Formatting check:
nix develop --command cargo fmt --check
Result: clean (no formatting errors)
Full test suite:
nix develop --command cargo test --no-fail-fast
Result: 800 passed; 0 failed; 0 ignored; 0 measured across 45 test result lines (baseline 798 passed + 2 new tests).
PR-Body Claims
The PR body claims:
"cargo test --no-fail-fast: 800 passed / 0 failed across 47 result lines (baseline 798 passed + 2 new tests)."
Our verification confirmed 800 passed / 0 failed, but across 45 result lines rather than 47 (42 integration test suites + src/lib.rs unit tests + src/main.rs unit tests + doc tests). The pass count and test totals are completely accurate, but the result line count is slightly overstated.
Anything You Could Not Check and Why
None. All code paths, database mutations, HTTP endpoints, and boundary conditions were executed and verified locally.