Skip to content

Generalize the cross-instance type check into a portability matrix - #6201

Closed
candrewlee14 wants to merge 2 commits into
drizzle-team:rc5from
candrewlee14:portability-matrix
Closed

Generalize the cross-instance type check into a portability matrix#6201
candrewlee14 wants to merge 2 commits into
drizzle-team:rc5from
candrewlee14:portability-matrix

Conversation

@candrewlee14

Copy link
Copy Markdown

Stacked on #6200. Until that lands this branch contains its commit too — review only Generalize the cross-instance type check into a portability matrix. I will rebase once the parent merges.

What

#6200 fixes SQL and guards it with a single hardcoded assignment. That guards exactly one type. This replaces it with a table.

Why

The underlying bug is not specific to SQL: any class whose private/protected members survive into the emitted .d.ts is compared nominally, and so is non-portable between two installs of the package. That is a property of the whole published surface, and it moves in both directions — a refactor can introduce a leak, and an unrelated @internal can quietly remove one.

A single assertion catches neither. The matrix asserts both:

  • a type recorded as portable that stops being portable fails (regression);
  • a type recorded as a known leak that becomes portable also fails, telling you to flip the flag.

Shape

PORTABILITY_MATRIX lists each probed type with its subpath, any needed type arguments, and whether it currently survives crossing between installs. Every portable: false entry carries a blockedBy naming the member responsible, so the table doubles as the work queue. All probes compile in one tsc program — the whole test runs in ~1.4s, comparable to the single assertion it replaces.

The recorded state is measured, not aspirational: it is exactly what the current published declarations do.

Follow-ups

Later PRs in this stack flip rows to portable: true as the underlying members are stripped.

cursoragent and others added 2 commits August 29, 2026 11:44
Strip implementation-only query-builder details from published declarations, infer decoder results structurally, and compile two physical package copies to prevent regressions.
The single SQL assignment only guarded one type. Replace it with a table of
public types probed in one tsc program, asserting both directions: a portable
type regressing fails, and a known leak becoming portable fails too, prompting
the flag to be flipped.

Records the measured state of the surface, annotating each known leak with the
private/protected member responsible.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qd99Mmmi1fZkKQiV3u1jXy
@candrewlee14

Copy link
Copy Markdown
Author

Consolidated into #6200. The whole change is 244 lines across 16 files, and because a fork PR cannot base itself on another fork branch, every PR in the stack was already showing all of its ancestors' commits — so the split bought no review isolation, just six merges and five rebases. It is now one PR with these commits intact, plus #6205 for the single change that touches observable API.

@candrewlee14
candrewlee14 deleted the portability-matrix branch August 29, 2026 19:02
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.

2 participants