Complete the Protocol Descriptor as the single home for per-protocol knowledge#37
Merged
Merged
Conversation
SharinganExport.countsLine() hardcoded three `count { it is X }` calls and a
literal "HTTP h · MQTT m · BLE b" template, so a fourth protocol would be
silently omitted from the session export header — while NotificationContent
already iterated Protocol.entries. Extract one internal protocolCountsLine()
helper next to the Protocol registry (EventFilter.kt) and route both callers
through it. Output is byte-for-byte identical for the three current protocols
(SharinganExportTest / NotificationContentTest stay green); a new protocol now
appears in the export header automatically.
TDD: EventFilterTest pins the format and asserts one segment per
Protocol.entries (red -> green).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…iptor Completes the descriptor as the single home for per-protocol knowledge. The tab-bar icon and the search-field placeholder were the last two per-protocol facts resolved by `when (protocol)` blocks inside HomeScreen; lift them to abstract tabIcon / searchPlaceholder members on ProtocolDescriptor, implemented by each descriptor, and collapse the two HomeScreen `when`s to descriptorOf(protocol).tabIcon / .searchPlaceholder. Adding a protocol now touches one place and the compiler forces both members to be supplied. Internal-only; no public API or noop change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Finishes the
ProtocolDescriptorso it is genuinely "the single home for everything Sharingan knows about one Protocol" (CONTEXT.md). Two per-protocol facts and one fragile counts-line were still living outside it; this brings them home. 100% internal — no public API /:sharingan-noopchange, soapiCheck/parity are unaffected.Found via the architecture review (the descriptor is already a deep module; these were the last leaks at its edges).
Two commits, two seams
1.
fix(export)— unify the counts line (latent bug).SharinganExport.countsLine()hardcodedcount { it is HttpEvent/MqttEvent/BleEvent }+ a literal"HTTP h · MQTT m · BLE b"template, so a 4th protocol would be silently omitted from the session export header — whileNotificationContentalready iteratedProtocol.entries. Extracted oneinternal protocolCountsLine()helper next to theProtocolregistry and routed both callers through it. Output is byte-for-byte identical for today's three protocols (existingSharinganExportTest/NotificationContentTeststay green); a new protocol now appears automatically.EventFilterTestcases pin the format and assert one segment perProtocol.entries(the regression guard).2.
refactor(ui)— move tab icon + search placeholder onto the descriptor.The tab-bar icon and search-field placeholder were the last two per-protocol facts resolved by
when (protocol)blocks inHomeScreen. Lifted to abstracttabIcon/searchPlaceholdermembers; the twowhens collapse todescriptorOf(protocol).tabIcon/.searchPlaceholder. The compiler now forces every descriptor to supply both.Note on "session"
The counts helper is deliberately named
protocolCountsLine(notsession*) and introduces noSessionterm — that name is reserved for the v2 persistence epic (#27), whereSessionbecomes a persisted, identified capture run. The helper is a pure fold over aList<SharinganEvent>, so it's reusable for rendering a loaded Session header later.Verification
:sharingan:testDebugUnitTest+:sharingan-noop:testDebugUnitTestgreen;:sharingan:compileKotlinIosSimulatorArm64green.when (protocol)remains outsideProtocolDescriptor; the hardcoded counts literal is gone.Net
Adding a protocol now touches one place (the descriptor), and the type system enforces it.
🤖 Generated with Claude Code