Skip to content

chore: type shim for csv-parse/lib/sync (TS7 compat) - #41314

Merged
dionisio-bot[bot] merged 1 commit into
developfrom
chore/ts7-csv-parse
Jul 21, 2026
Merged

chore: type shim for csv-parse/lib/sync (TS7 compat)#41314
dionisio-bot[bot] merged 1 commit into
developfrom
chore/ts7-csv-parse

Conversation

@ggazzo

@ggazzo ggazzo commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Type-only shim so the CSV importers typecheck under TypeScript 7 — reworked after CI caught a runtime crash in the first approach.

What happened

The original PR switched the imports from csv-parse/lib/sync to the exports-declared csv-parse/sync. Typecheck and plain-node resolution were green, but the production Meteor bundle crashed at boot (Error: Cannot find module 'csv-parse/sync', run 29833170912) — the Meteor bundler resolves npm requires by physical path and doesn't support package exports subpaths. The legacy csv-parse/lib/sync specifier exists precisely because of that.

Fix

Keep the runtime specifier untouched and bridge only the types, following the existing definition/externals pattern:

declare module 'csv-parse/lib/sync' {
	export * from 'csv-parse/sync';
}

csv-parse/lib/sync isn't in the package's exports map (which TS7's resolution enforces), while csv-parse/sync carries a proper types condition — so the ambient declaration satisfies TS7 without changing what the bundler loads.

Verification

  • TS7 probe (bundler resolution): import of csv-parse/lib/sync + shim → 0 errors
  • TS5 (current toolchain): 0 errors
  • Zero source/runtime changes — production bundle identical to develop

Part of the TS7-readiness set. Also supersedes the old branch content (the importer files moved to server/lib/import/ in the backend restructure; branch rebuilt on current develop).

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility when importing CSV parsing functionality, preventing related TypeScript resolution issues.

Task: ARCH-2286

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ae59c99

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dionisio-bot

dionisio-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds an ambient TypeScript module declaration that maps csv-parse/lib/sync to the package’s csv-parse/sync type exports.

Changes

CSV parser type bridge

Layer / File(s) Summary
Add csv-parse sync module bridge
apps/meteor/definition/externals/csv-parse.d.ts
Declares csv-parse/lib/sync and re-exports types from csv-parse/sync.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested labels: type: chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a TypeScript shim for csv-parse/lib/sync for TS7 compatibility.

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.

@ggazzo ggazzo added this to the 8.7.0 milestone Jul 10, 2026
@ggazzo

ggazzo commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

/jira ARCH-2200

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.61%. Comparing base (eb8c624) to head (ae59c99).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41314      +/-   ##
===========================================
+ Coverage    68.59%   68.61%   +0.01%     
===========================================
  Files         4134     4134              
  Lines       160802   160802              
  Branches     29274    29218      -56     
===========================================
+ Hits        110301   110329      +28     
+ Misses       45390    45365      -25     
+ Partials      5111     5108       -3     
Flag Coverage Δ
e2e 58.85% <ø> (-0.03%) ⬇️
e2e-api 45.58% <ø> (+0.25%) ⬆️
unit 70.55% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 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.

@ggazzo
ggazzo force-pushed the chore/ts7-csv-parse branch from 5797a73 to 711a314 Compare July 21, 2026 13:09
@ggazzo
ggazzo marked this pull request as ready for review July 21, 2026 13:09
@ggazzo
ggazzo requested a review from a team as a code owner July 21, 2026 13:09

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

KevLehman
KevLehman previously approved these changes Jul 21, 2026
@ggazzo ggazzo modified the milestones: 8.7.0, 8.8.0 Jul 21, 2026
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Jul 21, 2026
@dionisio-bot dionisio-bot Bot removed the stat: QA assured Means it has been tested and approved by a company insider label Jul 21, 2026
The Meteor bundler resolves npm requires by physical path and doesn't support
package exports subpaths — switching the imports to 'csv-parse/sync' crashes
the production bundle at boot (MODULE_NOT_FOUND). Keep the runtime specifier
'csv-parse/lib/sync' and bridge only the types: an ambient declaration
re-exporting from the exports-declared 'csv-parse/sync' entry, which TS7's
resolution accepts. Verified on TS5 and TS7; zero runtime changes.
@ggazzo
ggazzo force-pushed the chore/ts7-csv-parse branch from 711a314 to ae59c99 Compare July 21, 2026 13:53
@ggazzo ggazzo changed the title chore: exports-compliant csv-parse import (TS7 compat) chore: type shim for csv-parse/lib/sync (TS7 compat) Jul 21, 2026
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Jul 21, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 21, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 21, 2026
@ggazzo

ggazzo commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

/jira ARCH-2200

Merged via the queue into develop with commit c162052 Jul 21, 2026
56 checks passed
@dionisio-bot
dionisio-bot Bot deleted the chore/ts7-csv-parse branch July 21, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants