The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-7727-7fd4f892766f0a01c2d0c7a99cebc6c8d2ab7037
 has succeeded.
Run started by GitHub user aglinxinyuan (triggered by aglinxinyuan).

Head commit for run:
8bcc8ebc92ec4abb8f1d74e7baeff9dd71242b74 / Xinyuan Lin <[email protected]>
test(frontend): cover the compiling service and the search-results template 
(#7727)

### What changes were proposed in this PR?

Two frontend files, bundled because one needed a proven remedy and the
other was a plain gap.

| File | Before | After |
|---|---|---|
| `search-results.component.html` | **0/33 lines, 0/6 branches, 0/6
functions** | **33/33, 6/6, 6/6** |
| `workflow-compiling.service.ts` | 140/157 lines, 90/105 branches,
32/36 functions | **157/157, 103/105, 36/36** |

Tests **50 -> 73**. `search-results.component.ts` also rises to 42/42
lines as a side effect.

Both files reach 100% of their lines, which necessarily covers all 19 of
the lines Codecov reports missed (11 + 8).

### The template was not undertested — it was unattributed

This is #7458, and this instance is worth recording because it presents
as the opposite. The existing `describe` uses
`TestBed.overrideComponent` and **does render and assert on the DOM**:
it checks `texera-list-item` counts, `.card-entry` nodes, and load-more
visibility. The template still measured **0 of 33 lines**. Rendering
happened; nothing was attributed. Second fingerprint: under the override
the whole template function was attributed to the `.ts` as one uncovered
span `(55,35)-(79)`.

The appended `describe` keeps its own `TestBed` with no override and the
real `ListItemComponent`, so the existing tests and the
`StubListItemComponent` are untouched.

### Verification

23 mutations, **23 killed, no survivors** — each applied one at a time
with the production file byte-compared after every revert, and the
failing test read by name.

Two mutations had to be reformulated, which is the part worth flagging:

- Exchanging the compile response's success/failure legs is a
**TypeScript narrowing error**, not a behaviour change. A mutation that
only fails to compile proves nothing, so it was discarded and replaced
with three semantic mutants: the success leg additionally requiring zero
operator errors, the state stream being notified only from the failed
leg, and the failed leg reusing the previous errors.
- Dropping the `&& cardTemplate` guard breaks `strictTemplates`
narrowing, so that mutant carries a companion
`[ngTemplateOutlet]="cardTemplate!"` purely to keep it compiling. The
behaviour change — card view rendering with no template — is the
mutation, and it died on a DOM assertion.

One survivor was found and closed during the build rather than reported:
`[currentUid]="this.currentUid"` replaced by `entry.ownerId` passed,
because every fixture entry shared an owner. The new test gives two
entries distinguishable owners (7 and 99), asserts on the rendered
`.owner-badge`, then re-points `currentUid` to 99 and asserts the badge
moves — so a constant replacement dies too.

### Deliberately not included

Two branches in `workflow-compiling.service.ts` are structurally
unreachable, so it cannot exceed 103/105:

- `if (!dynamicSchema) return undefined` (line 241) is dead:
`DynamicSchemaService.getDynamicSchema()` returns a non-nullable
`OperatorSchema` and **throws** on a miss. This is also the file's only
uncovered statement.
- `if (schemas.length > 0)` (line 285) sits inside `if
(linksToThisPort.length > 0)`, where `schemas` is precisely that array
mapped, so the false leg cannot occur.

A production bug is reported rather than pinned: `getAttrNames` (line
362) tests required-ness against the **root** schema via
`operatorSchema.jsonSchema.required?.includes(attrName)`, while
`DynamicSchemaService.mutateProperty` recurses into nested
`properties`/`definitions`/`items`. So a nested property that is
required in its own sub-schema still gets `""` appended to its enum, and
a nested optional property whose name collides with a root-level
required one loses that escape hatch. The new tests exercise only
root-level properties, so neither behaviour is cemented.

Also noted, not cemented: `getOperatorInputSchemaMap` is a getter that
mutates `currentCompilationStateInfo`, flipping the whole compilation to
`Failed` when two links disagree on a port schema.

No production file is touched.

### Any related issues, documentation, discussions?

Closes #7726

### How was this PR tested?

```
npx ng test --watch=false --include="**/workflow-compiling.service.spec.ts" 
--include="**/search-results.component.spec.ts"
```

```
 Test Files  2 passed (2)
      Tests  73 passed (73)
```

Coverage measured with `--coverage` on the same run. `yarn format:ci`
passes, and was checked non-vacuously with a positive control: a
deliberately misformatted throwaway file made it exit 1 and name the
file, then was removed.

### 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/32008496732

With regards,
GitHub Actions via GitBox

Reply via email to