Skip to content

test: Migrate Polygon specs to the REST client - #10485

Draft
dblythy wants to merge 10 commits into
parse-community:alphafrom
dblythy:chore/spec-rest-polygon
Draft

test: Migrate Polygon specs to the REST client#10485
dblythy wants to merge 10 commits into
parse-community:alphafrom
dblythy:chore/spec-rest-polygon

Conversation

@dblythy

@dblythy dblythy commented May 29, 2026

Copy link
Copy Markdown
Member

Towards #8787.

Stacked on #10484 (chore/spec-rest-geopoint) — review/merge that first; the diff here will shrink to just the Polygon files once it lands.

Third slice of the REST-first spec migration:

  • Ports spec/ParsePolygon.spec.js to REST-based specs under spec/rest/objects/: polygon.spec.ts (object lifecycle, equalTo, validation), polygon-query.spec.ts ($geoIntersects point-in-polygon queries, incl. Update test case polygons so some should fail when lat / long is used… #4608 regressions), polygon-mongo.spec.ts (MongoDB storage format + 2d/2dsphere indexes).
  • Adds polygon/geoIntersects builders to spec/helpers/geo.ts and a describe_only_db ambient declaration.
  • No Parse JS SDK. Objects are created over REST throughout; the storage spec touches the database adapter directly only where there is no REST surface (raw stored document, index metadata).

Next: another spec migration in a follow-up PR using the same helpers.

Summary by CodeRabbit

  • Tests

    • Reworked the test infrastructure to support TypeScript execution and broaden spec discovery.
    • Added new REST integration coverage for Analytics, GeoPoint, and Polygon query behaviors (including validation/error cases and ordering/count assertions).
    • Removed older/superseded GeoPoint/Polygon/Analytics spec files to align with the new REST-first approach.
  • Chores

    • Added Babel runtime registration for test specs and updated the test runner configuration accordingly.
  • Documentation

    • Added a test-suite migration plan for incrementally moving the spec structure to REST-first testing.

@parse-github-assistant

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds TypeScript REST test infrastructure, Jasmine runtime transpilation, typed REST and geospatial helpers, migration documentation, and REST-based GeoPoint, Polygon, and analytics test coverage while removing three legacy JavaScript test files.

Changes

TypeScript REST Test Infrastructure and GeoPoint/Polygon Migration

Layer / File(s) Summary
Babel TypeScript Registration and Jasmine Configuration
package.json, package-lock.json, spec/support/*
Adds @babel/register, TypeScript spec discovery, and scoped runtime transpilation for files under spec/.
REST Request/Response Client and Core Contracts
spec/helpers/config.ts, spec/helpers/headers.ts, spec/helpers/request.ts, spec/helpers/errors.ts, spec/helpers/globals.d.ts
Adds typed REST requests, authentication headers, response parsing, parse-error assertions, test configuration, and Jasmine global declarations.
Domain-Specific REST and Geo Helpers
spec/helpers/client.ts, spec/helpers/analytics.ts, spec/helpers/geo.ts
Adds typed CRUD, analytics, and Parse geospatial query helpers.
Migration Plan and Strategy Documentation
spec/spec_migration.md
Documents the REST-first TypeScript migration architecture, conventions, phases, and acceptance criteria.
GeoPoint Lifecycle and Query Tests
spec/rest/objects/geopoint*.spec.ts
Adds REST coverage for GeoPoint persistence, nested values, arrays, proximity, distance, geobox, equality, counts, and inequality.
Polygon Lifecycle and Query Tests
spec/rest/objects/polygon*.spec.ts, spec/rest/objects/geopoint-polygon.spec.ts
Adds REST coverage for polygon normalization, updates, validation, containment, intersection, coordinate ordering, and query behavior.
Analytics Test Migration
spec/server/analytics.spec.ts, removed spec/Analytics.spec.js, spec/ParseGeoPoint.spec.js, spec/ParsePolygon.spec.js
Replaces legacy JavaScript suites with TypeScript analytics adapter tests and removes the prior GeoPoint and Polygon suites.

Estimated code review effort: 3 (Moderate) | ~30 minutes


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
Description check ❌ Error The description is useful but does not follow the required template and is missing the Issue, Approach, and Tasks sections. Rewrite the description using the repository template, adding Issue, Approach, and Tasks sections with the checklist completed as applicable.
Engage In Review Feedback ❌ Error Review feedback wasn’t incorporated: the transpilation example still shows ['.ts', '.js'], and ParseErrorBody/expectParseError remain unchanged. Update the doc example to ['.ts'] and relax ParseErrorBody/error handling as requested, or show a reviewer retraction after discussion.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR's main change and follows the required test: prefix and capitalization rule.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed Only test helpers/specs and a scoped tsRegister hook changed; no insecure patterns or relevant advisory-matching code paths were introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

dblythy added 10 commits May 30, 2026 01:17
Adds a narrow @babel/register hook (spec/support/tsRegister.js) loaded by Jasmine before helper.js so .ts spec/helper files are transpiled at require time. spec_files glob widened to discover .ts specs. Existing .js specs are unaffected — the hook only intercepts .ts under spec/.
Introduces spec/helpers/*.ts — a typed REST client over fetch (request, client, headers, config, errors, globals) so specs can talk to Parse Server through its public HTTP API without going through the Parse JS SDK. Also lands spec/spec_migration.md, the plan that drives the upcoming REST-first migration of the spec suite (towards parse-community#8787).
Replaces spec/Analytics.spec.js (Parse SDK + done() callbacks) with spec/server/analytics.spec.ts (REST client + async/await), plus spec/helpers/analytics.ts. No SDK import, no done(), no setTimeout. First spec to land under the new REST-first layout.
…sn't break them

CI runs Node 24, which natively strips TypeScript and loads .ts as ESM, bypassing the @babel/register CJS hook. ESM needs explicit extensions, so extensionless relative imports failed. Force Jasmine's require loader (engages the hook on Node 20), add explicit .ts extensions, and mark type-only imports with 'import type' so the suite loads identically on Node 20/22/24.
Guard undefined response data in find/count helpers and fix grammar in
the analytics spec description.
Use a dedicated maintenance-key value in buildHeaders, assert the Parse-error
shape in expectParseError, drop the redundant local reconfigureServer decl
(it lives in globals.d.ts), and fix the REST-client description in the plan.
Internal-server-error bodies use { code, message } rather than { code, error },
so a numeric code is the reliable signal that a rejection is a Parse error.
Port spec/ParseGeoPoint.spec.js to REST-based specs under spec/rest/objects
(lifecycle, queries, withinPolygon) and add a geo query helper, removing the
Parse JS SDK from these tests.
- Drop the misleading GeoPointLiteral[] | unknown union on withinPolygon
  (negative-path specs deliberately pass invalid values, so the param is unknown)
- Drop the unnecessary masterKey auth in the __type response test
- Filter the sub-object and array specs on a sentinel tag instead of an
  unfiltered find, so they don't depend on global cleanup ordering
- Clarify the seed-point comments (inside / on boundary / outside)
Ports spec/ParsePolygon.spec.js to REST-based specs under spec/rest/objects/:
- polygon.spec.ts: object lifecycle, equalTo, and validation
- polygon-query.spec.ts: $geoIntersects point-in-polygon queries (parse-community#4608)
- polygon-mongo.spec.ts: MongoDB storage format and 2d/2dsphere indexes

Adds polygon/geoIntersects builders to spec/helpers/geo.ts and a
describe_only_db ambient declaration. No Parse JS SDK; the storage spec uses
the database adapter directly only where there is no REST surface.
@dblythy
dblythy force-pushed the chore/spec-rest-polygon branch from 8dbc778 to 27fdf42 Compare May 29, 2026 15:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (4)
spec/server/analytics.spec.ts (3)

4-7: ⚡ Quick win

Consider returning promises from adapter stub methods.

The stub methods return undefined instead of promises. While the tests work (the controller wraps adapter calls in a promise chain), the stubs don't match the AnalyticsAdapter contract, which specifies that both methods should return Promise.resolve({}).

📝 Proposed fix to match the adapter contract
   const analyticsAdapter = {
-    appOpened: function () {},
-    trackEvent: function () {},
+    appOpened: function () {
+      return Promise.resolve({});
+    },
+    trackEvent: function () {
+      return Promise.resolve({});
+    },
   };

Based on learnings from Context snippet 1: AnalyticsAdapter interface specifies appOpened(parameters, req) and trackEvent(eventName, parameters, req) should return Promise.resolve({}).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/server/analytics.spec.ts` around lines 4 - 7, The analyticsAdapter stub
methods currently return undefined; update the analyticsAdapter object so its
appOpened and trackEvent functions return resolved promises (e.g., return
Promise.resolve({}) or make them async and return {}), matching the
AnalyticsAdapter contract and signatures used by the controller (ensure you
modify the analyticsAdapter.appOpened and analyticsAdapter.trackEvent methods
accordingly).

21-30: 💤 Low value

Consider verifying the req parameter is passed to the adapter.

The test verifies parameters (args[0]) but doesn't verify that the request object is passed as args[1]. According to the AnalyticsAdapter contract, appOpened(parameters, req) receives the Express request as the second parameter.

🔍 Optional: Add req parameter verification
     expect(appOpenedSpy).toHaveBeenCalled();
     const args = appOpenedSpy.calls.first().args;
     expect(args[0]).toEqual({ dimensions: { key: 'value', count: '0' } });
+    expect(args[1]).toBeDefined(); // Request object is passed

Based on learnings from Context snippet 1: AnalyticsAdapter interface shows appOpened(parameters, req) receives two parameters including the HTTP request.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/server/analytics.spec.ts` around lines 21 - 30, The test currently only
asserts the adapter parameters but not that the Express request was forwarded;
update the spec to also verify the second argument passed to
analyticsAdapter.appOpened is the request object by inspecting
appOpenedSpy.calls.first().args[1] (or using a more specific matcher) after
calling reconfigureServer({ analyticsAdapter }) and appOpened(...); ensure you
reference analyticsAdapter.appOpened (via appOpenedSpy) and assert args[1] is
the expected req (e.g., defined or matches the test request shape) so the
contract appOpened(parameters, req) is validated.

9-19: 💤 Low value

Consider verifying the req parameter is passed to the adapter.

The test verifies eventName (args[0]) and parameters (args[1]) but doesn't verify that the request object is passed as args[2]. According to the AnalyticsAdapter contract, trackEvent(eventName, parameters, req) receives the Express request as the third parameter.

🔍 Optional: Add req parameter verification
     expect(trackSpy).toHaveBeenCalled();
     const args = trackSpy.calls.first().args;
     expect(args[0]).toEqual('MyEvent');
     expect(args[1]).toEqual({ dimensions: { key: 'value', count: '0' } });
+    expect(args[2]).toBeDefined(); // Request object is passed

Based on learnings from Context snippet 1: AnalyticsAdapter interface shows trackEvent(eventName, parameters, req) receives three parameters including the HTTP request.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/server/analytics.spec.ts` around lines 9 - 19, The test currently
asserts trackEvent's eventName and parameters but doesn't verify the request is
forwarded; update the spec that spies on analyticsAdapter.trackEvent (and uses
track('MyEvent', ...)) to also assert that args[2] is the Express request
object—e.g., add an expectation that args[2] is defined and looks like the req
(has properties such as method or url) or otherwise equals the request passed
into the server so trackEvent(eventName, parameters, req) is called with the
req.
package-lock.json (1)

68-68: No known GitHub advisories for @babel/register et al.; bump @babel/register for currency.

  • GitHub advisory feed shows no vulnerabilities for @babel/register, clone-deep, pirates, pkg-dir, shallow-clone, is-plain-object, or isobject; kind-of has a HIGH advisory for >=6.0.0, <6.0.3, patched in 6.0.3 (your lock uses 6.0.3).
  • Lockfile has @babel/register 7.27.1; latest is 7.29.3 (May 2026) — consider updating.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package-lock.json` at line 68, Update the pinned dependency for
"`@babel/register`" to a more current, non-vulnerable release (e.g., bump from
7.27.1 to the latest 7.29.3) by updating the dependency declaration in
package.json (or the lockfile resolution) and regenerating the lockfile via your
package manager (npm install / npm ci) so package-lock.json reflects the new
"`@babel/register`" version; verify tests/builds pass and that the updated version
appears in package-lock.json under the "`@babel/register`" entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@package-lock.json`:
- Line 68: Update the pinned dependency for "`@babel/register`" to a more current,
non-vulnerable release (e.g., bump from 7.27.1 to the latest 7.29.3) by updating
the dependency declaration in package.json (or the lockfile resolution) and
regenerating the lockfile via your package manager (npm install / npm ci) so
package-lock.json reflects the new "`@babel/register`" version; verify
tests/builds pass and that the updated version appears in package-lock.json
under the "`@babel/register`" entry.

In `@spec/server/analytics.spec.ts`:
- Around line 4-7: The analyticsAdapter stub methods currently return undefined;
update the analyticsAdapter object so its appOpened and trackEvent functions
return resolved promises (e.g., return Promise.resolve({}) or make them async
and return {}), matching the AnalyticsAdapter contract and signatures used by
the controller (ensure you modify the analyticsAdapter.appOpened and
analyticsAdapter.trackEvent methods accordingly).
- Around line 21-30: The test currently only asserts the adapter parameters but
not that the Express request was forwarded; update the spec to also verify the
second argument passed to analyticsAdapter.appOpened is the request object by
inspecting appOpenedSpy.calls.first().args[1] (or using a more specific matcher)
after calling reconfigureServer({ analyticsAdapter }) and appOpened(...); ensure
you reference analyticsAdapter.appOpened (via appOpenedSpy) and assert args[1]
is the expected req (e.g., defined or matches the test request shape) so the
contract appOpened(parameters, req) is validated.
- Around line 9-19: The test currently asserts trackEvent's eventName and
parameters but doesn't verify the request is forwarded; update the spec that
spies on analyticsAdapter.trackEvent (and uses track('MyEvent', ...)) to also
assert that args[2] is the Express request object—e.g., add an expectation that
args[2] is defined and looks like the req (has properties such as method or url)
or otherwise equals the request passed into the server so trackEvent(eventName,
parameters, req) is called with the req.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1ce0fb0d-0dc6-4029-bedd-9fb03a5fb47e

📥 Commits

Reviewing files that changed from the base of the PR and between 1e0d6ce and 8dbc778.

📒 Files selected for processing (23)
  • package-lock.json
  • package.json
  • spec/Analytics.spec.js
  • spec/ParseGeoPoint.spec.js
  • spec/ParsePolygon.spec.js
  • spec/helpers/analytics.ts
  • spec/helpers/client.ts
  • spec/helpers/config.ts
  • spec/helpers/errors.ts
  • spec/helpers/geo.ts
  • spec/helpers/globals.d.ts
  • spec/helpers/headers.ts
  • spec/helpers/request.ts
  • spec/rest/objects/geopoint-polygon.spec.ts
  • spec/rest/objects/geopoint-query.spec.ts
  • spec/rest/objects/geopoint.spec.ts
  • spec/rest/objects/polygon-mongo.spec.ts
  • spec/rest/objects/polygon-query.spec.ts
  • spec/rest/objects/polygon.spec.ts
  • spec/server/analytics.spec.ts
  • spec/spec_migration.md
  • spec/support/jasmine.json
  • spec/support/tsRegister.js
💤 Files with no reviewable changes (3)
  • spec/Analytics.spec.js
  • spec/ParsePolygon.spec.js
  • spec/ParseGeoPoint.spec.js

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.60%. Comparing base (552c6dd) to head (27fdf42).
⚠️ Report is 82 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10485   +/-   ##
=======================================
  Coverage   92.60%   92.60%           
=======================================
  Files         193      193           
  Lines       16893    16893           
  Branches      234      234           
=======================================
  Hits        15643    15643           
  Misses       1227     1227           
  Partials       23       23           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dblythy

dblythy commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
spec/spec_migration.md (1)

184-185: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Resolve the TypeScript migration policy before using it as an acceptance criterion.

The checklist requires every migrated file to be renamed .spec.ts, while the open questions still permit a .js-on-REST intermediate path. Choose one policy and make the checklist, sequencing, and acceptance criteria consistent; otherwise reviewers cannot determine whether a REST migration without TypeScript is compliant.

Also applies to: 291-293

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/spec_migration.md` around lines 184 - 185, The migration policy is
inconsistent between the checklist and the open questions regarding `.spec.ts`
versus a `.js`-on-REST intermediate path. Update the TypeScript migration
policy, sequencing, checklist, and acceptance criteria in the migration
specification so they consistently choose one supported path and clearly define
whether REST migration without TypeScript is compliant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/helpers/request.ts`:
- Around line 19-22: Update ParseErrorBody and the error-handling logic in the
request helper to model parse-error payloads independently from the generic
success type T. Allow error details to be absent and support the documented
message-based internal-error shape, while preserving handling for failures
identified only by numeric code; remove casts of T to ParseErrorBody and parse
or validate the error response separately.

In `@spec/spec_migration.md`:
- Around line 82-89: Update the transpilation example in spec_migration.md to
match the tsRegister.js hook by removing .js from the documented extensions list
and retaining only .ts. Preserve the native execution path for existing
JavaScript specs.

---

Nitpick comments:
In `@spec/spec_migration.md`:
- Around line 184-185: The migration policy is inconsistent between the
checklist and the open questions regarding `.spec.ts` versus a `.js`-on-REST
intermediate path. Update the TypeScript migration policy, sequencing,
checklist, and acceptance criteria in the migration specification so they
consistently choose one supported path and clearly define whether REST migration
without TypeScript is compliant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 761a0a70-1020-4439-9842-e33076500511

📥 Commits

Reviewing files that changed from the base of the PR and between 1e0d6ce and 27fdf42.

📒 Files selected for processing (23)
  • package-lock.json
  • package.json
  • spec/Analytics.spec.js
  • spec/ParseGeoPoint.spec.js
  • spec/ParsePolygon.spec.js
  • spec/helpers/analytics.ts
  • spec/helpers/client.ts
  • spec/helpers/config.ts
  • spec/helpers/errors.ts
  • spec/helpers/geo.ts
  • spec/helpers/globals.d.ts
  • spec/helpers/headers.ts
  • spec/helpers/request.ts
  • spec/rest/objects/geopoint-polygon.spec.ts
  • spec/rest/objects/geopoint-query.spec.ts
  • spec/rest/objects/geopoint.spec.ts
  • spec/rest/objects/polygon-mongo.spec.ts
  • spec/rest/objects/polygon-query.spec.ts
  • spec/rest/objects/polygon.spec.ts
  • spec/server/analytics.spec.ts
  • spec/spec_migration.md
  • spec/support/jasmine.json
  • spec/support/tsRegister.js
💤 Files with no reviewable changes (3)
  • spec/Analytics.spec.js
  • spec/ParseGeoPoint.spec.js
  • spec/ParsePolygon.spec.js

Comment thread spec/helpers/request.ts
Comment on lines +19 to +22
export interface ParseErrorBody {
code: number;
error: string;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Model Parse-error payloads separately from success payloads.

ParseErrorBody requires error, but this helper intentionally accepts failures identified only by numeric code; the PR’s own history documents internal-error bodies using { code, message }. Casting the generic success payload T to ParseErrorBody further gives callers a false compile-time contract. Make error/message optional and parse or validate the error body independently of T. (github.com)

Also applies to: 71-78, 86-93

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/helpers/request.ts` around lines 19 - 22, Update ParseErrorBody and the
error-handling logic in the request helper to model parse-error payloads
independently from the generic success type T. Allow error details to be absent
and support the documented message-based internal-error shape, while preserving
handling for failures identified only by numeric code; remove casts of T to
ParseErrorBody and parse or validate the error response separately.

Source: MCP tools

Comment thread spec/spec_migration.md
Comment on lines +82 to +89
- New file `spec/support/tsRegister.js` (plain JS — it is the bootstrap):
```js
require('@babel/register')({
extensions: ['.ts', '.js'],
only: [/[\\/]spec[\\/]/], // never transpile node_modules / lib
cache: true,
});
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Align the transpilation example with the implemented hook.

The plan documents extensions: ['.ts', '.js'], but spec/support/tsRegister.js:1-13 intentionally intercepts only .ts. Keeping .js here contradicts the stated goal that existing JavaScript specs continue running natively and could cause a future implementation to transpile the entire legacy suite.

 require('`@babel/register`')({
-  extensions: ['.ts', '.js'],
+  extensions: ['.ts'],
   only: [/[\\/]spec[\\/]/],    // never transpile node_modules / lib
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- New file `spec/support/tsRegister.js` (plain JS — it is the bootstrap):
```js
require('@babel/register')({
extensions: ['.ts', '.js'],
only: [/[\\/]spec[\\/]/], // never transpile node_modules / lib
cache: true,
});
```
- New file `spec/support/tsRegister.js` (plain JS — it is the bootstrap):
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/spec_migration.md` around lines 82 - 89, Update the transpilation
example in spec_migration.md to match the tsRegister.js hook by removing .js
from the documented extensions list and retaining only .ts. Preserve the native
execution path for existing JavaScript specs.

@dblythy
dblythy marked this pull request as draft July 30, 2026 11:14
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.

1 participant