mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-11 03:09:57 +00:00
ci: flow-aware manifest discovery — a name list missed real readers
Review found lib/routers/chart.py binding `m = load_manifest(p) or {}` and
reading eight manifest keys through it. `m` was not in MANIFEST_VARS and
`m.get` did not match the readers-complete regex, so the module was
invisible to BOTH halves of the gate — unlisted and unscanned. Same for
lib/routers/song.py (binds `manifest` from load_manifest for enrichment
gap-fill). Both are now in READERS.
The structural fix, not the name-list patch: keys_touched() now discovers
receivers flow-aware — any local assigned from load_manifest(...) is a
manifest dict, whatever it is called. MANIFEST_VARS remains only as the
fallback for manifests that arrive as function parameters (ws_highway).
A plain `m = {}` is not a receiver; test pins that.
readers-complete now reuses keys_touched() itself instead of a parallel
KEY_OPS regex — the two detectors diverged once already (that is exactly
how chart.py slipped through), so now there is one detector and one truth.
check_reverse() gets a 300s subprocess timeout: the validator executes at a
pinned SHA, but a pathological pack or validator bug should fail the job,
not hang the runner to the Actions-level timeout.
Tests: flow-aware receiver under an arbitrary name (read + write), and the
negative — a plain dict named `m` stays out of the scan. 17 pass.
Signed-off-by: topkoa <topkoa@gmail.com>
This commit is contained in:
@@ -59,6 +59,28 @@ def test_load_manifest_wrapped_get_is_seen(tmp_path):
|
||||
assert "original_audio" in reads
|
||||
|
||||
|
||||
def test_flow_aware_receiver_any_name(tmp_path):
|
||||
# lib/routers/chart.py binds `m = load_manifest(p) or {}` — a fixed name
|
||||
# list missed it and the module's reads went entirely unscanned. Locals
|
||||
# assigned from load_manifest must be receivers whatever they're called.
|
||||
reads, writes = _touch(
|
||||
tmp_path,
|
||||
"""
|
||||
pak_info = sloppak_mod.load_manifest(p) or {}
|
||||
x = pak_info.get("stems")
|
||||
pak_info["genres"] = ["metal"]
|
||||
""",
|
||||
)
|
||||
assert reads == {"stems"} and writes == {"genres"}
|
||||
|
||||
|
||||
def test_plain_dict_named_m_is_not_a_receiver(tmp_path):
|
||||
# Flow-awareness must not make every short local a manifest: `m` bound to
|
||||
# something other than load_manifest stays out of the scan.
|
||||
reads, writes = _touch(tmp_path, 'm = {}\nx = m.get("title")')
|
||||
assert reads == set() and writes == set()
|
||||
|
||||
|
||||
def test_unrelated_dicts_are_ignored(tmp_path):
|
||||
reads, writes = _touch(tmp_path, 'x = config.get("title"); settings["artist"] = 1')
|
||||
assert reads == set() and writes == set()
|
||||
|
||||
Reference in New Issue
Block a user