Skip to content

chore(failure-classes): record the second instance of FC-raw-page-limit-before-visibility-filter - #12780

Merged
undivisible merged 2 commits into
BasedHardware:mainfrom
aryanorastar:chore/fc-raw-page-limit-registry-lifecycle
Sep 7, 2026
Merged

undivisible merged 2 commits into
BasedHardware:mainfrom
aryanorastar:chore/fc-raw-page-limit-registry-lifecycle

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

Registry-only lifecycle change. No code, no tests, no behaviour — one JSON file.

Why this is its own PR

FC-raw-page-limit-before-visibility-filter was born in #12712 (chat get_messages) and now has a second recorded instance in #12714 (memories scoring_desc). The definition still describes only the first.

I tried to fold these edits into #12714's merge resolution and scripts/failure-class rejected it, correctly:

instance_fix_mutates_registry: an instance-fix PR must not edit failure-class
definitions except to add or update 'canonical_prevention_artifact' on the
declared class; other registry edits need a separate registry-only lifecycle PR

That rule is worth respecting rather than routing around. An instance PR quietly rewriting shared contract text is how a registry stops meaning the same thing to everyone who greps it. So this is that separate PR.

What changes

violated_contract — names both hidden-row kinds. It currently says "for example reported chat messages", which reads as a chat-specific defect. The memories path hides rows on user_review is False and invalid_at, for the same reason (the predicate cannot be expressed as a Firestore where without dropping legacy documents missing the field, #4498) and with the same consequence.

canonical_prevention — adds what the second instance's review actually established, beyond "scan with a bounded budget":

  • Floor the budget at offset + limit, bound only the slack. Capping the total leaves a deep offset unreachable, so the page returns empty and the caller reads that as end-of-data — the original defect at a deeper boundary.
  • Keep the slack flat, not proportional. A proportional slack gives limit=2 a six-document allowance, too thin to cross a dense run of hidden rows. That one was caught by a reviewer-requested multi-batch test after the proportional version had already shipped to both PRs.

Both are non-obvious and were paid for twice. A canonical prevention that omits them lets the third instance rediscover them.

scope_hints — adds backend/database/memories.py and backend/utils/memory/memory_service.py alongside the chat paths.

evidence_prs — [] → [12712, 12714].

What deliberately does not change

canonical_prevention_artifact still lists only the chat test. #12714 appends the memories test, which is the one field an instance fix owns. Keeping it out of this PR avoids two PRs racing on the same key and leaves the ownership boundary exactly where the validator draws it.

If #12714 merges first, this PR's diff still applies cleanly — the two touch disjoint fields.

Verification

  • python3 -c "import json; json.load(...)" — parses
  • scripts/failure-class validate --pr-body-file — passes
  • Schema keys unchanged; status stays open

Failure-Class: none

Review in cubic

…it-before-visibility-filter

Registry-only. One JSON file, no code and no behaviour change.

The class was born in BasedHardware#12712 for chat get_messages and now has a second recorded
instance in BasedHardware#12714 for the memories scoring_desc path, but the definition still
described only the first.

violated_contract now names both hidden-row kinds. "for example reported chat
messages" reads as a chat-specific defect; the memories path hides rows on
user_review is False and invalid_at, for the same reason -- the predicate cannot
become a Firestore where without dropping legacy documents missing the field
(BasedHardware#4498) -- and with the same consequence.

canonical_prevention gains the two rules the second instance's review actually
established, both non-obvious and both paid for twice:

* Floor the budget at offset + limit and bound only the slack. Capping the total
  leaves a deep offset unreachable, so the page returns empty and the caller reads
  that as end-of-data -- the original defect at a deeper boundary.
* Keep the slack flat rather than proportional. A proportional slack gives limit=2
  a six-document allowance, too thin to cross a dense run of hidden rows. That was
  caught by a reviewer-requested multi-batch test only after the proportional
  version had already shipped to both PRs.

A canonical prevention that omits them lets the third instance rediscover them.

scope_hints adds the memories paths; evidence_prs goes from [] to [12712, 12714].

canonical_prevention_artifact is deliberately untouched -- BasedHardware#12714 appends the
memories test there, which is the one field an instance fix owns. This PR exists
because scripts/failure-class rejected folding these edits into that merge
(instance_fix_mutates_registry), and routing around that rule would defeat it.

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@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 1 file

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

Copy link
Copy Markdown
Member

Verified against the shipped code — this is the registry-only lifecycle change scripts/failure-class demands, and the new text records what both instance fixes actually established.

.github/failure-classes/FC-raw-page-limit-before-visibility-filter.json (the only changed file):

  • violated_contract now names both hidden-row kinds. Matches backend/database/memories.py: _memory_passes_list_visibility drops user_review is False and invalid_at-stamped rows, and its comment explains why that predicate can't become a Firestore where without losing legacy documents missing the field (GET /v3/memories returns 500 when memory record missing 'user_review' field #4498).
  • The two new canonical_prevention constraints are shipped facts, not aspiration: scan_budget = needed + slack with the floor at offset + limit and flat slack exists in both fixes — CHAT_MESSAGES_VISIBLE_PAGE_SCAN_SLACK = 1000 (chat) and _MEMORY_SCORING_VISIBLE_PAGE_SCAN_SLACK = 2000 (memories) — with adjacent comments recording exactly the deep-offset-empty-page and dense-hidden-run failure modes the new sentences capture. The multi-batch dense-run test the description mentions is real (test_scan_continues_across_batches_through_a_dense_block_of_hidden_rows).
  • scope_hints additions check out: backend/database/memories.py implements the scan, and backend/utils/memory/memory_service.py consumes get_memories.
  • Leaving canonical_prevention_artifact to fix(backend): fill scoring memory pages past hidden rows #12714 is the right ownership call — its registry patch appends exactly the memories test, the one field an instance fix may touch.

Two notes against the PR description:

Keeping registry rewrites out of instance-fix PRs is exactly the boundary the validator enforces, and the recorded lessons are the kind a third instance would otherwise rediscover the hard way. Formal approval and merge stay with a human maintainer.

Automated feedback, posted on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution docs-tooling Layer: Documentation, examples, dev tools labels Sep 5, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Registry-only chore verified against current main: #12712 merged, #12714 open (second instance), FC json content accurate and matches described change. Would merge under docs-correctness gate but mergeStateStatus is BLOCKED (review-required) and this is not desktop, so per policy approve-only.

BasedHardware#12714 merged at 14:39Z, producing exactly the conflict its review predicted:
both PRs rewrite `canonical_prevention`, so the line collides even though the
edits mean different things.

Resolved by keeping this PR's text, which is a strict superset -- main's version
is the original two sentences, this one adds the two lessons the second instance
paid for (floor the budget at offset + limit; keep the slack flat) and widens
`violated_contract` to name both hidden-row kinds.

Two details the mechanical "keep ours" would have got wrong:

- main re-encoded the em-dash as `—` and this branch had degraded it to a
  hyphen. Restored the em-dash, and kept this file's own escaped convention
  rather than switching it to a literal.
- `canonical_prevention_artifact` now carries both tests, because BasedHardware#12714 added
  the memories one and this merge keeps it. That field was always BasedHardware#12714's to
  own; the boundary the validator draws held on its own.

`evidence_prs` cites BasedHardware#12712 and BasedHardware#12714, and both are now merged -- the review's
concern about citing an open PR resolved itself by merge order.

Verified: JSON parses, `scripts/failure-class validate --pr-body-file` returns
ok: true, and the diff against main is exactly the four fields this PR claims.
@aryanorastar

Copy link
Copy Markdown
Collaborator Author

Pushed 66dfe05 — merged current main and resolved the conflict you predicted.

#12714 merged at 14:39Z, and the collision landed exactly where you said it would: both PRs rewrite the canonical_prevention line, so it conflicts textually even though the two edits mean different things.

Resolved by keeping this PR's text, which is a strict superset — main's version is the original two sentences; this one adds the two lessons the second instance paid for and widens violated_contract to name both hidden-row kinds.

Two things a mechanical "keep ours" would have got wrong, and I only caught them by diffing the two sides decoded rather than as raw lines:

The em-dash. #12714 re-encoded it as —; this branch had degraded it to a plain hyphen. I restored the em-dash and kept this file's own escaped convention rather than flipping it to a literal — the registry is mixed on that repo-wide, so matching the file beats matching my preference.

canonical_prevention_artifact. It now carries both tests, because #12714 added the memories one and the merge keeps it. That field was always #12714's to own, and the boundary the validator draws held on its own — no manual reconciliation needed, which is the outcome that argues for the split in the first place.

Your second note resolved itself by merge order: evidence_prs cites #12712 and #12714, and both are merged now, so the registry never ends up citing an open PR.

Verified: JSON parses, scripts/failure-class validate --pr-body-file returns ok: true, and git diff origin/main...HEAD is one file, +9/−4 — exactly the four fields the description claims, with nothing carried in by the merge.

MERGEABLE again, checks re-running.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified on the new head 66dfe05 — the merge resolution is exactly right, and both notes from my earlier review are now closed.

.github/failure-classes/FC-raw-page-limit-before-visibility-filter.json (still the only changed file, +9/−4 against current main):

  • The conflict landed where predicted — both PRs rewrote canonical_prevention — and the resolution keeps this branch's strict-superset text: the two instance lessons (floor the budget at offset + limit, keep the slack flat rather than proportional) plus the widened violated_contract naming both hidden-row kinds.
  • canonical_prevention_artifact correctly carries both tests now, inherited from merged fix(backend): fill scoring memory pages past hidden rows #12714 — backend/tests/unit/test_get_memories_scoring_visibility_pagination.py, which includes test_scan_continues_across_batches_through_a_dense_block_of_hidden_rows — alongside the chat test. This PR no longer edits that field, so the validator's ownership boundary held through the merge without manual reconciliation.
  • The em-dash encoding stays in the file's own escaped \u2014 convention rather than flipping to a literal — the right call for a mixed-convention registry.
  • evidence_prs: [12712, 12714] — both merged, so the registry never cites an open PR; that concern resolved itself by merge order.
  • The recorded constraints remain shipped facts on main, re-checked at the merge point: backend/database/memories.py sets needed = visible_offset + visible_limit and scan_budget = needed + _MEMORY_SCORING_VISIBLE_PAGE_SCAN_SLACK (flat, 2000), with adjacent comments recording the deep-offset-empty-page and dense-hidden-run failure modes; the chat path carries the matching CHAT_MESSAGES_VISIBLE_PAGE_SCAN_SLACK. Both new scope_hints point at code that exists.

Registry text is a maintainer-owned gatekeeper surface, so the merge decision stays with a human — the approval on record covers the pre-merge commit, and this head only adds the predicted-conflict resolution, so a quick re-confirm on 66dfe05 is all that remains before merge.

Automated feedback, posted on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@undivisible
undivisible merged commit 7040fbf into BasedHardware:main Sep 7, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-tooling Layer: Documentation, examples, dev tools positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants