forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on b02f499d2ae83c64acfb72cd9ca0dc3b5e252bc5

2026-10-23

🚚 edith moves to git.tahinli.comAhmet Kaan Gümüş · b02f499
🚚 edith moves to git.tahinli.com

The working tree as of 2026-10-23, as one commit on top of the last one
here. It carries the work up to that date plus the test-slimming work:
integration tests merged into one binary per crate, nextest config,
doctest = false, debug line tables only, perf tests behind --ignored,
and faster generators, reverse, undo, subtitle-export, hevc, stabilise
and hear tests.

2026-09-30

🐛 fix(test): the window guard's walk skipped no dot-directory, so a scratch clone spoke for the treeAhmet Kaan Gümüş · 308fc77
🐛 fix(test): the window guard's walk skipped no dot-directory, so a scratch clone spoke for the tree

`every_window_write_outside_set_window_is_named` walks the workspace root and
skipped only `target`, `.git` and `vendor`. This root also holds `.delta/` -- a
gitignored scratch area of clones and worktrees left by delta/A-B tooling -- and
the walk descended into it, so the guard was RED on main for ten window writes
inside a checkout nobody edits, with every reported path under
`.delta/worktrees/rfykqt93k1f7/`.

The noise was the smaller half. The same stale clone was also being counted
toward the coverage floor, so a foreign tree was propping up the assertion that
exists to prove the walk reaches real source -- the guard could read a file or
two of ours and still pass on the strength of a stranger's lines.

Skipping every dot-directory rather than naming `.delta`: a dot-dir is by
convention not part of the tree we make claims about, and the next scratch dir a
tool drops here is then skipped by the same rule.

Red before, green after, with `.delta` still on disk. Non-vacuity checked both
ways: a real `s.out_us` write injected into `crates/engine/src/sweep.rs` turns
the guard red on that path, and the file was restored byte-identically
(sha256 36d00f17d595dedfaa0d087ab924e7117698e0527d48ac22fdd904cfffc1af91). The
walk still reaches `crates/app` and now reads 86 files / 79,129 lines, which is
what the floor's own comment already claimed.
🔀 merge(edithloader): the .edith door bounds the caption window, band gain and transform positionAhmet Kaan Gümüş · 2c809fd
🔀 merge(edithloader): the .edith door bounds the caption window, band gain and transform position

# Conflicts:
#	crates/engine/src/project.rs
fix(engine): close the last two gaps in the window guard, and admit the restAhmet Kaan Gümüş · 04265e9
fix(engine): close the last two gaps in the window guard, and admit the rest

Two coverage gaps closed, one class documented as unmatchable, and a
third failure of this same guard found in the act of closing them.

**A `let` hid a struct literal.** The literal branch skipped any line
starting with `let `, so `let out_us = s.out_us;` was correctly a read
while `let tail = SubClip { in_us: cut, out_us: s.out_us, ..s };` -- a
plausible composer shape, and the shape `sub_clear` and `sub_open_room`
were written in before `set_window` existed -- went through green. The
exclusion is now per-occurrence and keyed on what FOLLOWS the name: `=`
is a local binding, `:` or `,` is a field. A tuple pattern
(`let (a, b) = ..`) is separated from a struct literal by the paren
rather than by the `let`, since the same comma means opposite things in
each.

**The walk skipped a file that never spelled the type.** Its filter was
`text.contains("SubClip")`, which is a name-based guess about which
files can reach the type -- the same mistake the hardcoded pair of file
names was, wearing a derived hat. A glob import and an alias defeat it
exactly as they defeated the list. The filter is gone: the walk now
opens EVERY `.rs` under `crates/` that is not test code, 86 files and
~77,600 lines, and the coverage floor moved with it (141 files and
~116,000 before `/tests/` and `mod tests` are cut).

**And the guard was silently asserting nothing.** While retuning that
floor, a clumsy edit deleted the `found.is_empty()` assertion -- the one
the whole test exists for. For a moment the test reported green while
`found` held a real offender, which is the fourth version of this guard
failing in the one way that looks exactly like success. Found by
instrumenting the walk rather than by reading the diff, which is the
only reason it was found at all. The assertion is back, with a comment
saying that if you retune anything here, check that line still exists.

**The unmatchable class, documented rather than chased.** `*a = *b;`,
`*a = other;`, `std::mem::swap(a, b)`, `a.clone_from(b)` and a macro
like `bump!(s.out_us, by)` all write a caption's window and none of them
spell the field name, so a field matcher returns nothing for all of
them. That is a property of the approach, not an oversight: a helper
that writes the field directly IS caught, and it is specifically the
whole-struct and macro forms that pass. The doc comment now names this
class FIRST, as the most likely route a real composer would take, ahead
of a rename of the fields, a writer inside a test, and a file outside
`crates/`. The five forms are pinned in a test asserted to be MISSED, so
the day one starts matching the test asks which side of the line moved
and the residual-risk list cannot quietly grow a claim the matcher has
not earned.

Guard verification, all from the tip, all red:

- the verifier's one-token `s.out_us += by(s.end(), to);` -> project.rs:5869
- a `let`-bound struct literal in place of `set_window` in `sub_open_room` -> project.rs:5807
- `regroup`'s two lines back to raw assignments -> project.rs:3491-3492
- a composer smuggled into `sweep.rs`, a third module -> sweep.rs:67
- a new module reaching the type by glob import and alias, never spelling it -> zz_glob_alias.rs:4
- clean -> green

`the_window_write_matcher_catches_the_ways_a_composer_hides` now pins
eight forms that must be caught (the five above plus `<<=`, a write
through an indirect `&mut`, and the shorthand), five reads that must not
fire, and five field-less forms asserted to be missed.

No production code changed: this is the `#[cfg(test)]` module only, and
all eight composers still route through `set_window`.
fix(engine): make the window guard match how a composer actually writesAhmet Kaan Gümüş · edc51b5
fix(engine): make the window guard match how a composer actually writes

The guard was certifying a claim it could not see. `s.out_us +=
by(s.end(), to);` is a ONE-TOKEN change from the real line, it left
`every_window_write_goes_through_set_window` green, and a grouped
caption's year-deep sibling really did end up 25,919,974,080,030us wide
-- 288,000,000us past the ceiling, which `open_project` then refused. A
guard that certifies a claim it cannot see is worse than a guard that
says what it is, so this fixes the matching and relabels the claim.

The old matcher knew four literal patterns: `.in_us = `, `.out_us = `,
`in_us:`, `out_us:`. It now knows:

- **every assignment operator**, not just `=` -- `+=`, `-=`, `*=`, `/=`,
  `%=`, `^=`, `&=`, `|=`, `<<=`, `>>=`. `==` and `<=` are excluded, and
  the first version of the new matcher got that wrong too: it counted
  `s.out_us <= s.in_us` as a write, which would have flagged every
  never-empty check in the file.
- **struct-literal fields and the shorthand form** (`out_us,`), not just
  `field: value`.
- **writes through a `&mut` the field access is indirect from**
  (`let x: &mut SubClip = q; (*x).in_us = 5;`), by skipping the `let`
  exclusion for the assignment forms and keeping it for the literal
  forms, so `let out_us = s.out_us;` is still not a write.
- **every module in the workspace that can NAME `SubClip`**, found by
  walking `crates/` rather than by hardcoding `project.rs` and
  `edith.rs`. The two-file version was silently certifying a claim about
  `crates/app` it had never opened; the walk now asserts it reached the
  app, and it flags the two `timeline_edit.rs` palette-row sites that
  feed `place_sub` as named allowlist entries rather than as files it
  does not read.

And it is labelled what it is: a **heuristic guard**, with the residual
risk written down -- a write through a helper taking `&mut SubClip` in a
form the matcher cannot see, a macro-mediated write, a `.rs` the walk
does not reach, a writer hidden inside a test, and above all a RENAME of
the fields, which would silence the matcher entirely while it stayed
green. Two tests hold that line:

- `the_window_write_matcher_catches_the_ways_a_composer_hides` pins six
  hiding forms, the verifier's `+=` among them, AND five reads that must
  not fire -- so the list above cannot be padded with reads to stay
  green.
- `every_window_write_outside_set_window_is_named` walks the tree and
  asserts a coverage floor, because the first two versions of this guard
  were vacuous: cutting at the first `#[cfg(test)]` read 160 lines of a
  10,800-line file, and cutting at the last landed inside the guard's
  own test module. A guard that reads nothing is worse than no guard
  because it reads as one, so the floor is asserted rather than assumed.

Both proved by mutation, from the tip:

- the verifier's one-token `s.out_us += by(s.end(), to);` -> the guard
  reds AND the grouped sibling reaches 25,919,974,080,030us;
