Skip to content

refactor(media): remove playback policy test seam - #132465

Merged
RomneyDa merged 3 commits into
mainfrom
cleanup/tests-core-ui
Aug 30, 2026
Merged

RomneyDa merged 3 commits into
mainfrom
cleanup/tests-core-ui

Conversation

@RomneyDa

Copy link
Copy Markdown
Member
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Removes a playback-policy unit test that duplicated the private production policy table and required a test-only production API. The snapshot had to change for behavior-preserving policy edits while stronger codec, file, and transcoding tests already cover the operator-visible behavior.

Why This Change Was Made

The private policy inventory and direct resolver assertions are deleted together with their production/test-support exposure. Gateway tests now use a narrow local playback-mode fixture, while the real playback suite continues to exercise codec probing, classification, fallback, cache, and ffmpeg behavior.

User Impact

No user-visible behavior changes. Maintainers have less duplicated policy data and a smaller test-only production surface.

Evidence

  • node scripts/run-vitest.mjs src/media/playback-transcode.test.ts — 31 passed.
  • node scripts/run-vitest.mjs src/gateway/control-ui.http.test.ts src/gateway/managed-image-attachments.test.ts — 268 passed.
  • node scripts/run-vitest.mjs src/tts/tts-audio-store.test.ts src/tts/tts-runtime-routing.test.ts — 21 passed.
  • git diff --check — passed.
  • node scripts/check-changed.mjs --dry-run -- ... — core/coreTests plan confirmed.
  • node scripts/check-changed.mjs -- ... — all checks through core typecheck passed; core-test typecheck was blocked by the existing shared-install error ui/vite.config.ts:9:22 TS7016 Could not find a declaration file for module 'pako'.
  • Structured Codex autoreview: no findings; patch correct (0.99 confidence).

LOC: production +0/-2; tests and test support +16/-116; net -102.

@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 29, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 8:36 PM ET / August 30, 2026, 00:36 UTC.

ClawSweeper review

What this changes

The PR removes test-only exports of the private playback policy and replaces direct policy assertions with public resolver and FFmpeg conversion-boundary tests.

Merge readiness

✅ Ready for maintainer review

Keep open. The latest revision addresses the prior P2 finding by exercising every supported MIME-to-demuxer mapping through the public conversion boundary, while removing only test-only access to private policy internals; this MEMBER-authored, maintainer-labeled PR requires normal maintainer handling rather than automated closure.

Priority: P3
Reviewed head: cab9fe58fa77e4e226bd80cd703501e221dec2eb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, behavior-preserving cleanup whose revised tests cover the public classification and conversion boundaries.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored bounded test refactor has no intended user-visible behavior change; focused test evidence is the applicable proof surface.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored bounded test refactor has no intended user-visible behavior change; focused test evidence is the applicable proof surface.
Evidence reviewed 7 items Public conversion coverage: The added table drives all 30 accepted MIME mappings through resolvePlaybackTranscode, deliberately supplies incompatible codecs for native containers, waits for the conversion job, and asserts the actual FFmpeg input demuxer plus output target.
Production owner boundary: The production resolver obtains the demuxer from the private policy immediately before constructing FFmpeg arguments; the PR removes only the test-global exposure, not this runtime path.
Gateway callers: Both Control UI and managed outgoing-media paths call the public source resolver before serving or recording playback metadata, so their local mocks do not require the private policy table.
Findings None None.
Security None None.

How this fits together

Playback handling classifies audio and video attachments, probes their codecs, and either serves compatible media unchanged or converts it to a portable format. Gateway media endpoints use this result to return original, pending, or transcoded attachment content.

flowchart LR
A[Media attachment] --> B[Gateway media endpoint]
B --> C[Playback resolver]
C --> D[Codec and container inspection]
D --> E{Compatible format?}
E -->|Yes| F[Serve original]
E -->|No| G[FFmpeg conversion job]
G --> H[Serve portable media]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -26, Tests -18. Total -44 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 0 26 -26
Tests 3 129 147 -18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 129 173 -44

Review metrics

Metric Value Why it matters
Production versus test LOC production -2; tests/test support -116 net, +114 changed test coverage The only production change removes test-only exports while the replacement coverage remains in tests.

Technical review

Best possible solution:

Keep the private policy unexported and retain the table-driven public classification and conversion tests as the canonical coverage for supported and unsupported playback media.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR is a behavior-neutral test refactor, and its relevant verification is the public resolver and conversion-boundary test coverage.

Is this the best way to solve the issue?

Yes. Exercising classification and FFmpeg demuxer selection through public APIs preserves the meaningful contract without retaining a test-only production policy export.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 80e4dd3d3ae4.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored bounded test refactor has no intended user-visible behavior change; focused test evidence is the applicable proof surface.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is a behavior-neutral internal test-surface cleanup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored bounded test refactor has no intended user-visible behavior change; focused test evidence is the applicable proof surface.

Evidence

What I checked:

  • Public conversion coverage: The added table drives all 30 accepted MIME mappings through resolvePlaybackTranscode, deliberately supplies incompatible codecs for native containers, waits for the conversion job, and asserts the actual FFmpeg input demuxer plus output target. (src/media/playback-transcode.test.ts:174, cab9fe58fa77)
  • Production owner boundary: The production resolver obtains the demuxer from the private policy immediately before constructing FFmpeg arguments; the PR removes only the test-global exposure, not this runtime path. (src/media/playback-transcode.ts:540, cab9fe58fa77)
  • Gateway callers: Both Control UI and managed outgoing-media paths call the public source resolver before serving or recording playback metadata, so their local mocks do not require the private policy table. (src/gateway/control-ui.ts:409, cab9fe58fa77)
  • Unsupported-media contract retained: The suite still verifies that an unsupported audio MIME resolves to fallback without invoking FFmpeg. (src/media/playback-transcode.test.ts:940, cab9fe58fa77)
  • Current-main comparison: Current main still exposes PLAYBACK_TRANSCODE_POLICY and resolvePlaybackMode through the test global, so the central cleanup is not already implemented there. (src/media/playback-transcode.ts:203, 80e4dd3d3ae4)
  • Feature-history routing: Recent source history attributes the playback-policy implementation to Dallin Romney, though the shallow-history boundary prevents verified introduction attribution. (src/media/playback-transcode.ts:34, 36a5a4c2beaa)

Likely related people:

  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Sarah Fortune: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-29T07:26:48.237Z sha 38c146b :: found issues before merge. :: [P2] Retain full policy coverage without the test seam
  • reviewed 2026-08-29T22:16:16.185Z sha 8744d25 :: found issues before merge. :: [P2] Exercise every demuxer mapping through the conversion boundary

@RomneyDa
RomneyDa force-pushed the cleanup/tests-core-ui branch from 38c146b to 8744d25 Compare August 29, 2026 22:09
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 30, 2026
@RomneyDa
RomneyDa merged commit ccecf46 into main Aug 30, 2026
240 checks passed
@RomneyDa
RomneyDa deleted the cleanup/tests-core-ui branch August 30, 2026 01:25
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 30, 2026
* test(media): remove playback policy inventory seam

* test(media): cover playback policy through public resolver

* test(media): cover playback demuxer mappings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant