Repository navigation
Fix migration P1s: live catalog status, run-owned stage updates, renamed-code reindex - #48
Open
naveenhiremath28 wants to merge 3 commits into
Open
naveenhiremath28 wants to merge 3 commits into
naveenhiremath28 wants to merge 3 commits into
Conversation
When the importer suffixes a duplicate scheme_code (or repairs an invalid one), the existing index points still carry the old code. Mark the document reindex_required with a reason so catalog_status reports pending_reindex.
update_document_stage now takes the reporting run's Temporal workflow id and updates that run's row instead of the document's newest workflow, so a late update from an older run cannot change a newer run's stage or job status.
catalog_status counted a document as live when its latest workflow was completed. A DEV-only document therefore showed as live, and starting a new run hid a live one. Migration 0003 redefines the view: live needs some completed workflow and either metadata.index_status.prod.status = 'indexed' or a completed run that skipped PROD (workflows.config.skip_prod, recorded at upload from DISABLE_PROD_SETTING). The importer sets skip_prod on legacy runs when DISABLE_PROD_SETTING is on.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #43 that fixes three of the P1 issues raised in review. Targets
kp-migrations, so it can be merged into #43 or cherry-picked.Changes
Importer: renamed codes are flagged for reindex (
scripts/migrate_sqlite_to_postgres.py)scheme_code(or repairs an invalid one), the old index points still carry the old code.reindex_requiredwith a reason naming the old and new code, socatalog_statusreportspending_reindex.index_statusis kept so a reindex can find the old points.Stage updates go to the reporting run (
pipeline/db.py,activities.py,workflows.py)update_document_stagetakes the reporting run's Temporal workflow id and writes only that run's row, instead of the document's newest workflow._mirror_statesupplies the id behindworkflow.patched("run-owned-stage-v1"), so in-flight workflows still replay.catalog_status: live requires a PROD index (migration0003)metadata.index_status.prod.status = 'indexed'or a completed run that skipped PROD on purpose (workflows.config.skip_prod).skip_prodis recorded at upload fromDISABLE_PROD_SETTING. The importer sets it on legacy runs when that flag is on.Deployment note
After
0003, a completed document with no PROD index entry stops showing as live. That is the intended fix for PROD-enabled setups. In a PROD-disabled deployment that already ran, existing documents stay hidden untilskip_prodis set on their runs (a one-lineUPDATE, not included here).Testing
tests/test_observability*.py(opentelemetrynot installed in my venv).completedmeant live; their fixtures now record a PROD index orskip_prod.Not covered: vector ID collisions and advisory promotion binding. Those are proposed for a separate PR, in line with the review request to split out the webhook/advisory work.