Skip to content

Tighten execution projection indexes (codex) - #2355

Merged
numnx merged 2 commits into
feature/CODUX-142-qs-code-quality-performance-audit-6from
task/feature-codux-142-qs-code-quality-performance-au-t04-codex-mr9j5nwf
Jul 6, 2026
Merged

Tighten execution projection indexes (codex)#2355
numnx merged 2 commits into
feature/CODUX-142-qs-code-quality-performance-audit-6from
task/feature-codux-142-qs-code-quality-performance-au-t04-codex-mr9j5nwf

Conversation

@numnx

@numnx numnx commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Tighten execution projection indexes

Automated task PR opened by Code UX for T04.

📋 Summary

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

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
Audit and harden the SQL/index contract for project execution snapshots, focusing on bounded slice queries and indexed filters used by live dashboard payload assembly.

## Scope
- Edit `src/repositories/execution/project-execution-snapshot-query.ts`
- Edit relevant slice modules as needed: `src/repositories/execution/execution-sprint-runs-query.ts`, `src/repositories/execution/execution-task-dispatches-query.ts`, `src/repositories/execution/execution-runtime-events-query.ts`, `src/repositories/execution/execution-invocations-query.ts`, `src/repositories/execution/execution-human-intervention-query.ts`
- Edit `src/repositories/db/app-db-migrations.ts` and `src/repositories/db/app-db-schema.ts` only for missing scalar indexes discovered in the owner queries
- Edit `tests/backend/repositories/execution/project-execution-snapshot-query.test.ts` and `tests/backend/repositories/db/app-db-schema.test.ts`
- Update `docs/architecture/code-quality-performance-contracts.md` indexed projection slices section with any new invariant

## Implementation Requirements
1. Review each query used by `queryProjectExecutionSnapshot` and ensure selected-sprint, expanded-run, project-recent, dispatch, runtime-event, invocation, and active-attention reads are visibly bounded and use stable scalar filters.
2. Add any missing `ensureIndex` and base schema index definitions needed by those reads; avoid indexes over prompt text, transcripts, markdown, large JSON blobs, or provider output.
3. Add or extend tests that create older unrelated rows plus active selected-sprint/expanded-run rows and assert snapshot results remain scoped, deduplicated, and capped.
4. Where practical in tests, assert the expected index exists for new migration/schema entries rather than relying on reviewer inspection.

## Constraints
- Do not change `ExecutionDashboardSnapshot` response shape.
- Do not introduce dashboard-side joins or additional polling endpoints.
- Preserve current usage and wall-time enrichment behavior, including deduplicating task and sprint-run IDs before rollups.
- Do not lower or remove existing caps to make tests easier.

## Verification
- Run `pnpm exec vitest run tests/backend/repositories/execution/project-execution-snapshot-query.test.ts tests/backend/repositories/db/app-db-schema.test.ts`.
- Run `pnpm run lint`.
- Success means snapshot projection remains bounded, schema/index tests cover any new indexes, and unrelated historical rows do not leak into live payload slices.

✅ 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:04 UTC
Finished 2026-07-06 18:11:19 UTC
Duration 6m 14s

📊 Token Usage

Metric Value
Input tokens 176,833
Cached input tokens 1,599,744
Output tokens 12,689
Total tokens 1,789,266
Invocations 1
Tool calls 49
Active time 5m 22s

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

🌿 Branch Info

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


🤖 Generated by Code UX

@numnx
numnx merged commit 9a73aaf 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-t04-codex-mr9j5nwf branch July 6, 2026 18:20
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