Skip to content

feat: assembly receipt of what each extraction actually cut (0.2.0) - #10

Merged
joepetjr merged 3 commits into
mainfrom
feat/assembly-receipt
Oct 27, 2026
Merged

joepetjr merged 3 commits into
mainfrom
feat/assembly-receipt

Conversation

@joepetjr

Copy link
Copy Markdown
Contributor

What

Adds an assembly receipt: a record of what each extraction actually cut.

  • extract_and_concat_ranges_with_receipt and extract_and_concat_segments_with_receipt return (path, AssemblyReceipt), or (None, None) on failure.
  • extract_and_concat_ranges and extract_and_concat_segments keep their signatures and behaviour; they are thin wrappers.
  • Receipt schema keycut-assembly-receipt/1 (documented in the README): per merged span, which requested ranges it absorbed, the keyframe-snapped source start, copy or re-encode and why, and where it landed in the output.
  • Output positions come from an ffprobe of each part before concat; a failed probe falls back to the planned duration and says so (duration_source: "planned").
  • Version 0.2.0.

Why

Callers could not learn what was really cut. The forward keyframe snap was only debug-logged, the sub-GOP merge was invisible, and so was the copy or re-encode choice. Downstream time mapping (chapters, captions, overlays) had to guess the edited timeline instead of reading it.

Stacked on #9 (fix/large-master-timeouts); it reuses that PR's size-scaled timeouts. Retarget to main after #9 merges.

Tests

  • tests/test_receipt.py: merge membership, snapped copy start, both re-encode reasons, contiguous output spans, probe failure falling back to planned durations, JSON round trip.
  • tests/test_integration_ffmpeg.py::TestAssemblyReceipt: real ffmpeg; a cut that forces a snap; the receipt's last output_end matches the probed output duration within one frame.
  • ruff check . clean; pytest -q 168 passed, no skips (ffmpeg present).

A 110 GB day master on a 9p mount took longer than the flat 600 s keyframe
probe, so keyframes came back unknown and every range fell back to a
re-encode that decoded from the start of the file under a flat 3600 s
timeout. Probe, copy and concat timeouts now scale with the bytes read at a
20 MB/s floor; the re-encode seeks on the input side with an output-side
-ss 0 so copied audio carries no pre-cut packets, and its timeout scales
with the range length. Releases 0.1.2.
@joepetjr
joepetjr changed the base branch from fix/large-master-timeouts to main October 27, 2026 19:15
# Conflicts:
#	CHANGELOG.md
#	pyproject.toml
#	src/keycut/__init__.py
@joepetjr joepetjr added the needs-operator Autoland hard-denied this PR; human merge required label Oct 27, 2026
@joepetjr

Copy link
Copy Markdown
Contributor Author

Hard-denied (hard-deny: protected path family) and ready to merge -- all checks green.

Offending paths:

  • pyproject.toml

Human merge:
sudo gh-merge-approved 10 --repo Back-Road-Creative/keycut --wait --yes

@joepetjr
joepetjr merged commit 6d24d68 into main Oct 27, 2026
4 checks passed
@joepetjr
joepetjr deleted the feat/assembly-receipt branch October 27, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-operator Autoland hard-denied this PR; human merge required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant