Skip to content

fix(artifacts): read Ogg Opus channel mapping tables - #14975

Merged
vincentkoc merged 1 commit into
morluto:mainfrom
xu91102:codex/opus-channel-mapping
Nov 30, 2026
Merged

vincentkoc merged 1 commit into
morluto:mainfrom
xu91102:codex/opus-channel-mapping

Conversation

@xu91102

@xu91102 xu91102 commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

REA can now report how the channels of an Ogg Opus file are routed, using the identification packet already read by inspect-artifact and inspect_artifact. This extends the static media inventory in #14700 and #14155. The change is scoped to that reader; no separate issue was opened.

Problem and expected behavior

On FFmpeg-encoded 5.1 audio, REA reported six channels and mapping family 1 but stopped at byte 19, immediately before the routing table. Deleting the last map entry and repairing the Ogg page framing still produced a complete inventory on the base commit. FFprobe rejected the shortened header. A second packet on the same Ogg page must not supply the missing index.

Change and scope

The existing Ogg reader reads at most the 19-byte fixed header, two counts and 255 channel indices, within the first packet's laced extent. It returns the declared stream count, coupled stream count and output-order indices for mapping families 1, 2 and 255, and reports a malformed header if that table ends early. Family 0 has implicit routing. Family 3 uses a demixing matrix. RFC 7845 §5.1.1 · RFC 8486 §3

Contract and boundary impact

The root format_metadata.channel_mapping_table field is optional. Both adapters consume the file reader's observation. An inventory saved on the base commit was replayed successfully with the field absent. The change reads file headers, does not decode audio or launch a media provider, and adds no dependency, tool, permission or configurable limit.

Evidence and regression coverage

On 8ff357043, the new reader regressions had 5 failures and 47 passes. The new code passes all 52 cases in the reader suite. The regression for a short first packet also supplies a plausible final index in a following packet on the same page.

Six FFmpeg-generated inputs cover mono, stereo, 5.1, 7.1, family 2 Ambisonics and family 255 discrete stereo. The four explicitly mapped headers match FFprobe's extradata byte for byte. Two controlled shortened files produce a format error. The compiled CLI and one real stdio MCP session agreed on all eight files. For 5.1 both adapters report:

{"channel_count":6,"mapping_family":1,"channel_mapping_table":{"stream_count":4,"coupled_stream_count":2,"output_channel_map":[0,4,1,2,3,5]}}

Validation performed

  • Eight focused test files passed (172 tests), plus eight README tests.
  • npm run check:fast, npm run docs:check, test discovery, advertised-schema verification, package dry run and installed package verification passed.
  • npm run check exited 1. Its nine Knip unused or duplicate export diagnostics matched a clean checkout of the exact base commit, line for line; all seven source paths named in those diagnostics matched the base bytes.
  • The native comparison ran on macOS. The local FFmpeg encoder does not implement mapping family 3; the matrix exclusion was exercised with a constructed header. Cross-platform runtime and playback quality were not tested.

Compatibility, safety, and release

Existing saved Evidence remains readable. Newly inspecting a shortened explicit routing table now yields a malformed-input result. The reader reports declared indices, including repeats and the value 255 for silence. Target file bytes and existing extraction boundaries remain intact. No release is requested.

Author readiness

Human owner: @xu91102

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Author checklist (completed by the PR author before requesting review)

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
  • I ran every test, build, or measurement needed to validate this change, reported a browser, GPU, or environment gap only when that runtime or hardware is unavailable, and reported the checks I ran and their results without presenting inferred correctness or speedups as measured.
  • Comments explain constraints or non-obvious decisions; task history and conversations stay out of code and docs.
  • Documentation is concise and factual, without punchy slogans or promotional language.
  • This change fixes the root cause and follows the engineering rules in AGENTS.md.
  • Formatted input is interpreted once at the owning boundary, and consumers use the owner's parsed facts. See Interpret boundary facts once.
  • Combined failures preserve partial observations, remaining resources, and cleanup facts. See Own the lifecycle.
  • A hardcoded limit is an REA_ runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T06:03:16.289626Z ecb1e25 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The reviewed changes appear safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds declared Ogg Opus channel routing to format_metadata.

  • Ogg Opus inspection reports the channel routing stored in its header.
  • The Ogg Opus CLI example names an evidence-output file.

Review was source-only; tests were not rerun. Whether another PR supersedes this change could not be checked because GitHub authentication was unavailable.

Reviews (2) · Last reviewed commit: "fix(artifacts): read Ogg Opus channel ma..." · Reviewed by Greptile

@vincentkoc
vincentkoc merged commit 0fd18df into morluto:main Nov 30, 2026
40 checks passed
@vincentkoc

Copy link
Copy Markdown
Collaborator

thanks! merged after a clean review and green CI (158 tests passed).

vincentkoc added a commit to xu91102/rea that referenced this pull request Nov 30, 2026
* commit '4ccc685dd5ed028bc625fdd8760539ce5a492d8d': (228 commits)
  test(asar): verify cleanup on the original file handle (morluto#15155)
  fix(ubi): bound smaller-grid probe memoization (morluto#15168)
  fix(artifacts): distinguish content from containment changes (morluto#15165)
  fix(bflt): retain complete text when data is truncated (morluto#15160)
  refactor(domain): reuse graph projection and validation helpers (morluto#15173)
  fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801)
  test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172)
  test(beam): reuse the CLI Evidence reader (morluto#15171)
  test(oci): share descriptor budget refusal assertions (morluto#15159)
  refactor(audit): share byte framing for offline audit logs (morluto#15162)
  refactor(evidence): reuse observed file reports for binary metadata (morluto#15161)
  fix(doctor): omit package-runner cache shims from installations (morluto#15059)
  refactor(packages): share package inspection budget contracts (morluto#15158)
  refactor(desktop): share completed command answer recovery (morluto#15156)
  refactor(views): share page byte reservations (morluto#15152)
  refactor(artifacts): share GPU and media asset layout rules (morluto#15150)
  fix(setup): name the detected host when Hopper setup does not apply (morluto#14449)
  fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020)
  fix(windows): report the ACE count a private DACL check observed (morluto#14450)
  fix(artifacts): read Ogg Opus channel mapping tables (morluto#14975)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants