chore(lint): forbid bare as casts (blindCast + ratchet), ported from prisma-next - #14
Closed
wmadden-electric wants to merge 1 commit into
Closed
chore(lint): forbid bare as casts (blindCast + ratchet), ported from prisma-next#14wmadden-electric wants to merge 1 commit into
as casts (blindCast + ratchet), ported from prisma-next#14wmadden-electric wants to merge 1 commit into
Conversation
Forbid bare `as` casts in production TS in favour of auditable helpers. - blindCast<T, "Reason">/castAs<T> in @makerkit/core/casts, plus assertDefined/invariant in @makerkit/core/assertions as the safe narrowing alternatives. - no-bare-cast GritQL Biome plugin (info severity; test files exempt, matching the existing biome test-file overrides). - lint:casts CI ratchet + unit tests: counts plugin diagnostics at HEAD vs the PR base and fails on any per-PR increase. Scans the base in a worktree using HEAD's config+plugin, so it self-bootstraps — the 59 existing casts are the baseline, delta=0. - PR-only cast-ratchet CI job (credential-free: points origin/main at the base sha already in history) + .cursor rules docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
wmadden
approved these changes
Jul 9, 2026
Contributor
Author
wmadden-electric
added a commit
that referenced
this pull request
Jul 23, 2026
The port's "app code unchanged" constraint was dropped; open-chat now consumes the service node directly and the launcher/env-shim scaffolding is gone. One capability gap remains as finding #14: the hydrated StreamsClient has no routing-key support and no public accessor for its raw connection values, so an app multiplexing chats over one per-user stream must keep the configKey() reach-around. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
wmadden-electric
added a commit
that referenced
this pull request
Jul 23, 2026
The port's "app code unchanged" constraint was dropped; open-chat now consumes the service node directly and the launcher/env-shim scaffolding is gone. One capability gap remains as finding #14: the hydrated StreamsClient has no routing-key support and no public accessor for its raw connection values, so an app multiplexing chats over one per-user stream must keep the configKey() reach-around. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
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.
Imports prisma-next's bare-
as-cast enforcement into makerkit, adapted to this repo.What lands
blindCast<T, "Reason">/castAs<T>in@makerkit/core/casts, plusassertDefined/invariantin@makerkit/core/assertionsas the safe narrowing alternatives.biome-plugins/no-bare-cast.gritfires on every bareas(exceptas const) in production files, at info severity so it never breaks a build. Test files are exempt; the exclusion regexes mirror this repo's existingoverridestest-file patterns.pnpm lint:castscounts plugin diagnostics at HEAD vs the PR base and fails on any per-PR increase. A PR-onlycast-ratchetCI job runs it;pnpm test:scriptscovers the ratchet itself (8 unit tests)..cursor/rules/no-bare-casts.mdc+type-predicates.mdc.Notes for review
delta=0); only new casts fail.--config-path) is deliberate: it anchors this repo's relativefiles.includesexcludes (!docs,!prisma-next) to the same root for both scans, so the two counts are comparable. An empty.gitignoreis dropped into fixture trees that lack one (vcs.useIgnoreFilerequires it).origin/mainat the PR base sha (already in history viafetch-depth: 0), so it needs no authenticated fetch and keepspersist-credentials: false.as-contract-cast-smell.mdc(about prisma-next's schema-Contract serializer seam, unrelated to makerkit's R6 Contract) and the standalone plugin fixtures dir (the ratchet test is self-contained, avoiding a lint-staged config).🤖 Generated with Claude Code