The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
d9c443f38e2f4ac730c840a9fbb0ed8ed19cde63 / Meng Wang <[email protected]>
test(amber): extend WorkflowVersionResource unit test coverage (#7166)

### What changes were proposed in this PR?

Extends the existing `MockTexeraDB`-backed `WorkflowVersionResourceSpec`
(which
only covered `fetchSubsequentVersions` + `applyPatch`) to cover the
resource's
remaining methods. 14 new tests:

- **Pure diff logic** — `applyPatch` reconstructs an older content from
a stored
delta (no DB); `isSnapshotInRangeUnimportant` returns true for equal
bounds and
for a replace-only range, false when the range contains an important
(non-replace)
  change.
- **Version persistence (object methods)** — `insertNewVersion` persists
a
retrievable version; `getLatestVersion` returns the highest vid, and
creates one
when the workflow has none; `insertVersion` always versions a new
workflow, and
  otherwise only when the content actually changed.
- **Resource endpoints** — `retrieveVersionsOfWorkflow` returns the
importance-encoded list for a user with access and an empty list
otherwise;
`retrieveWorkflowVersion` reconstructs the workflow for an authorized
user and
throws `ForbiddenException` otherwise; `cloneVersion` creates a new
workflow from
  an existing version.

The spec's `beforeEach` now also seeds an owner + a stranger user with
the
appropriate access grants (mirroring `WorkflowResourceCoverSpec`) so the
auth-gated endpoints can be exercised. No production code was changed.

### Any related issues, documentation, discussions?

Closes #7161.

### How was this PR tested?

`sbt "WorkflowExecutionService/testOnly *WorkflowVersionResourceSpec"` —
15 passed
(1 existing + 14 new), run twice for determinism against the embedded
Postgres.
The failure path was verified by breaking an assertion (1 failed,
non-zero exit),
and `Test/scalafmtCheck` + `Test/scalafix --check` are clean.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

Report URL: https://github.com/apache/texera/actions/runs/30658710217

With regards,
GitHub Actions via GitBox

Reply via email to