You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/25 08:07:29 UTC
[PR] test(frontend): close the result-table frame's stat-formatting gaps [texera]
aglinxinyuan opened a new pull request, #7972:
URL: https://github.com/apache/texera/pull/7972
### What changes were proposed in this PR?
`result-table-frame.component.spec.ts` goes from 41 tests to 46, closing the last reachable gap in the component.
Measured from raw lcov (v8 via vitest), identical include glob on both sides, `rm -rf coverage junit.xml` between runs. The before figure came from restoring the spec with `git show HEAD:<spec>` — a single exact path, never a directory checkout.
| Counter | Before | After |
|---|---|---|
| Lines hit | 184/185 = 99.46% | **185/185 = 100%** |
| Codecov's metric (fully covered) | 180/185 = 97.30% | **184/185 = 99.46%** |
| Branch arms | 92/96 | **95/96** |
| Functions | 37/37 | 37/37 |
**+4 fully-covered lines and +3 branch arms — and this is plainly a small PR.** Three short tests, ~40 spec lines. I would rather say that than dress it up: 184/185 is this file's permanent ceiling under a test-only change.
Functions were already 37/37 with zero `FNDA:0` entries in both runs. Worth checking rather than assuming, because three times in this campaign a file sat at high line coverage with functions uncovered.
### What the new tests actually pin
One of them closes a real hole rather than a counter: an existing test's *name* claimed it exercised the empty-result guard, while its body actually exercised the `operatorId` guard. The two are now separated.
Another covers a genuinely reachable path that the type signature denies: `IcebergDocument.getTableStatistics` emits **ISO date strings** for `Timestamp` column min/max, contradicting the frontend's `Record<string, Record<string, number>>`. Reaching it needs two `as unknown as number` casts, which the test carries a comment explaining — otherwise a reviewer would reasonably read it as a coverage hack.
### Verification
16 mutations, **14 killed, 2 survivors**, both stated rather than papered over.
- **`BRDA:250,20,1` is structurally dead.** The `: currentStr` arm of `previous !== undefined ? previous.toFixed(2) : currentStr` sits inside `typeof current === "number" && typeof previous === "number"`, so `previous` is provably not undefined. Closing it would need a production edit (deleting the vacuous guard), which the test-only constraint forbids. This is why the ceiling is 184/185.
- **A single-sided `previous.toLocaleString()` → `String(previous)` at line 253 survives, and is left unkilled on purpose.** It is observable only when the *same* column's stat is non-numeric in one snapshot and a number ≥ 1000 in the other — a mid-run stat type flip. Pinning that would cement a shape the backend does not produce.
Five claims from the first draft were corrected, including a test title that claimed to observe `toLocaleString` for string payloads (it cannot — `String#toLocaleString` returns the same string), and a "there is no other gap for anyone to re-hunt" conclusion drawn from the absence of zero-count lcov entries, which is a category error: a fully-hit file can still be entirely unpinned.
### Reported, not pinned
An empty fetched page returns at the line-424 guard **before** `isLoadingResult = false` at line 428, so the `nz-table`'s bound spinner never clears for an operator that produced zero rows. The test deliberately omits that assertion so this PR does not cement it; it deserves its own issue.
No production file is touched, and the worktree's `node_modules` is a real install rather than a junction.
### Any related issues, documentation, discussions?
Closes #7971
### How was this PR tested?
```
npx ng test --watch=false --include="**/result-table-frame.component.spec.ts"
```
```
Test Files 1 passed (1)
Tests 46 passed (46)
```
`yarn format:ci` passes. `frontend/junit.xml` and `frontend/coverage/` are regenerated by every run and are not committed.
### 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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): close the result-table frame's stat-formatting gaps [texera]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7972:
URL: https://github.com/apache/texera/pull/7972#issuecomment-5407467372
## [Codecov](https://app.codecov.io/gh/apache/texera/pull/7972?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 92.80%. Comparing base ([`3198595`](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0ce7e0c`](https://app.codecov.io/gh/apache/texera/commit/0ce7e0cc70f590709b54591bbf508dffed716441?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 4 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #7972 +/- ##
============================================
+ Coverage 92.79% 92.80% +0.01%
Complexity 4616 4616
============================================
Files 1174 1174
Lines 47453 47453
Branches 5304 5304
============================================
+ Hits 44034 44039 +5
+ Misses 1899 1898 -1
+ Partials 1520 1516 -4
```
| [Flag](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
|---|---|---|---|
| [access-control-service](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.00% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [agent-service](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `98.62% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [amber](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `89.12% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.67% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [config-service](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.73% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [file-service](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `84.48% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [frontend](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `95.05% <ø> (+0.02%)` | :arrow_up: | |
| [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `79.13% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [pyamber](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `97.57% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/7972/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.19% <ø> (ø)` | | Carriedforward from [3198595](https://app.codecov.io/gh/apache/texera/commit/319859571e30d123a50081a918815d9b65b4300f?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/7972?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): close the result-table frame's stat-formatting gaps [texera]
Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #7972:
URL: https://github.com/apache/texera/pull/7972
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): close the result-table frame's stat-formatting gaps [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7972:
URL: https://github.com/apache/texera/pull/7972#issuecomment-5407377608
<!-- texera-reviewer-suggestion -->
### Automated Reviewer Suggestions
Based on the `git blame` history of the changed files, we recommend the following reviewers:
- **Contributors with relevant context:** `@juliethecao`
You can notify them by mentioning `@juliethecao` in a comment.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): close the result-table frame's stat-formatting gaps [texera]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7972:
URL: https://github.com/apache/texera/pull/7972#discussion_r3856068127
##########
frontend/src/app/workspace/component/result-panel/result-table-frame/result-table-frame.component.spec.ts:
##########
@@ -402,6 +428,77 @@ describe("ResultTableFrameComponent", () => {
expect(bypassSpy).toHaveBeenCalledWith(black("3") + black(".") + black("0") + black("0"));
});
+ // `tableStats` is declared Record<string, Record<string, number>>, but the backend
+ // does put non-numeric values in it: IcebergDocument.getTableStatistics seeds a
+ // Timestamp column's min/max with an ISO date *string*, and the template feeds those
+ // straight into compare(). The casts below model that real payload, which is the only
+ // way to reach the non-numeric formatting branch. Note that String#toLocaleString is
+ // the identity, so a string payload cannot observe that call at all; what this test
+ // pins is that previousStr is derived from the previous snapshot instead of collapsing
+ // onto currentStr. The toLocaleString call itself is pinned by the numeric test below.
+ it("highlights only the character that changed when both stats are non-numeric strings", () => {
+ const bypassSpy = vi.spyOn(TestBed.inject(DomSanitizer), "bypassSecurityTrustHtml");
+ component.isOperatorFinished = false;
+ component.tableStats = { ts: { min: "2024-01-02" as unknown as number } };
+ component.prevTableStats = { ts: { min: "2024-01-09" as unknown as number } };
+
+ component.compare("ts", "min");
+
+ // the two dates agree up to the last character, which is the only one highlighted
+ expect(bypassSpy).toHaveBeenLastCalledWith(
+ "2024-01-0"
+ .split("")
+ .map(char => black(char))
+ .join("") + blue("2")
+ );
+ });
+
+ it("highlights the trailing characters that the shorter previous snapshot never reaches", () => {
+ const bypassSpy = vi.spyOn(TestBed.inject(DomSanitizer), "bypassSecurityTrustHtml");
+ component.isOperatorFinished = false;
+ component.tableStats = { ts: { min: "2024-01-02" as unknown as number } };
+ component.prevTableStats = { ts: { min: "2024" as unknown as number } };
+
+ component.compare("ts", "min");
+
+ // the first four characters match and stay black; for every index past the end of
+ // previousStr the lookup yields undefined, which counts as changed
+ expect(bypassSpy).toHaveBeenLastCalledWith(
+ "2024"
+ .split("")
+ .map(char => black(char))
+ .join("") +
+ "-01-02"
+ .split("")
+ .map(char => blue(char))
+ .join("")
+ );
+ });
+
+ // The non-numeric branch is also taken for a *numeric* current stat whose previous
+ // snapshot is missing (a column that has only just appeared in the stats stream), and
+ // there the difference between toLocaleString and plain String conversion is
+ // user-visible: a row count in the millions is rendered with group separators. The
+ // expectation is computed rather than hard-coded so it holds under any locale, and the
+ // first assertion keeps it from going vacuous on a runtime without number grouping.
+ it("formats large numeric stats with locale group separators", () => {
+ const bypassSpy = vi.spyOn(TestBed.inject(DomSanitizer), "bypassSecurityTrustHtml");
+ component.isOperatorFinished = false;
+ component.tableStats = { col: { count: 1234567 } };
+ component.prevTableStats = { col: {} };
+
+ component.compare("col", "count");
+
+ const grouped = (1234567).toLocaleString();
+ expect(grouped).not.toBe("1234567");
+ expect(bypassSpy).toHaveBeenLastCalledWith(
+ grouped
+ .split("")
+ .map(char => black(char))
+ .join("")
+ );
+ });
Review Comment:
The assertion `expect(grouped).not.toBe("1234567")` makes this test dependent on the runtime’s default locale/ICU behavior and can fail in environments where `toLocaleString()` doesn’t apply grouping by default. To keep the test deterministic while still ensuring `compare()` uses `toLocaleString()` (vs `String()`), spy on `Number.prototype.toLocaleString` and use the spy’s returned value for the expectation.
##########
frontend/src/app/workspace/component/result-panel/result-table-frame/result-table-frame.component.spec.ts:
##########
@@ -149,7 +149,11 @@ describe("ResultTableFrameComponent", () => {
expect(component).toBeTruthy();
});
- it("currentResult should not be modified if setupResultTable is called with empty (zero-length) execution result", () => {
+ // NOTE: this exercises the *missing operator* guard, not the empty-result guard - the
+ // fixture built in beforeEach has no operatorId, so setupResultTable returns before it
+ // ever looks at the row count. The empty-result guard is covered by
+ // "keeps the existing table when the fetched page comes back empty" below.
+ it("currentResult should not be modified if setupResultTable is called without a selected operator", () => {
component.currentResult = [{ test: "property" }];
(component as any).setupResultTable([], 0);
Review Comment:
`setupResultTable` is a public method on the component (not a private helper), so casting `component` to `any` here is unnecessary and weakens type-checking in the spec.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org