Skip to content

`feat(repositories): model project and workspace identity for multi-c…#50

Open
Adityakk9031 wants to merge 3 commits into
AlmanacCode:mainfrom
Adityakk9031:#47
Open

`feat(repositories): model project and workspace identity for multi-c…#50
Adityakk9031 wants to merge 3 commits into
AlmanacCode:mainfrom
Adityakk9031:#47

Conversation

@Adityakk9031

Copy link
Copy Markdown
Contributor

Summary

Resolves #47 by introducing a multi-workspace project model. CodeAlmanac now decouples logical Project Identity (shared codebase name & identity) from local Workspace Identity (checkout root path).
Multiple checkouts of the same project (e.g. /work/a/lmfellow and /work/b/lmfellow) no longer collide or fail with SQLite integrity errors on repositories.name. Instead, both register as workspaces under the single shared project lmfellow, and --wiki <name> execution dynamically resolves the workspace matching the active current working directory (cwd).

Key Changes

  • Database Schema (tables.py):
    • Added projects and workspaces tables to SQLite schema.
    • Relaxed repositories.name UNIQUE constraint to allow multiple workspace rows for a single project name.
  • Domain Models & Identifiers (models.py, identity.py):
    • Added Project and Workspace Pydantic models.
    • Added deterministic project_id_for(name) and workspace_id_for(root_path) generator functions.
  • Persistence Layer (store.py):
    • Updated RepositoryStore.remember() to upsert records into projects and workspaces tables alongside repositories.
  • Service Resolution (service.py):
    • Removed duplicate name checks in register(), enabling auto-registration of new workspaces under existing projects.
    • Enhanced select_by_name(), select_for_read(), and select_for_operation() to resolve workspace checkouts preferred by the caller's cwd.
  • Automated Tests (test_repository_store.py):
    • Added test_read_repository_at_registers_multiple_workspaces_under_same_project verifying multi-checkout registration and CWD-based workspace resolution.

Testing & Verification

  • Ran test suite: pytest tests/test_repository_store.py
  • Result: 4 passed in 0.83s

@Adityakk9031

Copy link
Copy Markdown
Contributor Author

@divitsheth have a look

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.

Model one Almanac project across multiple local checkouts

1 participant