Skip to content

Cross-diff trace against widgetii/sc_sc2315e (older RE port)#150

Merged
widgetii merged 1 commit intomasterfrom
feat/sc-sc2315e-crossdiff
May 3, 2026
Merged

Cross-diff trace against widgetii/sc_sc2315e (older RE port)#150
widgetii merged 1 commit intomasterfrom
feat/sc-sc2315e-crossdiff

Conversation

@widgetii
Copy link
Copy Markdown
Member

@widgetii widgetii commented May 3, 2026

Closes the sixth gap from #145's plan-vs-shipped audit. Triangulates the trace-extracted scaffold against the older reverse-engineered port at widgetii/sc_sc2315e in addition to widgetii/smart_sc2315e (already covered).

Headline result

Four artifacts, all converging on the same canonical SC2315E init:

pair address value LCS
trace (Majestic) vs smart_sc2315e 100% 100% 100%
trace (Majestic) vs sc_sc2315e 100% 100% 100%
smart_sc2315e vs sc_sc2315e (refs only) 100% 100% 100%
trace (Majestic) vs trace (Sofia) (from #145) 100% 100% 100%

172 writes, 169 unique addresses, identical values, identical order across every pair. No drift, no missing regs. The trace pipeline reliably extracts the canonical sequence, and the two independent reverse-engineering efforts converged on the exact same answer.

What changed

Two small relaxations in trace_diff.py were needed to make the cross-diff actually run:

1. extract_function_body() — previously hard-required void <fn> to open. The RE port's init is int sc2235_init(VI_PIPE), so the scope flag silently matched zero writes (the symptom in my first attempt). Relaxed to accept any whitespace-delimited rettype/qualifier sequence.

2. RE_ANY_WRITE — expected the register-write call name to end at write_register(. The RE port uses sensor_write_register_0(...) (bus-numbered suffix). Allowed an optional \\w* after register before the open paren.

Both are deliberately permissive: they accept the new shapes without losing precision on the old ones.

Test plan

  • tools/test_pipeline.sh extended with a synthetic ref using the older RE-port shape (int xxx_init, sensor_write_register_0(...)); asserts 100% match. Catches regressions in the relaxed regexes.
  • Pair-wise diffs of all four artifacts above run clean
  • CI test-extraction-pipeline job picks up both old and new fixture assertions
  • No regression on existing self-diff (still 100%)

Audit progress after this PR

# Status
1 (compile-test scaffold) merged in #146
2 (AE callback skeleton) merged in #147
3 (MIPI/VI struct output) merged in #148
4 (mode-switch capture) merged in #149
5 (regression check) done in #146
6 (sc_sc2315e cross-diff) this PR
7 (sofia-vs-majestic.md writeup) open — could fold into the existing docs as a worked example

🤖 Generated with Claude Code

Closes the sixth gap from #145's plan-vs-shipped audit. The plan called
for triangulating the trace against widgetii/sc_sc2315e (the older
reverse-engineered port from the SC2235 SDK template, predating
widgetii/smart_sc2315e). Two small relaxations in trace_diff.py let
that diff run cleanly:

* extract_function_body() previously hard-required `void <fn>` to
  open. The RE port's init returns int (`int sc2235_init(VI_PIPE)`),
  so the scope flag silently matched zero writes. Relaxed the regex
  to accept any whitespace-delimited rettype/qualifier sequence.

* RE_ANY_WRITE expected the register-write call name to end at
  `write_register(`. The RE port uses `sensor_write_register_0(...)`
  (bus-numbered suffix). Allowed an optional `\w*` after `register`
  before the open paren.

Result: pair-wise diff between trace, smart_sc2315e, and sc_sc2315e
all show 100/100/100% (172 writes, 169 unique regs, identical values,
identical order). Three independent artifacts converge on the same
canonical SC2315E init - vendor binary, OpenIPC port from SC2231
template, RE port from SC2235 template. No drift, no missing regs.

test_pipeline.sh extended with a synthetic ref using the older
RE-port shape (int-returning function, _0-suffix call) so the relaxed
regex never regresses. Self-diff (current shape) and cross-style
(older shape) both asserted at 100% address match.

Docs: new "Triangulating against multiple references" section walks
through the four-way comparison procedure and the SC2315E result.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 21ecd53 into master May 3, 2026
3 checks passed
@widgetii widgetii deleted the feat/sc-sc2315e-crossdiff branch May 3, 2026 14:43
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.

1 participant