fix(worker): relabel rewriter tags after cross-backend reshape (#113)#119
Conversation
The Tag* / TagPrefix* constants in rewriter_tags.go are VAAPI-canonical (inlineass-vaapi, opencl-tonemap->vaapi, bitmap-inlineass-vaapi, etc.) because VAAPI was the first backend implemented. After a cross-backend reshape onto NVENC the rewriter executes the CUDA branch (inlineass(CUDA), tonemap_cuda), but the emitted tags still showed vaapi-canonical names — so the 320/320 nvenc qa_matrix pass logged things like hw-decode:filter:opencl-tonemap->vaapi:inlineass-vaapi even though the actual filter graph was tonemap_cuda + inlineass(CUDA). The output worked; the tags misrepresented the executed graph. Fix: relabelCrossBackendTags() runs on res.Changes before the log emission. Detects `cross-backend:*->X` and rewrites VAAPI-named substrings to the X target's names (currently only nvenc mapping). Same-backend rewrites and unknown target backends are no-ops. Closes #113. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds ChangesCross-backend tag relabeling for NVENC rewrite
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies" Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@worker/agent/rewriter_tags_relabel_test.go`:
- Around line 52-62: Add a new table-driven test entry in
rewriter_tags_relabel_test.go that verifies relabeling of OpenCL tonemap to
VAAPI: include an input tag "filter:tonemap_opencl" (and any companion tags
needed by the existing table shape) and assert the expected output contains
"filter:tonemap_vaapi" and "force-output-format-vaapi" (or document an explicit
no-op if that's the intended behavior); place it alongside the existing cases
(e.g., near the "SW-tonemap normalized tag" case) so the test enforces the
contract for the OpenCL→VAAPI relabeling path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 70a54d76-efb6-4d36-83a8-5318570cc932
📒 Files selected for processing (3)
worker/agent/main.goworker/agent/rewriter_tags.goworker/agent/rewriter_tags_relabel_test.go
| { | ||
| name: "SW-tonemap normalized tag", | ||
| in: []string{ | ||
| "cross-backend:vaapi->nvenc", | ||
| "filter:tonemap_opencl-normalized", | ||
| }, | ||
| want: []string{ | ||
| "cross-backend:vaapi->nvenc", | ||
| "filter:tonemap_cuda-normalized", | ||
| }, | ||
| }, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Add a case for filter:tonemap_opencl->tonemap_vaapi / force-output-format-vaapi.
Tied to the rep coverage gap above. If those tags reach the nvenc path, a row asserting they relabel (or a documented no-op) locks the contract.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@worker/agent/rewriter_tags_relabel_test.go` around lines 52 - 62, Add a new
table-driven test entry in rewriter_tags_relabel_test.go that verifies
relabeling of OpenCL tonemap to VAAPI: include an input tag
"filter:tonemap_opencl" (and any companion tags needed by the existing table
shape) and assert the expected output contains "filter:tonemap_vaapi" and
"force-output-format-vaapi" (or document an explicit no-op if that's the
intended behavior); place it alongside the existing cases (e.g., near the
"SW-tonemap normalized tag" case) so the test enforces the contract for the
OpenCL→VAAPI relabeling path.
Summary
Closes #113. After a cross-backend reshape onto NVENC, the rewriter executes the CUDA branch (`inlineass(CUDA)`, `tonemap_cuda`) but the emitted tags still showed VAAPI-canonical names — so the 320/320 nvenc qa_matrix pass logged `hw-decode:filter:opencl-tonemap->vaapi:inlineass-vaapi` even though the actual filter graph was `tonemap_cuda + inlineass(CUDA)`.
The output was correct; the tag strings misrepresented the executed graph.
What changed
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests