Skip to content

feat(cascade): Extract cascade metadata to dedicated table#397

Merged
arockwell merged 13 commits intomainfrom
feat/cascade-metadata-table
Jan 29, 2026
Merged

feat(cascade): Extract cascade metadata to dedicated table#397
arockwell merged 13 commits intomainfrom
feat/cascade-metadata-table

Conversation

@arockwell
Copy link
Owner

Summary

  • Moves cascade-specific fields (stage, pr_url) from documents table to dedicated document_cascade_metadata table
  • Improves schema clarity and allows cascade features to evolve independently
  • Maintains backward compatibility with dual-write strategy

Changes

  • Add new document_cascade_metadata table with foreign key to documents (ON DELETE CASCADE)
  • Add emdx/database/cascade.py module with cascade-specific operations
  • Update documents.py to dual-write for backward compatibility
  • Add migration_032 to create table and backfill existing data
  • Update cascade commands and UI to use new module

New Module API

from emdx.database import cascade as cascade_db

cascade_db.get_cascade_metadata(doc_id)
cascade_db.update_cascade_stage(doc_id, stage)
cascade_db.update_cascade_pr_url(doc_id, pr_url)
cascade_db.get_oldest_at_stage(stage)
cascade_db.list_documents_at_stage(stage)
cascade_db.count_documents_at_stage(stage)
cascade_db.get_cascade_stats()
cascade_db.save_document_to_cascade(title, content, stage, ...)

Testing

  • 22 new tests covering all cascade metadata operations
  • Tests migration, CRUD, stage queries, and foreign key cascade delete

🤖 Generated with Claude Code

arockwell and others added 13 commits January 29, 2026 01:42
Moves cascade-specific fields (stage, pr_url) from documents table to a
dedicated document_cascade_metadata table. This improves schema clarity
and allows cascade features to evolve independently.

Changes:
- Add new document_cascade_metadata table with foreign key to documents
- Add emdx/database/cascade.py module with cascade-specific operations
- Update documents.py to dual-write for backward compatibility
- Add migration_032 to create table and backfill existing data
- Update cascade commands and UI to use new module

The documents table still has stage/pr_url columns for backward
compatibility during transition. The new cascade module reads from
the dedicated table.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts:
- pyproject.toml: Use newer typer 0.15+ from main
The old release script had corrupted python_version and minversion.
These conflict markers were left behind from a previous merge.
The gui function is decorated with @app.command(), so pointing to it
directly caused the lazy loader to wrap it incorrectly, showing help
instead of launching the GUI. Now points to the app which has the
single gui command registered.
The gui function was decorated with @app.command() which made it a
Typer subcommand. When lazy loading tried to use it, it created a
group requiring 'emdx gui gui'. Now gui is a plain function that
the lazy loader wraps correctly as a direct command.
The LazyCommand class extends click.MultiCommand which makes it always
behave like a group. Single commands like gui need to be registered
eagerly to work correctly. This matches how prime and status are
registered.
@arockwell arockwell merged commit 0081ae2 into main Jan 29, 2026
1 check failed
arockwell added a commit that referenced this pull request Feb 6, 2026
The gui command was moved from lazy to eager registration in #397 to
fix it not launching. The lazy loading test needs to reflect this by
no longer expecting emdx.ui.gui to stay unloaded.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
arockwell added a commit that referenced this pull request Feb 6, 2026
The gui command was moved from lazy to eager registration in #397 to
fix it not launching. The lazy loading test needs to reflect this by
no longer expecting emdx.ui.gui to stay unloaded.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
arockwell added a commit that referenced this pull request Feb 6, 2026
The gui command was moved from lazy to eager registration in #397 to
fix it not launching. The lazy loading test needs to reflect this by
no longer expecting emdx.ui.gui to stay unloaded.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant