headroom/crates/headroom-core/tests
JD Davis f236ef2e31
test(ccr): cross SQLite max lifetime boundary (#2794)
## Description

Fixes the failing Rust test on `main` after #2669 made SQLite CCR
entries valid at the exact TTL boundary. The integration test waited
only 3.3 seconds for a three-second ceiling; unix-second truncation can
represent that as exactly three seconds, so the entry is correctly still
valid. The test now crosses a guaranteed four-second elapsed boundary.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- Extend the max-lifetime test's access loop from four to five 700 ms
gaps.
- Document why four gaps can land on the valid equality boundary and why
five are deterministic.
- Leave production SQLite TTL behavior and defaults unchanged.

## Testing

- [x] Unit tests pass (`cargo test -p headroom-core --test
ccr_backends`)
- [x] Formatting passes (`cargo fmt --all -- --check`)
- [ ] Type checking passes (`mypy headroom`)
- [ ] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
cargo test -p headroom-core --test ccr_backends
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

5 consecutive repetitions of the previously failing test:
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 11 filtered out
```

## Real Behavior Proof

- Environment: macOS, Rust workspace at
`d0a86d409f`
- Exact command / steps: `for iteration in 1 2 3 4 5; do cargo test -q
-p headroom-core --test ccr_backends
sqlite_max_lifetime_caps_sliding_window || exit; done`
- Observed result: all five repetitions passed; the complete 12-test CCR
backend suite also passed.
- Not tested: Redis integration, which is unrelated to this SQLite
timing-only test change.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Screenshots (if applicable)

N/A — test-only timing correction with no UI changes.

## Additional Notes

`cargo clippy -p headroom-core --all-targets -- -D warnings` reaches two
pre-existing warnings in unrelated `code_compressor.rs` and
`log_compressor.rs`; this PR changes neither file and introduces no Rust
code warnings.

Co-authored-by: JD Davis <jd@jds-macbook-air.tail2a279.ts.net>
2026-08-05 08:33:21 -07:00
..
auth_mode.rs fix(proxy/auth): match real Anthropic OAuth token prefix (sk-ant-oat) (#1672) 2026-07-02 14:26:19 -07:00
cache_control.rs fix(rust): A4 — honor cache_control markers; serde_json arbitrary_precision + raw_value 2026-05-02 08:22:10 -07:00
ccr_backends.rs test(ccr): cross SQLite max lifetime boundary (#2794) 2026-08-05 08:33:21 -07:00
ccr_roundtrip.rs feat(rust): add structured prose offload plumbing (#334) (#2378) 2026-07-18 09:53:44 -07:00
code_compressor_parity.rs feat(rust): port CodeCompressor AST compressor to Rust (parity-only) (#1154) 2026-07-27 09:21:57 -07:00
kompress_parity.rs feat(rust): port Kompress ML prose compressor to Rust (parity-only) (#1153) 2026-07-27 08:17:53 -07:00
live_zone_ccr.rs fix: B7 — CCR hardening: persistent backends + always-on tool 2026-05-02 16:52:33 -07:00
live_zone_dispatch.rs fix: B4 — token validation gate + per-content-type byte thresholds 2026-05-02 14:11:15 -07:00
live_zone_thresholds.rs fix: clear CI mypy + rust test failures introduced in eaf5980 2026-05-09 15:05:29 -07:00
live_zone_token_validation.rs fix: B4 — token validation gate + per-content-type byte thresholds 2026-05-02 14:11:15 -07:00
recommendations_loader.rs fix: B5 — TOIN observation-only refactor + per-tenant aggregation key 2026-05-02 16:24:03 -07:00
tokenizer_proptest.rs feat(rust): tokenizer crate with tiktoken-rs + HuggingFace + estimator 2026-04-25 14:22:09 -07:00