mengw15 opened a new pull request, #7166:
URL: https://github.com/apache/texera/pull/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])
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]