Skip to content

Prevent infinite loop in unstable AST JSDoc scanner - #1

Open
huyn7539 wants to merge 5 commits into
mainfrom
antelier-replay/pr-64141
Open

Prevent infinite loop in unstable AST JSDoc scanner#1
huyn7539 wants to merge 5 commits into
mainfrom
antelier-replay/pr-64141

Conversation

@huyn7539

@huyn7539 huyn7539 commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Replay of microsoft#64141 (agent PR, head cba9b6b) on a fork, to test Antelier against a real large repo. Nothing here is proposed for upstream.

The unstable AST JSDoc scanner could loop indefinitely when a scan range ended immediately after -, because the range check did not guard the full identifier condition.

Changes

  • Guard both identifier parts and hyphens with pos < end:
while (pos < end && (isIdentifierPart(...) || char === CharacterCodes.minus))
  • Add regression coverage verifying that a range ending in x- reaches EOF and preserves the expected tokens.

Copilot AI and others added 3 commits September 3, 2026 00:56
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Claim check for #1 — 2 of 5 claims checked · 2 present

Claims vs diff (5)
# Claim (quoted from the PR) Label Evidence
1 Guard both identifier parts and hyphens with pos < end:
…/ast/scanner.ts @@ -2434,7 +2434,7 @@ L2437
present identifier appears in the expected changed hunk lines
2 Add regression coverage verifying that a range ending in x- reaches EOF and preserves the expected tokens.
…/test/scanner.test.ts @@ -0,0 +1,23 @@ L1
present test file is present in the PR file list
3 not checkable (show)
  1. Prevent infinite loop in unstable AST JSDoc scanner — not checked (judged tier off)
  2. Fix AST JSDoc scan range handling — not checked (judged tier off)
  3. Format AST scanner regression test — not checked (judged tier off)
not checkable collapsed by default
1 context line (not claims, show)
  1. The unstable AST JSDoc scanner could loop indefinitely when a scan range ended immediately after -, because the range check did not guard the full identifier condition. — context: describes state or cause, not a change this PR makes
context describes state or cause; never labelled
Attention (2)
  1. undisclosed-file — File changed but not mentioned in the PR body — packages/typescript/test/scanner.test.ts — packages/typescript/test/scanner.test.ts @@ -0,0 +1,23 @@ L1-L23
  2. ci-reported — CI — reported build: QUEUED, claim-check: IN_PROGRESS, extension: QUEUED, package-feed-proxy: QUEUED, go-test: QUEUED, test (ubuntu-latest): QUEUED, test (windows-latest): IN_PROGRESS, test (noembed): QUEUED, test (concurrent test programs): QUEUED, test extra (ubuntu-latest): QUEUED, test extra (windows-latest): IN_PROGRESS, lint (ubuntu-latest): QUEUED, lint (windows-latest): QUEUED, lint (noembed): QUEUED, format: QUEUED, generate: QUEUED, tidy: IN_PROGRESS, smoke: QUEUED, misc: QUEUED; reported, not observed by Work Loop — packages/typescript/test/scanner.test.ts @@ -0,0 +1,23 @@ L1-L23
Author attestation — draft, confirm or edit

What changed: Guard both identifier parts and hyphens with pos < end: — packages/typescript/src/ast/scanner.ts @@ -2434,7 +2434,7 @@ L2437
Why: Why this change was made is not established by the excluded motivation text; confirm intent. — packages/typescript/src/ast/scanner.ts @@ -2434,7 +2434,7 @@ L2437
What could break: Callers of the touched export createScanner could break; confirm its compatibility at this diff. — packages/typescript/src/ast/scanner.ts @@ -2434,7 +2434,7 @@ L2437
What was tested: Add regression coverage verifying that a range ending in x- reaches EOF and preserves the expected tokens. — packages/typescript/test/scanner.test.ts @@ -0,0 +1,23 @@ L1

Confirm attestation in Antelier

After confirmation, each answer is checked against the same diff as the PR claims.

Rules applied (2) · Provenance · Not read (21 lines)

Rule version claim-check-rubric-v1 · JSON route /api/truth/v1/pr/1

Generated by Antelier. Every citation resolves to diff bytes; no human has reviewed these results.

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.

unstable/ast: scanJsDocToken infinite-loops when a scan range ends on a trailing '-' (fix from #63581 not carried into the AST scanner)

2 participants