Skip to content

fix(parse): preserve strict column mismatch reasons - #1254

Open
11suixing11 wants to merge 1 commit into
C2FO:mainfrom
11suixing11:fix/strict-column-reason
Open

fix(parse): preserve strict column mismatch reasons#1254
11suixing11 wants to merge 1 commit into
C2FO:mainfrom
11suixing11:fix/strict-column-reason

Conversation

@11suixing11

@11suixing11 11suixing11 commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • Preserve withHeaders.reason when strict column handling marks a parsed row invalid.
  • Add an issue regression test for header transformation plus strict column handling with both too many and too few columns.
  • Exercise the public data-invalid event and verify rows, reasons, emitted data, and final row count.

Fixes #772.

Why

HeaderTransformer already creates the Column header mismatch... reason, but CsvParserStream.transformRow() dropped that reason before emitting data-invalid. Consumers listening for the third data-invalid argument therefore received undefined even though the mismatch reason was known.

There was an earlier closed PR (#1112) for the same issue, but current main still reproduces the behavior. This version adds focused coverage for the exact reported path.

Verification

  • corepack pnpm exec jest packages/parse/__tests__/issues/issue772.spec.ts --runInBand
  • corepack pnpm test (38 suites, 604 tests, and all examples)
  • corepack pnpm run build (7 workspace projects)
  • corepack pnpm run format:check
  • git diff --check

@c2fo-cibot c2fo-cibot Bot added the size/M Denotes a PR that changes 30-99 lines label Jul 29, 2026
@11suixing11
11suixing11 force-pushed the fix/strict-column-reason branch from 38dbc1e to d94cc37 Compare July 30, 2026 13:14
@11suixing11
11suixing11 force-pushed the fix/strict-column-reason branch from d94cc37 to db9b96b Compare July 31, 2026 06:20
@11suixing11

Copy link
Copy Markdown
Author

I re-ran this branch after the upstream rebase.

Local verification:

  • pnpm exec jest packages/parse/__tests__/issues/issue772.spec.ts --runInBand — 1 test passed
  • git diff --check — clean

GitHub currently reports the Test and dependency-review workflows as action_required with no jobs, and the PR is blocked on required review. No further code change is needed from my side unless the maintainers identify a different compatibility concern.

@11suixing11

Copy link
Copy Markdown
Author

Additional independent verification for this PR:

  • Clean frozen-lockfile install completed.
  • Workspace build passed.
  • After the build, lint passed.
  • Jest passed: 38 suites / 604 tests.
  • Workspace examples passed.

A direct pnpm test before the build still reaches the repository's existing workspace-resolution lint baseline; the build-first sequence above completes cleanly. No code changes were needed in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 'Column header mismatch' reason gets lost

1 participant