Conversation
This was referenced May 21, 2026
Extends `_compare_unwrapped` with a dispatch branch for `LatchRecordModel` subclasses, plus `_compare_link`. Per spec, the link's target table is not checked — any `LatchRecordModel` subclass matches any `link` column, keeping the check tolerant of models that represent only a subset of a larger linked table. The SDK's `to_python_type` maps link columns to `Record`, so a column is a link iff `column_type is Record`. **`_looks_like_latch_record_model` is a structural check** (per @msto's review): instead of `issubclass(t, LatchRecordModel)` — which would force a lazy local import to avoid the circular `_record_model` ↔ `_schema` dependency — it verifies that `t` is a Pydantic `BaseModel` subclass with the `id` and `name` fields `LatchRecordModel` mandates. A dedicated test confirms an unrelated `BaseModel` without those fields is NOT treated as a link. Split out of the original combined array+link PR per @msto's request. Related to #42. Tracked at #53.
msto
force-pushed
the
feat/registry-validate-link
branch
from
May 21, 2026 19:27
54069bb to
4d29545
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related to #42. Stacked on #51. Tracked at #53.
Extends
_compare_unwrappedwith a dispatch branch forLatchRecordModelsubclasses, plus_compare_link.LatchRecordModelsubclass matches anylinkcolumn, keeping thecheck tolerant of models that represent only a subset of a larger
linked table. The SDK's
to_python_typemaps link columns toRecord, so a column is a link iffcolumn_type is Record._looks_like_latch_record_modelis a structural check (peryour review): instead of
issubclass(t, LatchRecordModel)—which would force a lazy local import to avoid the circular
_record_model↔_schemadependency — it verifies thattis aPydantic
BaseModelsubclass with theidandnamefieldsLatchRecordModelmandates. A dedicated test confirms an unrelatedBaseModelwithout those fields is NOT treated as a link.Split out of the original combined array+link PR per your request.
Test plan
LatchRecordModelsubclass.LatchRecordModelbase.→
TYPE_MISMATCH.RecordSubclass | None↔ nullable link column happy path.BaseModel(noid/name) does NOT get treated asa link — surfaces as a primitive
TYPE_MISMATCH.Co-Authored-By: Claude noreply@anthropic.com