[Task] Access extraction Stage 3: Move Live Models And Migrations #43

Closed
opened 2026-07-06 11:33:09 +02:00 by zemion · 2 comments
Owner

Imported from the GovOPlaN access extraction plan.

  • Source: /mnt/DATA/git/govoplan-core/docs/ACCESS_EXTRACTION_PLAN.md
  • Line: 230
  • Section: Stage 3: Move Live Models And Migrations

Plan excerpt:

### Stage 3: Move Live Models And Migrations

Move active identity/access models out of `govoplan_core.db.models`.

Tasks:

- Decide the stable table naming strategy.
- Map legacy model names to access-owned model classes.
- Keep database table names where possible to avoid data migration churn.
- Add Alembic migration metadata owned by access.
- Keep compatibility aliases in core while modules migrate.
- Update bootstrap/create-all compatibility paths.

Acceptance criteria:

- Existing development databases migrate without data loss.
- New databases initialize with access-owned metadata.
- Core no longer owns live account/user/group/role/session/API-key model
  definitions except compatibility aliases.

<!-- codex-backlog-fingerprint:f815c1608da4c3fa4b997a3a --> Imported from the GovOPlaN access extraction plan. - Source: `/mnt/DATA/git/govoplan-core/docs/ACCESS_EXTRACTION_PLAN.md` - Line: `230` - Section: `Stage 3: Move Live Models And Migrations` Plan excerpt: ```markdown ### Stage 3: Move Live Models And Migrations Move active identity/access models out of `govoplan_core.db.models`. Tasks: - Decide the stable table naming strategy. - Map legacy model names to access-owned model classes. - Keep database table names where possible to avoid data migration churn. - Add Alembic migration metadata owned by access. - Keep compatibility aliases in core while modules migrate. - Update bootstrap/create-all compatibility paths. Acceptance criteria: - Existing development databases migrate without data loss. - New databases initialize with access-owned metadata. - Core no longer owns live account/user/group/role/session/API-key model definitions except compatibility aliases. ```
zemion added this to the Access Extraction milestone 2026-07-06 12:53:04 +02:00
Author
Owner

Codex State: progress

Summary

  • Completed the live model ownership move for Stage 3 while preserving existing table names.
  • Tenant is now defined by govoplan-tenancy; access imports it and declares tenancy as an upstream dependency.
  • Governance template models, audit log model, and system settings model now live in admin, audit, and core respectively, with govoplan_core.db.models kept as the compatibility export surface.
  • Module migration specs are registered for tenancy/admin/audit; metadata planning now deduplicates shared Base.metadata entries.

Changed Files

  • govoplan_tenancy/backend/db/models.py
  • govoplan_access/backend/db/models.py
  • govoplan_admin/backend/db/models.py
  • govoplan_audit/backend/db/models.py
  • govoplan_core/admin/models.py
  • govoplan_core/db/models.py

Verification

  • python -m unittest tests.test_module_system tests.test_access_contracts tests.test_database_migrations: 24 passed
  • python -m unittest tests.test_api_smoke: 39 passed
  • npm run test:module-permutations: passed
  • scripts/check_dependency_boundaries.py: passed

Next / Blocked

  • Do not remove compatibility imports yet; later extraction stages should move/retire compatibility admin routes and direct access shims deliberately.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Completed the live model ownership move for Stage 3 while preserving existing table names. - Tenant is now defined by govoplan-tenancy; access imports it and declares tenancy as an upstream dependency. - Governance template models, audit log model, and system settings model now live in admin, audit, and core respectively, with govoplan_core.db.models kept as the compatibility export surface. - Module migration specs are registered for tenancy/admin/audit; metadata planning now deduplicates shared Base.metadata entries. ### Changed Files - `govoplan_tenancy/backend/db/models.py` - `govoplan_access/backend/db/models.py` - `govoplan_admin/backend/db/models.py` - `govoplan_audit/backend/db/models.py` - `govoplan_core/admin/models.py` - `govoplan_core/db/models.py` ### Verification - `python -m unittest tests.test_module_system tests.test_access_contracts tests.test_database_migrations: 24 passed` - `python -m unittest tests.test_api_smoke: 39 passed` - `npm run test:module-permutations: passed` - `scripts/check_dependency_boundaries.py: passed` ### Next / Blocked - Do not remove compatibility imports yet; later extraction stages should move/retire compatibility admin routes and direct access shims deliberately. Suggested status label: `status/in-progress`
Author
Owner

Codex State: checked 2026-07-09

I rechecked the Stage 3 acceptance against the current tree. The live model/migration ownership move is complete for this issue: core no longer has the old govoplan_core/db/models.py live model ownership surface, access owns the account/user/group/role/session/API-key models, tenancy owns Tenant, and the dependency boundary checker passes with 0 transitional exceptions.

Verification: python3 scripts/check_dependency_boundaries.py passed in govoplan-core.

Closing as complete. Remaining route/service ownership cleanup belongs to #62/#63/#82 rather than this model-ownership issue.

## Codex State: checked 2026-07-09 I rechecked the Stage 3 acceptance against the current tree. The live model/migration ownership move is complete for this issue: core no longer has the old govoplan_core/db/models.py live model ownership surface, access owns the account/user/group/role/session/API-key models, tenancy owns Tenant, and the dependency boundary checker passes with 0 transitional exceptions. Verification: python3 scripts/check_dependency_boundaries.py passed in govoplan-core. Closing as complete. Remaining route/service ownership cleanup belongs to #62/#63/#82 rather than this model-ownership issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-core#43
No description provided.