Skip to content

fix(doctor): run the migration checks SM010 and SM011 (#895) - #902

Merged
antosubash merged 15 commits into
mainfrom
fix/issue-895-doctor-migration-checks
Nov 10, 2026
Merged

antosubash merged 15 commits into
mainfrom
fix/issue-895-doctor-migration-checks

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

  • make doctor / smpy doctor now report SM010 and SM011, which they documented but never ran. Doctor reads alembic_version and the table list from SM_DATABASE_URL (new simple_module_db.migration_state.read_migration_state) and the heads from alembic.ini (else host/alembic.ini).
    • SM010 is an ERROR when the database lacks any head (the missing heads are named), and a WARNING when it was never migrated or could not be read (database or Alembic config).
    • SM011 reports a table in a module's models that a database at every head lacks.
    • A missing SQLite file is never created; URI-mode paths are handled.
  • Doctor resolves a relative SQLite URL against the project root, as the app does; absolutize_sqlite_url moved to simple_module_core.dotenv. This also fixes SM033 reading the wrong database when run from host/.
  • A development boot reports SM011 once its database is at head, or after the setup wizard migrates it. The Doctor screen's re-run keeps the finding.
  • Docs updated: diagnostic-codes.md, database/migrations.md, per-module-base.md, framework-conventions.md and the shipped simple-module-doctor skill. CHANGELOG Fixed entry added. Behaviour change: make doctor exits 1 on a dev database that is behind head.

Closes #895

Verification

  • Not browser-verified: CLI and boot diagnostics only (--skip-browser).
  • Local CI:
    • make lint green; make test-js green.
    • make ci-doctor reports 0 errors and 0 warnings, so the repo's own modules are covered by migrations.
    • make test-py: 8265 passed, 2 failed in tests/integration/test_invalidation_cross_process.py (httpx ReadTimeout under full-suite load). origin/main fails the same way locally, and the file passes on its own.
  • Checked against the real migration history:
    • a dropped audit_log_audit_entry table gives SM011, exit 0;
    • downgrade audit_log@-1 gives an SM010 error naming b8d4f2a6c901, exit 1;
    • a dev boot prints SM011.
  • Review: three passes of correctness and maintainability reviewers, plus Codex after pass 1 and on the final diff.
  • Verification report: https://claude.ai/artifact/QpQU5jXhVKxGQAoUELvjjn

Report links are Claude Artifacts and start private; the author can share them from claude.ai/code/artifacts if reviewers need access.

Test plan

  • make ci-doctor in CI stays green
  • CI is green

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-10T15:27:54.893562Z 6768b14 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6768b14
Status: ✅  Deploy successful!
Preview URL: https://a1440ef5.simple-module-python.pages.dev
Branch Preview URL: https://fix-issue-895-doctor-migrati.simple-module-python.pages.dev

View logs

@antosubash
antosubash merged commit c00ef29 into main Nov 10, 2026
17 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.

doctor: SM010/SM011 never run, so an unmigrated module table goes unreported

1 participant