Skip to content

Commit 993289c

Browse files
committed
fix(showcase): dedupe identical green-and-fresh depth helpers
Consolidate isE2eGreenAndFresh into isGreenAndFresh; both had identical staleness semantics. Single helper now serves D3/D5/D6, removing a drift hazard. No behavior change.
1 parent b7b95b4 commit 993289c

1 file changed

Lines changed: 5 additions & 25 deletions

File tree

showcase/shell-dashboard/src/components/depth-utils.ts

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ function isGreen(live: LiveStatusMap, key: string): boolean {
6666

6767
/**
6868
* A row counts as green only when it is green AND fresh. A frozen-green row
69-
* from a stalled driver must NOT credit its depth — the same false-green
70-
* staleness downgrade `cell-model.ts` applies to D3/D5/D6, mirrored here so
71-
* both consumers agree.
69+
* from a stalled driver must NOT credit its depth — otherwise the depth ladder
70+
* reads a dead probe pipeline as a false-green (e.g. a D3 e2e signal whose
71+
* driver stopped writing). Mirrors the staleness downgrade `cell-model.ts`
72+
* applies to D3/D5/D6 so both consumers agree.
7273
*/
7374
function isGreenAndFresh(
7475
live: LiveStatusMap,
@@ -87,23 +88,6 @@ function isRowStale(row: StatusRow, now: number, maxAgeMs: number): boolean {
8788
return now - observedMs > maxAgeMs;
8889
}
8990

90-
/**
91-
* The e2e (D3) signal counts as green only when a green row exists AND it
92-
* has been refreshed within the staleness window. A frozen green row from a
93-
* driver that stopped writing must NOT credit D3 — otherwise the depth
94-
* ladder reads a dead probe pipeline as a false-green D3. Mirrors the
95-
* staleness downgrade in cell-model.ts so both consumers agree.
96-
*/
97-
function isE2eGreenAndFresh(
98-
live: LiveStatusMap,
99-
key: string,
100-
now: number,
101-
): boolean {
102-
const row = live.get(key);
103-
if (row?.state !== "green") return false;
104-
return !isRowStale(row, now, E2E_STALE_AFTER_MS);
105-
}
106-
10791
/**
10892
* Check whether all D5 PB rows for a given (slug, catalogFeatureId) are green
10993
* AND fresh. Returns false if the feature has no D5 mapping or any mapped row
@@ -228,11 +212,7 @@ export function deriveDepth(
228212
};
229213
}
230214
if (
231-
!isE2eGreenAndFresh(
232-
live,
233-
keyFor("e2e", cell.integration, cell.feature),
234-
now,
235-
)
215+
!isGreenAndFresh(live, keyFor("e2e", cell.integration, cell.feature), now)
236216
) {
237217
return {
238218
achieved,

0 commit comments

Comments
 (0)