- a composer smuggled into a THIRD module (`sweep.rs`, which the old
  two-file guard never opened) -> the guard reds by file and line;
- `regroup`'s two lines moved back to raw assignments -> reds;
- clean -> green.

**Why the compiler is still the better answer, and why it was not taken
here.** Making `in_us`/`out_us` private to this module would turn every
outside write into a compile error, which no one-token edit can defeat
-- that is what "let the compiler be the proof" would buy. Priced: 74
`SubClip` construction sites workspace-wide, 31 of them in this crate's
own integration tests, plus a public constructor to replace them, and it
reaches `crates/app`'s `timeline_math.rs` and `player/timeline_edit.rs`,
which other lanes own. That is a refactor of a door's public shape
rather than a bound, and the wrong size for a bug-hunt lane sharing a
machine with three siblings. The invariant itself is already structural
in the code -- all eight composers call `set_window` -- so what this
guard adds is the tripwire for the ninth, not the invariant.
fix(engine): make the caption-window bound structural, not per-armAhmet Kaan Gümüş · eb3f571
fix(engine): make the caption-window bound structural, not per-arm

Three rounds of review each found one more composer a per-arm check had
missed, and the third is the one that ends the sequence: the fix is not
another arm, it is the invariant's shape.

`grow_window` was not, in fact, the single writer of a window.

**A rejoin SUMS two legal halves.** `Project::regroup` keeps the left
half's `in_us` and takes the right half's `out_us` -- and `sub_joinable`
has just established that the halves are consecutive in the *source*,
so the joined width is the sum of two widths that each passed their own
door. Neither half is illegal; the whole is. Two 20-day windows and one
undo-a-split keystroke gave 40 days, which `save_project` wrote and
`open_project` refused. My sweep had disposed of this as "takes the
neighbour's own out_us" -- true, and beside the point: the ceiling bounds
a SUBTRACTION, not its operands.

**A head drag grows the width too.** The ceiling bounds a difference, so
falling `in_us` makes the window wider exactly as growing `out_us`
does. The Start arms clamped `in_us` from above (`in_us <= out_us - 1`),
which says nothing at all about the ceiling: a caption a year into its
source, dragged back 200 days, was 200 days wide with `out_us` never
moving.

So the bound is now one function every writer routes through:

    set_window(&mut SubClip, in_us, out_us)
    // 0 <= in_us < out_us  &&  out_us - in_us <= MAX_WINDOW_US

and `grow_window` is gone -- it was a helper around one arm, which is
what made the other arms look exempt. Everything goes through
`set_window` now: `trim_sub` both edges, `write_sub_edge` both edges,
`regroup`'s join, and the four halves `sub_clear` and `sub_open_room`
build. The doors still REFUSE on entry (parse, `with_subs`, `place_sub`)
and `set_window` still CLAMPS on composition, because that asymmetry is
the point: a door sees a value nobody was mid-gesture on, a composer is
an edit a person is watching happen.

**The closed set is now proved, not argued.** Reasoning about arms does
not scale to an unknown number of them, so
`project::tests::every_window_write_goes_through_set_window` reads both
files and fails if `in_us`/`out_us` is written anywhere outside
`set_window` and the parser's two door lines. It is deliberately a
source scan rather than a `debug_assert!`, because a `debug_assert!`
only fires on a path some test happens to walk.

That scan was vacuous the first two times and the test says so:
cutting at the first `#[cfg(test)]` scanned 160 lines of a 10,800-line
file (a smuggled writer in `write_sub_edge` sailed through), and
cutting at the last one landed inside the scan's own test module. It now
cuts at the test module and asserts how many lines it read, because a
guard that reads nothing is worse than no guard -- it reads as one.

**The ceiling's stated reason was wrong and is now right.** I had claimed
`window_at` needed the ceiling below 2^53 for f64 exactness. It does not:
it is pure i64 with a `saturating_mul`, so the f64 argument never
applied. The real arithmetic: `window_us() * into` with `into` up to
4.29e9 saturates for any window above `i64::MAX / u32::MAX` = 2.1e9us
(~35 minutes), so 30 days is 1200x past the point where the proportion
stops being exact -- which is the actual precision cost, and the reason
this is not "unlimited". f64 exactness IS the right argument for
`sub_lane_cues`'s cue mapping, where 30 days is ~3.5 orders inside
2^53. Nothing else derives anything from a window, so a wider value
costs no memory: the ceiling is a claim about meaning, not resource.

Witnesses, each with its own mutation:

- `a_rejoin_of_two_legal_windows_stays_inside_the_ceiling` -- two 20-day
  halves, one rejoin. Un-routed: "the rejoin summed two 1296000000000us
  windows into 3456000000000us, past the 2592000000000us ceiling".
- `a_head_drag_no_further_than_the_ceiling` -- a year-deep caption, one
  head drag to the offered room. Start arm reverted to a raw `in_us`
  assignment: "gave a 3000030000000us window".
- `every_window_write_goes_through_set_window` -- passes clean; fails on
  a smuggled writer in `write_sub_edge`, on on a smuggled writer in
  `edith.rs`, and on `regroup`'s two lines moved out of `set_window`.
- Loosening `set_window` itself (dropping the ceiling clamp) reds all
  four caption witnesses at once, which is the property a per-arm fix
  does not have.

UX note, recorded as the verifier found it and left unchanged: a drag
that reaches the ceiling stops silently. That is consistent with every
other trim wall here -- `trim_to` drops the snap cue, `commit_trim`
toasts only on `Err` -- so the ceiling behaves like a wall, not like an
error.
🔀 merge(decode): EXIF orientation is shown, and a decode failure says why it stoppedAhmet Kaan Gümüş · a72b5b1
🔀 merge(decode): EXIF orientation is shown, and a decode failure says why it stopped

# Conflicts:
#	crates/app/src/tests/media.rs
docs(demux): name the dropped display height as a design gap, not an oversightAhmet Kaan Gümüş · 25cd3de
docs(demux): name the dropped display height as a design gap, not an oversight

`PixelAspect::stated_size` reads a unit-0 pair's display height, checks it for
the degenerate claim, and then does not use it -- a 1920x803 scope is drawn
1920x1080, because this engine's model moves the width only.

That is correct today and I want it written down rather than left looking like
a bug, because it stops being correct the moment any path starts honouring a
stated display height: the height half is being discarded deliberately, and the
reason it is safe to discard (`VideoMeta::height` is the coded height
everywhere, and every consumer reads the aspect as width-only) is exactly what
such a change would remove.

Documentation only; no behaviour change.
fix(demux): a unit-3 DAR is judged by its raster too, not by its termsAhmet Kaan Gümüş · 8773473
fix(demux): a unit-3 DAR is judged by its raster too, not by its terms

Second verification was right, and this is the same defect one match arm below
the unit-0 fix: the unit-3 arm multiplied the DAR by the coded size and then
judged the *derived* pair by the reduced-term bound, which is the rule unit 0
was just fixed for and unit 3 was left under.

A DAR has to be brought onto the coded frame to become a pixel ratio, and that
multiplies by the coded size, so what reduces afterwards carries the sizes. A
239:100 scope -- 2.39:1 -- derives 2151:1600 over a 1920x1080 coded track and
the same over 3840x2160, both past the 1024 bound, while over 1440x1080 it
derives 717:400 and passes. So the bound read the same ratio three different
ways depending only on the frame it sat on, and refused the two frames a
scope is most likely to arrive on.

Measured, not inferred. `PixelAspect::stated_ratio` now takes the DAR against
the coded frame unreduced and refuses only the degenerate case, so
`width_factor` multiplies the coded width by it and bounds the raster with
`MAX_DISPLAY_WIDTH` -- a bound on the picture rather than on the digits of a
derivation. The pair itself is the engine's own model, unchanged, so every
sane picture reads exactly as it did before.

Witnesses, with the expected widths measured by running BASE 0c9d76c over the
same fixtures rather than recomputed by me:
  - 239:100 over 1920x1080 coded -> 2582 (base 2582)
  - 239:100 over 3840x2160 coded -> 5162 (base 5162)
  - 239:100 over  720x576  coded -> 1376 (base 1376)
RED before this change, reproduced on the same fixtures: the first two opened
square at the coded size; only 720x576, which reduces to 239:125 and so passes
the bound, stretched. Non-vacuity proven by mutating the arm back through
`stated()` and watching the test go red.

While matching base I also found and reverted a regression of my own: I had
written the even-grid rounding as `next_multiple_of(2)`, which rounds UP,
where the original `(x | 1) & !1` rounds DOWN. That would have silently moved
every existing anamorphic picture by two columns (3840x2160 at 239:100 scales
to 5163 and has always displayed 5162, not 5164). Restored to the original
rounding, and the three expected widths above pin it.

