Skip to content

refactor(tune): consolidate shared scoring utilities - #1513

Merged
lusoris merged 1 commit into
masterfrom
codex/dedupe-domain-batch
Sep 23, 2026
Merged

lusoris merged 1 commit into
masterfrom
codex/dedupe-domain-batch

Conversation

@lusoris

@lusoris lusoris commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Consolidates the Go tuning stack onto canonical shared model-argument, backend-selection,
and sorted-registry helpers, removing three duplicate-function groups. It also makes a
missing score JSON result fail with exit status 65 instead of being silently accepted,
and cleans every touched file to the repository's HISS profile without adding
suppressions. The dedupe baseline moves from 9 groups / 926 functions to 6 groups / 930
functions; the remaining groups are listed explicitly below.

Type

  • feat — new feature
  • fix — bug fix
  • perf — performance improvement
  • refactor — no behavior change
  • docs — documentation only
  • test — test-only
  • build / ci — tooling / infra
  • port — cherry-pick from upstream Netflix/vmaf
  • sycl / cuda / simd — backend-specific

Checklist

  • Commits follow Conventional Commits (the commit-msg hook enforces this).
  • make format && make lint is green locally.
  • Unit tests pass: meson test -C build.
  • If I touched any SIMD/GPU code path, I ran /cross-backend-diff and the worst ULP is <= 2.
  • If I touched a feature extractor with SIMD/GPU twins, I either updated every twin or listed the gap under "Known follow-ups" below.
  • If I added a new .c / .cpp / .cu / .h / .hpp, it has the appropriate license header (see CONTRIBUTING.md).
  • If this is a breaking change, the commit message uses ! or BREAKING CHANGE: and the migration path is documented below.
  • If this PR adds an ADR, the ADR row lives in docs/adr/_index_fragments/<NNNN-slug>.md and the slug is appended to docs/adr/_index_fragments/_order.txt — do not edit docs/adr/README.md directly (regenerated by scripts/docs/concat-adr-index.sh; see ADR-0221).

This is a Go-only change: no C/C++, SIMD/GPU, feature-extractor, public libvmaf, or ADR
surface is touched. The focused Go tests, vet, governance audit, container build, and full
pre-push hook suite are green; the unrelated Meson and whole-tree Make gates were not
rerun for this batch.

Bug-status hygiene (ADR-0165)

  • no state delta: mechanical consolidation plus a directly covered missing-result exit-status correction; no tracked bug changes state.

Netflix golden-data gate (ADR-0024)

  • I did not modify any assertAlmostEqual(...) score in the Netflix golden Python tests.
  • If I believe a golden value must change, I have explained why below AND pinged @lusoris for a CODEOWNERS exception.

Cross-backend numerical results

Not applicable: no scoring kernels, golden assertions, models, or backend arithmetic changed.

Performance (if perf or feat)

Not applicable.

Deep-dive deliverables (ADR-0108)

  • Research digest — no digest needed: mechanical consolidation against the existing ADR-1137 direction.
  • Decision matrix — no alternatives: only-one-way consolidation onto the existing canonical implementations.
  • AGENTS.md invariant note — pkg/corpus/AGENTS.md now identifies pkg/scorebackend as the sole backend detector.
  • Reproducer / smoke-test command — focused commands are provided below.
  • CHANGELOG fragment — changelog.d/changed/go-tuning-domain-dedupe.md plus the rendered Unreleased block.
  • Rebase note — the consolidation and compatibility-wrapper boundary are recorded in docs/rebase-notes.md.

Reproducer

go test -count=1 ./pkg/model ./pkg/bisect ./pkg/scorecli ./pkg/corpus ./pkg/fast ./pkg/tune/executor ./pkg/codecadapter ./pkg/prefilter ./pkg/scorebackend ./cmd/vmafx-tune/cmd
go vet ./pkg/model ./pkg/bisect ./pkg/scorecli ./pkg/corpus ./pkg/fast ./pkg/tune/executor ./pkg/codecadapter ./pkg/prefilter ./pkg/scorebackend ./cmd/vmafx-tune/cmd
scripts/ci/check-default-model-single-source.sh
praetorctl audit
docker exec vmaf-dev-mcp /usr/local/bin/vmafx-tune corpus --help

