Repository navigation
fix(OMN-19971): a declared key column the relation lacks never reaches the latest-per-key read - #3224
Conversation
…s the latest-per-key read Six snapshot exposures (delegation summary, model-routing, quality-gate, token-usage, savings, cost savings-overview) key on (snapshot_grain, tenant_id). snapshot_grain is the constant half of the bus compaction key and deliberately not a column of their views. The latest-row-per-key read from OMN-20327 selected every declared key column, so all six answered 503 projection_column_missing on the dev lane (readback 2026-10-02 06:01Z). TableRowSource now reads the relation's live columns once (bound to_regclass($1), cached) and keys the read only on declared key columns the relation carries. With none left, the per-key read is skipped. The contracts stay as they are, so bus compaction is unchanged. Tests: unit (SQL shape, bound and cached lookup) and real Postgres. On dev's reader the two snapshot cases fail; consumer-flow's every-key walk, a missing non-key column and a missing relation behave the same before and after. Version 0.4.279.
…pshot-grain-virtual-key
✅ Architectural Review — PASSEDErrors: 0 What this checks
No architectural violations found. Static architectural lint — no model inference (OMN-14176). |
…3224 OCC companion by node_pr_lifecycle_fix_effect (OMN-13317 F1 / OMN-13990 / OMN-14285). Product PR head 2b392042c2f3149348d417b0ef276cd2037541f4.
✅ Hostile Reviewer — PASSEDBlocking findings (critical/error): 0 Gate semantics
Powered by omniintelligence.review_pairing.cli_review — node-based adversarial review via HandlerLlmCliSubprocess (OMN-8524) |
…nimarket#3224 The declared checks were executed for real in the OmniNode-ai/omnimarket checkout at the PR head by the product-repo OCC receipt runner, and the results written append-only into this companion. Producer-minted PENDING receipts are superseded by a net-new record; no existing receipt was edited. Ticket: OMN-16859 (AC3b) Onex-Workflow: OCC Receipt Runner Onex-Run: https://github.com/OmniNode-ai/omnimarket/actions/runs/36981640282
) * evidence(OMN-19971): author OCC companion for OmniNode-ai/omnimarket#3224 OCC companion by node_pr_lifecycle_fix_effect (OMN-13317 F1 / OMN-13990 / OMN-14285). Product PR head 2b392042c2f3149348d417b0ef276cd2037541f4. * evidence(OMN-19971): self-bind OCC#12295 + rebind contract_sha256 * evidence(OMN-16859): executed test_passes receipts for OmniNode-ai/omnimarket#3224 The declared checks were executed for real in the OmniNode-ai/omnimarket checkout at the PR head by the product-repo OCC receipt runner, and the results written append-only into this companion. Producer-minted PENDING receipts are superseded by a net-new record; no existing receipt was edited. Ticket: OMN-16859 (AC3b) Onex-Workflow: OCC Receipt Runner Onex-Run: https://github.com/OmniNode-ai/omnimarket/actions/runs/36981640282 --------- Co-authored-by: omnimarket-bot <bot@omninode.ai> Co-authored-by: onexbot-occ-writer[bot] <307849072+onexbot-occ-writer[bot]@users.noreply.github.com>
…orted name CodeQL flagged the module-level _FIXTURES tuple on #3224 as an unused global. The dsn fixture now requests local_postgres through the imported object's own __name__, which uses the import without a suppression comment or a placeholder global. 5 passed on a real PostgreSQL.
Resolves the version conflict: dev moved to 0.4.281, so this branch takes dev's pyproject.toml and uv.lock and bumps omnimarket to 0.4.282 (only the two version lines differ from dev). Unit projection tests: 400 passed, 5 skipped; tests/integration/projection/test_omn19971_virtual_key_real_postgres.py: 5 passed.
|
The CodeQL note on Merged as Left on OMN-19971: AC1 is still not met on the dev lane because of two other problems read on 2026-10-03 (intermittent 503 timeouts on three exposures, and a decisions window serving old rows). Thank you! |
Summary
Six snapshot exposures answer 503
projection_column_missingon the .201 dev lane since omnimarket#3208:delegation.summary,delegation.model-routing,delegation.quality-gate,delegation.token-usage,delegation.savingsandcost.savings-overview. On 10-01 all six answered 200 and matched their writers. That is the Overview page's delegation and savings data. Found in the OMN-19971 readback of 2026-10-02 06:01Z (ticket commentbee62174); it also re-fires the catalogue check that no exposure marked ok answers 503.Cause. #3208 added a latest-row-per-key read that selects, orders and compares on every declared
key_columnsentry. These six declarekey_columns: [snapshot_grain, tenant_id].snapshot_grainis the constant half of the bus compaction key, minted by the republish query, and deliberately not a column of their views (node_projection_delegation/contract.yaml, thesnapshot_graincomment). Postgres raisesUndefinedColumnError, and the reader maps it to 503.What changed
src/omnimarket/projection/table_reader.py:TableRowSourcereads the relation's live column names once per relation frompg_attribute, with the relation as a bound value (to_regclass($1)), cached beside the cursor-type cache. It reads them only for an exposure that has key columns and a recency column.physical_key_columns(): the declared key columns the relation carries, in declared order.build_window_querytakesrelation_columnsand keys the latest-row-per-key read on those. With none left, the per-key read is skipped.snapshot_grainfromkey_columnswould break bus compaction (one live record per tenant per aggregate).pyproject.toml, and only theomnimarketversion line inuv.lock).How it was verified
Failure modes written before the implementation, each with a test:
Tests:
tests/unit/projection/test_omn19971_virtual_key_columns.py(4): SQL shape for F1–F3, and the bound, cached lookup (F5).tests/integration/projection/test_omn19971_virtual_key_real_postgres.py(5), on a real disposable PostgreSQL: a per-tenant view with nosnapshot_grain(F1), consumer-flow's shape with one busy and two quiet keys (F2), a virtual-only key (F3), a missing non-key column (F4), a missing relation (F5).table_reader.py(750808959), F1 and F3 fail and F2, F4 and F5 pass. The last three are guard rails, and they pass before and after.tests/unit/projection,tests/unit/nodes/node_projection_read_effect,tests/integration/nodes/node_projection_read_effectand the new files give 443 passed, 5 skipped.mypy --strictontable_reader.py,ruff checkandruff format --checkare clean.Lab first, on the lakshman lane on .201 (read-only, 2026-10-02T07:41:16Z):
build_window_querybuilt the SQL from the real contracts.relation_columnscame from the lab views' ownpg_attribute, and the tenant was820272f9-…. Each query ran in aREAD ONLYtransaction onomnibase-infra-lakshman-postgres.ERROR: column "snapshot_grain" does not exist.Failure paths
n/a: this change writes no verdict, receipt or report. It changes which columns one read keys on.
Open defects
none
Local gates
--no-verify, noSKIP=, no--no-gpg-sign, nocore.hooksPathoverride. Every pre-commit and pre-push hook ran.Not in this change
key_columns.Overlap-Reviewed: #2965 — both touch pyproject.toml and uv.lock: #2965 raises the omnibase-core floor to 0.47.24 and removes its git-rev override; this changes only omnimarket's own version line (0.4.278 to 0.4.279). Different lines and different purposes, so each is needed; whichever merges second takes the next version.
Evidence-Ticket: OMN-19971
Evidence-Source: OCC#12295