Skip to content

fix(health): name scoring-job index migrations in the as-built map - #139

Draft
cursor[bot] wants to merge 32 commits into
mainfrom
cursor/bc-03f12a2f-298e-42d6-913c-a684930556c3-3259
Draft

fix(health): name scoring-job index migrations in the as-built map#139
cursor[bot] wants to merge 32 commits into
mainfrom
cursor/bc-03f12a2f-298e-42d6-913c-a684930556c3-3259

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Why

PR #131 classifies expired scoring-job leases, but the TRACEABILITY migrations/ tree still ended at 0012 and docs/architecture/AS_BUILT_SCHEMA.md had no Active-PR note for 0020/0021/0022. Reviewers would treat that tree as the physical inventory and miss the product apply path.

This branch is #131 at 8c51e3d plus the inventory and millisecond-rounding repair. Prefer this head over merging #82, #113, or #131 alone.

TDD

RED: active_backlog_health_indexes_are_named_in_the_physical_inventory failed because the TRACEABILITY tree did not name 0020_backlog_health_indexes.sql.

GREEN: the tree and as-built map name 0020/0021/0022 as Active PR evidence, not protected-main truth.

What changed

Verification

  • cargo test --test documentation_architecture_contract (11/11);
  • cargo fmt and cargo clippy --all-targets -- -D warnings.

The fractional-millisecond PostgreSQL case is in tests/postgres_scoring_job_backlog_health.rs for exact-head CI (TEST_DATABASE_URL is not available in this writer environment).

Coordination

Open in Web View Automation 

seonghobae and others added 30 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>
The capability-health row still described #82 as observation-only.
Record apply_backlog_health_index_migration so TRACEABILITY matches the
reviewed product apply contract.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Operators could not classify queued, leased, retry-scheduled, or
quarantined scoring work with the same content-free policy used for
outbox and data-rights readiness. Add the probe, caller-supplied
classifier, and product apply path for partial scoring-job indexes.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
A healthy outbox or data-rights queue must not hide a stalled or
unknown scoring-job observation. Classify the three families together
and keep stalled above unknown above within-bounds.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Count leased rows whose persisted expiry is already past the database
clock so a dead worker cannot hide behind a healthy enqueue-age bound.
Apply the leased-expiry partial index through apply_scoring_job_migration.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
cursoragent and others added 2 commits August 16, 2026 15:45
Record the dead-worker residual, prefer this successor over #113 alone,
and cite lease and probe sources in APA 7th.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
The TRACEABILITY migrations tree still ended at 0012 while 0020-0022
already shipped on the scoring-job readiness branch. Name those files
in the tree and AS_BUILT_SCHEMA as Active PR evidence, and round
EXTRACT(EPOCH) millisecond conversions so a fractional created_at
cannot truncate to an invalid stored time.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@cursor
cursor Bot requested a review from seonghobae August 16, 2026 15:49
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