Skip to content

maintenance: add safe market cache repair workflow - #4

Merged
Shadowell merged 1 commit into
mainfrom
codex/repair-market-cache
Aug 10, 2026
Merged

maintenance: add safe market cache repair workflow#4
Shadowell merged 1 commit into
mainfrom
codex/repair-market-cache

Conversation

@Shadowell

Copy link
Copy Markdown
Owner

Summary

  • add a default dry-run maintenance command for invalid market-cache dates
  • require a verified SQLite backup before transactional mutation
  • clean corrupted K-lines and dependent task/state/report records atomically
  • document inspection, apply, verification, and restore procedures
  • add rollback, backup-failure, idempotence, and dry-run regression tests

Local verification

  • python3 -m pytest tests/test_repair_market_cache.py -q → 5 passed
  • python3 -m pytest -q --ignore=tests/test_api_regression.py → 65 passed
  • python3 -m py_compile scripts/repair_market_cache.py
  • git diff --check

Local repair evidence

Dry-run found 4,696 affected rows, including 2,328 K-line rows dated 1992-05-04. Apply mode created a verified ignored backup, removed the corrupted records transactionally, reset sync state to idle/maintenance, and the follow-up dry-run reported zero affected rows with PRAGMA integrity_check = ok.

The backup remains local under the ignored data/backups/ directory. No database, backup, or token is included in this PR.

Known local environment limitation

The default port 18890 remains held by an unresponsive PID 2427, so the local API regression suite cannot run. The full GitHub Actions suite is required before merge.

Closes #3

@Shadowell
Shadowell merged commit 144d065 into main Aug 10, 2026
2 checks passed
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.

maintenance: repair corrupted market cache with a safe, auditable workflow

1 participant