From ec8503686fafe60c785387e4ddc014788b597901 Mon Sep 17 00:00:00 2001 From: Jonathan Marc Bearak Date: Tue, 5 May 2026 03:22:55 -0400 Subject: [PATCH] Use non-reserved identifier generator in quoted-path parsing tests The local arbitrary_identifier() generator could randomly produce Stata\nreserved qualifier keywords (if, in) or prefix/file commands (by, do,\netc.). When fast-check sampled such a keyword as a varlist argument to\ndisplay/list/gen, the parser correctly treated it as a qualifier rather\nthan a variable, causing intermittent CI failures in property tests like\n'should capture all arguments before comma'.\n\nDelegate to arbitrary_non_reserved_identifier() from the shared\ngenerators per the AGENTS.md guidance, which filters out\nRESERVED_QUALIFIER_KEYWORDS, PREFIX_COMMANDS, and FILE_COMMANDS. --- tests/property/quoted-path-parsing.prop.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/property/quoted-path-parsing.prop.test.ts b/tests/property/quoted-path-parsing.prop.test.ts index d2c74877..1885b4da 100644 --- a/tests/property/quoted-path-parsing.prop.test.ts +++ b/tests/property/quoted-path-parsing.prop.test.ts @@ -3,6 +3,7 @@ import * as fc from 'fast-check'; import { StataLexer } from '../../src/lexer'; import { StataParser } from '../../src/parser'; import { CommandNode } from '../../src/types'; +import { arbitrary_non_reserved_identifier } from './generators'; /** * Property tests for quoted path parsing fix. @@ -73,9 +74,13 @@ describe('Quoted Path Parsing Property Tests', () => { /** * Generator for valid Stata identifiers (WORD tokens). + * Excludes reserved qualifier keywords (`if`, `in`), prefix commands + * (`by`, `bysort`, `quietly`, ...), and file commands (`do`, `use`, ...) + * which are parsed specially when they appear as the first identifier + * after a command. See tests/property/generators/primitives.ts. */ function arbitrary_identifier(): fc.Arbitrary { - return arbitrary_macro_name(); + return arbitrary_non_reserved_identifier(); } /**