Skip to content

Bound snapshot cache invalidation (codex) - #2352

Merged
numnx merged 1 commit into
feature/CODUX-142-qs-code-quality-performance-audit-6from
task/feature-codux-142-qs-code-quality-performance-au-t03-codex-mr9j5n3h
Jul 6, 2026
Merged

Bound snapshot cache invalidation (codex)#2352
numnx merged 1 commit into
feature/CODUX-142-qs-code-quality-performance-audit-6from
task/feature-codux-142-qs-code-quality-performance-au-t03-codex-mr9j5n3h

Conversation

@numnx

@numnx numnx commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Bound snapshot cache invalidation

Automated task PR opened by Code UX for T03.

📋 Summary

Sprint: Sprint 142 · QS: Code Quality & Performance Audit · Task: T03

Audit and improve Code UX quality and performance by tightening existing hot-path contracts across live snapshots, execution projection, provider telemetry, dashboard render derivation, repository boundaries, MCP validation, guardrails, and documentation.

📝 Full Task Prompt
## Objective
Improve dashboard snapshot cache invalidation by tracking cache keys per project so hot realtime invalidations do not scan every cached project/query key.

## Scope
- Edit `src/app/lifecycle/dashboard-snapshot-cache.ts`
- Edit `src/app/lifecycle/dashboard-snapshot-cache-policy.ts` only if a key parsing helper is needed
- Edit `tests/backend/app/lifecycle/dashboard-snapshot-cache.test.ts`
- Update `docs/architecture/code-quality-performance-contracts.md` cache policy notes if the invalidation contract changes

## Implementation Requirements
1. Add private project-to-cache-key indexes for full execution snapshots, lean execution snapshots, and project stats snapshots inside `DashboardSnapshotCache`.
2. Register keys when setting cache entries and remove them when invalidating a project, invalidating stats, or clearing all caches.
3. Keep `DashboardSnapshotCachePolicy.getProjectExecutionSnapshotCacheKey`, `getProjectStatsCacheKey`, and existing cache key string formats backward compatible unless tests prove a safer helper is needed.
4. Add tests that seed multiple project cache entries, invalidate one project, and assert only that project’s full/lean execution and stats entries are removed while unrelated project entries remain cached.

## Constraints
- Do not change API response shapes for `/api/live`, `/api/execution`, or project stats.
- Preserve lean snapshot source identity behavior so feed-less snapshots do not survive a full snapshot rebuild.
- Keep cache TTL values centralized in `DashboardSnapshotCachePolicy`.
- Avoid broad repository or dashboard-server edits in this task.

## Verification
- Run `pnpm exec vitest run tests/backend/app/lifecycle/dashboard-snapshot-cache.test.ts`.
- Run `pnpm run lint`.
- Success means invalidating one project no longer requires scanning unrelated project cache keys and existing snapshot cache behavior remains compatible.

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.5

⏱️ Timing

Started 2026-07-06 18:05:03 UTC
Finished 2026-07-06 18:07:58 UTC
Duration 2m 54s

📊 Token Usage

Metric Value
Input tokens 65,978
Cached input tokens 413,824
Output tokens 5,057
Total tokens 484,859
Invocations 1
Tool calls 22
Active time 2m 15s

Included usage estimate (subscription/local login): $0.69

🌿 Branch Info

Base: feature/CODUX-142-qs-code-quality-performance-audit-6
Head: task/feature-codux-142-qs-code-quality-performance-au-t03-codex-mr9j5n3h


🤖 Generated by Code UX

@numnx
numnx merged commit 99c2ccf into feature/CODUX-142-qs-code-quality-performance-audit-6 Jul 6, 2026
6 checks passed
@numnx
numnx deleted the task/feature-codux-142-qs-code-quality-performance-au-t03-codex-mr9j5n3h branch July 6, 2026 18:10
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