Skip to content

chore(lint): prevent generic isRecord guards - #1272

Merged
betegon merged 2 commits into
mainfrom
bt/chore-no-generic-is-record
Jul 29, 2026
Merged

chore(lint): prevent generic isRecord guards#1272
betegon merged 2 commits into
mainfrom
bt/chore-no-generic-is-record

Conversation

@betegon

@betegon betegon commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

Prevents new generic isRecord type guards under src/. Existing call sites now use local, shape-specific guards so they state which runtime shape they need.

Replay recording segments now keep the object boundary already published by @sentry/api instead of degrading it to a local unknown[][] schema. The formatter still uses small semantic guards for nested RRWeb payloads.

Changes

  • add a Biome Grit rule that flags function-valued isRecord declarations
  • replace the existing generic helpers with domain-specific guards
  • fetch replay recording segments through the generated API operation and validate its generated response contract
  • remove the redundant local replay recording schema and the bespoke lint-rule test harness

Test Plan

  • pnpm exec vitest run test/lib/api/replays.test.ts test/lib/formatters/replay.test.ts — 12 passed
  • pnpm run lint
  • pnpm run typecheck
  • pnpm run check:deps
  • pnpm run check:errors — no error-class anti-patterns; existing silent-catch backlog remains advisory
  • temporary Biome smoke fixtures confirmed isRecord is rejected and a local hasFileMap guard is accepted

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1272/

Built to branch gh-pages at 2026-07-24 20:43 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 89.47%. Project has 5473 uncovered lines.
✅ Project coverage is 81.78%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/formatters/replay.ts 82.61% ⚠️ 4 Missing and 3 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.71%    81.78%    +0.07%
==========================================
  Files          427       427         —
  Lines        30036     30042        +6
  Branches     19526     19555       +29
==========================================
+ Hits         24544     24569       +25
- Misses        5492      5473       -19
- Partials      2049      2047        -2

Generated by Codecov Action

@betegon
betegon marked this pull request as ready for review July 24, 2026 18:04
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 24, 2026
Consume the @sentry/api operation and response validator at the HTTP boundary instead of maintaining a broader local schema. Remove the redundant lint-rule contract test because Biome is the enforcement path.
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: medium PR risk score: medium labels Jul 24, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8e598d3. Configure here.

Comment thread src/lib/api/replays.ts
@betegon
betegon merged commit d4b0e2e into main Jul 29, 2026
33 checks passed
@betegon
betegon deleted the bt/chore-no-generic-is-record branch July 29, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant