chore(portal): wave-4 dead-code removal and logic simplifications#45
Conversation
|
CI triage — the
Since the module really is outside the graft, the consistent fix is to take its last test with it: drop the import and the The fork-seam gates (0.16.6 + 0.15.17) are green on this head, so the graft-side deletions look clean. Will give this the full review once #44 settles and the stack collapses to its own diff. |
|
#44 is merged (main |
Removes the verified-dead code and never-fire machinery from the wave-4
review; no behavior change on any production path.
Deletions (grep-verified zero importers):
- portal/realtime.ts + realtime.test.ts — the RPC endpoint-probe module;
nothing imported it and it shipped in the published npm artifact.
- portal/config.ts — the pre-wiring-patch injection path; sync-upstream.sh
already annotated it "(deleted)" and excluded it from the graft. Its sole
remaining importer, harness/compat/analyze.test.ts's withPortal case, is
dropped with it (getPortalDataset/withPortal were used only there) so the
repo-root `node --test harness/compat/*.test.ts` job stays green.
- StateDiff/toStateDiff + statediffs.json fixture — no producer or consumer.
- DiscoveryState.status — written on every transition, read by nothing
(and wrong as telemetry under chained extensions).
- checksEnabled/checksStrict — unreferenced invariant-mode helpers.
- rankTraces' strict INV-5 assert — ranks are strictly increasing by
construction (the forEach counter); same rationale as INV-2's
deliberately-omitted per-row assert. INVARIANTS.md cell updated.
Simplifications:
- reconcile()/portalRealtimeEvents' anchor is REQUIRED — the optional
legacy mode preserved exactly the blind-append hole INV-10 closed, and
production always passed an anchor.
- FinalizedHead collapses to { number, hash? } (the bare-number variant
was test-only).
- streamHotBlocks' inline field-projection fallbacks are replaced by the
shared BLOCK_FIELDS/LOG_FIELDS constants (single source, no drift).
- traceSafeChunkBlocks loses its "compat" re-export in portal-transform
and its env-reading default parameter (INV-14: env is parsed once into
PortalConfig; the shell always passes cfg.traceChunkBlocks).
- STREAM_REALTIME drops the always-true Boolean(chain.portal) conjunct.
Graft suite green on 0.16.6 and 0.15.17 (15 files, 205 tests each);
harness/compat green (6 tests, the withPortal case dropped with config.ts).
Portal-layer coverage +1.0 stmts (the dead module leaves the denominator).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1c48841 to
9eadd50
Compare
|
Restacked onto
All four checks ( |
|
Merge-gate evidence (the fork's gated standard) — APPROVE on head 9eadd50 Three independent verification fronts, plus green CI on both runs: 1. Reference + gate verification (independent pass): every deleted export traced to zero remaining references at head — including string-level refs: the 2. Adversarial review (cross-model): correctly flagged that three removals are not behavior-neutral over the exported functions' full input domain — 3. Call-site diff read: both wiring patches select Non-blocking follow-ups (we'll fold these into the next portal PR — no need for another round here):
Merging. Thanks for the clean restack + the |
Summary
Removes the code the wave-4 review verified as dead (every deletion grep-verified for zero importers) and applies the flagged logic simplifications. Net −469 lines; no behavior change on any production path.
Deletions
portal/realtime.ts(259 lines) +realtime.test.ts(105) — the RPC endpoint-probe module: zero runtime importers, yet grafted and shipped in the published npm artifact.portal/config.ts(43 lines) — the pre-wiring-patch injection path;sync-upstream.shalready annotated it "(deleted)" and excluded it from the graft. Its sole remaining importer —harness/compat/analyze.test.ts'swithPortalcase — is dropped with it (getPortalDataset/withPortalwere used only there), keeping the repo-rootnode --test harness/compat/*.test.tsjob green.StateDiff/toStateDiff+ thestatediffs.jsonfixture — no producer or consumer anywhere.DiscoveryState.status— written on every transition, read by nothing (planDiscoveryignored it), and wrong as telemetry (a predecessor completing setidlewhile a chained successor still scanned).checksEnabled/checksStrict— unreferenced invariant-mode helpers.rankTraces' strict INV-5 assert — the rank is the forEach counter of a monotonically walked array, strictly increasing by construction; the assert could never fire (the same rationale INV-2 documents for its deliberately-omitted per-row assert). INVARIANTS.md "Checked at (runtime)" cell updated.Simplifications
reconcile()/portalRealtimeEvents' anchor is now required — the optional legacy mode preserved exactly the blind-append hole INV-10 was amended to close, and production (the wire) always passed an anchor. Startup is now always anchored.FinalizedHeadcollapses to{ number, hash? }— the bare-numbervariant was test-only; drops thetypeofbranching in the finalize poll.streamHotBlocks' inline field-projection fallbacks are replaced by the sharedBLOCK_FIELDS/LOG_FIELDSconstants — the exact duplication the wire's own header comment disclaims.traceSafeChunkBlocksloses its "compat" re-export in portal-transform (an internal fork module has no external compat surface) and its env-reading default parameter (INV-14: env is parsed once intoPortalConfig; the shell always passescfg.traceChunkBlocks).STREAM_REALTIMEdrops the always-trueBoolean(chain.portal)conjunct (the constructor is only selected for portal chains).config.tsmention; sync-upstream.sh copy comment updated.Test plan
scripts/sync-upstream.sh 0.16.6 --testgreen — 15 files, 205 tests (incl.portal-realtime/portal-realtime-wire/portal-shell, which cover the anchor-required change against the merged fix(portal): wave-4 review — five medium fixes (store parity, monotonic head, schema-degradation bounds, bounded realtime probe) #44)scripts/sync-upstream.sh 0.15.17 --testgreen — 15 files, 205 testsnode --test harness/compat/*.test.tsgreen — 6 tests (thewithPortalcase dropped withconfig.ts)repo-tests,fork-seam (0.16.6),fork-seam (0.15.17),versionsgapassertion); everyportalRealtimeEventstest supplies a startup anchor consistent with its streamrealtime*.ts) still matchesrealtime-standardize.test.ts, so the standardize suite keeps running🤖 Generated with Claude Code