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:
9ad312f2008039ce2a3b2af34c893c3af92d1e7c / Xinyuan Lin <[email protected]>
test(frontend, auth): pin the email validator, re-home the unauthorized spec 
(#7919)

### What changes were proposed in this PR?

Two small, unrelated things that share one property: the behaviour is
exercised today but asserted nowhere.

**1. `frontend/src/app/common/util/email.ts` had no spec.** It is the
only un-spec'd file in its `util` directory, and it is on the sign-in
path — `AuthService` reads `email` out of the email-request modal's
`getValues()`. New `email.spec.ts`, 7 tests, taking the file to 100%
lines and branches.

**2. `UnauthorizedExceptionMapperSpec` was in the wrong module.** It
tests `common/auth`'s `UnauthorizedException`, but lived in
`access-control-service`. JaCoCo reports per module, so it credited that
file with nothing. Moved to `common/auth/src/test`, which takes
`UnauthorizedException.scala` from 66.7% to 100%.

| File | Codecov | How |
|---|---|---|
| `email.ts` | 5/8 = 62.5% → **8/8 = 100%** | new spec |
| `UnauthorizedException.scala` | 6/9 = 66.7% → **9/9 = 100%** | spec
relocation |

Both baselines reproduce Codecov's published figures digit-for-digit,
measured whole-module with no filter on either side.

### The honest yield is smaller than those percentages suggest

**+5 fully-covered lines and +1 branch arm — of which +3 lines are
re-attribution, not new testing.** The Scala half moves already-tested,
already-CI-running behaviour into the module where it counts; it adds
one new assertion and nothing else. And on the frontend half, one of the
three lines is promoted only by an unreachable null-guard arm, so that
half is +2 lines and +1 arm rather than +3 and +2.

So the genuinely new coverage here is **2 lines**. I would rather lead
with that than with two 100%s.

### What actually earns the PR

The email validator could be gutted and nothing in the repository would
notice. Five mutants survived the first draft, three of them on
`email.ts`:

| Mutation | Now killed by |
|---|---|
| drop the trailing anchor from the regex | rejects an address with
trailing text after the TLD |
| replace the whole regex with `/@/` | rejects strings that merely
contain an at-sign |
| narrow the TLD to `\.com$` | accepts a non-`.com` TLD |
| `UnauthorizedException`'s reason-phrase overload | the 401 test's new
reason-phrase assertion |
| `UnauthorizedException`'s status constant | existing status assertion
|

That is the point of the frontend spec: the file's *coverage* was
largely duplicated by indirect drivers, but its *behaviour* was
duplicated nowhere. The indirect drivers are `auth.service.spec.ts` and
`texera-login.component.spec.ts` — the latter reaching it through a
static call, which the first draft got wrong when it inventoried them.

### Verification

16 mutations, **15 killed, 1 survivor.**

**The survivor, stated plainly and not dressed up as equivalent:**
flipping `UnauthorizedException.scala:43`'s `enableSuppression = false`
to `true` leaves the whole 108-test module green. It *is* observable in
principle through `getSuppressed`, but nothing in the repository calls
it, so there is no honest assertion to make. Recorded rather than
papered over.

### Deliberately not included

`LargeBinaryManager` was the third file in scope and is dropped at **+0
lines**. Reaching it needs a `build.sbt` change with LICENSE-binary
fallout, which the test-only constraint forbids.

Three tests added in the repair pass move zero counters — the lcov is
byte-identical with and without them — and they are kept only for the
mutants they kill.

No production file is touched. `access-control-service` was re-compiled
after the move to confirm nothing there depended on the relocated spec.

### Any related issues, documentation, discussions?

Closes #7918

### How was this PR tested?

```
sbt "Auth/test"
```

```
[info] Total number of tests run: 108
[info] Tests: succeeded 108, failed 0, canceled 0, ignored 0, pending 0
```

```
npx ng test --watch=false --include="**/email.spec.ts"
```

```
 Test Files  1 passed (1)
```

`Auth/Test/scalafmtCheck` passes, `AccessControlService/Test/compile`
succeeds after the move, and `yarn format:ci` passes. The new frontend
spec carries the Apache licence header.

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

Generated-by: Claude Code (Opus 5)

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

With regards,
GitHub Actions via GitBox

Reply via email to