The GitHub Actions job "Benchmarks" 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:
246d86c1e4ccf8189d9b5b78c909626dc082178c / Meng Wang <[email protected]>
test(file-service): cover the dataset publicity toggles and public version list 
(#7885)

### What changes were proposed in this PR?

Extends `DatasetResourceSpec` with 12 tests for the six
endpoints/helpers the issue
lists, none of which any test reached before (`grep` for each name in
the spec
returned nothing). Measured with `sbt FileService/jacoco` on a clean
`jacoco.exec`,
before and after:

| `DatasetResource.scala` | Before | After |
| --- | --- | --- |
| lines | 212/290 (73.10 %) | **231/290 (79.66 %)** |
| methods of the `DatasetResource` class | 33/56 | **39/56** |

The six newly-covered methods are exactly the six the issue names.

- **`toggleDatasetPublicity`** — called twice so the assertion pins the
*flip*
rather than a one-way set, once as the owner and once as a non-owner
holding
  WRITE; refused for a caller holding only READ.
- **`toggleDatasetDownloadable`** — same flip assertion for the owner,
plus the
rejection. Note the issue describes this as "same shape" as the
publicity
toggle, but the code differs: this one is guarded by `userOwnDataset`
and
throws `"Only dataset owners can modify download permissions"`, so a
non-owner
with WRITE access is refused here while the publicity toggle accepts
them. The
  test asserts that difference rather than the issue's description.
- **`updateDatasetDescription`** — persisted description re-read through
the DAO,
  and the write-access rejection with the old value left intact.
- **`getPublicDatasetVersionList`** / **`fetchDatasetVersions`** —
versions of a
public dataset returned newest-first, alongside a second public dataset
whose
versions must not leak in; the empty case; and the `ForbiddenException`
for a
  private dataset.
- **`retrieveOwners`** — one email per distinct owner, with two datasets
sharing an
owner (so the `selectDistinct` collapses them) and a fourth owner whose
dataset
is not granted to the caller; plus the empty result for a user with no
access.

Two determinism notes, both called for by the issue: the version rows
are seeded
with explicit `creation_time` values, because the endpoint orders by
that column
and its default would stamp every row inserted in one test identically;
and
`retrieveOwners` is driven by a user created inside the test, since the
shared
session users accumulate access rows from other tests and reusing one
would make
the result depend on test order. No production code was changed.

### Any related issues, documentation, discussions?

Closes #7876.

### How was this PR tested?

```
sbt "FileService/Test/scalafmtCheck" "FileService/Test/scalafix --check" \
    "FileService/testOnly *DatasetResourceSpec"
```

142 tests in the suite, all passing (130 before, 12 new);
`scalafmtCheck` and
`scalafix --check` clean. `sbt FileService/jacoco` runs the whole module
green at
310 tests and produced the numbers above. Failure path verified by
breaking one
assertion in each of the 12 new tests: 12 failed / 0 succeeded, sbt
exited
non-zero, then restored to green.

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

Generated-by: Claude Code (Opus 5)

---------

Signed-off-by: Meng Wang <[email protected]>
Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>

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

With regards,
GitHub Actions via GitBox

Reply via email to