Skip to content

rewrite(phase6): batch 8 — I2C/ADC/GPIO catalog re-derivation - #161

Merged
SoundMatt merged 2 commits into
rewrite/v3-from-c-rcpfrom
phase6/i2c-adc-gpio
Aug 22, 2026
Merged

rewrite(phase6): batch 8 — I2C/ADC/GPIO catalog re-derivation#161
SoundMatt merged 2 commits into
rewrite/v3-from-c-rcpfrom
phase6/i2c-adc-gpio

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Part of the v3.0.0 ground-up rewrite (#129, ROADMAP.md Phase 17). Phase 6 (requirement catalog), batch 8 of 13.

This batch: I2C (26 c-RCP entries) / ADC (55) / GPIO (46)

Same pattern as batch 7 (#160): all three modules' code was already re-implemented against c-RCP's real design in an earlier untracked pass — the gap was almost entirely catalog/tags, not implementation. GPIO needed zero code/test edits at all.

  • 101 new catalog entries: I2C 18, ADC 46, GPIO 37.
  • 21 id-collision gaps filed to .fusa-reqs-pending.json (I2C 7, ADC 9, GPIO 5) — ADC's is the cleanest case: its module was fully redesigned, so old entries at ids 001-009 describe functions confirmed to no longer exist anywhere in the codebase.
  • 4 genuine behavioral gaps (GPIO 002-005) — c-RCP's bounds/mask/get primitives have no standalone cpp equivalents, logic is inlined ad hoc at call sites.
  • 1 real bug fixed: a mislabeled Catch2 tag in test_i2c.cpp pointing at the wrong requirement, retargeted correctly.
  • 1 new test closing a real coverage gap (ADC's leading-count truncation case), plus 2 manifest/assertion fixes.

Verification

Independently re-verified (the porting agent itself also ran the real cpfusa trace tool: 782/782 annotated, secTested holding at 72): semantic id-keyed diff confirms zero pre-existing entries modified, exactly 101 new ids matching the per-prefix breakdown exactly, zero duplicate ids. Spot-checked the REQ-ADC-008 id-collision claim directly against both catalogs — confirmed real. Full tree rebuilt from scratch: 0 errors, 0 warnings, 58/58 ctest suites pass.

🤖 Generated with Claude Code

SoundMatt and others added 2 commits August 22, 2026 09:12
Part of the v3.0.0 ground-up rewrite (cpp-RCP #129, ROADMAP.md Phase 17),
branch rewrite/v3-from-c-rcp. Phase 6 (requirement catalog), batch 8 of 13.

## Scope

i2c.hpp's REQ-I2C-* (c-RCP: 26 entries), adc.hpp's REQ-ADC-* (55),
gpio.hpp's REQ-GPIO-* (46) -- 127 c-RCP entries total.

## Major finding: same pattern as batch 7 -- code was already far ahead of the catalog

All three modules' code was already re-implemented against c-RCP's real
design in an earlier, untracked pass, with top-of-file manifests
already covering nearly the full c-RCP id range. The gap was almost
entirely in the catalog and the 9 pre-existing low-numbered ids per
module, not missing implementation. GPIO needed zero code/test edits
at all; ADC's module was fully redesigned (compute_average/
AdcEndpoint::request_reading/handle_request/encode_adc_value no longer
exist), making its 9 old-id collisions the cleanest case of the three
-- single-occupant stale content with zero remaining tags pointing to
them.

## New catalog entries (101)

- I2C: 18 (REQ-I2C-008-018, 020-026)
- ADC: 46 (REQ-ADC-010-055)
- GPIO: 37 (REQ-GPIO-010-046)

## Id-collision gaps filed (21, same class as batches 6/7)

- I2C: 7 (001-007) -- old entries describe now-removed pre-rewrite
  functions (i2c_mode_of 2-way decode, compound_wait_matches_bits) or
  content that migrated to other ids; real c-RCP content genuinely
  implemented+tested, often via legitimate dual-tagging with the old
  entry's own still-valid test.
- ADC: 9 (001-009) -- cleanest collision case: verified directly,
  cpp's REQ-ADC-008 ("AdcEndpoint::handle_request applies Table 33 Row
  2...", carries severity:cybersecurity, left untouched) describes a
  function (AdcEndpoint::handle_request) confirmed to no longer exist
  anywhere in the codebase; c-RCP's real REQ-ADC-008 ("collect_
  response_values reports a short count...") is unrelated content,
  same numeral.
- GPIO: 5 (001, 006-009) -- old entries still valid for their own
  content, real c-RCP content at the same numerals implemented+tested
  elsewhere via dual-tags.

## Genuine behavioral gaps filed (4, GPIO only)

REQ-GPIO-002/003/004/005 -- c-RCP's pin_index_valid()/pin_mask()/
pin_get()/write_semantics_valid() have no standalone cpp equivalents;
bounds/mask/get logic is inlined ad hoc at call sites rather than
exposed as independently-tested primitives (confirmed via zero
matching bracket tags anywhere).

## Retired, no action

REQ-I2C-019 only -- c-RCP itself retired it, superseded by 001/021/022.
No retired ids in ADC or GPIO's ranges.

## Real bug fixed: mislabeled tag

tests/test_i2c.cpp's config_write_not_supported TEST_CASE was
mistagged [REQ-I2C-012] (that id's real meaning is "decode_transfer_
request rejects a malformed frame" -- unrelated); retargeted to
[REQ-I2C-007], restoring a legitimate dual-tag with the old catalog
entry it actually matches.

## New test added

ADC's collect_response_values leading-count truncation (REQ-ADC-007)
had no test exercising the avg_count > value_count case -- added.
Plus two manifest-line/assertion fixes (REQ-ADC-035/041 tags added to
the header manifest; an out-of-range-code assertion strengthened in
the existing AdcErrc message test).

## Verification

Independently re-verified (the porting agent itself also ran the real
cpfusa trace tool: 782/782 annotated, 780/782 tested by design -- the
2 untested, REQ-ADC-032/034, mirror c-RCP's own test_ep_adc.c
convention where "testedness" lives in other modules' suites, secTested
holding at 72): semantic id-keyed diff confirms zero pre-existing
catalog entries modified/deleted, exactly 101 new ids matching the
report's per-prefix breakdown exactly (I2C 18, ADC 46, GPIO 37), zero
duplicate ids anywhere. Confirmed no new entry carries
severity:cybersecurity -- sec-tested count holds exactly at 72/782.
Directly spot-checked the REQ-ADC-008 id-collision claim against both
catalogs' actual content -- confirmed real. Full tree rebuilt from
scratch: 0 errors, 0 warnings, 58/58 ctest suites pass (100%).

.fusa-reqs.json: 681 -> 782 entries (+101, 6806 -> 8003 lines).
.fusa-reqs-pending.json: 48 -> 73 entries (+25, 517 -> 783 lines).
include/rcp/i2c.hpp, include/rcp/gpio.hpp: unchanged.
tests/test_i2c.cpp: net 0 lines (1 line content-changed).
tests/test_adc.cpp: +22 lines.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
Real CI (not just the porting agent's local check) caught a genuine
gap this batch's own local verification missed: REQ-ADC-032/034 were
traced (had //fusa:req tags) but had zero //fusa:test tags or bracket
tags anywhere in the tree -- cpfusa's tested-coverage gate requires
tested == total exactly, with no tolerance for "req-only by design"
entries, unlike the porting agent's own local read of the situation.

REQ-ADC-034 ("ADC sampling occurs only while a request executes, and
a compound wait compares the last acquired average without sampling"):
the catalog entry's own text already identifies the real mechanism as
acf.hpp's compound_wait_match() -- a shared, endpoint-agnostic
comparator, not ADC-specific code. Dual-tagged the existing
"compound_wait_match exact-match mode" TEST_CASE in test_acf.cpp with
[REQ-ADC-034] (bracket tag) and added the matching //fusa:test
REQ-ADC-034 manifest line, following this rewrite's established
cross-file dual-tagging convention for shared mechanisms.

REQ-ADC-032 ("An ADC endpoint serves exactly one channel, is limited
to 16-bit resolution, and requires a selected analog input pin"): no
existing test pinned the 16-bit wire-format constant directly (every
use of kAdcValueLen was incidental, inside unrelated codec tests).
Added a real, dedicated TEST_CASE asserting kAdcValueLen ==
sizeof(uint16_t) == 2, plus the matching manifest line.

## Verification

Full tree rebuilt from scratch: 0 errors, 0 warnings, 58/58 ctest
suites pass. Independently re-derived cpfusa's own req/test coverage
logic in Python against the real .fusa-reqs.json + all include/rcp/
*.hpp + tests/*.cpp files: 782/782 requirements now have both a
//fusa:req reference and a //fusa:test-or-bracket reference, zero
gaps -- confirming the real CI gate will pass on the next run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 4a08cff into rewrite/v3-from-c-rcp Aug 22, 2026
22 checks passed
@SoundMatt
SoundMatt deleted the phase6/i2c-adc-gpio branch August 22, 2026 16:28
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