Skip to content

fix(import): import steps that have no expected result - #626

Merged
therealbrad merged 3 commits into
mainfrom
fix/import-steps-null-expected-result
Sep 8, 2026
Merged

fix(import): import steps that have no expected result#626
therealbrad merged 3 commits into
mainfrom
fix/import-steps-null-expected-result

Conversation

@therealbrad

@therealbrad therealbrad commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

Backports the CSV import fix from release/v1.1 to the 1.0 line so it ships as a patch release.

  • Steps without an expected result failed to import. The route wrote a raw null for Steps.expectedResult, a nullable Json column that ZenStack v3 only accepts as the DbNull sentinel (the convention copyMoveWorker.ts and testCaseVersionService.ts already follow). Every stepped row was reported as Invalid create args for model "Steps": … expected string, received null at "data.expectedResult" … and no steps were created, while the case rows were still inserted, so a failed import left half-built cases behind. This also broke the documented export → edit → re-import round trip, since our own export writes empty expected results. Reported against 1.0.x on 2026-09-08.
  • Restoring a soft-deleted case re-created version 1 and collided with the case's surviving version snapshots (@@unique([repositoryCaseId, version])). The restore path now allocates the next free version, the way the update path does.
  • .releaserc.json: release-scoped commits no longer bump the app version. They change workflow files, not the application. Without this rule the feat(release) from feat(release): publish the Helm chart alongside the self-host images #621, already on main since v1.0.1, would make this release 1.1.0 instead of 1.0.2. Same treatment as the docs, packages, cli, forge-app and deps scopes.

Cherry-pick of a6091db41 from release/v1.1, which keeps the fix for 1.1.

Dependency updates for the open Dependabot alerts

The 1.0.0 graduation took beta's tree wholesale, which silently dropped the security floors main had accumulated in pnpm-workspace.yaml (the #563 sweep). Two of the alerts are that regression.

  • sharp — restores the ^0.35.0 floor. Without it the docs site's @acid-info/docusaurus-og pulled sharp@0.32.6 back in; it now builds against 0.35.4 (verified by build:docs in the gate). Dependabot alert 454.
  • linkify-it — restores the ^5.0.2 floor. @forge/react's Atlassian packages had pulled 2.2.0 and 3.0.3 back in; both now dedupe to 5.0.2, which ships CJS and ESM builds so @atlaskit/adf-schema's require() path is fine. Forge app webpack build passes. Alerts 441 and 453.
  • @hono/node-server — exact pin 1.19.13^1.19.15, resolving 1.19.17. Stays on 1.x because @zenstackhq/cli only accepts ^1.13.8. Alert 514.
  • xlsx — npm's xlsx is frozen at 0.18.5 and will never receive the fixes; SheetJS publishes current releases only from its own CDN. The dependency now points at https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz, integrity-pinned in the lockfile with version: 0.20.3. This is the attachment preview parser (lib/utils/officeDocuments.ts), so it runs on untrusted uploads and the prototype-pollution and ReDoS fixes matter. Alerts 512, 513, 515, 516.
  • image-size (alerts 496, 497) — no fix exists; the latest release is the vulnerable 2.0.2. It is only reachable through @docusaurus/mdx-loader at docs build time, processing our own images. Recommend dismissing as "vulnerable code is not actually used".

The other floors the graduation dropped (adm-zip, body-parser, brace-expansion@1, immutable, svgo) already resolve to safe versions in the lockfile, so they are left alone.

Related Issue

Customer email report (no issue filed).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement

How Has This Been Tested?

Describe the tests you ran to verify your changes:

  • Unit tests — app/api/repository/import/route.test.ts (41 tests), including the DbNull expectation on the step create and the new "allocates the next version when the restored case already has snapshots" regression test
  • Integration tests
  • E2E tests
  • Manual testing — sample CSVs in both supported layouts (pipe-in-cell single-row, and multi-row with a separate Expected Result column) parsed through parseStepsCell / aggregateMultiRowSteps; full pnpm precommit gate, re-run after the dependency changes (12,932 tests, docs build with sharp 0.35.4); Forge app webpack build with linkify-it 5.0.2; lockfile grepped to confirm no vulnerable copy remains

Test Configuration:

  • OS: macOS
  • Browser (if applicable): n/a
  • Node version: v24.14.0

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have signed the CLA

Screenshots (if applicable)

Additional Notes

Merging this cuts v1.0.2 via semantic-release (squash title fix(import): … → patch). Verified by running @semantic-release/commit-analyzer over v1.0.1..HEAD with this branch's .releaserc.json: patch with the new rule, minor (1.1.0) without it. The release notes will also list #619 and #621, which are on main but unreleased.

Follow-up worth its own change: the import wizard offers "Expected Result" as a mapping target in single-row mode, but the route only honors it in multi-row mode. That is what led the reporter to a CSV where every step had no expected result.

The CSV import route passed a raw null for Steps.expectedResult, a
nullable Json column that ZenStack v3 only accepts as the DbNull
sentinel — the convention the copy/move worker and the version service
already follow. Every stepped row was reported as a problem and no
steps were created, while the case rows were still inserted, so a
failed import left half-built cases behind. This also broke the
documented export, edit and re-import round trip, since our own export
writes null expected results. The route's unit tests mock the database,
so they never exercised the real validation.

Restoring a soft-deleted case had a related defect: it re-created
version 1 and collided with the case's surviving version snapshots.
The restore path now allocates the next free version, the way the
update path does.

(cherry picked from commit a6091db)
Commits scoped to the release pipeline change workflow files, not the
application, so they should not decide the next app version on their own.
Without this rule the feat(release) already on main since v1.0.1 would turn
the next patch release into 1.1.0.
The 1.0.0 graduation took beta's tree wholesale, which dropped the
security floors main had accumulated in pnpm-workspace.yaml. Two of the
open alerts are that regression: sharp@0.32.6 came back under the docs
OG plugin and linkify-it 2.x/3.x under the Forge app's Atlassian
packages. Both floors are restored. @hono/node-server moves off its
exact 1.19.13 pin to the patched 1.19 line; it stays on 1.x because
@zenstackhq/cli only accepts ^1.13.8.

npm's xlsx is frozen at 0.18.5 and will never receive the prototype
pollution and ReDoS fixes, so the dependency now points at the SheetJS
CDN tarball for 0.20.3, integrity-pinned in the lockfile. It parses
uploaded attachments for the preview, so those fixes matter.

image-size has no fixed release and is only reachable through the docs
build, so it is left as is.
@therealbrad
therealbrad merged commit 5bb98b8 into main Sep 8, 2026
8 checks passed
@therealbrad
therealbrad deleted the fix/import-steps-null-expected-result branch September 8, 2026 17:34
@therealbrad

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 1.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

therealbrad added a commit that referenced this pull request Sep 8, 2026
Ported from main 5bb98b8 (#626): a feat(release) on the branch would otherwise bump the next app version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant