Skip to content

fix(health): apply backlog indexes through the product API - #103

Draft
cursor[bot] wants to merge 29 commits into
mainfrom
cursor/bc-914e2d45-c04c-4746-ae84-8ca84386214a-0afd
Draft

cursor[bot] wants to merge 29 commits into
mainfrom
cursor/bc-914e2d45-c04c-4746-ae84-8ca84386214a-0afd

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Why

PR #82 adds partial readiness indexes in migrations/0020_backlog_health_indexes.sql, but the only apply path was a private test include_str!. Callers that bootstrap through apply_integration_migration, apply_inbox_consumption_migration, and apply_data_rights_migration never received those indexes. Recovery applies the directory chain, so the file and the product apply API had diverged.

This branch is #82 at b02bc5e plus the apply-path fix. Do not merge #82 without this commit.

TDD

RED: the index contract imported apply_backlog_health_index_migration before the function existed (E0432).

GREEN: the product function applies 0020, the index contract uses only that API, a second apply is idempotent, and a schema without the owned tables fails closed.

What changed

  • add apply_backlog_health_index_migration in src/postgres_health.rs;
  • require the index contract to use that function instead of a private include_str!;
  • document the apply order in CHANGELOG, OPERABILITY, and TRACEABILITY;
  • record SRE and NIST SP 800-53 Rev. 5 references in OPERABILITY for health/monitoring doctoring.

Verification

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test --lib, capability-health and backlog-health PostgreSQL contracts, including the new apply-path tests.
  • Local PostgreSQL 16 was used for backlog contracts; CI remains the PostgreSQL 18 evidence path.

Out of scope

HTTP probes remain PR #91. Scoring-job backlog observation remains a later slice. No universal SLO defaults are introduced.

Open in Web View Automation 

seonghobae and others added 26 commits August 15, 2026 12:42
The first positive-millis conversion returned before Linux line coverage
could see the later consumption and propagation timestamp checks.
Linux line coverage treats the later conversion ? as its own statement.
Return those invalid stored times through an explicit match arm.
Client-only invalid timestamp probes left the GenericClient Transaction
instantiation of each independent oldest-event conversion uncovered.
Backlog probes accept GenericClient, so an aborted transaction and a
closed connection must both surface typed database errors on the
query Result paths.
#76 already landed, so keep Active PR #82 as the remaining backlog-observation
slice. Name the caller-policy probes in TRACEABILITY, OPERABILITY, and the
changelog. HTTP probes and measured deployment-profile thresholds stay outside
this branch.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
The inherited #72 recovery fixture inserted a processing consumption
row without claim_deadline_at. Migration 0019 requires that column for
processing rows, and the deadline trigger is UPDATE-only, so exact-head
CI failed closed. Seed a valid persisted claim and assert the deadline
survives COPY restore.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Migration 0019 requires claim_deadline_at for processing consumption rows,
and the deadline trigger is UPDATE-only. Direct INSERT fixtures used by the
integration-backlog probe must persist that column so exact-head CI can
observe in-flight work without weakening the fail-closed shape check.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
PostgreSQL rejected $5 as both bigint claim expiry and double-precision
interval input. Persist claim_deadline_at with clock_timestamp() so the
0019 shape check stays fail-closed without weakening the probe contract.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Migration 0020 only ran from a test include_str, so callers using the
product apply functions never received readiness indexes. Add
apply_backlog_health_index_migration and require the index contract to
use that path, including missing-relation and idempotent apply cases.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@seonghobae
seonghobae marked this pull request as ready for review August 16, 2026 22:16
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@opencode-agent

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 276b6c010e06c63d4d4f997c96fa4813ed6cfca6

@opencode-agent

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 276b6c010e06c63d4d4f997c96fa4813ed6cfca6

@opencode-agent

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 276b6c010e06c63d4d4f997c96fa4813ed6cfca6

@opencode-agent

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 276b6c010e06c63d4d4f997c96fa4813ed6cfca6

@opencode-agent

opencode-agent Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 276b6c010e06c63d4d4f997c96fa4813ed6cfca6

Copy link
Copy Markdown
Contributor

Admission-state correction for exact head 276b6c010e06c63d4d4f997c96fa4813ed6cfca6.

Finding: non-mergeable live base comparison is diverged (29 ahead / 659 behind); no current APPROVED review.

This PR remains Open and is moved to Draft/Proposed. Commits, reviews, threads, and valid delta are preserved. Return it to Ready only after causal repair and fresh exact-head evidence. No bypass, synthetic status/approval, manual rerun, Force Push, review dismissal, or Close is used.

@seonghobae
seonghobae marked this pull request as draft September 19, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants