Skip to content

feat(inference): suggest implicit foreign-key relationships#463

Open
seonghobae wants to merge 1 commit into
mainfrom
feat/inference-on-main
Open

feat(inference): suggest implicit foreign-key relationships#463
seonghobae wants to merge 1 commit into
mainfrom
feat/inference-on-main

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

Independent PR against main (replaces #444, which was needlessly stacked on adhesive-piper).

GET /api/snapshots/{uuid}/inferred-relationships proposes implicit foreign keys a DB never declared — the core value for reverse-engineering legacy/analytics schemas. Heuristic: <X>_id column → a same-schema table X/Xs with a PK; excludes already-declared FKs and a table's own PK. confidence: high when the column type matches the referenced key, else medium, each with a reason.

Self-contained (app/spec/relationship_inference.py, no foundation deps), IDOR-safe endpoint. backend pytest +6 (incl. a TDD-caught self-PK false positive); mypy clean.

🤖 Generated with Claude Code

Standalone against main (self-contained: reads snapshot JSON, no foundation deps). GET /api/snapshots/{uuid}/inferred-relationships proposes undeclared FKs for reverse-engineering DBs that never declared them: <X>_id -> same-schema table X/Xs with a PK, excluding declared FKs + own-PK self-loop; confidence high/medium by type match. IDOR-safe, +6 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AxU2xaupAjp912oDNFuWyd
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