Skip to content

test: add JavaScript optional-chaining parser fixture - #39

Open
ranita872 wants to merge 2 commits into
gavinjudd:mainfrom
ranita872:parser-edge-fixture
Open

test: add JavaScript optional-chaining parser fixture#39
ranita872 wants to merge 2 commits into
gavinjudd:mainfrom
ranita872:parser-edge-fixture

Conversation

@ranita872

Copy link
Copy Markdown

Summary

  • Add a synthetic JavaScript parser-edge fixture covering optional property and element access.
  • Register the fixture in the parser-backed JavaScript test lane.
  • Assert parser identity, bounded derived features, and that raw fixture source does not appear in the parse result.

Observed behavior

The fixture is based on the documented behavior of optional chaining in the public microsoft/TypeScript-Website repository.

Reference:
microsoft/TypeScript-Website
packages/documentation/copy/en/release-notes/TypeScript 3.7.md
Immutable commit: 7a686ece189c7f9587a245fa2270ed9dc0f03abb

The referenced release notes document optional property access (?.) and optional element access (?.[0]). The fixture here is independently written synthetic code and does not copy source from the referenced repository.

Validation

Passed:

  • node scripts/bootstrap.mjs
  • pnpm --filter @gitmog/quality-judge test parser.test.ts — 7/7 tests passed
  • pnpm quality:fixtures
  • Formatting
  • Lint
  • Typecheck

pnpm verify reaches the full test suite but reports 3 unrelated Windows/environment-sensitive CLI test failures:

  • cache-control.test.ts — symlink creation returns EPERM
  • export-artifact.test.ts — symlink creation returns EPERM
  • terminal-output.test.ts — locale/time-zone formatted timestamp differs on this Windows environment

No changes were made to those unrelated tests.

Scope / contract impact

  • No production analyzer behavior changed.
  • No Quality Preview formula or scoring behavior changed.
  • No parser activation/version contract changed.
  • No dependencies or lockfiles changed.
  • No package/release assets changed.
  • No canonical battle bytes changed.
  • Deterministic versioning behavior is unchanged.

This change only expands engineering validation coverage for a JavaScript parser edge case.

Engineering validation impact

The new fixture exercises real TypeScript compiler AST parsing for JavaScript optional chaining while keeping the fixture synthetic, bounded, and source-free in derived output.

The change is intentionally limited to the fixture and its directly associated parser tests.

@ranita872
ranita872 requested a review from gavinjudd as a code owner September 5, 2026 19:22

@gavinjudd gavinjudd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the contribution!

The fixture is focused, the public reference
checks out, and all seven submitted parser tests pass locally.

One required correction before merging here

The new block in packages/quality-judge/tests/parser.test.ts fails the pinned Prettier check.

Please format that file with the repository's formatter and push the update.
The JavaScript fixture itself is already formatted correctly.

Optional improvement: the full-source exclusion assertion compares serialized
JSON with unescaped multiline source. Compare against the JSON-escaped source
instead, and consider checking the two distinctive optional-chain expressions.
Your existing function-name checks already catch a whole-fixture leak, so this
is test strengthening, not a production privacy defect. It does not need to
expand into analyzer changes.

We also reproduced both symlink EPERM failures on unchanged main under the same
Windows sandbox. Those are not introduced by this PR; please leave the unrelated
CLI tests untouched. The timestamp mismatch did not reproduce in our run.

After the formatting update, we'll review the final commit and decide separately
whether to approve the required hosted checks. No workflow changes are needed.

@ranita872

Copy link
Copy Markdown
Author

Formatted packages/quality-judge/tests/parser.test.ts with the repository formatter and pushed the requested update.
The parser test suite passes 7/7.

gavinjudd commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Thanks for the update! The PR still points to a64f610, and packages/quality-judge/tests/parser.test.ts still has the original indentation in the current diff. Please check that the formatted file is committed and pushed to ranita872/gitmog-cli:parser-edge-fixture. Once the new commit appears here, I'll review it.

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.

2 participants