Repository navigation
fix(cli): restore the read-ahead's invariant assertions - #1796
Merged
Merged
Conversation
* fix(cli): restore the read-ahead's invariant assertions A lint cleanup (#1785) replaced the seven assert()s of FrameReader and release_fetched_picture() by early returns and folded conditions. The clang-tidy finding behind it (misc-static-assert, cert-dcl03-c) is a false positive of clang-tidy 22 on glibc 2.44 hosts: glibc's C++ assert macro expands to a conditional with a constant arm, and the check then fires for every runtime assert. The CI image (glibc 2.39) reports none, so the committed baseline was right. The replacements changed what a broken invariant does: publish() dropped the frame, wait_for_free_slot() ended the reader as if the stream were over, start() and next() returned silently. All seven assertions and <cassert> are back; the other four files of #1785 keep their fixes. test_cli_frame_reader_asserts_contract lists all seven on master and none here, and reports two planted replacements. Debug build with the assertions active: fast suite 232 of 232, CLI on the Netflix pair exits 0. Closes T-CLI-FRAME-READER-ASSERTS-REPLACED-2026-10-02 and defers T-TIDY-GLIBC-244-STATIC-ASSERT-FALSE-POSITIVE-2026-10-02. * docs: regenerate the indexes and the citation map after rebasing
lusoris
force-pushed
the
fix/cli-restore-frame-reader-asserts
branch
from
October 2, 2026 05:23
21b1f09 to
f4acc3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
vmafCLI's read-ahead (FrameReader, ADR-1366) checks its invariants withassert()again. #1785 had replaced all seven by early returns and folded conditions to remove a clang-tidy finding that is a false positive on the host it was measured on.The defect
T-TIDY-CPU-LANE-ABOVE-BASELINE-2026-10-02counted 7cert-dcl03-c,misc-static-assertfindings incore/tools/vmaf.cppas regressions. They are not:assert(e)in C++ to((e) ? void (1 ? 1 : bool (e)) : __assert_fail(...)), and clang-tidy 22.1.8 then reports the check for every runtimeassert().assert(p != nullptr)on a pointer parameter gives 1 warning on the host (glibc 2.44) and 0 with the same check under glibc 2.43 (dev container). The requiredTidy Ratchetcontext measures on ubuntu-24.04 (glibc 2.39), so the committed baseline was right.The replacements changed what a broken invariant does:
publish()count_ < kReadaheadDepthwait_for_free_slot()count_ <= kReadaheadDepthfalse: the reader ends as if the stream were overstart()next(),release_fetched_picture()-EINVAL/ nothingrequest_stop()None of these states is reachable by construction, but an invariant that fails silently is worse than one that stops.
What changed
core/tools/vmaf.cpp: the sevenassert()s and<cassert>are back. The other four files of fix(lint): bring the cpu tidy lane back to its baseline #1785 keep their fixes.core/test/test_cli_frame_reader_asserts_contract.py(fast suite): fails when one of the seven is no longer an assertion.core/tools/AGENTS.md,docs/state.md,docs/rebase-notes.md, changelog fragment.Verification
The CLI on the Netflix 576x324 pair in that debug build exits 0 with 48 frames.
Not run: the clang-tidy cpu lane in the CI image. On this host it reports the seven false positives again by design;
T-TIDY-GLIBC-244-STATIC-ASSERT-FALSE-POSITIVE-2026-10-02records how to measure instead.Deep-dive deliverables (ADR-0108)
core/tools/AGENTS.mdpython3 core/test/test_cli_frame_reader_asserts_contract.pychangelog.d/fixed/cli-frame-reader-asserts-restored.mddocs/rebase-notes.md