Skip to content

Conversation

@samuelstroschein
Copy link
Member

@samuelstroschein samuelstroschein commented Nov 18, 2025

Note

Adds explicit foreign key scoping (version_id/file_id) with sensible defaults, scopes PK/unique/FK validation by file and version, requires file_id for deletes, updates conversation/label schemas, and expands tests.

  • Schema & Types
    • Add LixForeignKeyScopeColumn and scope to LixForeignKey (JSON schema updated) to control implicit FK scoping (version_id, file_id).
  • Validation
    • Implement FK scoping: normalize/apply scope to state queries; default scoping for state and special entities.
    • Scope primary key and unique validations by file_id within a version; ignore inherited rows.
    • Enforce FK checks within version/file scope; reject references to inherited or cross-version entities; respect materialized mode.
    • Require file_id for delete operations; apply scoped reverse-FK checks on delete.
    • Pass file_id through all validate paths; improved error messages.
  • Entity Schemas
    • lix_entity_conversation, lix_entity_label: add scope: ["version_id"] on state FKs.
  • VTable
    • Propagate file_id to validateStateMutation for insert/update/delete.
  • Tests
    • Add/adjust tests for file-scoped PK/unique, FK scoping per file/version, deletion constraints, untracked/tracked FK rules, inherited-state rejection, and special versionless lix_change behavior.

Written by Cursor Bugbot for commit d6069c8. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

⚠️ No Changeset found

Latest commit: d6069c8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Nov 18, 2025

View your CI Pipeline Execution ↗ for commit d6069c8

Command Status Duration Result
nx run-many --nx-bail --target=build --parallel ✅ Succeeded 53s View ↗
nx run-many --target=test --parallel ✅ Succeeded 3m 2s View ↗
nx run-many --target=lint --parallel ✅ Succeeded 9s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-18 17:14:22 UTC

@samuelstroschein samuelstroschein temporarily deployed to scope-constraints-to-per-file-id - lix-docs PR #3749 November 18, 2025 17:09 — with Render Destroyed
@samuelstroschein samuelstroschein merged commit ecace99 into main Nov 18, 2025
3 checks passed
@samuelstroschein samuelstroschein deleted the scope-constraints-to-per-file-id branch November 18, 2025 17:15
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants