Skip to content

fix: declare the descending action_items created-range composite and select action_items indexes for jit-qa - #13454

Merged
Git-on-my-level merged 1 commit into
mainfrom
codex/jit-qa-action-items-indexes-20260910
Sep 10, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
codex/jit-qa-action-items-indexes-20260910

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Summary

GET /v1/action-items?start_date=…&completed=false orders created_at descending (_apply_action_item_date_filters), but the index registry declared the composite as (completed ASC, created_at ASC, __name__ ASC), which serves only the reverse ordering. The development (default) database happened to carry an undeclared descending composite, so the gap never surfaced there. The isolated jit-qa database, provisioned from the manifest alone, returned 500 FailedPrecondition "The query requires an index" on that read at signed-in app startup, and also on the due-range reads (/v1/action-items?due_start_date=… and /v1/scores) because the bounded JIT QA operator never selected the action_items composites at all while its plan reported "none missing" (measured 2026-09-10, Cloud Run request logs for backend-jit-qa).

Changes:

  • backend/database/firestore_index_registry.py: ACTION_ITEMS_COMPLETED_CREATED_RANGE_QUERY now declares (completed ASC, created_at DESC, __name__ DESC), matching the production query builder. The ascending composite stays in the manifest because another spec declares it; reconciliation is create-only.
  • firestore.indexes.json: regenerated (one new action_items entry).
  • backend/scripts/jit_qa_firestore_index_operator.py: the bounded jit-qa set adds ACTION_ITEMS_COMPLETED_DUE_RANGE_QUERY and ACTION_ITEMS_COMPLETED_CREATED_RANGE_QUERY (14 → 16 composites) so the named QA app's task dashboard and scores reads are served.
  • Tests: the due-range contract test gains the created-range behavioral case (records the real read path's filters/orderings and asserts the manifest declares the descending composite); operator tests updated for the two new requirements.

Not covered: conversation_id + created-range reads have no declared composite either; nothing in the app issues that shape today, so it is left as is rather than adding a speculative index.

Operational note

Merging changes firestore.indexes.json, which queues gcp_firestore_indexes.yml for prod (create-only; the prod GitHub Environment reviewer approves it). The jit-qa database is reconciled separately by dispatching jit_qa_manual_operator.yml with operation=indexes-apply and confirmation=APPLY_JIT_QA_INDEXES.

Failure-Class: FC-undeclared-serving-query-index
Line-Count-Exception: backend/database/firestore_index_registry.py | 1527 -> 1533 | six comment lines explaining why the created-range composite is declared descending; the registry is the single generated-manifest source and cannot be split for one direction fix

🤖 Generated with Claude Code

Review in cubic

…select action_items indexes for jit-qa

The created-range action-items read orders created_at descending, but the
registry declared the composite ascending; databases without an undeclared
descending index (the isolated jit-qa database) failed the read with
FailedPrecondition. The bounded jit-qa operator also never selected the
action_items composites, so /v1/action-items and /v1/scores returned 500 at
signed-in QA app startup while the index plan reported nothing missing.

Failure-Class: FC-undeclared-serving-query-index

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@Git-on-my-level
Git-on-my-level merged commit 816720d into main Sep 10, 2026
51 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/jit-qa-action-items-indexes-20260910 branch September 10, 2026 22:23
Git-on-my-level added a commit that referenced this pull request Sep 10, 2026
…d select the newest-first composite for jit-qa (#13457)

## Summary

Follow-up to #13454. After its indexes were applied to the isolated
`jit-qa` database, `GET /v1/action-items` returned 200 but `GET
/v1/scores` still returned 500 (`FailedPrecondition`): the weekly count
in `get_scores` is
`ACTION_ITEMS_COMPLETED_CREATED_RANGE_QUERY.build(...)` with no
ordering, and Firestore serves that aggregation only from the
**ascending** `(completed, created_at, __name__)` composite. #13454 had
flipped that spec to descending, which is what the newest-first *list*
read needs but not what the count needs, and the ascending composite is
declared by an index-only requirement (`action_items_completed_created`)
the bounded jit-qa operator never selected.

Changes (registry stays truthful for both consumers; the generated
manifest's index set is unchanged, only entry order moves):

- `backend/database/firestore_index_registry.py`:
`ACTION_ITEMS_COMPLETED_CREATED_RANGE_QUERY` is ascending again,
documented as the `get_scores` count aggregation; the newest-first list
composite `(completed ASC, created_at DESC, __name__ DESC)` is now the
index-only requirement `action_items_completed_created_newest_first`,
beside its `action_items_*` siblings.
- `backend/scripts/jit_qa_firestore_index_operator.py`: selects
index-only requirements by identifier and adds
`action_items_completed_created_newest_first` (16 → 17 composites for
jit-qa).
- Tests: contract test adds the scores-count case (ascending composite
declared); operator tests updated.

Verified so far on jit-qa: after #13454's apply, six `/v1/action-items`
reads returned 200 in Cloud Run logs and only `/v1/scores` remained at
500 with the ascending-index suggestion.

Failure-Class: FC-undeclared-serving-query-index
Line-Count-Exception: backend/database/firestore_index_registry.py |
1533 -> 1542 | one new index-only requirement plus its rationale comment
in the single generated-manifest source; not splittable for one
composite

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/13457?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
pull Bot pushed a commit to codingwatching/omi that referenced this pull request Sep 11, 2026
…d select the newest-first composite for jit-qa

get_scores counts completed tasks created in the last week through
ACTION_ITEMS_COMPLETED_CREATED_RANGE_QUERY.build with no ordering, which
Firestore serves only from the ascending composite. BasedHardware#13454 flipped that spec
to descending for the newest-first list read; declare that ordering as an
index-only requirement instead and select it in the bounded jit-qa operator.

Failure-Class: FC-undeclared-serving-query-index

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Sep 11, 2026
…e database (#13464)

## Summary

The isolated `jit-qa` Firestore database is provisioned by the bounded
QA operator, which selected 17 of the 78 registry composites. Every
shared query outside that set returns `FailedPrecondition` on the QA
plane while the plan reports "none missing":

- 2026-09-10: `GET /v1/action-items` and `GET /v1/scores` (closed by
#13454 / #13457 with three more composites)
- 2026-09-11: `POST /v2/chat/materialize-prompts` →
`chat_first_intents.release_due_deferrals` needs `chat_first_deferrals
(account_generation, state, due_at)`, which the registry already
declares as `chat_first_deferrals_due`

The QA app now runs the full shared desktop path for real working days,
so adding composites one measured failure at a time costs a PR plus an
apply run per path. The registry is exactly the set production is
reconciled against, so the operator now selects all of it. Project,
database, confirmation, and the QA-only single-field target are
unchanged, and `firestore.indexes.json` is untouched (no prod
reconciliation run is queued by this change).

## Verification

- `backend/tests/unit/test_jit_qa_firestore_index_operator.py` and
`test_action_items_due_range_index_contract.py`: 28 passed
- After merge: dispatch `jit_qa_manual_operator.yml`
`operation=indexes-apply` and confirm the deferral query serves on
jit-qa

Failure-Class: FC-undeclared-serving-query-index

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/13464?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
huiyuansun28-cmyk added a commit to huiyuansun28-cmyk/omi that referenced this pull request Sep 15, 2026
@huiyuansun28-cmyk

Copy link
Copy Markdown
Contributor

PR: #14044

AUTO (AI Agent). Authorship disclosed.

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.

2 participants