aglinxinyuan opened a new pull request, #7681:
URL: https://github.com/apache/texera/pull/7681

   ### What changes were proposed in this PR?
   
   `dataset-detail.component.html` was at **92.0% of lines, 72.9% of branches 
and 42.9% of functions** behind a 129-test spec. This is **not** an instance of 
#7458 — the spec uses no `TestBed.overrideComponent`, so no attribution is 
lost. The gaps were real: handlers on child outputs, controls inside CDK 
overlays, the version-creator block, and the false legs of the header and 
settings ternaries.
   
   | | Before | After |
   |---|---|---|
   | lines | 312/339 (92.0%) | **339/339 (100%)** |
   | branches | 35/48 (72.9%) | **48/48 (100%)** |
   | functions | 15/35 (42.9%) | **35/35 (100%)** |
   
   Tests **129 -> 161**, all 32 new ones in one appended `describe` with its 
own `TestBed`, no override, real children and real overlays. No existing test 
or stub is touched.
   
   ### Verification — and a correction
   
   The first pass reported 25 mutations, all killed, zero survivors. **That did 
not hold.** Four reviewers were asked to *refute* the suite; between them they 
predicted 21 distinct surviving mutations, and **every one of the 21 did 
survive the 154-test suite.** 23 of the 24 findings are now fixed, and each 
repaired kill was re-proved with **only the new block selected** (`--filter 
"DatasetDetailComponent rendered template"`, 129 pre-existing tests skipped), 
so no new test leans on a neighbour.
   
   Two failure modes are worth recording, because neither is visible in a 
coverage report:
   
   **Branches counted as covered and still unpinned.** The upload row's tooltip 
ternary read 2/2 covered, yet swapping its two results passed. Both legs 
rendered somewhere; nothing asserted *which*. The same shape hid an exchange of 
the two `nz-switch` models and an exchange of the view/like counters.
   
   **Degenerate fixtures.** A row with `totalTime` and `estimatedTimeRemaining` 
both `undefined` renders `["1s", "1s left"]`, because `formatTime` maps 
`undefined`, `0` and any `n <= 0` to `"1s"` — so swapping elapsed and 
remaining, a real user-visible bug, was undetectable. `formatSpeed(1024)` and 
`formatSpeed(40)` likewise both render `"0.0 MB/s"`. Those tests now use 
distinguishable values (`12s` / `1m30s left`, `5.0 MB/s`) and keep the 
degenerate case as a separate, honestly-named floor test.
   
   Also fixed: `toContain("2")` against a size of `2048` (passes on the raw 
number — now `toBe("2.00 KB")`), two `expect.any(Number)` arguments that left 
chunk-size and concurrency swappable, and an `isLogin` flag hidden behind 
`expect.anything()`.
   
   ### One mutation is deliberately left alive
   
   `html:401` `[(ngModel)]="selectedVersion"` -> `[ngModel]` survives, and that 
is correct rather than a gap: the same element carries 
`(ngModelChange)="onVersionSelected($event)"`, and `onVersionSelected` assigns 
`this.selectedVersion` itself (`ts:527`). Removing the two-way sugar leaves an 
observationally identical component. It is an equivalent mutant, settled by 
running it rather than by reading.
   
   ### A misdiagnosis worth flagging
   
   An earlier pass concluded that `[disabled]="isCreatingVersion"` on the 
version-name input was **inert** — that `NzInputDirective` swallowed the 
binding because `[(ngModel)]` supplies an `NgControl`. That was wrong, and the 
test settled it: `NgModel` routes `disabled` through `control.disable()`, which 
it defers to a **microtask**, so the DOM simply lags one turn behind 
`detectChanges()`. With the microtask hop the field really does lock. Both the 
flip and outright deletion of that binding now fail.
   
   ### Deliberately not included
   
   `html:585`'s `userHasWriteAccess() &&` is redundant — the enclosing 
`nz-collapse` at `html:452` is already gated on `userDatasetAccessLevel === 
"WRITE"`, which is exactly what that method returns. Reported, not tested.
   
   The read-only leg of the description editor's `[editable]` is unreachable 
from the template: the Settings tab itself sits behind 
`*ngIf="userHasWriteAccess()"`, so a reader never gets there.
   
   No production file is touched.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7680
   
   ### How was this PR tested?
   
   ```
   npx ng test --watch=false --include="**/dataset-detail.component.spec.ts"
   ```
   
   ```
    Test Files  1 passed (1)
         Tests  161 passed (161)
   ```
   
   32 new on top of the existing 129. Coverage measured with `--coverage` on 
the same run. `yarn format:ci` passes.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


-- 
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]

Reply via email to