Skip to content

fix(no-base-to-string): memoize recursive stringification checks#832

Merged
graphite-app[bot] merged 1 commit into
mainfrom
c/03-25-fix_no-base-to-string_memoize_recursive_stringification_checks
Mar 25, 2026
Merged

fix(no-base-to-string): memoize recursive stringification checks#832
graphite-app[bot] merged 1 commit into
mainfrom
c/03-25-fix_no-base-to-string_memoize_recursive_stringification_checks

Conversation

@camc314

@camc314 camc314 commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

camc314 commented Mar 25, 2026

Copy link
Copy Markdown
Contributor Author

How to use the Graphite Merge Queue

Add the label 0-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@camc314 camc314 marked this pull request as ready for review March 25, 2026 15:40
Copilot AI review requested due to automatic review settings March 25, 2026 15:40
@camc314 camc314 self-assigned this Mar 25, 2026
@camc314 camc314 force-pushed the c/03-25-fix_no-base-to-string_memoize_recursive_stringification_checks branch from 4383ce4 to 5dc8448 Compare March 25, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses pathological recursion in the no-base-to-string rule’s type stringification checks (fixing oxc-project/oxc#20733) by memoizing recursive certainty computation and adding a regression test that reproduces the problematic recursive tuple-union-in-template-literal shape.

Changes:

  • Add per-run memoization (with cycle breaking) for collectToStringCertainty and collectJoinCertainty to prevent runaway recursion.
  • Add a new invalid test case that exercises the recursive tuple-union Expression shape from issue #20733.
  • Update rule tester snapshot output to include the new diagnostic.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/rules/no_base_to_string/no_base_to_string.go Introduces memoization for recursive certainty computation to avoid pathological recursion.
internal/rules/no_base_to_string/no_base_to_string_test.go Adds a regression test case reproducing the recursive tuple-union template literal scenario.
internal/rule_tester/snapshots/no-base-to-string.snap Updates snapshots for the new invalid test output (but includes an extra suspicious entry).
Comments suppressed due to low confidence (1)

internal/rule_tester/snapshots/no-base-to-string.snap:898

  • The snapshot adds an entry keyed as [TestNoBaseToStringRuleIssue20733/invalid-0 - 1], but there doesn't appear to be any Go test/subtest with that name in the repo. This looks like a stale/accidental snapshot entry (it duplicates the new invalid-89 output) and should be removed to avoid accumulating unused snapshot cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

camc314 commented Mar 25, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

@graphite-app graphite-app Bot force-pushed the c/03-25-fix_no-base-to-string_memoize_recursive_stringification_checks branch from 5dc8448 to e13b890 Compare March 25, 2026 15:49
@graphite-app graphite-app Bot merged commit e13b890 into main Mar 25, 2026
7 of 8 checks passed
@graphite-app graphite-app Bot removed the 0-merge label Mar 25, 2026
@graphite-app graphite-app Bot deleted the c/03-25-fix_no-base-to-string_memoize_recursive_stringification_checks branch March 25, 2026 15:57
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.

linter: Type aware template literal check exponentially slow

2 participants