Skip to content

refactor(meta): point ModelData at effective ModelId - #248

Merged
buke merged 1 commit into
mainfrom
feat/meta-effective-dual-store-eds4
Aug 5, 2026
Merged

refactor(meta): point ModelData at effective ModelId#248
buke merged 1 commit into
mainfrom
feat/meta-effective-dual-store-eds4

Conversation

@buke

@buke buke commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

  • Retire MetaModelData @SqlCompute tip subquery (sqlModelId); ModelId is again a physical ManyToOne FK to the effective meta_model.id written by the host loader.
  • Point loader test helper loaderTestModelID at LookupEffectiveModel so fixtures match production resolve.
  • SavedFilter product is not implemented yet; SF12 design alignment lives in local .dev/ docs only (not in this PR).

Test plan

  • ./choysum test unit meta --be --pattern 'model_data|MetaModelData|parseMetaModelData'
  • go test ./internal/module/evolution/data/ ./internal/module/lifecycle/ -count=1
  • CI green on this PR

Made with Cursor


PR Type

Enhancement


Description

  • Go Core: Update loader test helper to LookupEffectiveModel.

  • TS Modules: Restore ModelId as physical ManyToOne FK column.

  • License/SPDX: No new source files; no license impact.

  • Test Coverage: Updated Go and TypeScript unit tests.


File Walkthrough

Relevant files
Tests
loader_test.go
Update Go loader test helper to resolve effective model   

internal/module/evolution/data/loader_test.go

  • Update loaderTestModelID helper to use meta.LookupEffectiveModel
    instead of raw query.
  • Ensure model fixtures resolve effective model IDs matching host loader
    behavior.
+3/-3     
model_data_ref.test.ts
Update TypeScript unit tests for MetaModelData ModelId     

modules/meta/service/tests/model_data_ref.test.ts

  • Replace @SqlCompute test assertions with checks for physical column
    metadata.
  • Verify ModelId is registered as a ManyToOne field and sqlModelId is
    undefined.
+7/-33   
Refactoring
model_data.ts
Restore ModelId field as physical ManyToOne relation         

modules/meta/service/models/model_data.ts

  • Remove sqlModelId method and @SqlCompute decorator on ModelId.
  • Revert ModelId to a physical ManyToOne FK field targeting MetaModel.
+3/-20   

Summary by CodeRabbit

  • Bug Fixes
    • Improved model resolution to use the effective model selection.
    • Updated model references to persist and load consistently.
    • Removed outdated computed model ID behavior, improving data consistency.

- Remove MetaModelData tip SqlCompute so ModelId reads the stored effective FK.

- Align loader fixtures with LookupEffectiveModel instead of bare First.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

MetaModelData.ModelId is now a mutable physical relation without computed SQL resolution. Loader tests resolve model IDs through meta.LookupEffectiveModel, and metadata tests verify the new relation behavior.

Changes

Model resolution

Layer / File(s) Summary
Physical ModelId relation
modules/meta/service/models/model_data.ts, modules/meta/service/tests/model_data_ref.test.ts
Removes sqlModelId and its SQL dependencies. Verifies that ModelId is a physical ManyToOne column without a compute handler.
Effective-model loader lookup
internal/module/evolution/data/loader_test.go
Updates loaderTestModelID to use meta.LookupEffectiveModel and reports lookup failures accordingly.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: Review effort 1/5

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main refactor to use the effective ModelId.
Description check ✅ Passed The description explains the changes, scope, affected files, and test plan with sufficient detail.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/meta-effective-dual-store-eds4

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@buke
buke merged commit 6751d8c into main Aug 5, 2026
44 checks passed
@buke
buke deleted the feat/meta-effective-dual-store-eds4 branch August 5, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant