refactor(engine): promote temporal probe from cli hack to api integration - #1117
refactor(engine): promote temporal probe from cli hack to api integration#1117seonghobae wants to merge 8 commits into
Conversation
…tion Replace the "Temporary: Inject temporal analyzer ... just to prove it works" block in cli.py with api._build_local_temporal_features(), merged into audio_features under stem features so tempo/beat cues and the real recording's title survive into the job result even when stem separation is unavailable. _build_from_arrangement now takes the song title from audio_features when present instead of the hard-coded "Late Night Set". Raise STEM_SEPARATION_TIMEOUT_SECONDS 20 -> 300 and the Rust ANALYSIS_PROCESS_TIMEOUT 30s -> 360s: the old values guaranteed a timeout on any real-length song and forced the fallback path unconditionally. Move the empty/unreadable-source branch coverage off the deleted cli probe onto api._build_local_temporal_features; add a tempo-preserved assertion to the stem-degrade test; repoint the progress-jsonl test at bandscope_analysis.api.TemporalAnalyzer. ruff + ruff format + mypy src + pytest --cov-fail-under=100 all pass (678 passed, 100% coverage). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SoJBAAXwv58S8P4hQBQQAw
📝 WalkthroughWalkthrough로컬 오디오 분석에 Changes분석 파이프라인 변경
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🟡 Moderate · up to The PR moves tempo and recording-title generation into the main analysis flow, but stale v1 cache entries can bypass those changes, and an unreadable recording may still fall back to the hard-coded rehearsal title. These bounded correctness issues should be resolved before merging. Sequence Diagram(s)sequenceDiagram
participant CLI
participant AnalysisAPI
participant TemporalAnalyzer
participant StemSeparation
CLI->>AnalysisAPI: 분석 작업 요청 전달
AnalysisAPI->>TemporalAnalyzer: 로컬 오디오 temporal feature 추출
TemporalAnalyzer-->>AnalysisAPI: title과 tempo 반환 또는 실패
AnalysisAPI->>StemSeparation: stem feature 추출
StemSeparation-->>AnalysisAPI: stem feature 또는 오류 반환
AnalysisAPI->>AnalysisAPI: temporal feature와 stem feature 병합
AnalysisAPI-->>CLI: 최종 분석 결과와 상태 반환
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… progress Iteration-2 status: gates still fail closed. Central .github landed 8 Noema-reliability fixes (#1477-#1504) plus an active "remove fixed LLM response timeout" branch. Local response: staged merge-ready work behind the closed gates — PR #1116 (this baseline) and PR #1117 (temporal probe promoted from cli hack to api integration, 100% coverage locally). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SoJBAAXwv58S8P4hQBQQAw
|
@opencode-agent Take the sole writer lease for the current exact CI repair on canonical Exact repository CI run Treat this as a stale test contract caused by this branch, not a reason to roll production cache semantics back. Make the smallest test-only repair in |
|
@opencode-agent Review the unchanged exact head |
Summary
Promotes temporal analysis from the old
cli.pyprobe into the productionapi.pyorchestration path so tempo metadata survives stem-separation degradation and a local recording keeps its operator-visible source label.api._build_local_temporal_features(request)runsTemporalAnalyzerforlocal_audiorequests and always preserves the already-validatedsourceLabel; if temporal DSP raisesFileNotFoundErrororValueError, tempo/beat fields are omitted rather than invented.run_analysis_job_updatescomposes temporal metadata with stem features; validated stem values retain precedence on collisions._build_from_arrangementuses the local recording title when available instead of falling back toLate Night Set.analysis-cache-v2, so pre-temporal v1 results cannot short-circuit the new metadata path.FEATURE_CACHE_SCHEMA_VERSION = 1and retains its existinganalysis-cache-v1digest/path so compatible expensive separation results remain reusable.Regression coverage
test_temporal_metadata_regression.pyproves temporal failure retains the operator recording label, pre-temporal v1 full results are rejected, full results move to v2, and compatible v1 stem-feature paths remain unchanged.test_branch_coverage_contract.pykeeps the analyzer-failure branch aligned with the source-label-preserving fallback.test_run_analysis_job_updates_report_progress_and_cachenow checks completed results inanalysis-cache-v2separately from reusable.features.jsonmetadata inanalysis-cache-v1, while preserving the second-run cache-hit/separator-not-recalled contract.Security Notes
TemporalAnalyzeralready operated on the same operator-selected local recording path; this change moves that existing computation into the production orchestration path. No network, dependency, privilege, or new executable authority is introduced.sourcePathremains supplied through the existing desktop selection/validation boundary. Cache files remain untrusted app-owned persisted data and are accepted only through their schema/shape validation paths.FileNotFoundError/ValueErrordrops unavailable DSP metadata but retains the known validatedsourceLabel. Stem separation failure continues through the existing bounded fallback behavior. No tempo or beat value is synthesized after a failed temporal analysis.Dependency / supply chain
No dependency, lockfile, model, or workflow change is introduced by this PR.
i18n impact
None. The title comes from the recording label already supplied by the desktop boundary; no new customer-facing locale key is introduced.
Exact-head gate
develop@749511c3ad4000090048718f685c6bee6b3d2c25.b98f266d2356d56be624fb617580b5252e85baaa.coverage-evidenceis terminal-success. A fresh exact-headopencode-reviewdispatch is queued; queued evidence is not passing evidence. At the latest refetch no exact-head check had a terminal failure, but remaining required gates must still become terminal-success on this unchanged head.Predecessor, queued, skipped, cancelled, failed, stale-head, model-only, self/author, status-only, or administrative-bypass evidence does not transfer. Merge only after every applicable required exact-head gate and a qualifying independent non-author approval are terminal-success with addressed threads resolved.