`a_hostile_sar_pair_is_still_refused_by_the_term_bound` holds the other half:
the unit-4 SAR pair IS a ratio, so chosen bytes are still refused there, and a
real 4:3 -- reduced or not -- is still read. The bound was moved off the arms
it cannot judge, not dropped.
fix(engine): clamp a caption window on GROWTH, and raise the ceilingAhmet Kaan Gümüş · f23dd8f
fix(engine): clamp a caption window on GROWTH, and raise the ceiling

A ceiling is only half an invariant. Every door -- the parse,
`with_subs`, `place_sub` -- sees a window on the way IN, so on its own it
left two holes, both of which cost a user their saved work.

**The app could write a file it refused to open.** `trim_sub`'s End arm
GROWS `out_us`, and it grew past the ceiling: a caption trimmed out to
the room the engine itself offered reached 25 hours, `save_project`
wrote `sub 1 0 3240000 0 0 90039000000`, and `open_project` refused
that file with "past the 86400000000us a caption can hold". The trim is
committed and undo does not survive a restart, so there is no in-app way
back -- the editor wrote work it then could not reopen. The `saturating_add`
that killed the overflow panic did not keep the value inside the bound.

**The ceiling was below real use.** A caption's window is a window into
SOURCE media, so its width is the length of the recording it was cut
from, and that is not bounded by a day. A 25-hour conference stream or a
lecture archive measures its own palette row in tens of hours, so the
ceiling refused the user's own media back at them, at `place_sub`, with
nothing placed. "A window this wide is a number nobody meant" holds for
i64::MAX; it does not hold for a long recording.

So:

- `MAX_WINDOW_US` is 30 days, and the reason is arithmetic rather than
  editorial. `SubClip::window_at`'s proportion cut saturates rather than
  wrapping, so the ceiling is about PRECISION: f64 holds an integer
  exactly to 2^53, and 30 days is 2.6e12 -- nine orders of magnitude
  inside it, so the cut is exact rather than merely finite. It is 3.5e6x
  below i64::MAX, and exact in `sub_lane_cues`'s cue mapping for the same
  reason. No real recording reaches it; a typed number does not survive it.

- `grow_window` is the growth law, and is now the single function that may
  write `out_us`. `trim_sub`'s End arm and the group-follow
  `write_sub_edge` both go through it. Growth CLAMPS and entry REFUSES,
  and the asymmetry is the point: a trim is a continuous gesture whose
  every intermediate frame the user sees, so clamping is a drag that
  stops -- exactly like the frame walls `trim_sub` already applies. A
  value arriving from a file or a foreign caller is not mid-gesture, so
  it is named and refused rather than quietly changed.

- `trim_sub_room` is walled by the same number. A front-end asks it to
  draw the drag and then trims to whatever it is told, so an engine that
  offers a trim its own `trim_sub` would clamp is a drag that snaps back
  at the end of the gesture. The room and the trim now agree by
  construction.

Witnesses, each with its own mutation (saveload.rs):

- `a_trim_grown_to_the_offered_room_saves_and_reopens` -- 40-day track,
  trim to the offered room, save, reopen. Clamp removed: "gave a
  2592027000000us window, past the 2592000000000us ceiling".
- `a_group_trim_carries_its_sibling_no_further_than_the_ceiling` --
  `follow_group` SKIPS the dragged member, so a primary-trim-only fix
  misses this entirely: the route is a sibling on a second lane, placed
  20 days into the track so the same delta overshoots. Clamp removed:
  "the group carried the sibling to a 25919974080030us window" -- 10x the
  ceiling.
- `a_caption_over_a_day_of_track_places_and_round_trips` -- a 25-hour
  track placed exactly as `Player::sub_of_track` builds it. Ceiling
  lowered to a day: refused at `place_sub`, nothing placed.

Swept every other writer of `in_us`/`out_us`, all now inside the bound:

- `sub_clear` (both halves) and `sub_open_room` (both halves): the values
  are `window_at` results, which `SubClip::window_at` already clamps into
  the window -- a split cannot widen what it splits.
- `Project::close_gaps`-style join: takes the neighbour's own `out_us`.
- `trim_sub` Start and `write_sub_edge` Start: `in_us` is clamped to
  `out_us - 1`, which is below the ceiling.
- `app`'s `trimmed_sub`: moves `frames` only, never a clock.
- `Project::sub_lane_cues`: reads the window, writes nothing.
🔀 merge(gain): monitoring owns the gain and re-arms the deviceAhmet Kaan Gümüş · 8c1aee4
🔀 merge(gain): monitoring owns the gain and re-arms the device

# Conflicts:
#	crates/app/src/tests/mod.rs
docs(engine): MAX_RESOLUTION is 8K UHD, and a DCI master is refused by nameAhmet Kaan Gümüş · e62406e
docs(engine): MAX_RESOLUTION is 8K UHD, and a DCI master is refused by name

Verification was right that my comment called 7680 "the 8K ceiling", which
reads as though an 8192-wide master were covered. It is not: 7680 is 8K UHD
(7680x4320), and 8K DCI is 8192 wide. An 8192-wide ProRes 4444 XQ master
opened before this lane and is now refused by name, because the bound is now
asked of a container header and not only of a keystroke and a `.edith` line.

`MAX_RESOLUTION` stays 7680 rather than being raised to 8192: `is_resolution`
gates those two doors at 7680 as well, and widening the ceiling on every path
to accommodate a container is a wider decision than a header fix should make
on its own. A caller that needs DCI width raises it deliberately, on all four
doors at once.

So the behaviour change is a tested claim rather than a surprise:
`the_resolution_bound_admits_uhd_and_refuses_dci_width_by_name` patches a
copy of `assets/test_baseline.mp4` to 7680 wide (opens, read as stated) and
to 8192 wide (refused by `UnsupportedDisplaySize`, message naming 8192). Both
patches are the two u16 dimension fields of the visual sample entry, so the
file length and every offset in it are unchanged.
fix(demux): judge a DisplayUnit 0 pixel pair by its raster, not by its termsAhmet Kaan Gümüş · 598e6c8
fix(demux): judge a DisplayUnit 0 pixel pair by its raster, not by its terms

Verification found a real defect in the previous commit: it applied the
reduced-term ratio bound to `DisplayUnit 0`, where the `Display*` pair is a
pixel SIZE. Reducing it against the coded size carries the *sizes*, not terms,
so the bound refused the two most common letterbox ratios on exactly the arm
the fix newly enabled: on a 1440x1080 coded track, 1920x1080 (4:3) opened
correctly but 1920x803 (2.39:1 scope) and 1920x1037 (1.85:1 flat) both
opened square at 1440x1080. The unit-3 DAR spelling of the same picture
(239:100 -> 717:400) was unaffected, because a DAR pair does reduce to small
terms.

The two bounds answer two different questions and are now kept apart:

  - `stated` -- for a pair that IS a ratio (an mp4 `pasp`, `DisplayUnit 4`,
    a unit-3 DAR). A reduced term past 1024 means chosen bytes, and that is
    the right test there.
  - `stated_size` -- for a unit-0 pixel pair. It takes the stated display
    WIDTH and refuses only the degenerate claims (a zero half). Width is the
    only axis an aspect moves in this engine: `VideoMeta::height` is the
    coded height for every file, by design and by its own documentation, so
    the height half of the pair is not taken and the raster bound in
    `width_factor` (`MAX_DISPLAY_WIDTH`) is what limits the result.

`width_factor` no longer applies the term bound at all, because it is the one
function every door reaches and cannot tell whether its ratio was read or
built. Judging the raster has no conflict: it catches the wrap and the zero
without refusing a scope.

Witness RED, measured on the fixture, before this change: both cinematic
ratios reported `PixelAspect { h: 1, v: 1 }` -- square.

The unit-0 witness is also restated to match this engine's model honestly: a
1920x803 scope is drawn 1920x1080 here. The width is the file's own claim; the
height is the coded one, because a pixel aspect has never moved the height in
this codebase and this lane does not change that.
fix(engine): the AV1 and hardware refusals report themselves tooAhmet Kaan Gümüş · 5dd4f36
fix(engine): the AV1 and hardware refusals report themselves too

The class was not closed. `run` reported its decode and demux failures
through `DecodeFailure`, but the two other decode loops did not:

- `run_av1`'s software refusal printed "software AV1 decode failed at
  frame N" to stderr and set nothing -- the exact shape the H.264 witness
  reproduces, in a different loop and out of a different decoder.
- `run_hw` never took the parameter at all; its mid-stream `Err` arm
  printed "hardware decode error at frame N" and returned.

