Skip to content

docs(js): don't check at runtime what TypeScript rules out - #8985

Merged
kixelated merged 1 commit into
mainfrom
docs/js-no-runtime-type-checks
Nov 17, 2026
Merged

kixelated merged 1 commit into
mainfrom
docs/js-no-runtime-type-checks

Conversation

@kixelated

@kixelated kixelated commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The maintainer decided on moq-dev/moq#8961 that the JS API does not check at runtime what TypeScript already rules out, and asked for that rule in js/AGENTS.md. Nothing there says so yet.

Approach

One rule in js/AGENTS.md Conventions: only TypeScript callers are supported, so no runtime checks for misuse the types rule out; validate only data crossing a trust boundary. The boundary wording matches how the code already parses: zod schemas on the catalog, auth, and JSON inputs, and element attributes that throw on an invalid value.

Impact

None: internal agent docs only. Existing runtime type guards (for example net/src/util/sequence.ts) are not touched here.

Alternatives

None. No existing rule was close enough to tighten.

Follow-ups

None.

Validation

Docs change with no behavior to exercise. just check passes; quest review --harness codex round 1 found nothing.

Models

Size: S
Implementer: Claude Code, claude-sonnet-5-5, unknown effort

(Written by Claude Sonnet 5.5)

Review

Rewritten by quest review after each round.

  • Head: fbfb6cb

  • Base: origin/main at 73d65ed

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1e791-b5b6-7f51-ba16-c69b57f4d26c, round 1

  • Score: 10/10, The change only documents a validation policy consistent with existing review rules, changes no runtime behavior, and has no actionable defects.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed commit: fbfb6cbc70f87a2efcc337b130b2860307fd9bd2.

The TypeScript-only policy matches the decision in #8961. I’d narrow “Validate only data that crosses a trust boundary” to avoid telling future agents to remove checks for invalid values that TypeScript does allow, such as a negative sequence number typed as number, or a write after close. Keep runtime checks for invariants the types cannot express, and validate untrusted inputs at the boundary. No runtime change in this PR.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes: single-commit docs change to js/AGENTS.md.

  • No runtime type-check rule: adds one Conventions bullet saying only TypeScript callers are supported, so the code shouldn't check at runtime for misuse the types rule out. Validation stays for data crossing a trust boundary (wire, JSON via zod, element attributes).

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds a convention for TypeScript callers. The convention advises against runtime checks for misuse already excluded by types. It limits validation to data crossing trust boundaries, such as wire data, JSON, and user input.

Merge Risk: Minimal · up to fbfb6

This change only adds an internal guidance note about TypeScript runtime checks. It has no production impact and is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a convention in js/AGENTS.md telling contributors not to add runtime checks for misuse that TypeScript already rules out. The docs(js) prefix and the summary both matc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the purpose: adding a convention to js/AGENTS.md that skips runtime checks for misuse already excluded by TypeScript types and validates only trust-boundary data. It names the a…
Full details: Title check

Explanation

The title names the main change: a convention in js/AGENTS.md telling contributors not to add runtime checks for misuse that TypeScript already rules out. The docs(js) prefix and the summary both match the single-line addition to AGENTS.md.

Full details: Description check

Explanation

The description states the purpose: adding a convention to js/AGENTS.md that skips runtime checks for misuse already excluded by TypeScript types and validates only trust-boundary data. It names the affected file, the related maintainer decision, the scope (internal agent docs only), and the validation performed. This matches the changeset, which adds one line to js/AGENTS.md.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60b083cd-9d90-477e-9e6c-da3d15940291
Commits

Reviewing files that changed from the base of the PR and between 2d123fb and fbfb6cb.

Files selected for processing: 1

  • js/AGENTS.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@kixelated
kixelated added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit a79bbae Nov 17, 2026
7 checks passed
@kixelated
kixelated deleted the docs/js-no-runtime-type-checks branch November 17, 2026 03:46
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.

1 participant