evaluators icon indicating copy to clipboard operation
evaluators copied to clipboard

[BUG]: TypeScript `generate:schemas` writes Windows path separators into the generated headers, so `--check` fails on every schema on Windows

Open matthewalberto opened this issue 3 weeks ago • 1 comments

What happens

On Windows, npm run generate:schemas:check in sdks/typescript reports all 18 generated schema modules as out of sync on a clean checkout, and npm run generate:schemas rewrites all 18. The only change is the // Source: header:

 // GENERATED — do not edit directly.
-// Source: ../../evals/feedback/ela-writing/tone-appropriateness/output_schema.json
-//         ../../evals/feedback/ela-writing/tone-appropriateness/input_schema.json
+// Source: ..\..\evals\feedback\ela-writing\tone-appropriateness\output_schema.json
+//         ..\..\evals\feedback\ela-writing\tone-appropriateness\input_schema.json
 // Regenerate: npm run generate:schemas

The header is built with path.relative(SDK_ROOT, schemaPath) in scripts/generate-schema.ts (lines 200 and 248), which uses the platform separator. The committed files use /, so a Windows contributor either can't pass the drift check or, after regenerating, commits 18 files of backslash-only churn that would then fail CI on Linux.

The same cause makes 3 tests in tests/unit/scripts/generate-schema.test.ts fail on Windows: "generates a file identical to the committed one" (the header diff above), "derives the path from the whole id" (expects schemas/academic-standards-alignment/..., gets a backslashed absolute path), and "marks every generated module as generated in .gitattributes" (compares .gitattributes entries, written with /, with relative() output, which has \). Three more in the same file, the main() CLI tests, fail on Windows for a separate reason: spawnSync(TSX_BIN, ...) returns status null, I think because the .bin/tsx shim can't be spawned without a shell on Windows. I haven't looked into that one further.

Line endings are not involved: the clone has LF in the working tree (git ls-files --eol shows i/lf w/lf), and the diff above is the whole change. The Python generator (scripts/generate_contracts.py --check) passes on the same machine.

Steps to reproduce (Windows)

git clone https://github.com/learning-commons-org/evaluators
cd evaluators/sdks/typescript
npm ci
npm run generate:schemas:check   # 18 x "is out of sync"
npm run test:unit                # generate-schema.test.ts: 6 failures (3 from this, 3 CLI spawn)

Expected: the check passes and regenerating changes nothing, as on Linux and macOS.

Actual: every generated module is reported stale; regenerating rewrites the headers with \.

Versions: main at cc63a62 (12 Nov 2026), SDK 1.3.0, Node 22.22.2, Windows 11.

A possible fix is to normalise the header path to / (for example relative(...).split(sep).join('/'), or path.posix for the display string), and to do the same where the tests build expected paths. I'm happy to send a PR for this if you'd like one.

matthewalberto avatar Nov 13 '26 11:11 matthewalberto

@matthewalberto - Thank you for reporting this bug. We have reviewed and implemented the necessary fix, and are actively planning to include this in our upcoming release, tentatively planned early next week. If you run into any additional issues, feel free to reach out on this ticket or open a new one.

adnanrhussain avatar Nov 19 '26 20:11 adnanrhussain