Skip to content

Commit 898394c

Browse files
committed
test: lock global provider wrappers to byte-idempotent order
1 parent 398ea19 commit 898394c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/global_playback_integrity_policy_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,23 @@ def capture_scheduler(text, provider_id, patch_script, options, profile_name):
9696
assert "scripts/provider_patches/hls_runtime_integrity_v1.py" in paths
9797
assert any(row.get("scope") == "global_playback_integrity" for row in records if isinstance(row, dict))
9898

99+
# The complete discovery transform must be byte-idempotent. Stable output bytes
100+
# are required for content-addressed filenames, cache keys and future post-Brain
101+
# minification/purification: a second apply with no source change cannot create a
102+
# new provider artifact just because wrapper tail ordering is reconsidered.
103+
reapplied, reapplied_records = module.apply_overrides(
104+
"future-provider-never-seen-before", patched, phase="discovery"
105+
)
106+
assert reapplied == patched
107+
assert reapplied.decode("utf-8").count("NUVIO_GLOBAL_STREAM_PRESENTATION_V1") == 1
108+
assert reapplied.decode("utf-8").count("NUVIO_GLOBAL_RUNTIME_MEDIA_SAFETY_V1") == 1
109+
assert reapplied.decode("utf-8").count("NUVIO_HLS_RUNTIME_INTEGRITY_V1") == 1
110+
assert not any(
111+
row.get("type") == "replace"
112+
for row in reapplied_records
113+
if isinstance(row, dict)
114+
)
115+
99116
# Runtime repair phase must not inject discovery wrappers.
100117
runtime, runtime_records = module.apply_overrides("future-provider-never-seen-before", future, phase="runtime")
101118
assert b"NUVIO_HLS_RUNTIME_INTEGRITY_V1" not in runtime

0 commit comments

Comments
 (0)