Run #1 (6302e0b) failed at the tests gate for two reasons local runs
masked:
- The act image lacks OpenCV's runtime libs, so every
scenedetect-importing media test died on `ImportError: libGL.so.1`.
The workflow now installs libgl1/libglib2.0-0 with ffmpeg, and the
README documents the headless-Linux runtime libs for users.
- Rich rendered `va transcribe --help` at 80 columns and wrapped
`openai-transcriptions` mid-token: GITHUB_ACTIONS makes typer force a
terminal, and TERM=dumb then picks rich's 80-column fallback. Tests
now pin COLUMNS=120 before any Console is constructed and keep typer
in auto-detect mode, so help and doctor output are width-independent
of the runner.
Gates 4/4: 449 passed, 2 skipped; also green under
GITHUB_ACTIONS=true COLUMNS=80.
Two verification gaps from the review:
- the `transcript is not None` guard added in d94188e had no test. The stage skip
policy normally keeps a transcript-less diarize apply out of the scheduler's way,
so the test calls the apply callable the scheduler invokes (RunContext with no
transcript) and asserts the load leaves the run untouched; removing the guard
makes it fail with NoneType.model_copy inside attribute_speakers
- the third #9 divergence (va analyse --max-shots / --no-describe) was only
asserted CLI-side. The new parity test runs both doors against the same fake
pipeline and asserts identical stage calls *and* that max_shots=8 reaches the
shots stage from both (shown red against an MCP tool that dropped max_shots)
Issue #6's "alias" criterion was unfinished: vision.llama_server_up was a
one-line pass-through and vision also owned LLAMA_SERVER_COMMAND, which doctor
imported from vision - so the llama-server facts were spread over two modules
and a third consumed the copy.
- llm: owns LLAMA_SERVER_COMMAND next to the local provider name and the
llama_server_models/llama_server_up health check
- vision: drops the alias and the constant; describe_shots/describe_moment call
llm.llama_server_up, the actionable hint interpolates llm.LLAMA_SERVER_COMMAND
- doctor: imports the startup command from llm
- tests: the describer health-check stubs target llm.llama_server_up; the
localhost server stub (path + trailing-slash check) moves to tests/test_llm.py
with the rest of the llama-server tests; the duplicate closed-port test goes
_mcp_server probed the module for run/run_server/mcp/server with a getattr
ladder, plus a second server.run branch - names mcp_server always exports (or
never will), so most of the ladder was unreachable and the failure messages
described a situation that cannot occur.
- cli: one lazy `from .mcp_server import DEFAULT_HTTP_HOST, run` inside a
try/except that keeps the actionable install message; importlib is gone
- tests: the serve-mcp dispatch stub provides the two names the entry point
uses
The scheduler loop still special-cased one stage by name twice
(if spec.name == "ingest": the cache-hit "downloaded" rewrite and an extra
downstream invalidation under the content hash), while the table is supposed to
be the single encoding of the stage graph.
- StageSpec gains three policy fields: namespace ("content" by default;
"source" for ingest, whose artifact precedes the content hash), hit_update
(fields a cache hit overwrites) and force_invalidates_content
- RunContext.namespace and Pipeline._execute_spec read those fields; no
stage-name switch is left in the scheduler loop
- tests: the table declares exactly ingest as the source-namespaced, hit-updating,
content-invalidating stage; the existing cached/forced ingest behaviour tests
stay green
The "int, not bool, within range" guard was hand-rolled five times (analysis.moment
max_frames/width, analysis.frame width, mcp max_images, mcp transcript_max_chars),
and the MCP tool signatures re-typed max_shots=64 instead of importing the constant.
- analysis: checked_int(value, name, minimum=, maximum=) is the one implementation
(bool rejected, one message shape) and is exported for the doors; moment/frame use
it for their numeric knobs
- mcp: max_images and transcript_max_chars go through the same guard, and both
max_shots defaults are DEFAULT_MAX_SHOTS
- tests: the guard's message/range contract, moment+frame's public rejection paths,
both MCP tool guards (no stage runs), and the tool schemas' max_shots default
tied to DEFAULT_MAX_SHOTS (all shown red against a disabled range check)
"width is None and height is None" was spelled out at analysis._require_video,
analysis.analyse's diagnosis and pipeline's shots params/skip policy. A computed
property on MediaFacts names the fact once.
- models: MediaFacts.has_video (foundation file; the code-review record authorizes
this deliberate edit per ADR-0001)
- analysis/pipeline: the three sites ask media.has_video
- tests: the property over a video and an audio-only MediaFacts
analysis._window_segments re-implemented vision.transcript_slice_for's clipping,
word-midpoint test included - and the two had already diverged on the window
edge: the shot prompt used a half-open [start, end), moment used a closed one.
- vision: window_segments(transcript, start, end) is the one pure clipper,
returning TranscriptWindow (segment bounds, speaker, clipped text); half-open
so two abutting windows never speak the same word twice
- vision.transcript_slice_for renders those windows for the shot prompt
- analysis._window_segments clamps them into MomentSegment (vision imported
lazily, as describe_moment already is)
- tests: the shared half-open clipper directly, and moment's transcript slice
through the public operation: a word whose midpoint is exactly t_end is not
in the window (the moment half was red before the change)
Diarizer.diarize(wav, options) took an option value its constructor already
held, so every caller passed the same object twice. The two concrete backends
also exposed supported_options/ignored_options frozensets that nothing read -
speculative hooks that duplicated what cache_params already makes explicit.
- Diarizer.diarize(wav) uses the DiarizeOptions value the diarizer was built
with; the protocol docstring states that ownership and pyannote's applicable
knobs (num_speakers only; cluster/merge are sherpa segmentation settings)
- SherpaDiarizer/PyannoteDiarizer drop supported_options and ignored_options;
applicability stays observable in the protocol docstring, cache_params and
the pyannote cache-params test
- diarize_audio and the pipeline's diarize stage call diarize(wav) (the
injectable test-stage seam keeps its (wav, *, options) signature)
- tests: each backend applies the option value it was constructed with (both
were red: diarize() required the extra argument)
The backend name lists existed four times: transcribe's Literal/STT_BACKENDS,
diarize's Literal/DIARIZE_BACKENDS, a dead copy plus a misleading 'single source'
comment in config, and two CLI StrEnums re-spelling the STT names. A new backend
had to be added in three places to be selectable.
- transcribe/diarize: the registry is now a StrEnum (the one spelling of the
names); STT_BACKENDS/DIARIZE_BACKENDS derive from it, so the registry cannot
drift from its own type
- config: drop the dead DIARIZE_BACKENDS copy and the unused STT_BACKENDS alias
(the comment claimed a single source it did not provide); the fields reference
transcribe.SttBackend / diarize.DiarizeBackend directly
- cli: --backend uses the registry enums (typer renders their choices and
rejects unknown values) instead of private StrEnums
- tests: 'va transcribe|diarize --help' and an invalid --backend both show
exactly the registry's names (shown red against a hand-picked choice list)
Settings() was inlined at every command and tool, and three commands still
patched a profile field with model_copy. One construction path, once per
entry point, keeps the profile readable at the seam where a flag arrives.
- config: load_settings(**profile_overrides) constructs Settings once and
applies only the explicit (non-None) profile overrides
- cli: every command builds its settings at entry; --backend/--model go
through load_settings instead of a per-command model_copy; no Settings
import is left in the adapter
- mcp: every tool builds its settings once at entry and hands it to the
operation
- tests: behavioural flags (--no-diarize/--no-describe/--max-shots/--force)
travel in AnalysisOptions and leave the settings profile untouched;
--backend/--model override VA_* at the entry point (both tests were shown
red against a settings patch / an override-dropping load_settings)
The MCP extract_keyframes tool hand-built a dict with per-shot model_dump while
the CLI had its own private _ShotsPayload model for the same shape - a
pydantic-at-the-boundary breach (CONTRACTS 1 rule 2).
- models: add ShotsPayload (source, workdir, shots), exported next to Shot
- cli: drop the private copy and use the shared model
- mcp: structured content is ShotsPayload serialised, not a hand-built dict; the
shot/image counts stay in the human-readable summary
- tests: extract_keyframes structured content carries workdir and no ad-hoc keys
'va shots' and 'va describe' each ran the scheduler twice: a probe call only
to recover the payload's source/workdir, then the outcome operation. One
command must be one scheduler run.
- analysis: shots() and describe() return the assembled Artifacts from their
single run, consistent with probe()/analyse(); doors extract the field they
render (artifacts.shots, artifacts.source, artifacts.workdir)
- cli: 'shots' and 'describe' drop the extra probe run
- mcp: extract_keyframes reads the shot list from the returned artifacts
- tests: CLI command is asserted to be exactly one analysis operation, with
the JSON payload still carrying source/workdir/shots; the MCP/CLI analysis
stubs return artifacts from the narrow outcomes
An uncached http(s) source has no resolved content hash, yet probe/audio/
describe/report still hashed a None hash and then asked for a namespace,
so analysis.cached() (and therefore 'va ask <url>') raised the internal
ValueError 'stage probe needs a resolved source hash' instead of the
documented diagnosis.
- pipeline: the content-keyed stages return no cache key until video_sha is
resolved (one _content_key helper), matching _transcribe_params; cached()
therefore returns None and ask() raises its documented RuntimeError
- tests: cached()/ask() against an uncached URL (the missing case: the old
tests only used local paths)
MediaInfo conflated content facts with a run-time handle, so byte-identical aliases could not share a probe artifact and every cache read needed a path-rebasing sweep.
- models: replace MediaInfo in one sweep with content-only MediaFacts and run-time MediaRef; Artifacts gains ref; MediaFacts.extra drops local filename/path keys on construction
- media.probe returns MediaFacts with no path/source and no ffprobe filename
- pipeline: probe params are the content hash only; attach MediaRef on every run; delete _rebase_media/_rebase_report; keep yt-dlp title/metadata as sanitized run-time facts for reports
- synthesis: prompts and metadata consume facts only; report assembly takes the run-time source; report metadata carries no local path
- cli/mcp: compose facts + ref where a local path or source display is needed
- CONTRACTS sections 3-4, README and PLAN reference the new shapes; tests cover the alias cache hit, facts round-trip and path-free report metadata
Cache migration: dropping source from the probe params changes probe keys, so existing probe entries are a one-time invalidation (one cheap ffprobe call per source).
Closes#7
Settings stays a config reader; stages now take a per-stage value (SttOptions, DiarizeOptions, ShotOptions, DescribeOptions, ReportOptions) instead of the whole settings bag. options_for(stage) is the single place that fills defaults, so the 0.7 diarize threshold, minimum segment durations and model resolution rules exist once.
The STT backend rule no longer inspects model_fields_set: an explicit stt_backend wins, else a non-default whisper_model selects whisper, else the profile default. Whisper with the default checkpoint is selected by stt_backend=whisper via env/TOML.
Pipeline runners, cache-key builders and the injectable stages= seam consume the option values. describe_shots and synthesise_report no longer take Settings. DiarizeOptions has no independent threshold default, and diarize_audio's sherpa happy path is covered with a fake sherpa module.
- Add StageCache.cached_run and route Pipeline._execute_stage through it.
- Cache Q&A answers under stage 'ask' keyed by the report fingerprint.
- Return PromptInfo from build_synthesis_prompt and record it in report metadata.
- Pin _report_json budget behaviour with named tests.
The option only accepted "adaptive" and was then dropped: the pipeline
hardcodes the detector name in the shots cache key, so it could never
change behaviour. Typer now rejects --detector as an unknown option.
- cli.py: drop the option and its validation block
- tests/test_cli.py: assert the flag is absent from help and rejected by
typer; drop it from COMMAND_OPTIONS
- README.md: stop advertising the flag
- synthesis.py: rewrap two E501 prompt literals (the issue #1 fix) so the
repository-wide lint gate is green; prompt text is unchanged
Tracker: issue #2.
The repo failed its own lint gate (CONTRACTS.md 1.6): two implicit-concatenation
lines in SYNTHESIS_TASK and CHUNK_TASK were 309 and 121 characters. Both are
split across lines inside the existing parentheses; because Python merges
adjacent literals before anything sees them, the rendered prompt text is
byte-identical (verified by sha256 of every prompt constant before and after).
tests/test_synthesis.py previously only asserted fragments of the rendered
prompt, so the wording was unpinned. test_prompt_text_is_pinned_byte_for_byte
now snapshots all six prompt constants exactly, so a future reformatting or
reword shows up as a test failure rather than silent prompt drift.
Closes#1
Empirical sweep on the fast-cut vlog test video (9:14, single dynamic
narrator): threshold 0.5 split him into 15 speakers/46 turns, 0.7 gives
7 speakers/14 turns with S1 at 94% of speaking time (remaining fragments
coincide with genuinely different B-roll audio); 0.8 identical to 0.7.
New VA_DIARIZE_CLUSTER_THRESHOLD setting (in the diarize cache key);
synthesis prompts now instruct that S-labels come from automatic
diarization and one person may be split across several labels. After the
fix the report's people list is clean: narrator/host, John (off-screen),
the montage woman, Lee Sedol and AlphaGo (from OCR) - no S4/S10/S14 noise.
331 passed, 2 skipped; ruff clean.
Long shots (> VA_SUBDIVIDE_AFTER_SECONDS, default 20s) are now subdivided by a
deterministic frame-difference activity curve (one ffmpeg rawvideo pass, 64x36
gray at 2 fps): segment boundaries land at equal cumulative-activity quantiles,
so busy stretches are sampled densely and quiet ones sparsely; each segment's
keyframe sits at its calmest sample (a settled frame: clean slides, no
mid-transition blends) and carries a relative activity level that the vision
prompt surfaces to the model. Modes: VA_SHOT_SAMPLING=adaptive|uniform|scene.
Shot gains optional keyframe_time + activity fields; extract_keyframes honors
keyframe_time; shots cache key covers the new settings. Research basis: classic
IFD-curve content-adaptive summarization + AKS (arXiv:2502.21271).
330 passed, 2 skipped; ruff clean.
When the average detected shot exceeds 20s (talks, lectures, overlay-style
videos with no hard cuts), re-segment the video into equal ~15s segments
(capped at max-shots) so the vision stage sees the whole video; phash dedup
still drops visually identical frames. New Settings: uniform_sampling,
uniform_interval_seconds, uniform_max_avg_shot_seconds (all in the shots
cache key). Validated on the Two Minute Papers test video: 1 described
frame -> 28, including OCR of the on-screen paper references (Monien &
Speckenmeyer 1985, Schoning 1999), the 3-SAT example cards, and the paper
abstract sentence.
325 passed, 2 skipped; ruff clean.
- Settings.ollama_base_url / ollama_api_key (config.toml or VA_OLLAMA_* env),
falling back to OLLAMA_BASE_URL / OLLAMA_API_KEY, endpoint defaulting to
https://ollama.com/v1; remote endpoints without a key raise with instructions
- va doctor understands the settings-based key and hints at config.toml
- autouse test fixture makes the suite hermetic against the user's real
config.toml and provider-key env vars
- README/CONTRACTS/PLAN: mixed setup (local Parakeet STT + DeepSeek via Ollama
Cloud) documented; live-probed /v1 endpoint (200 on models, 401 on dummy key)
321 passed, 2 skipped; ruff clean