Repository navigation
test(frontend): cover the compiling service and the search-results template - #7727
Merged
aglinxinyuan merged 2 commits intoAug 17, 2026
Merged
aglinxinyuan merged 2 commits into
aglinxinyuan merged 2 commits into
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7727 +/- ##
============================================
- Coverage 90.93% 90.76% -0.17%
+ Complexity 4450 4403 -47
============================================
Files 1174 1173 -1
Lines 47139 46961 -178
Branches 5284 5258 -26
============================================
- Hits 42866 42626 -240
- Misses 2580 2662 +82
+ Partials 1693 1673 -20
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Aug 18, 2026
…rds (apache#7733) ### What changes were proposed in this PR? Two small frontend targets. The headline is the console frame template, whose line percentage hid the real gap: | File | Before | After | |---|---|---| | `console-frame.component.html` | branches **0/8**, functions **5/9** | **8/8 branches, 9/9 functions** | | `console-frame.component.ts` | 96.9% lines, 95% functions | **65/65 lines (100%), 20/20 functions** | | `preset.service.ts` | 94.8% lines, 90.5% branches | **111/115 lines, 70/74 branches** | 7 tests added. Covered: `ngOnChanges` adopting a new operator id, the empty-list fallback, typing into the command box through a real `input` event and submitting, narrowing the send by picking a worker in the `nz-select` overlay, the settings dropdown's two toggles, and two `preset.service` validation guards. **This is 8 lines by line-count.** What earns it is the branch and function coverage on the template — every interactive control in the console frame was previously unexercised — and that all 8 mutations die. ### Not an apache#7458 case, and worth saying so The obvious guess for a dark template here is the `TestBed.overrideComponent` attribution loss behind merged PRs apache#7535, apache#7627, apache#7629, apache#7661, apache#7681 and apache#7727. It is not: the existing spec uses `imports: [ConsoleFrameComponent, ...]` with no override, and the coverage map shows bindings executing counted (the `*ngFor` statement has 124 hits). So this extends the existing TestBed rather than appending a separate one — the opposite call from apache#7727, for a checkable reason. ### Verification 8 mutations, **8 killed, no survivors**, each applied one at a time with the anchor asserted unique, reverted and `git diff`-checked between every run. All failures are assertion failures, never compile errors. | Mutation | Killed by | |---|---| | **exchange** `[(ngModel)]="showTimestamp"` and `"showSource"` | toggles the timestamp and source tags independently | | `[(ngModel)]="targetWorker"` -> one-way | narrows the command to the worker picked | | `[(ngModel)]="command"` -> one-way | sends the text typed into the command box | | **exchange** `currentValue` and `previousValue` | `ngOnChanges` adopts the newly bound operator id | | remove the `\|\| []` fallback | falls back to an empty list for an unseen operator | | **exchange** the `"error"` and `"info"` switch bodies | refuses to save with an 'info' severity | | `push(replacementPreset)` -> `push(originalPreset)` | stores the replacement when the dictionary has no entry yet | | give `"warning"` a default toast instead of throwing | refuses to save with a 'warning' severity | The first one is the reason the fixture is not degenerate: the kill lands on the *independence* assertion (timestamp off, source still on). Turning both toggles off at once would have survived the exchange. One mechanical note worth recording: the settings dropdown's menu is projected into a CDK overlay wired in `ngAfterViewInit` behind an `auditTime(150)`, so its fixture must be created **inside** `fakeAsync`. Created in a plain `beforeEach`, the timers escape `tick()`, the overlay never attaches, and the switch count is 0 — a test written against that state would pass while asserting nothing. ### Deliberately not included, with evidence - **`updatePreset` (lines 184-190) is dead *and* buggy**, so no test was written for it. It has zero call sites repo-wide outside its own spec. And `indexOf(presets, originalPreset)` is lodash reference-equality against a freshly `JSON.parse`d array, so it always returns `-1`: `splice(-1, 1)` deletes the **wrong** preset and `presets[-1] = ...` is a silent no-op that `JSON.stringify` drops. Its sibling `updateOrCreatePreset` carries the comment *"presets are freshly JSON-parsed, so reference-based indexOf would miss"* and uses `findIndex(isEqual)` — the fix was applied there and not here. Any test would cement the bug. - **`console-frame.component.html` lines 54 and 59 are structurally unreachable**: `#checkedTemplate` and `#unCheckedTemplate` are each declared **twice** (36/41 and 53/58), and both `nz-switch`es resolve to the first pair. The coverage map proves it — statements at 37/42 have 46 hits (2 switches x 23 fixtures) while 54/59 have 0. - Two `.ts` branch arms are guard-guaranteed: `renderConsole()`'s `if (this.operatorId)` already forces the ternary's true leg, and `#consoleList` is unconditional in the template so its `@ViewChild` is always set in a rendered fixture. A third, weaker observation, reported and not pinned: `ngOnChanges` does `this.operatorId = changes.operatorId?.currentValue`, so an `ngOnChanges` fired by a change to `consoleInputEnabled` alone would wipe `operatorId` to `undefined` and silently disable the debug console. `ResultPanelComponent` always sets both inputs together, so it is latent rather than triggered today; the new test pins only the normal path. No production file is touched. ### Any related issues, documentation, discussions? Closes apache#7732 ### How was this PR tested? ``` npx ng test --watch=false --include="**/preset.service.spec.ts" --include="**/console-frame.component.spec.ts" ``` ``` Test Files 2 passed (2) ``` 86 tests green in the two target specs; 174 green including the consumer specs `result-panel.component.spec.ts` and `preset-wrapper.component.spec.ts`, checked for CDK-overlay leakage across specs. `yarn format:ci` passes. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5)
This was referenced Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Two frontend files, bundled because one needed a proven remedy and the other was a plain gap.
search-results.component.htmlworkflow-compiling.service.tsTests 50 -> 73.
search-results.component.tsalso 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
describeusesTestBed.overrideComponentand does render and assert on the DOM: it checkstexera-list-itemcounts,.card-entrynodes, 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.tsas one uncovered span(55,35)-(79).The appended
describekeeps its ownTestBedwith no override and the realListItemComponent, so the existing tests and theStubListItemComponentare 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:
&& cardTemplateguard breaksstrictTemplatesnarrowing, 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 byentry.ownerIdpassed, 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-pointscurrentUidto 99 and asserts the badge moves — so a constant replacement dies too.Deliberately not included
Two branches in
workflow-compiling.service.tsare structurally unreachable, so it cannot exceed 103/105:if (!dynamicSchema) return undefined(line 241) is dead:DynamicSchemaService.getDynamicSchema()returns a non-nullableOperatorSchemaand throws on a miss. This is also the file's only uncovered statement.if (schemas.length > 0)(line 285) sits insideif (linksToThisPort.length > 0), whereschemasis 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 viaoperatorSchema.jsonSchema.required?.includes(attrName), whileDynamicSchemaService.mutatePropertyrecurses into nestedproperties/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:
getOperatorInputSchemaMapis a getter that mutatescurrentCompilationStateInfo, flipping the whole compilation toFailedwhen two links disagree on a port schema.No production file is touched.
Any related issues, documentation, discussions?
Closes #7726
How was this PR tested?
Coverage measured with
--coverageon the same run.yarn format:cipasses, 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)