Skip to content

Conversation

@jope-bm
Copy link
Contributor

@jope-bm jope-bm commented Dec 30, 2025

Summary

  • Adds stable external_id UUID field to Project and Entity models for v2 API
  • External IDs are immutable UUIDs that won't change with renames or database migrations
  • V2 API endpoints now use external_id in URL paths instead of internal integer IDs
  • Existing records receive auto-generated UUIDs during migration

Changes

Database

  • New Alembic migration adding external_id column to project and entity tables
  • Unique indexes on both columns for fast lookups
  • Backfills existing records with generated UUIDs

Models

  • Project.external_id - UUID string, auto-generated on create
  • Entity.external_id - UUID string, auto-generated on create

API

  • V2 routers updated to accept external_id (UUID string) in path parameters
  • New dependency functions: ProjectExternalIdPathDep, EntityRepositoryV2ExternalDep, etc.
  • Project resolve endpoint now returns external_id
  • Schemas updated to expose external_id in responses

Tests

  • Updated v2 API tests to use external_id-based endpoints
  • Added test coverage for external_id resolution

Test plan

  • Run unit tests: just test-unit-sqlite
  • Run integration tests: just test-int-sqlite
  • Run Postgres tests: just test-postgres
  • Verify migration works on fresh database
  • Verify migration backfills existing records correctly
  • Test API endpoints with external_id paths

🤖 Generated with Claude Code

jope-bm and others added 5 commits December 29, 2025 18:00
Adds a stable external_id UUID field to both Project and Entity models
for use in the v2 API. This provides immutable identifiers that won't
change with renames or database migrations, improving API reliability
and enabling better cross-system references.

Changes:
- Add external_id column to project and entity tables via migration
- Add repository methods to query by external_id
- Update v2 API routers to use external_id in URL paths
- Add new FastAPI dependencies for external_id validation
- Update schemas to expose external_id in responses
- Update tests for new external_id-based API

The external_id is automatically generated as a UUID v4 for new records
and backfilled for existing records during migration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: Joe P <[email protected]>
The down_revision field in merge migrations is a tuple of strings,
not a single string. Updated type annotation to Union[str, Sequence[str], None].

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: Joe P <[email protected]>
…dencies

The v2 external importer dependencies (using external_id UUIDs) were missing
the file_service parameter that was added to the Importer base class in a
recent refactor. This caused TypeError when constructing importers via the
v2 API endpoints.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: phernandez <[email protected]>
Windows has different process cleanup behavior that makes subprocess-based
cleanup tests unreliable in CI. These tests validate Unix-style process
cleanup which isn't applicable to Windows anyway.

The tests continue to run on Linux and macOS where the behavior is
consistent and meaningful.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: phernandez <[email protected]>
@phernandez phernandez force-pushed the feature/external-id-for-projects-and-entities branch from ba40105 to b2ba64a Compare January 2, 2026 18:23
@phernandez phernandez merged commit a4000f6 into main Jan 2, 2026
20 checks passed
@phernandez phernandez deleted the feature/external-id-for-projects-and-entities branch January 2, 2026 19:00
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.

3 participants