Both now set the same cell `run_span` already holds, keeping the stderr
line for logs exactly as the other arms do. `run_hw` deliberately does
NOT report the failure before its first picture: that `return false` is
the signal that software should take over, the caller reports the
fallback, and saying it there as well would put a fault on the strip for
a span that is about to decode cleanly.

`decode_failure.rs` loses its container-agnostic damage helper and the AV1
case. The helper only ever knew how to damage an mp4's mdat payload;
every attempt to reach the AV1 arm through a Matroska fixture failed
before a single frame decoded (a zeroed span breaks the EBML chain and
the file will not open at all -- "bad EBML variable-length integer" --
and an EBML walk to zero only block payloads did not find blocks in the
time available). Leaving a half-working fixture builder in a test is
worse than naming the gap, so both are gone and the gap is in the report.

Gates: cargo check -p engine --all-targets 0/0; decode_failure 2/2;
exif_orientation 5/5; images 8/8.
fix(engine): the canvas gate asks about the pair the encoder placesAhmet Kaan Gümüş · 8d8aff1
fix(engine): the canvas gate asks about the pair the encoder places

The gate added in 2d54df8 handed `fit_is_identity` the source's CODED
pair, so every source whose samples are not square lost the copy door:
a 1440x1080 file with a 4:3 sample aspect draws at 1920x1080, and a
project opened at that size is copying it exactly -- main writes the
source's own 1440x1080 blocks and states the ratio in the `Display*`
elements, which draws at precisely the canvas. Measured: with the
preceding commit that project encoded instead
("HW encode (VA-API) · no sound to write") and
tests/anamorphic.rs::a_matroska_copy_keeps_the_pixel_aspect went 4/5.

The picture a fit is composed against is the DRAWN one --
`VideoMeta::width`/`height`, the coded pair with the file's turn and its
pixel aspect already applied -- so that is what the gate compares with
the canvas. The coded pair keeps its own question, which the pre-existing
coded-to-coded check already asks: what a copied track *declares*.

Measured: `a_matroska_copy_keeps_the_pixel_aspect` green again, seat
line "export video: copy (source packets)"; the whole anamorphic suite
5/5; video_copy 10/10 (the resized-canvas witness still bites); export
28/28; `cargo check --all-targets` 0 warnings. Two mutations, each
biting the other half: putting the coded pair back reds the anamorphic
test (anamorphic.rs:425), and making the identity always true reds the
canvas witness ("a smaller canvas (960x540) was copied").
fix(engine): bound a clip's transform position, and sweep the loader classAhmet Kaan Gümüş · d964f6c
fix(engine): bound a clip's transform position, and sweep the loader class

The third of the class "a number read out of a file a hand can edit,
used in arithmetic without a bound", and the last one the sweep found.

`transformed_dst_rect` caps `scale` at 1024 canvas widths for exactly
this reason -- the comment at the cap says so -- and `pos_x`/`pos_y`
multiply the canvas and are *added* to the placement's centre with no
bound at all. `float()` in the parser refuses only inf/NaN, so
`transform 3e38 0 1 0 0 0 0 0` is a legal line. `f64 as i64` saturates,
so the value arrived as `i64::MAX` and the ADD is what overflowed: a
panic on the compositing thread in a debug build, a silently wrapped
position in a release one. Clamped to the same +/-1024 canvas fractions
`scale` already gets, with saturating adds, so a position past the point
where the picture is long gone gives the two empty rects the function
already answers with.

The sweep, over every numeric field the `.edith` parser reads and every
config file the app reads. Two rules decide a site: a value is safe
either because the parse bounds it by name, or because a consumer clamps
it unconditionally before the arithmetic -- and only the second kind is
silent about a value the file actually stated.

The parser's four helpers (`number`, `number64`, `micros`, `float`) bound
nothing; the bound is always in the branch or in a consumer.

SAFE (bounded at the parse): resolution (`is_resolution`), fps
(0 < f <= 1000), samplerate (1k..384k), limiter.ceiling_db
(`with_ceiling` at the parse itself), clip geometry (`check()`'s
`start + frames`), clip.speed, the three fade/transition counts
(`.min(frames)`), clip.visualizer (`u8::try_from`), every table index
(`table_index` re-checks), sub.start/frames (`checked_add`), sub.track
(must name a palette row the file has), sub.link (saturating counter).

SAFE (clamped by a consumer, wherever the value came from): eq/color/
transform floats, gain.db (`with_mix`), color.* (`Lut::new`),
transform.scale/rotate/crop_* (`cap_w`, `nearest_90_steps`, the crop
clamp), playhead (`landing`), source.audio_stream (no arithmetic; every
consumer `.get()`s).

KNOWN, NOT A FAULT: clip.viz_paint is an unbounded u64, but every
accessor in `decode.rs` is a bit mask, so there is no overflow -- the
glow byte is read unclamped where the writer clamps it to 16, so a
hand-written file can ask for more work than the UI can produce. A cost,
not a wrong answer. Left alone deliberately.

The app's own config: eight files, only two carry a number. The
stance-splits loader (I-2) is safe because `split_size` re-clamps every
seam on every frame and `Player::split_px` is its only reader -- the
loader stores a value the frame loop then bounds. The subtitle size is
range-checked at the parse, and `RangeInclusive::contains` being a
partial comparison is what makes NaN/inf fall back rather than survive.
The keymap reads no number at all; the rest are whole-file tokens
resolving to a bool or an enum.
fix(demux): the mp4 door gets the resolution bound the Matroska one now hasAhmet Kaan Gümüş · fcb7844
fix(demux): the mp4 door gets the resolution bound the Matroska one now has

The previous commit bounded `PixelWidth`/`PixelHeight` and left the mp4 arm
reading its dimensions unchecked. The mp4 crate types a track's width and
height as `u16`, which is a smaller claim than Matroska's EBML integer but
still eight times past `MAX_RESOLUTION`: a visual sample entry of
`ff ff ff ff` is a legal 65535x65535, and it reaches the same
`display_width * height` allocation in `decode.rs`.

Both doors now refuse a stated picture past the bound, by the same
`UnsupportedDisplaySize`.

Witness, with non-vacuity proven: the test patches the first visual sample
entry's two 16-bit dimension fields of a copy of `assets/test_baseline.mp4`
(offsets 32 and 34 into the entry) to `ff ff` and asserts the open is refused
by name. With the bound removed from the source the test fails ("a 65535x65535
mp4 is refused by name, never opened"), so it bites.
docs(player): correct a comment that described a state the file did not haveAhmet Kaan Gümüş · 6f579f0
docs(player): correct a comment that described a state the file did not have

The note beside the pre-arm list claimed `remove_lane` was off the list "for
the same reason" as Crossfade and Dissolve. It is not: the three
`ActionId::Remove*Lane` entries are still in that `matches!` block.

They are still wrong there -- `remove_lane` now carries its own arm inside its
`Some(Ok(()))`, so each of those removals arms twice over -- but taking them
off is a wider pass over this list than the previous commit made, and the
comment should say that rather than claim a fix that is not there.
fix(demux): a container may not state a picture past the resolution boundAhmet Kaan Gümüş · 48ad076
fix(demux): a container may not state a picture past the resolution bound

The class sweep for lane H, and it found one more instance of the same defect
one layer down from the `pasp` one: `mkv_tracks` read `PixelWidth` and
`PixelHeight` with a bare `ebml_uint(...) as u32`, so a Matroska header could
state any picture at all and the engine opened it.

`crate::MAX_RESOLUTION` (8K) already existed for exactly this, and was applied
to a keystroke (`PlaybackSession::set_resolution`) and to a `.edith`
`resolution` line -- but never to a container header. So 65535x65535 opened
cleanly, and `decode.rs:1324` then sized its stretched planes as
`display_width * height`: 6_442_254_337 bytes for one frame's luma and
chroma, before a single pixel is read. The `as u32` narrowing made it worse
in the other direction too -- `PixelWidth` of 2^32+1440 truncates to 1440.

Both elements are now refused by name, `UnsupportedDisplaySize`, matching the
existing `NoVideoTrack` / `UnsupportedRotation` convention (Display impl,
Error impl, `is_it`), so the open fails with a message naming the size claimed
and the maximum, and a caller can match the type rather than the prose.

Witness RED: the patched fixture opened and reported `65535x65535` coded, with
the test naming the 6.4 GB allocation `decode.rs` would have sized from it.
A companion test holds the other half of the contract -- the ordinary
fixture is inside the bound and still opens -- so the bound cannot quietly
become a refusal of the library.
fix(engine): the copy door reads the project canvas, not just the coded sizeAhmet Kaan Gümüş · 2d54df8
fix(engine): the copy door reads the project canvas, not just the coded size

An untouched HEVC/AV1 Matroska project whose canvas differs from its
source's coded pair exported at the SOURCE's frame size, entirely
unscaled, with the seat line still reading "copy · …" -- a file at a
resolution nobody chose.

`CopyPlan::of` compared each source's coded pair with `meta.coded_width`
/`coded_height`, which the demuxer wrote for the first source and only a
*source* ever moves. The canvas a person picks rides in `meta.width`/
`meta.height` (`PlaybackSession::set_resolution` writes exactly those
two), and nothing in the gate looked at it -- so a resized project took
the copy door and shipped the source's raster.

The gate now asks one question where it asked none: is this clip's
placement of this source on this canvas the identity? That is
`fit_is_identity`, computed from `scale::fit_rect` itself rather than
from a list of policies, so it refuses a canvas of another size under
every policy while holding for `Fill`/`Stretch`/`Center` on a canvas the
size of the source's own samples -- where there is nothing to crop and
nothing to resample. The encode door is untouched (it already sizes
from the canvas), and so is what a copy writes when the canvas matches.

Witnesses in crates/engine/tests/video_copy.rs, both red before:
a_canvas_the_source_is_not_is_encoded_at_the_canvas (960x540 and
720x1280 on a 1280x720 fixture: encoded, and at the canvas) and
a_fit_policy_on_a_matching_canvas_is_still_the_identity (Fill,
Stretch and Center on the source's own canvas still copy, byte for
byte -- which a blanket "non-default policy re-encodes" fix fails).
feat(app): a decode failure reaches the strip, as the lost sound device doesAhmet Kaan Gümüş · 6bc4cc2
feat(app): a decode failure reaches the strip, as the lost sound device does

`PlaybackSession::video_failure_reason` (the engine half is the previous
commit) had no consumer, so a decode failure still reached nobody: the
worker printed it to stderr, dropped the channel, and the app read the
closed channel as the film finishing. The transport said ENDED over a
frozen last good frame with nothing in the window saying why.

It goes through the **existing** notice queue, not a second banner
system: `decode_failed_line` is `audio_lost_line`'s twin, and
`decode_change_notice` is `audio_change_notice`'s, step for step, because
the thing that changed is the same kind of thing -- a reason the engine
started or stopped stating between two frames. `watch_decode` sits beside
`watch_audio` in the pump, keyed to `session_gen` for the same reason, so
a preview flip cannot announce the other session's failure.

`AudioStep`/`audio_step` become `ReasonStep`/`reason_step`: the pure
decision was never about audio, it is a comparison of one session
generation and two reasons, and the picture side now needs it too. A
second copy of that state machine would have been the wrong answer.

The retraction is what keeps this from becoming noise: a decode that
fails, is seeked away from and succeeds takes its line back, or the strip
keeps saying DECODE FAILED over a film that plays. Asserted both ways,
along with the two lines not taking each other down.

cargo test -p edith --bin edith tests::media -- 34/34.
fix(engine): clamp a band's gain, the one field Coeffs::new left openAhmet Kaan Gümüş · 1b0fbe8
fix(engine): clamp a band's gain, the one field Coeffs::new left open

`Band`'s doc states the invariant for the whole struct: out-of-range
values are clamped when coefficients are built, so a deserializer can
hand this over unchecked. `Coeffs::new` clamped three of the four
fields -- `fs`, `f0`, `q` -- and computed `a = 10^(gain_db/40)` from the
fourth with nothing at all.

That is not a magnitude, it is a pole placement. For a peaking section
`|pole| = sqrt(a2/a0)` walks toward 1 as `a` grows: at 200 dB the radius
is 0.9999993 and the section rings for ~32 seconds, and past a few
hundred dB the f32 rounding puts the poles *exactly* on the unit circle.
Nothing upstream stops it -- `edith.rs`'s `band()` takes any parseable
field, its `float()` refuses only inf/NaN, `Project::set_eq` refuses
only `!finite`, and the UI's 12 dB is a card decision rather than a
project guarantee. The device clamp and the export's own [-1, 1] then
turn the result into a hard-clipped full-scale square for the whole
clip, in monitoring and in the exported file alike, and with the limiter
on the overflow is folded into its gain and colours every later sample.

Clamped at the same site as the other three, so the documented invariant
is true. `MAX_BAND_GAIN_DB`/`MIN_BAND_GAIN_DB` are +/-40 dB: far past
any card (deliberately -- a project may be more extreme than the control
that set it) while keeping `a` a linear gain of 100, comfortably inside
f32. Clamped rather than refused, because the struct's contract is that
a deserializer may hand this over unchecked: a project saying +400 dB
gets +40 dB, not a project that will not open.

Witness (arithmetic, not an audibility claim -- nothing here says what
the filter sounds like, only that it is stable): the poles of
`z^2 + a1 z + a2` solved off the normalized coefficients, asserted
strictly inside the unit circle, plus a full-scale 1 kHz burst whose
peak stays at the ceiling's own gain. Pre-fix, +10000 dB produced
`b0: inf` and +100 dB sent a full-scale burst to 62773.
docs(limiter): engaging mid-stream costs a permanent shift, and here it is measuredAhmet Kaan Gümüş · 4156093
docs(limiter): engaging mid-stream costs a permanent shift, and here it is measured

`engaged` is `warm: 0` over a zero-filled line and `process` emits
`line[at]`, so the output is the input delayed by the whole line --
permanently, for the rest of the stream. Its doc claimed the cost was
"a hair of silence at the moment somebody engages a limiter", which is
what the *open* path (`new`) does: head-aligned and short by the
lookahead once. The two are not the same, and the doc described the one
this function is not.

The audio behaviour is unchanged: a permanent offset of at most
`LOOKAHEAD_MS` is below the perceptual threshold, and whether to pay it
is a design call about the export's A/V alignment, not a bug fix. What
changes is that the doc now says what the code does, and a unit test
holds it there -- same tone through `engaged` and through `new`,
asserting the index offset, the block lengths, and that the offset
persists into the next block rather than being a one-off.
fix(player): one owner for the monitoring level, so a preview close cannot undo itAhmet Kaan Gümüş · 8b784e6
fix(player): one owner for the monitoring level, so a preview close cannot undo it

The level is the *window's*, but it was pushed at whichever session
happened to be on screen (`apply_volume` went through
`active_session()`, preview-or-timeline). Open a preview, press M, press
Esc: the preview is quiet, the notice goes, and the timeline plays at
the level from before the preview -- usually full -- while the control
still reads "Muted". Shown level and heard level disagreed and nothing
said so. `open_preview` pushed at the preview directly rather than
through the one door, which is the same defect wearing a different hat.

The app keeps exactly one copy of the level (`Player::volume`, a setting
of the window and not of any session) and every session is a follower
of it. The engine cannot own it: a preview and the timeline are two
sessions with two devices, and the level has to outlive both, so the
owner is above them.

* `push_gain(gain, sessions)`: the push, over every session handed in.
  A free function over the sessions rather than a `&self` method so the
  round trip can be driven without a `Player`, which takes a gpui
  `Context` this test binary has no `TestAppContext` to build.
* `apply_volume` is a call to it with both session slots; `open_preview`
  and `close_preview` call it, so no door can swap the session on screen
  without telling the new one what the window is showing.

Witnesses: `a_preview_close_leaves_the_timeline_at_the_level_the_window_shows`
round-trips the level through the real push and reads it back out of the
device (`PlaybackSession::gain`), with a control that a session outside
the push is untouched. `the_window_level_is_pushed_at_every_session_and_on_every_swap`
pins the wiring the first cannot execute; reverting the push to the
active session alone fails it.
fix(audio): a gain that survives the device being replacedAhmet Kaan Gümüş · 2734028
fix(audio): a gain that survives the device being replaced

The monitoring gain was written straight at the device and remembered
nowhere, so every replacement of that device came up at 1.0 -- and a
session playing muted whose output died (a PipeWire restart, a sink
unplugged) came back at full volume with the toolbar still reading
"muted". Compare `content_at`, which is reset at the same door with a
comment about the stream that died: the clock anchor has an owner, the
level did not.

* `ao_gain` (engine-audio): the symmetric read-back of `ao_set_volume`,
  off the same `Shared::gain` the RT callback multiplies by, so a caller
  can ask the device rather than remember what it asked for.
* `AoSession::gain`: that read-back, and the Silent sink now keeps the
  gain it was given (`ao.rs`'s pin answered `true` to every gain, which
  made the sink unable to witness any of this). The plugin symbol is
  optional, like `ao_stream_ended`: an older plugin still plays, it just
  cannot be asked.
* `Audio::gain`: the session's own copy, written only by `set_gain` and
  only after the device has taken the number, so it cannot drift.
* `rearm_audio` and `arm_audio` put it back onto the fresh stream.

Witness: `a_rearmed_output_comes_back_at_the_level_the_session_was_running`
reads the level back out of the device before and after a re-arm driven
the way the sibling re-arm test drives it (dead flag, cooldown spent,
play + seek), with the death flag clearing as the control that a new
device really was installed. Reverting the one `ao.set_volume` line in
`rearm_audio` fails it: `left: Some(1.0), right: Some(0.0)`.

No audibility is claimed anywhere in this change: what is witnessed is
state, read back out of the device.
fix(player): the three doors the action table armed on their behalfAhmet Kaan Gümüş · 7285b61
fix(player): the three doors the action table armed on their behalf

A verifier pass found the class not disposed at three sites my earlier commits
left standing, and it was right. `Player::act` pre-arms `mark_dirty` from a
`matches!` list BEFORE it dispatches, and `ActionId::Crossfade` and
`ActionId::Dissolve` were on it -- so the arm had already fired before
`crossfade_selected` / `dissolve_selected` ran, and those two called
`set_transition_out` / `crossfade` directly with no arm and no gate of their
own. Pressing the dissolve chord on the last video clip lit `unsaved`, wrote
the sidecar and raised the close prompt while the engine refused with "NOTHING
TO DISSOLVE -- no neighbour end to end" and the bytes did not move: the same
defect, on the sibling door. `act_lane` had the same shape for `remove_lane`,
which refuses a track still holding clips and the last of its kind.

Exactly those three sites, nothing else in the list:

- `crossfade_selected` and `dissolve_selected` arm on the write that took and
  on the join's own edges, the same gate `set_transition_frames` already rides
  (both engine doors answer "the clips are adjacent", snapshot and clamp
  included). `Crossfade` and `Dissolve` come off the list. The dissolve also
  gains the arm it never had: the clip-menu row
  (`ui::bench_stance.rs:577`) reaches `dissolve_selected` directly and was
  armed by nothing at all, so the key path was armed twice and the menu path
  not once.
- `remove_lane` arms inside its own `Some(Ok(()))`, and `act_lane`'s pre-arm is
  gone, so the key and the header button share the one armed door instead of
  two arms for one step.

On the verifier's risk that all three app witnesses are `fn_body` text
assertions, which a mutation moving the arm elsewhere would pass: the premise
those assertions rest on is now a runnable behavioural test rather than a
prose claim. `project::tests::a_transition_door_says_yes_to_a_write_that_moved_nothing`
drives `set_transition_out` and `crossfade`, shows both answer `true` and each
spend an undo step for a write that moved nothing, shows the edges that did not
move, and shows a refusal still answering `false`. The front-end has no window
harness to drive, so the engine is where this can be pinned by running it.

Witness: `the_action_table_arms_nothing_a_door_answers_for_itself` in the
family's `fn_body` shape, with all five of its assertions proven to bite
separately -- crossfade arm, dissolve arm, the two list entries, the
`remove_lane` arm, and `act_lane`'s absent arm. Red panic lines and the
restored-file sha256s (timeline_edit.rs 9128a0fa, actions.rs ca9debbc,
library.rs 61b2f579) are in the lane report.
fix(engine): a decode failure says why it stoppedAhmet Kaan Gümüş · 2052c96
fix(engine): a decode failure says why it stopped

A decode worker that ran to the end of a file and one that gave up on a
corrupt packet both drop the sender, and `try_frame` returns `None` for
either. The app read that as end-of-stream, so a file with a damaged
middle froze on its last good picture and the transport said ENDED -- no
notice, no banner, and nothing on screen to say the film had stopped
being the film. The only trace was an `eprintln!` on a decode worker,
which is where a person standing at a terminal is and not where a person
sitting at the window is.

`DecodeFailure` is the reason channel the sound path has had for a device
that dies mid-session, for the picture side: one cell per worker, handed
to every span that worker decodes, because a reseek reuses the thread and
a failure has to outlive the span that set it. Every `eprintln!` on the
decode and demux error paths now goes through it, so the stderr line is
still there for a log and the reason is also somewhere a window can read
it. `PlaybackSession::video_failure_reason` is that reader, the video
twin of `audio_disabled_reason`.

The distinction the audio path already keeps is kept: a span that played
its whole range sets nothing. A reason channel that fires on every film
is a channel nobody reads, and there is a test that says so.

A span clears the reason when it starts, because a span is a fresh
question -- but only a span that is actually going to run, so a span
superseded on its way through the queue cannot erase a failure that has
not been reported yet.

Witness (crates/engine/tests/decode_failure.rs, 2 tests): test_av.mp4
with the last eighth of its *mdat payload* zeroed and its `moov` intact,
which is what a transfer that dies part-way leaves behind. Red on the
base: 130 frames, `decode error at access unit 130` on stderr, and then
`is_eos() == true` -- the transport reading a broken file as a finished
one, with no reason anywhere. Green after: the same 130 frames, and the
reason readable. The control, an undamaged file played to its end, reports
`None` on both.
fix(demux): Matroska DisplayUnit 0 states the stretch, not a cropAhmet Kaan Gümüş · d4dc736
fix(demux): Matroska DisplayUnit 0 states the stretch, not a crop

The Matroska spec has DisplayUnit 0 mean the DisplayWidth/DisplayHeight pair
is in *pixels*, so `1920`x`1080` beside a `1440`x`1080` coded track is exactly
the 4/3 stretch. `pixel_aspect_of` returned square for unit 0, on a comment
claiming "a pair beside the coded one at all means a crop, not an aspect" --
true of the DAR spelling, not of the pixel spelling. The picture was drawn at
1440x1080 instead of 1920x1080 and nothing said so.

No test ever saw the path: `scripts/gen_fixtures.sh` produces unit 3 only
(ffmpeg spells the aspect as a DAR), so units 0/1/2 had no fixture at all.

Unit 0 now reduces to the same SAR as unit 3 -- both are "the display against
the coded one" -- and both arms share it. Units 1 and 2 stay square: they are
physical sizes a picture shown on a screen cannot mean anything by, and saying
so is deliberate rather than an accident of falling through.

The fixture is built here by patching `test_anamorphic.mkv` rather than
committed as a binary, and the patch preserves the element's exact byte length
so every absolute offset in the file -- the SeekHead and all CueCluster-
Positions -- stays correct and the copy seeks as the original does. The test
asserts the patched bytes landed at offset 369.

ffprobe independently corroborates the fixture: the patched file reports
sample_aspect_ratio 4:3, the same picture the SAR and DAR spellings name.

Witness RED, before the fix: the patched fixture opened fine and reported
PixelAspect { h: 1, v: 1 } -- square, and 1440x1080.
fix(demux): an untrusted pasp ratio cannot size a zero or wrapped rasterAhmet Kaan Gümüş · 33ee2ba
fix(demux): an untrusted pasp ratio cannot size a zero or wrapped raster

The mp4 `pasp` box is eight bytes of header and both halves went into
`PixelAspect { h, v }` unvalidated, while every other arm of that reader
validated. Four consequences, all reachable at file open, before a pixel is
drawn:

  - `is_square()` treated `h == 0, v == 5` as non-square, though its own
    comment claimed it covered "a degenerate one a crafted header claimed";
  - `width_factor` divided by nothing, giving `h == 0` a factor of 0;
  - `width_factor` narrowed `coded * h` from a u64 to a u32, and 1920 *
    0x00FF_FFFF wraps to 2_147_481_728;
  - both flowed into the `resize` that sizes the decode worker's stretched
    planes and into `meta.width`.

`width_factor` is now total: it refuses anything `PixelAspect::stated` calls
unusable (a zero half, or a reduced pair carrying a term past 1024 -- judged
reduced, so ffmpeg's unreduced 17280/12960 spelling is judged by the picture
it names), computes in a u64 that cannot overflow, and falls back to the
coded width rather than narrowing to a zero or an oversized raster. The bound
that keeps a header claim from sizing an unsatisfiable allocation is
`MAX_DISPLAY_WIDTH`. `pasp_of` judges the read through the same `stated`, so
the aspect this engine *reports* is one it can draw.

Sane ratios are unchanged bit for bit: 4/3 over 1440x1080 is still 1920.

Witnesses:
  - demux unit: six degenerate claims (both zero halves, both wrap directions)
    must all read as the coded width. RED: `h:0,v:1 -> 0`,
    `h:16777215,v:1 -> 2147481728`, `h:1,v:16777215 -> 0`.
  - end to end: a byte-patched copy of assets/test_baseline.mp4, its eight
    `pasp` payload bytes replaced, opened through the ordinary door. RED was a
    hard SIGABRT -- "memory allocation of 3092375531520 bytes failed" -- not an
    assertion failure, which is the whole severity of the defect.
test(app): the dock keeps a decoder refusal where it drops a seatAhmet Kaan Gümüş · 47adb87
test(app): the dock keeps a decoder refusal where it drops a seat

The dock's metadata line drops the decoder seat (`HW`, `SW`, ...) from
the row detail -- the transport line and the Properties side both still
say it, so the row says what the file *is*. That filter is what decides
whether a refusal survives to the row, and it was inline, so nothing
could say.

`without_seats` is the same expression, named: a whole part is dropped
only when it is exactly a seat's word, so a file the decoder refused
reaches the dock whole. Witness drives the real predicate over a real
refusal, and fails when the split is mutated off the separator.
fix(engine): a still is shown the way its EXIF orientation saysAhmet Kaan Gümüş · e600a6e
fix(engine): a still is shown the way its EXIF orientation says

A phone photographs a portrait picture and stores it as landscape plus a
tag saying which way up it is. The `image` crate keeps that tag in its
decoder and applies nothing, so every still door read the *stored* shape:
the preview, the timeline clip box, the poster thumbnail, the library
row, the canvas seed and an export of that clip. A portrait phone photo
opened sideways in all of them, silently.

The turn is now read and made once, in `Still::open`, before the planes
are written -- the same step the video doors take for a display matrix,
at the same place in the pipeline, through the same `Rotation`. Because
the turn is in the planes, `Render`, the `VideoMeta` both still doors
mint, an export's `place_picture` and `image_size` all report the shown
pair without any of them re-deriving it, and no consumer can be
forgotten.

EXIF 2, 4, 5 and 7 are mirrorings and this engine has no flip anywhere
in its pipeline, so they are refused by name at the door
(`UnsupportedStillOrientation`, `is_it` and all) the way a display
matrix that is not a quarter turn is: a mirrored photo shown the wrong
way round is a wrong picture, not a missing feature. The refusal is
propagated unchanged rather than folded into a sentence with the file's
name, so a caller can still downcast it.

`DecodeSession::open_range` also reaches a still now. It handed one to
the mp4 demuxer, which answers "a box with a larger size than it" -- a
true sentence about a container and nothing a person can act on -- so
this door, the one a front-end opens a file through, refused every
picture outright, and the poster thumbnail was one of its callers.

Witness (crates/engine/tests/exif_orientation.rs, 5 tests): a JPEG built
in-test with four coloured quadrants and a hand-written APP1/EXIF
segment carrying tag 0x0112, sampled a pixel per corner so a wrong
direction cannot pass. Red on the base: `image_size` (64, 32), frame
64x32, corners ["red","green","blue","yellow"] -- the stored layout,
orientation ignored. Green after: (32, 64) and ["yellow","red","green",
"blue"], with 180, anticlockwise and no-turn each asserted in its own
direction, all four mirrors refused by name, and the export portrait
with no matrix of its own. `cargo test -p engine --test images` 8/8.
fix(app): a refused file names the refusal on its library rowAhmet Kaan Gümüş · c2e0146
fix(app): a refused file names the refusal on its library row

`engine::decode::probe` answers a stream this machine has no seat for
with an `Err` carrying the plugin's own words. `Player::refill` took
`engine::decode::probe(&path).ok()`, so the refusal and "a file with no
decoder to name" both became a missing map entry -- and a missing entry
drew an empty second line, the same line a song draws. A file that cannot
be decoded therefore looked exactly like a file that needs no word, and
the freeze that followed looked like the end of the film.

The map now holds a `Decoder` that can say all three things: asked and
not answered, the seat it will open on, or the refusal in the words the
decoder used. The row's existing detail line carries it; no second label
mechanism, and no change to what import or open does with the file.

Witness: `a_refused_file_names_the_refusal_on_its_row` drives the real
`engine::decode::probe` -- a `.mkv` that is not a container, refused by
the demuxer with no plugin and no hardware -- and asserts the row detail
equals the refusal. Red before (the row drew ""), green after, and red
again with `Decoder::detail`'s refusal arm reverted, and with
`From<engine::Result<..>>` mapping `Err` back to `Pending`.
fix(engine): bound a caption's microsecond window at the doorAhmet Kaan Gümüş · 70ba4eb
fix(engine): bound a caption's microsecond window at the door

A `sub` line's `in_us`/`out_us` is the one number in the `.edith`
format with no magnitude bound: the parse asks whether the window is
*open* (`out_us > in_us`) and never how wide it is, and `micros()` is a
bare i64 parse. So `out_us = 9223372036854775807` was a legal line.

Every split, ripple and group trim re-derives the two halves of the
window by proportion -- `SubClip::window_at`, a plain
`window_us() * into` -- which overflows on the first frame inside the
caption. A hand-edited or hostile `.edith` therefore panics the editor
on the UI thread the first time a user ripple-deletes across, splits or
trims that caption, losing unsaved work, and the file re-crashes on the
next open. In a release build the same line wraps the caption's clock
negative instead: `trim_sub`'s only check on its result is a
`debug_assert!`.

Bounded at the door, by name, beside every other range check a `.edith`
line already has to pass, and the composing arithmetic made total so a
future caller cannot reintroduce the wrap:

- `project::MAX_WINDOW_US` -- a day of track, the same shape of refusal
  as `is_resolution` for a `resolution` line.
- checked at all three doors a caption comes through: the parse
  (`edith.rs`), `Project::with_subs` (a hand-built `Project`) and
  `Project::place_sub` (a dragged placement).
- `SubClip::window_at` saturates its multiply and clamps its answer into
  the window it is cutting; `SubClip::window_us` saturates its
  subtraction; `trim_sub` and `write_sub_edge` saturate their additions.

Witness (`crates/engine/tests/saveload.rs`, hand-built project file, no
`--release`): the 30-second-window control loads, splits and ripples
across; the same file with `out_us = i64::MAX` used to load and then
overflow at `project.rs:654` on both `cut_at` and `cut_regions`, and is
now refused by name at `line 7`. Non-vacuity: with the parse bound
disabled the test goes red on `with_subs`' refusal instead, and with
both disabled it loads again.
fix(player): a transition step or retyped number arms only what movedAhmet Kaan Gümüş · 7752ec5
fix(player): a transition step or retyped number arms only what moved

Found by the class sweep of "dirty armed ahead of the mutation door, or while
dropping the door's answer", alongside the two mix/EQ doors this wave fixed.
`Player::set_transition_frames` armed on the raw bool from
`set_transition_out` and `crossfade`, and both of those answer true for any two
adjacent clips: they snapshot, they clamp, and a `frames` already in force is
written over the value the join already carried and still reported as a write.
So a `+` step once the dissolve is at the cap, or the same number retyped into
the duration field, lit `unsaved`, wrote a sidecar and raised the close prompt
over an unchanged timeline.

The arm now rides a before/after read of the join's own edges, the comparison
`move_sub` and `commit_fade` already make. The new `transition_edges` helper
reads BOTH sides of the join, because a crossfade writes the anchor's
`fade_out` and its neighbour's `fade_in`: a comparison of the anchor alone
would miss a crossfade whose neighbour-side edge is the one that did not move.
Both the stepper and the typed field keep landing the number the same way -- only
the arm moved.

Witness: `a_transition_step_or_a_retyped_number_arms_only_what_moved`, in the
same `fn_body` shape as the family, asserting the arm is after the comparison
and absent before it, and that the helper still reads both edges. Shown RED
against the pre-fix source.
fix(player): the equalizer commit arms on the curve having movedAhmet Kaan Gümüş · a5f4c04
fix(player): the equalizer commit arms on the curve having moved

`Player::commit_eq` called `session.set_eq(...)` and then armed, dropping the
door's answer entirely. Worse, that answer is the weak shape the family already
knows about: `Project::set_eq` returns false only for an index that is not there
and a curve that is not finite, and otherwise snapshots and rewrites the very
slot the clip already holds -- so it says true for a re-commit of the curve
already in force. The "Flatten all" button reaches `commit_eq` with every gain
already at zero, and the card's own close armed autosave, the `unsaved` ghost
and the close prompt over a project nothing had changed.

The arm now rides the same pair `apply_fit` already rides for `set_fit`: the
curve having moved, read back with `eq_of`, and then the door's own answer. A
missing index, a non-finite curve and a no-op commit are all unarmed; a real
change arms exactly once.

`reset_after_reseek` moves inside the gate with the arm rather than staying
outside it: it exists because `set_eq` reseeks inside the engine, so on a write
that did not take there is no reseek whose flags need clearing.

The scan case joins `every_click_door_that_writes_the_project_arms_autosave` in
the family's `fn_body` shape, and holds the two-part gate: without the
`eq_of` comparison the door's bool alone would pass. Shown RED against the
pre-fix source with the arm and the comparison reverted separately.
fix(player): the mix card's arm rides the mix door's own answerAhmet Kaan Gümüş · 5d1e7d9
fix(player): the mix card's arm rides the mix door's own answer

`Player::nudge_mix` called `mark_dirty()` before it asked the session
anything, so every press armed autosave -- the ledger's `unsaved` ghost, a
sidecar write, the close prompt -- whether or not a value moved. Both doors it
goes through already answer the question: `set_lane_gain_db` and `set_limiter`
each return false for a value already in force. So a fader held against its
wall (the clamp is reached, the number written is the number there), a ceiling
already at its clamp, and a re-tapped limiter switch all lit `unsaved` over a
project whose bytes had not moved, and asked the user to save work nobody did.

The arm moves inside the match, on the bool the door returned. The nudge's own
math is untouched: the mixer is still handed the value on every press, so what
the ear hears while the arrow is held is unchanged -- a no-op press is simply no
longer an edit.

The scan case joins the family in
`every_click_door_that_writes_the_project_arms_autosave`, in the same
`fn_body` shape, and asserts both halves: the arm is after the gate and absent
before it. Shown RED against the pre-fix source.
fix(engine): judge proxy candidacy on the coded pair, not the displayed oneAhmet Kaan Gümüş · 6924a19
fix(engine): judge proxy candidacy on the coded pair, not the displayed one

`proxy::wanted` read `meta.width`/`meta.height`, which `VideoMeta` documents as
the DISPLAYED pair: the coded one with its axes swapped where the file carries a
90- or 270-degree display matrix, and width-stretched by a non-square sample
aspect. A full-HD AVC phone clip carrying a 90-degree turn therefore reports
1080x1920, reads as "taller than 1080p" and is judged proxy-worthy -- the whole
file goes through a decoder and an encoder in the background, and takes proxy
cache space, to stand in for a clip this machine already plays at rate. The
auto-proxy switch shows ON over a file that needed nothing.

What a decoder is handed is the stored raster, so the stored raster is what the
size test is about: `coded_width`/`coded_height`. The codec test is not a size
question and is unchanged, so a turned HEVC or AV1 file is still wanted, and a
genuinely tall stored raster is still wanted turn or not.

The unit test's `meta` helper is now a thin wrapper over a `turned_meta` that
takes a rotation and builds the displayed pair the way `demux` builds it, and
the test asserts both the refusal and the two cases that must stay wanted.
Shown RED against the pre-fix predicate.

2026-09-24

fix(decode): stretch before the turn, so a rotated anamorphic file fills its canvasAhmet Kaan Gümüş · f4bc699
fix(decode): stretch before the turn, so a rotated anamorphic file fills its canvas

A 1440x1080 SAR-4/3 file with a 90-degree display matrix rendered
1440x1440: the render composed turn-then-stretch, landing the ratio on
the coded height, and the square raster sat letterboxed inside the
1080x1920 canvas the probe declares -- bars in the preview and baked
into the export. The ratio belongs to the axis that was horizontal
BEFORE the turn: the coded width is stretched by h/v and the turn then
swaps the stretched pair, which is what the probe has declared all
along. Render::frame and place_picture now both stretch first, the one
order that agrees with the probe.

The suite's rotated case had been vacuous -- the in-test fixture was a
setsar file with no display matrix, asserting nothing about the turn.
It now remuxes a real 90-degree matrix on (-display_rotation 90, the
gen_fixtures pattern), asserts the probe's swapped stretched pair
(1080x1920, not 1440x1440), and drives the render through the same
assertions; the export test grows the rotated clip with
preview-vs-export equality. Mutation witness: with the render reverted
to turn-then-stretch the new assertions fail with exactly
left (1440, 1440) / right (1080, 1920).

The demux comment now names the render's order and the failure the
other one produces, so the two can't drift again.
test(anamorphic): the anamorphic fixtures and the suite that pins themAhmet Kaan Gümüş · db45d3c
test(anamorphic): the anamorphic fixtures and the suite that pins them

scripts/gen_fixtures.sh grows the anamorphic block: test_anamorphic.mp4
and .mkv, one 1440x1080 setsar=4/3 source in each container (mkvmerge is
not installed; ffmpeg's own Display* output is the source of truth), and
test_anamorphic_hevc.mkv for the copy door, which only copies HEVC or
AV1 Matroska.

crates/engine/tests/anamorphic.rs pins the whole contract on them:
- the probe reads coded 1440x1080 and drawn 4/3 off both doors, the
  ratio compared reduced because the mkv carries ffmpeg's DAR spelling
  (17280/12960) where the mp4 carries the SAR itself;
- the preview hands out 1920x1080 with picture in every corner (numeric
  gate) and a measured 16:9 display aspect;
- the export re-encodes to the drawn shape, square, the same picture
  the preview showed within encode loss;
- the Matroska copy keeps the aspect beside the coded blocks (read
  back), and the mp4 Exact row refuses in the words 'a copy would lose
  the pixel aspect';
- square files still read one to one, swapped only where their matrix
  turns them.

The HEVC-door tests skip on a machine without the plugin, as
video_copy's decode-back test does.
copy(exact): the copy door keeps the pixel aspect, and an mp4 copy refuses itAhmet Kaan Gümüş · 312b13e
copy(exact): the copy door keeps the pixel aspect, and an mp4 copy refuses it

ffmpeg's own copy behaviour: the blocks are the source's coded pixels
and the aspect travels with them as container metadata. The Matroska
copy door now does that: CopyPlan compares CODED to CODED (the display
comparison would refuse every anamorphic source and then lie about the
track it wrote), declares the source's coded pair, and writes the
source's aspect as Display* elements -- unit 4, the SAR itself, the
ratio this engine's reader reproduces exactly. A square copy writes no
Display* at all, so every existing copy's header is byte-identical.

The mp4 copy cannot carry it: the sample entry this writer produces has
no pasp box, and a header that declares the coded pair while the pixels
are drawn 4/3 wide lies about its own shape. Refused by name -- 'a copy
would lose the pixel aspect' -- before the container's codec sentence,
so the export re-encodes into the square pixels the picture is drawn at
(mp4 export measured: 1920x1080, square).
fix(decode): size the stretch buffers before the resampleAhmet Kaan Gümüş · c3f9e0a
fix(decode): size the stretch buffers before the resample

scale_i420 asserts exact planes; the stretch buffers were empty
Vecs, so the first anamorphic frame died on the destination-luma
assertion instead of being stretched. Sized with the rest of the
steady-state scratch, once per worker, exactly as  is.
apply(decode): stretch the anamorphic picture once, at the single post-decode stepAhmet Kaan Gümüş · b3a5acb
apply(decode): stretch the anamorphic picture once, at the single post-decode step

ffmpeg applies the sample aspect exactly once, at the conversion to the
square-pixel raster; so does this engine now. Render::frame takes the
file's pixel_aspect beside its rotation and, only where the samples are
not square, resamples the coded picture to the displayed width with the
existing scale_i420 -- the same bilinear the canvas places through. A
square-pixel file takes the branch by a bool and not one byte is
touched: the passthrough fast path, the tonemap FNV constants and the
graded path are all exactly what they were (matrix_render and
tonemap_render green unchanged).

The export takes the same two facts through place_picture -- stretch
after turn, the order ffmpeg composes -- and an anamorphic span is
barred from the DMA fast path, whose whole premise is that no seat
touches a sample before the encoder. Dissolve's B half carries its own
file's aspect beside its own rotation.

VhMeta grows the coded pair and the aspect ratio, so the plugin ABI
answers both questions a display size may now raise: what to draw and
what the samples are stored at.
probe(demux): sample aspect ratio off the container, coded dims beside the display pairAhmet Kaan Gümüş · 66a1c40
probe(demux): sample aspect ratio off the container, coded dims beside the display pair

ffmpeg's model: the decoder keeps coded pixels and carries the SAR as
metadata. VideoMeta carries the pair now: coded_width/coded_height are
what the samples are stored at, pixel_aspect is the ratio one coded
pixel is drawn at (PixelAspect, square when nothing is stated), and
width/height stay the displayed shape their docs always promised --
stretched by the aspect, then swapped by the turn, in that order.

mkv: DisplayWidth/DisplayHeight/DisplayUnit read off the Video element
(units 3 DAR and 4 SAR; absent, or units 0/1/2, square -- measured
against ffmpeg 8.1.2, which writes a 16/9 DAR pair with unit 3 for a
setsar=4/3 source and nothing at all for a square one).
mp4: pasp (hSpacing/vSpacing) out of the visual sample entry, behind
the same fixed 78-byte header colr and hvcC sit behind, absent = square
-- measured: ffmpeg writes pasp 4/3 for setsar=4/3 and 1/1 otherwise.

VhMeta's twin fields ride along so the plugin ABI can carry the same
answer once a display size differs from the coded one.