Skip to content

fix: report ref_schema for cross-schema foreign keys - #190

Open
wuzi wants to merge 1 commit into
TabularisDB:mainfrom
wuzi:fix/fk-ref-schema
Open

wuzi wants to merge 1 commit into
TabularisDB:mainfrom
wuzi:fix/fk-ref-schema

Conversation

@wuzi

@wuzi wuzi commented Nov 11, 2026 •

Copy link
Copy Markdown

Companion to TabularisDB/tabularis#1474 (host issue TabularisDB/tabularis#1473).

The host's ForeignKey gains an optional ref_schema. Without it, a foreign key into another schema (billing.carry_forwards → core.organizations) makes the Related Records panel query billing.organizations and fail. Both FK queries already select foreign_schema_name; row_to_foreign_key now emits it as ref_schema, so get_foreign_keys, get_all_foreign_keys_batch and get_schema_snapshot all carry it. The shape matches the built-in driver, and older hosts ignore the extra field.

Validation:

  • New live_db test with a cross-schema FK asserts ref_schema from both RPCs. It fails without the change (left: Null) and passes with it.
  • 449 library and 5 binary tests pass; cargo clippy --all-targets -- -D warnings and cargo fmt --all -- --check pass.
  • Host parity suite pointed at this build: parity_get_foreign_keys, parity_get_foreign_keys_composite_table and parity_get_foreign_keys_cross_schema pass with the host change; they fail against rc.14. No new parity failures.
  • Manual: installed into a Tauri dev build against a real multi-schema database; the Related Records panel resolves core.organizations.

@kilo-code-bot

kilo-code-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

row_to_foreign_key now emits ref_schema from foreign_schema_name, which both FK queries already select (::text). Because get_foreign_keys, get_all_foreign_keys_batch and get_schema_snapshot all go through this function, they all carry the field. The field is omitted when the value is NULL, so older hosts are unaffected. The new live_db test covers both RPCs. I did not run the tests.

Files Reviewed (3 files)
  • CHANGELOG.md
  • src/handlers/metadata.rs
  • tests/live_db.rs

Reviewed by claude-sonnet-5.5 · Input: 248 · Output: 1.6K · Cached: 180.3K

@aesslinger aesslinger added bug Something isn't working prerelease:rc Version suggestion targets a release candidate labels Nov 11, 2026
@aesslinger aesslinger self-assigned this Nov 11, 2026
@github-actions

Copy link
Copy Markdown

Version suggestion

Based on this PR's title (fix) and the prerelease:rc label:

Current 1.0.0-rc.14
Suggested next tag v1.0.0-rc.15

This is informational only — no tag or release is created automatically yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working prerelease:rc Version suggestion targets a release candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants