Skip to content

Commit 01c815c

Browse files
committed
test: de-flake w738 byte-stable envelope check (exclude non-deterministic _meta)
`_envelope_for` byte-compared two envelopes that each stamp `_meta` (timestamp, index_age_s, and — when stale — index_status). Two calls that straddle a one-second boundary produced different `index_age_s` (e.g. 2593 vs 2594), failing the assertion intermittently on slower CI lanes. The test asserts legacy-vs-typed-projection content equivalence, not metadata stability, so drop `_meta` before serializing. Deterministic now.
1 parent c8e66a0 commit 01c815c

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

tests/test_w738_suppression_wire_format.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,20 @@
3535

3636

3737
def _envelope_for(suppressions: list[dict]) -> str:
38-
return to_json(
39-
json_envelope(
40-
"triage-list",
41-
summary={"verdict": f"{len(suppressions)} suppression(s)", "total": len(suppressions)},
42-
budget=0,
43-
suppressions=suppressions,
44-
)
38+
env = json_envelope(
39+
"triage-list",
40+
summary={"verdict": f"{len(suppressions)} suppression(s)", "total": len(suppressions)},
41+
budget=0,
42+
suppressions=suppressions,
4543
)
44+
# Drop the non-deterministic metadata bucket before serializing: ``_meta``
45+
# stamps ``timestamp`` + ``index_age_s`` (and, when stale, ``index_status``),
46+
# which differ between two calls that straddle a second boundary. This test
47+
# asserts the legacy-vs-typed-projection content equivalence, not metadata
48+
# stability — comparing with ``_meta`` made it intermittently fail
49+
# (e.g. ``index_age_s`` 2593 vs 2594) on slower CI lanes.
50+
env.pop("_meta", None)
51+
return to_json(env)
4652

4753

4854
def test_triage_list_envelope_byte_stable_well_formed(tmp_path: Path) -> None:

0 commit comments

Comments
 (0)