Fix flaky cut-isolation test; bring docs current on the hark relationship

test_cut_pending_isolates_per_episode_failures matched a bare "2" against
the full audio file path to target episode 2's failure — but pytest's
auto-numbered tmp_path can itself contain that digit, so the test failed
depending on run order. Now matches the deterministic per-episode filename.

README/CLAUDE.md/PLAN.md still described the hark relationship as an open
question; M5 was actually decided (library dependency, not a merge) — bring
them in line with what hark's own docs already say.
This commit is contained in:
flan
2026-07-11 04:37:25 +00:00
parent 77d69bfb39
commit 7e4172c70c
5 changed files with 55 additions and 26 deletions
+12
View File
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- `__version__` in `src/adscrub/__init__.py` was stuck at 0.1.0 across every
milestone release since `pyproject.toml`'s version was bumped each time but
this constant never was — the CLI's `--version` and every outbound
User-Agent header have claimed to be `adscrub/0.1.0` this whole time.
- `test_cut_pending_isolates_per_episode_failures` matched a substring ("2")
against the full audio file path to distinguish episode 2's failure from
episode 1 — but pytest's auto-numbered `tmp_path` ("pytest-26", "pytest-102",
...) can itself contain that digit, making the test flaky depending on run
order. Now matches the deterministic filename (episode id) instead.
## [0.4.0] - 2026-07-10
### Added
+12 -12
View File
@@ -54,19 +54,19 @@ episode works on any feed, at the cost of real per-episode compute.
## Relationship to hark
Explicitly a candidate for later merging into `flan/hark` as a module — both projects
fetch feeds, upsert episodes into SQLite, and re-host derived feeds for the same
AntennaPod-stays-unmodified loop. Kept as a separate repo for now because the two
pipelines (topic extraction from metadata vs. audio transcription/cutting) don't share
meaningful code yet. Don't build permanence into this separateness (e.g. don't invent
a distinct auth/web layer, deployment identity, or feed-registration UX that would
just get thrown away on merge) — keep it a thin CLI + SQLite + pipeline, matching
hark's own M0/M1 shape, so a later merge is a module import, not a rewrite.
Resolved 2026-07-11 (PLAN.md's M5): stays a separate repo, separate CHANGELOG/SemVer,
separate test suite. `flan/hark` depends on this one as a library (`uv` path
dependency, editable) — hark's `episodes`/`shows`/`ad_segments` schema was shaped to
match this project's own, so this package's schema-coupled functions
(`pending_episodes`, `transcribe_episode`, `detect_pending`, `cut_pending`, ...) work
unchanged when called with a `conn` from hark's database. hark's CLI
(`chapters`/`transcribe`/`detect-ads`/`cut`) is a thin wrapper calling straight into
this package — no code here is duplicated into hark.
The full pipeline (ingest → chapters → transcribe → detect → cut → serve) is now
built end-to-end as of 0.4.0, which is exactly the trigger PLAN.md's M5 names for
actually making the merge-or-stay-standalone call — **that's the owner's decision, not
something to resolve unprompted.** Don't preemptively start merging repos.
Don't build features assuming this will get absorbed into hark's own source later —
that already got tried once (a full copy-merge into `src/hark/`, wrong shape, reverted
same day) and isn't the direction. Keep this repo's own CLI/pipeline/tests
self-sufficient and runnable standalone, same as before.
## Conventions
+10 -7
View File
@@ -72,13 +72,16 @@ Tests use local feed fixtures — no network.
## Relationship to hark
This may end up merged into [hark](https://git.onetick.ninja/flan/hark) as a
module rather than staying a permanently separate service — both projects fetch
feeds, upsert episodes into SQLite, and re-host derived RSS feeds for the same
AntennaPod-stays-unmodified loop. Kept separate for now since the two pipelines
(topic extraction vs. audio transcription/cutting) don't share much code yet;
don't over-invest in infrastructure that would need to be thrown away if they
merge later.
Resolved 2026-07-11 (see M5 in docs/PLAN.md): this stays a separate product.
[hark](https://git.onetick.ninja/flan/hark) depends on it as a library (a `uv`
path dependency, editable) rather than folding its source in — hark's own
`episodes`/`ad_segments` schema was shaped to match this project's, so
adscrub's schema-coupled functions (`pending_episodes`, `transcribe_episode`,
`detect_pending`, `cut_pending`, ...) work unchanged against hark's database.
`hark chapters`/`transcribe`/`detect-ads`/`cut` are thin CLI wrappers around
this package. An earlier pass at the merge fully copied this source into
`src/hark/`, which was the wrong shape and got reverted — see hark's
CHANGELOG 0.4.0.
## AI use disclosure
+15 -6
View File
@@ -79,16 +79,25 @@ Milestones. Each one ships something usable and gets a CHANGELOG version.
commands. `$ADSCRUB_BASE_URL` must be set to wherever the podcast player can actually
reach the container — `serve` prints a warning if left at the `localhost` default.
## M5 — hark module decision
## M5 — hark module decision (resolved 2026-07-11)
- Now that M4 works end-to-end, the actual decision point: fold this into `flan/hark`
as a module (shared feed-ingest code, one deployed service) or keep it standalone?
**Owner call, not decided here** — don't pre-build shared infrastructure before this
is actually decided.
- Decision: stays a separate product. `flan/hark` depends on this repo as a library
(`uv` path dependency, editable), not a source merge — hark's schema was shaped to
match this one so adscrub's schema-coupled functions work unchanged against hark's
database. `hark chapters`/`transcribe`/`detect-ads`/`cut` are thin CLI wrappers that
call straight into this package.
- An earlier pass in the same session fully copied this source into `src/hark/`
(wrong shape — two products' worth of code entangled in one), pushed to hark's
main, then reverted via `git revert -m 1` once caught. See hark's CHANGELOG 0.4.0
for the full story.
- Practical effect on this repo: still developed and versioned independently, own
CHANGELOG/SemVer, own test suite. hark's Docker build doesn't yet resolve the path
dependency (build context only has hark's own files) — a packaging gap noted in
hark's own docs/PLAN.md, not this repo's problem to solve.
## Open questions (owner input needed, don't block on these)
- M5's hark-merge decision (see above).
- ~~M5's hark-merge decision~~ Resolved 2026-07-11 (see above).
- M3 currently defaults to `claude-opus-4-8`; revisit cost vs. accuracy on ad-span
boundaries once it's run against real transcripts (a cheaper model may be plenty
for a fairly mechanical "find the sponsor read" task).
+6 -1
View File
@@ -172,7 +172,12 @@ def test_cut_pending_isolates_per_episode_failures(conn, tmp_path, monkeypatch):
conn.commit()
def fake_probe_duration(path):
if "2" in str(path):
# Match the episode-2 audio file by its deterministic name
# (data_dir/audio/<episode_id>.mp3), not a substring of the full
# path — tmp_path itself is pytest's auto-numbered temp dir
# ("pytest-26", "pytest-102", ...) and can coincidentally contain
# "2", which made this test flaky depending on run order.
if path.stem == str(ep2["id"]):
raise RuntimeError("ffprobe failed")
return 100.0