Skip to content

fix(build): a newer Cargo.lock is stale only when it changes libobs-rust's packages (Refs #5323) - #5383

Merged
vpacher merged 2 commits into
masterfrom
fix/5323-cargo-lock-freshness
Nov 21, 2026
Merged

vpacher merged 2 commits into
masterfrom
fix/5323-cargo-lock-freshness

Conversation

@vpacher

@vpacher vpacher commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Refs #5323

Problem

The archive freshness check (#5341) compares Cargo.lock by modification time alone. A PR that adds a crate libobs-rust does not use changes the lockfile. Cargo then correctly keeps the archive, the checkout makes the lockfile newer, and Tier 2 Linux on a kept Dell tree fails:

stale Rust archive .../liblibobs_rust.a: newer input Cargo.lock

This ejected #5362 from the queue (run 44754423221, job 136350628389 on dell-fsx3mn2-5). Every PR that adds a crate, or changes a dependency outside libobs-rust, hits it.

Change

Cargo's depfile lists only path dependencies (a release liblibobs_rust.d has 1174 paths, all under rust/ or build-script output, none from crates.io). So the archive's registry packages come from the lockfile: the closure of libobs-rust, every package reachable from it through the lock's dependency lists, with version, source, checksum and resolved dependencies.

  • When the archive is newer than Cargo.lock, the check saves that closure and the archive's mtime in liblibobs_rust.lock-closure beside the archive (best effort: a read-only external archive keeps the mtime rule).
  • When Cargo.lock is newer, the archive is fresh only if the closure equals the stamp for an unchanged archive mtime.
  • Stale, as before: no stamp, a stamp for another build of the archive, a lockfile or rust/libobs-rust/Cargo.toml that cannot be read, a dependency the lockfile does not lock.
  • All other inputs and their error texts are unchanged; the lockfile is checked last, so a stamp is saved only for an archive that passed everything else.

New module rust/obs-build/src/libobs/lockfile.rs; check_rust_archive calls check_lockfile.

Tests

obs-tests-app (rust/obs-build/tests/native/archive_freshness.rs), 2 new cases:

  • hybrid_archive_checks_only_its_own_packages_in_a_newer_lockfile: a touched lockfile, a new unrelated crate and its dependency, and a second serde for another crate (Cargo then writes serde 1.0.1 in libobs-rust's entry) stay fresh. A bumped dependency, a new dependency of a local crate, an unreadable lockfile, another archive build and a missing stamp are stale.
  • hybrid_archive_reads_the_repository_lockfile: the repository's real Cargo.lock (CRLF-tolerant) parses, stays fresh with an unrelated crate appended, and is stale when libobs-rust's own entry gets a new dependency.

RED 951116345: both fail (newer input Cargo.lock for the touched lockfile). GREEN 18a196f8d: 6/6 archive freshness cases pass, ./lint passes (build-rust, Linux x86_64).

End to end on a kept tree (build-rust): real soldr cargo build --locked --release -p libobs-rust archive and depfile, then soldr cargo build --locked -p obs-sys --features bundled with OBS_BUILD_RUST_ARCHIVE, before and after cherry-picking #5362's commits (lockfile change only, Cargo keeps the archive):

obs-build after #5362's lockfile change
master 0419d4a26 stale Rust archive ...: newer input Cargo.lock
this branch passes the check; stops later at native dependency x11 (no X11 dev packages on that box)

A kept tree gets its first stamp at the first build that writes the archive again; until then it behaves as master.

Tier 2/3: not applicable (build tooling, no C original). Test cost: the 2 cases take 0.01 s, no own threads, temp dirs only. No features.md line: no user-visible change.

🤖 Generated with Claude Code

vpacher and others added 2 commits November 21, 2026 08:06
…not stale, RED (Refs #5323)

A kept Tier 2 tree fails with 'newer input Cargo.lock' when a PR adds a
crate that libobs-rust does not use (merge-group run 44754423221, #5362):
Cargo correctly keeps the archive, and the lockfile is newer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…GREEN (Refs #5323)

Cargo's depfile lists only path dependencies, so the archive's registry
packages come from the lockfile: the closure of libobs-rust through the
lock's dependency lists. When the archive is newer than Cargo.lock, the
check saves that closure and the archive's mtime in
liblibobs_rust.lock-closure. A newer Cargo.lock is fresh only when its
closure equals the stamp for an unchanged archive. No stamp, a stamp for
another archive build, or a lockfile that cannot be read stay stale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vpacher
vpacher requested a review from zackees as a code owner November 21, 2026 07:10
@vpacher vpacher changed the title fix(build): stamp libobs-rust's lockfile closure beside the archive, GREEN (Refs #5323) fix(build): a newer Cargo.lock is stale only when it changes libobs-rust's packages (Refs #5323) Nov 21, 2026
@vpacher
vpacher added this pull request to the merge queue Nov 21, 2026
Merged via the queue into master with commit 30495d5 Nov 21, 2026
45 checks passed
@vpacher
vpacher deleted the fix/5323-cargo-lock-freshness branch November 21, 2026 08:50
vpacher added a commit that referenced this pull request Nov 21, 2026
…5230)

hybrid_archive_reads_the_repository_lockfile (#5383) used obs-dock-layout as
a package that the repository lockfile does not have. This PR adds that crate,
so in the merge queue the dependency resolved and the archive was stale for
"it changes the packages" instead of "cannot be read" (Fast Gate, macOS and
Windows Rust Tests, run 44900012182). The fixtures now use
obs-unrelated-fixture and unrelated-fixture-dep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
amsterdamboomer pushed a commit to amsterdamboomer/obs-studio that referenced this pull request Nov 21, 2026
…obs-rust#5362)

* test: obs-dock-layout model, RED against stubs (Refs obs-rust#5230)

Step 2 of the dock layout plan on obs-rust#5230: a new crate with the layout
model of the main window, no Qt and no platform code, so its decisions
run on every CI target (W1, W5). Not used by the frontend yet; the
adapter and its header come in step 3.

The model keeps the sizes the user wants: the depth of each dock area in
pixels and the length of each dock in its row, applied as shares of the
row (D1). Only a separator drag changes them (D3, R7); a window change
only puts them back where they fit. The record is the additive
BasicWindow/DockSizes value with the hash of the DockState blob (D6).

Tier 1 tests in obs-tests-gpu (the frontend's Rust category): record
format, window changes (E2, E3, D1, R9), drags (D3 in a clamped row,
R7), placement (hide/show, P7, E14, tabs), the restores of a layout
with no known sizes (obs-rust#3740, P2, P5, P6, E25), the C ABI, and one
session under a floating and a tiling window manager that must save
the same record (W2). Every test fails here: the model's methods and
the record codec are todo!().

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat: obs-dock-layout model, GREEN (Refs obs-rust#5230)

The model behind the stubs:

- A row is the shown, docked docks of one area that share the area's
  edge; an area whose docks share one depth has a depth.
- Window changes learn sizes not known yet (rescaled to the row's known
  sizes, never from a clamped row) and return the resizeDocks calls
  that give each row its shares and each area its pixels, as far as the
  preview has room. 1 px differences are left alone.
- A separator drag records the docks and areas it resized; a press and
  release that resized nothing is no change. In a clamped
  row the dragged docks share the row's wanted total in their new ratio,
  so the untouched docks keep their shares (D3).
- A dock moved to another area or tab group loses its length; hiding,
  showing and floating keep it.
- Every number from the caller is clamped to +-2^20 px (and a record
  size above that is no record), so no sum or product can overflow and
  nothing panics across the C ABI.
- A layout restored with no known sizes is restored again at each window
  change until it shows unclamped or the user changes something (the
  decision of 2026-11-20 on obs-rust#5230); quit then saves that blob.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: obs-dock-layout learns a side column at its minimum when the preview has room, RED (Refs obs-rust#5230)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: obs-dock-layout learns a side column at its minimum when the preview has room, GREEN (Refs obs-rust#5230)

A dock at its minimum across its area's depth is a window clamp only when
the central widget is at its minimum too. Real Qt (test_dock_state_restart
on the adapter) showed a column the user left at its minimum: its depth was
never learned, so every start had no complete sizes and ignored the record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: lockfile fixtures use a package name no crate has (Refs obs-rust#5323, obs-rust#5230)

hybrid_archive_reads_the_repository_lockfile (obs-rust#5383) used obs-dock-layout as
a package that the repository lockfile does not have. This PR adds that crate,
so in the merge queue the dependency resolved and the archive was stale for
"it changes the packages" instead of "cannot be read" (Fast Gate, macOS and
Windows Rust Tests, run 44900012182). The fixtures now use
obs-unrelated-fixture and unrelated-fixture-dep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant