Repository navigation
refactor(core): pilot C++23 conversion (metadata_handler) + migration research digest - #19
Merged
Merged
Conversation
lusoris
marked this pull request as ready for review
May 28, 2026 11:37
… research digest Convert core/src/metadata_handler.c to metadata_handler.cpp as the Phase 4 C++ internals modernization pilot (ADR-0708). Research-0732 surveys all core/src/*.c candidates and ranks them by ROI. Pilot changes: - git mv metadata_handler.c -> metadata_handler.cpp (preserves blame) - vmaf_metadata_destroy: manual linked-list traversal replaced by std::unique_ptr<VmafCallbackList> with CallbackListDeleter RAII; guaranteed teardown on any future early-return path - metadata_handler.h: extern "C" guards added so C callers (feature_collector.c) continue to link unchanged - meson.build: compiled as isolated metadata_handler_cpp20_lib static lib with override_options ['cpp_std=c++20'], matching the Vulkan VMA precedent; project-wide cpp_std=c++11 is not affected - core/test/meson.build: 25 .c -> .cpp references updated Research deliverables: - docs/research/0732-vmafx-cpp23-internals-migration-plan.md: full survey with ROI table for all 14 candidates; top-5 targets for Wave 1-3 PRs - docs/adr/0708-vmafx-cpp23-internals-pilot.md: policy ADR with alternatives considered table Netflix golden gate (post-conversion, all three reference pairs): Pair 1 (src01 576x324): 76.6678 [places=4 PASS] Pair 2 (CB 1-px shift): 35.0687 Pair 3 (CB 10-px shift): 7.9859 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lusoris
force-pushed
the
refactor/cpp23-pilot-metadata-handler
branch
from
May 28, 2026 11:52
5f84338 to
f89f82f
Compare
6 tasks done
1 task
lusoris
added a commit
that referenced
this pull request
Sep 22, 2026
…r errors vmafx-tune held the last of this slice's debt: six cobra constructors and ten run/emit functions over the 60-line bound, ten discarded errors, and one unbounded model-path walk. Flag registration moves out of each constructor into a register*Flags helper, which is where the bulk of every constructor was. The run functions split into validate, execute and render stages along the seams their own comments already marked, so argv order, JSON key order, error strings and the order validations run in are untouched -- a request with several bad values still reports the same first complaint. The remaining `_ = cmd.MarkFlagRequired(...)` sites now call markCommandFlagsRequired, the package's existing helper that turns a wiring defect into an exit-2 validation error; fast.go and corpus.go already used it. The scratch-file bookkeeping in the per-shot driver reports its failures instead of dropping them: a probe that will not close, a reference that will not delete and a workdir that will not pre-create are each a step toward the disk-pressure failure ADR-0577 and ADR-0598 exist to contain, and none of them was visible before. The saliency model walk is bounded by the starting path's depth, since filepath.Dir removes one element per step and is a fixed point only at the root. Also records the changelog fragment for the whole cmd/** batch and the invariant the MCP tool-registration split creates, appended as #19 so no existing invariant number moves: a register* helper that registerTools does not call registers nothing, and the parity test only asserts every Python tool is present, so it would not catch it.
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
core/src/metadata_handler.ctometadata_handler.cppviagit mvas the Phase 4 C++ internals modernization pilot (ADR-0708).vmaf_metadata_destroynow usesstd::unique_ptr<VmafCallbackList>with a customCallbackListDeleterthat walks and frees the linked-list nodes — replaces the manual traversal loop and guarantees cleanup on any future early-return path.core/src/*.ccandidates + per-file migration recipe for Wave 1–3 follow-up PRs.Changed files
core/src/metadata_handler.cpp(was.c)unique_ptrteardowncore/src/metadata_handler.hextern "C"guards added (C callers unchanged)core/src/meson.buildmetadata_handler_cpp20_libstatic lib withoverride_options: ['cpp_std=c++20']core/test/meson.build.c→.cppreferences updateddocs/adr/0708-vmafx-cpp23-internals-pilot.mddocs/research/0732-vmafx-cpp23-internals-migration-plan.mdNetflix golden gate (post-conversion)
Run inside the worktree against
/tmp/cpp23-pilot-build:Score unchanged from master — the conversion touches zero float arithmetic.
Top-5 ROI candidates (from Research-0732)
metadata_handler.cpp(this PR)unique_ptrlinked-list RAIIlog.cconstexprarrays, futurestd::formatmem.cstd::align_val_t/ alignedoperator newopt.cstd::variant, conceptsfex_ctx_vector.cstd::vector, conceptsPrerequisites
Deliverables checklist (ADR-0108)
docs/research/0732-vmafx-cpp23-internals-migration-plan.md## Alternatives consideredcore/src/AGENTS.md§9 (extern "C" guard invariant)meson setup /tmp/cpp23-pilot-build core -Denable_cuda=false -Denable_sycl=false && ninja -C /tmp/cpp23-pilot-build && meson test -C /tmp/cpp23-pilot-build --suite=fast(50/50 pass)changelog.d/changed/0708-cpp23-internals-pilot.mddocs/rebase-notes.mdPR checklist
extern "C"inmetadata_handler.h— all C callers unaffectedmeson.builduses isolated static lib (cpp_std=c++20does not leak)docs/state.mdupdated (T-CPP23-INTERNALS-PILOT-2026-05-28 row)docs/adr/README.mdindex🤖 Generated with Claude Code