Additional evidence: the full pre-push suite passed, including Govulncheck, scoped mypy,
strict MkDocs, secret scanning, and governance checks. A fresh dev-MCP image build compiled
all seven Go commands, and the explicit Go vmafx-tune corpus --help runtime smoke passed.

Known follow-ups

praetorctl dedupe scan . is expected to remain non-zero for the six groups outside this
batch, so the dedupe-cadence post-commit check remains red until they are handled:

  1. provideMetrics: cmd/vmafx-controller/main.go:260 and cmd/vmafx-server/main.go:214.
  2. Generated DeepCopyInto: api/vmafx/v1/zz_generated_deepcopy.go:25 and :101.
  3. handleReadyz: cmd/vmafx-controller/http_server.go:114 and cmd/vmafx-server/http_server.go:167.
  4. handleHealthz: cmd/vmafx-controller/http_server.go:102 and cmd/vmafx-server/http_server.go:155.
  5. JSON writers: cmd/vmafx-controller/http_server.go:189, cmd/vmafx-server/http_server.go:262, and cmd/vmafx-server/rest_adapter.go:110.
  6. provideScorer: cmd/vmafx-controller/main.go:232 and cmd/vmafx-server/main.go:184.

Residuals observed while validating, deliberately not folded into this batch:

  • Dev-MCP logs cannot load libonnxruntime_providers_cuda.so; the inference probe falls
    back to CPU and passes.
  • The uncached C build emits two cJSON warnings because its true / false macros hide
    C keywords.
  • The post-commit state-sync hook cannot bind the root-level OPEN.md because that file
    is absent in this worktree; this does not affect the passing commit or pre-push gates.

Breaking changes / migration

None. pkg/corpus retains deprecated compatibility wrappers while callers move to
pkg/scorebackend, and model argument formatting preserves the existing CLI forms.

Merge with master, 2026-09-23

Master's zero-warning pass (#1518) landed most of this consolidation
independently while this branch sat as a draft, down to adding
pkg/model/default.go on both sides. Master's spelling wins wherever the two
are equivalent, so the merged tree stays identical to what master just gated on:

  • pkg/corpus/score.go, pkg/scorecli, pkg/tune/executor,
    pkg/bisect/score_yuv.go, pkg/fast/pipeline.go and pkg/model take
    master's helper names, signatures and deferred-cleanup shape.
  • pkg/corpus/backend.go keeps this branch's deeper move: the backend
    vocabulary, probe and strict-selection policy live in pkg/scorebackend and
    pkg/corpus retains deprecation shims. Master had only aliased the error
    type, so this is the part of the PR that still adds something.
  • pkg/codecadapter keeps this branch's per-adapter constructors rather than
    master's three grouped literals; both satisfy the size limit.
  • cmd/vmafx-tune/cmd/corpus.go keeps master's shared
    markCommandFlagsRequired and gains back the output and scoring registrars
    this branch split out, renamed to master's register* convention.
    TestCorpusFlagSurface caught the omission on the first attempt — the
    --output, --vmaf-bin, --score-backend and nine other flags had gone
    missing — and passes now.

go build ./..., go vet and CGO_ENABLED=0 go test ./pkg/... ./cmd/... are
clean apart from the pre-existing cgo-gated cmd/vmafx-mcp,
cmd/vmafx-node and cmd/vmafx-ort-runner build failures, which reproduce
unchanged on master.

Generated files were regenerated with their scripts rather than hand-resolved.

@github-actions github-actions Bot added the type:refactor Internal refactor label Sep 20, 2026
@lusoris
lusoris marked this pull request as ready for review September 22, 2026 23:40
@lusoris
lusoris force-pushed the codex/dedupe-domain-batch branch from a507eb8 to 8f81c23 Compare September 23, 2026 04:50
@lusoris
lusoris merged commit 905509b into master Sep 23, 2026
80 checks passed
@lusoris
lusoris deleted the codex/dedupe-domain-batch branch September 23, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:refactor Internal refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant