fix(no-base-to-string): memoize recursive stringification checks#832
Conversation
How to use the Graphite Merge QueueAdd 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. |
4383ce4 to
5dc8448
Compare
There was a problem hiding this comment.
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
collectToStringCertaintyandcollectJoinCertaintyto 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 newinvalid-89output) and should be removed to avoid accumulating unused snapshot cases.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
5dc8448 to
e13b890
Compare

fixes oxc-project/oxc#20733