chore: tier-A CLAUDE.md cleanup pass (12 surgical fixes) + 138-item deferred backlog#23
chore: tier-A CLAUDE.md cleanup pass (12 surgical fixes) + 138-item deferred backlog#23Timidan wants to merge 1 commit into
Conversation
Applied 9 unambiguous fixes from a 10-zone CLAUDE.md audit (~150 total findings). Only items with zero behavior change, zero parallel-work conflict (PR #20 lifi-intents, #21 mezo, #22 cleanup), and clear dead-code or surface-confusion signal were applied; the rest are deferred to the PR description as a backlog. Net: 12 files, -65 lines net. Surface confusion (P1): - structStorageDecoding.ts:484 — collapse identical-branches ternary 'const elementSize = elementType === 'address' ? 1 : 1' → '= 1' - storageSlotCalculator.ts:86 — parseSlotInput dropped redundant hex branch (both branches called BigInt(trimmed)) - edbTraceConverter.ts:55 — same redundant-hex-branch in parseTraceValue Speculative API surface (P2): - SolidityViewer.tsx — removed unused props highlightLine, scrollToLine, theme (sole caller never passes any) - PackingVisualizer.tsx — removed unused rawHex prop + caller's pass - api/{lifi-composer,lifi-earn,edb-proxy}.ts — dropped 'HEAD' from ALLOWED_METHODS (no caller issues HEAD) Dead exports (P3): - scripts/bridge-security.mjs — sanitizeForLogging (zero callers) - scripts/bridge-config.mjs — TRACE_DETAIL_COMPACT_ARTIFACTS env constant (zero readers) - eslint.config.js — ignore globs for nonexistent dirs (current_bundle, test-results, test-*, **/test-*.js, test-app-*)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3061f421e7
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const MAX_BODY_BYTES = 50 * 1024 * 1024; // 50 MB (artifacts_inline can be large) | ||
| const FETCH_TIMEOUT_MS = 120_000; // 2 min for regular requests | ||
| const ALLOWED_METHODS = new Set(["GET", "POST", "OPTIONS", "HEAD"]); | ||
| const ALLOWED_METHODS = new Set(["GET", "POST", "OPTIONS"]); |
There was a problem hiding this comment.
Keep HEAD support consistent in EDB proxy
When a client uses HEAD against /api/edb (for example an availability check or metadata probe), this new allowlist rejects it with 405 even though the same handler still advertises HEAD in Access-Control-Allow-Methods and keeps special bodyless handling for HEAD before forwarding. This makes the CORS contract in api/edb-proxy.ts inconsistent with the actual method gate; either keep HEAD here or remove the remaining HEAD handling/header.
Useful? React with 👍 / 👎.
Origin
10 zone-scoped subagents audited every nook and cranny of HexKit against the four CLAUDE.md principles:
Aggregate: ~103 high-confidence findings, ~47 lower-confidence findings across configs, styles, simple-grid, simulation-results, lifi-earn integrations, explorer, debug, other components, utils + types, contexts + services + hooks, api/, scripts/.
What this PR applies (12 files, -65 net lines)
Only the Tier-A subset — items that:
tsc --noEmitandvite build(verified: ✓ built in 17.24s)Surface confusion (P1)
src/contexts/debug/structStorageDecoding.ts:484—const elementSize = elementType === 'address' ? 1 : 1→const elementSize = 1. Result correct for both branches; the ternary signaled an intent that was never delivered.src/utils/storageSlotCalculator.ts:86—parseSlotInputcollapsed: both the0x-branch and the default branch calledBigInt(trimmed).src/utils/edbTraceConverter.ts:55— same redundant-hex pattern inparseTraceValue.Speculative API surface (P2)
src/components/explorer/SolidityViewer.tsx— removedhighlightLine,scrollToLine,themeprops + their twouseEffects. The sole callerContractExplorer.tsx:536never passes any of the three.src/components/explorer/storage-viewer/PackingVisualizer.tsx— removed unusedrawHexprop + caller'srawHex={slot.value}atSlotRow.tsx:242.api/lifi-composer.ts:11,api/lifi-earn.ts:11,api/edb-proxy.ts:11— dropped"HEAD"fromALLOWED_METHODS(no caller issues HEAD).Dead exports / config (P3)
scripts/bridge-security.mjs— removedsanitizeForLoggingexport (zero callers).scripts/bridge-config.mjs:25— removedTRACE_DETAIL_COMPACT_ARTIFACTSenv-derived constant (zero readers anywhere).eslint.config.js— trimmedignoresglobs for nonexistent directories (current_bundle/**,test-results/**,test-*/**,**/test-*.js,test-app-*/**).Verification
tsc --noEmitvite buildDeferred backlog (138 findings)
The full audit output landed ~150 findings. The remainder are deferred because they fall into one of:
Backlog by zone
Zone 1: src/components/simple-grid — 17 findings
functionDetection.tsimports the other two but its own exportdetectTokenTypehas zero call sites; live path istokenDetection/universal.ts.ContractCardProps,FunctionPanelProps,RawCalldataPanelProps,DiamondProgressProps) +SavedContractEntryduplicate + deadFACET_STATUS_COLORS/LABELS(re-declared inhooks/useDiamondState.ts). ~245 LOC.detectAndFetchTokenInfothendetectTokenType) with race-pronesetTokenDetectionwrites.eventsParam: string[] = []declared, threaded through 3 call sites, never destructured in the body. Pure speculative param.const rpcUrl = …computed, never read.filtersstate initialized as{gas,full,storage,events}butGridContext.tsx:173types it as{showOnlyErrors}. Type contract mismatch + zero reads.enhancedParameters/setEnhancedParameters,useEnhancedUI/setUseEnhancedUI,lookupFunctionSignaturesimport,generateCallData— all plumbed through context but never consumed.FacetDetailStatus/FacetDetaildefinitions.getWalletChainIdsignatures (syncvsasync), masked byanyeverywhere.<style>{…}</style>re-injected on every render, targeting markup rendered by an external component. Belongs in a CSS file.if inputs.length === 0branch (top-of-function guard at 20-26 already returns null).onClickhandler holds full read+write+simulation control flow.anydespiteGridContextValuebeing fully typed. The typed interface is decorative; all consumers destructure asany.setIsLoadingImplementation(false)).Zone 2: src/components/simulation-results — 15 findings
ContractContextExtrasandSimulationResultExtrasdefined in both with overlapping fields.InternalInfoRowtype +hasInternalInfohelper, zero external consumers.SimulatorTabunion hasassets | gas | debugvalues with no correspondingTabsTrigger(UI renderssummary | contracts | events | state).onReSimulateprop threaded through but no caller passes it (App.tsx:74renders<SimulationResultsPage />propless).normalizeHexsingle-use abstraction for one equality check.formatHexadds nothing overvalue ?? '0x0'.30_000_000,1_000_000,100_000_000+ hardcodedtxFee = "0 ETH"literal returned alongside computedgasUsed.useMemowith 3 nearly-identical opcode-row builders (parallel implementations).hasAttemptedLoad.currentonidchange; previous effect already handles via deps.handleOpenDebugis 130 lines with 5 disjoint code paths.Zone 3: src/components/integrations — 12 findings
*ALIAS_GROUPSdefinitions across useVaultsByIntent / fallback / useIntentRecommendation / VaultRecommendations (silent divergence).formatApydeclarations + 3formatTvldeclarations across VaultList / VaultDrawer / IdleYieldBanner / simulator/formatters / fallback / useIntentRecommendation.useMultiAssetVaultsredundant 1-rank returning N identical objects.VaultFilters— 5 of 7 fields dead.ConciergeConfig.perChainTimeoutMsdeclared but useIdleBalances ignores it.console.log/warnin concierge hooks (production noise).Zone 4: src/components/explorer — 11 findings (5 already applied above)
Applied: SolidityViewer props × 3, PackingVisualizer rawHex.
Deferred:
knownKeys: string[] = []param + dead L401-418 mapping-resolution branch (sole caller always passes[]).addTraceSlotsandclearEvidenceexported with zero callers.signalOrOptions instanceof AbortSignaloverload; sole caller passes the options object.getKeysForSlotexported in controls interface, zero callers.Zone 5: src/components/debug + contexts/debug — 14 findings (1 applied above)
Applied: structStorageDecoding.ts:484 ternary collapse.
Deferred:
solidityStructLayoutdirectly.rpcPort: numberrequired by the type but never read; all call-sites pass0as stub.DebugWindowexport (wraps in DebugProvider); sole consumer usesDebugWindowWithContext.isCollapsed,onToggleCollapse,onCloseprops; sole caller passes onlyclassName.500snapshot-eviction inlined 7 times; existingsetLimitedCacheEntryhelper available.navigateTo = async (row) =>defined identically (≈28 lines) in bothstepUpandstepOver.if (import.meta.env.DEV) console.log(…)calls; existingdebugLoghelper does this gate already.decodedTraceRowsRef+traceRowsRefparallel refs to the same data with differing types; theanyslippage inuseDebugNavigationflows from this.Zone 6: other src/components — 20 findings
@phosphor-icons/react(imported in 81 places). Parallel implementations.KeyboardEvent("Ctrl+K")to open UniversalSearchBar. Fragile pattern; replace with auseSearchTogglecontext.ChainKeytype +KEY_TO_IDlookup labeled "Legacy ... kept for backwards compatibility" but actively imported byNetworkSelector.tsx.TXHASH_REPLAY_KEYredeclared (also attransaction-builder/types.ts:30,useUniversalSearch.ts:94). Three copies of one storage key.tokenMovementsExpanded,listRef: null,listHeight: 0,ROW_HEIGHT— dead virtualization scaffolding.TOOLS/TOOL_ROUTESarrays describing the same routes.descriptionprop accepted then discarded as_description. Either drop the prop or actually emit<meta name="description">.typeof window === "undefined"guards in a Vite SPA (no SSR path exists).SIGNATURE_TAB_OPTIONS+TOOL_SUB_TABSdead.Icon+UIIcons; onlyUIIconsis used.sonnerwhose 4 methods just forward totoast.success/error/warning/info.Zone 7: src/utils + src/types — 24 findings (some overlap with PR #22)
transaction-simulation/index.ts; 2 callers can import directly.@deprecatedcompatibility shims with 1 in-repo caller each.ABIFetchResultbase never used standalone; onlyExtendedABIFetchResultextends.../riskScorer,../types,../recoverSigners, etc.).resolveSlotLabel+tryResolveMappingSlotexported but only called within the file.traceDecoder/index.ts.ERC20_TRANSFER_ABI,ERC721_TRANSFER_ABIdeclared, never referenced.parseError+ParsedErrorexported, zero external callers.@deprecatedre-export per its own header comment.initFromTraceDatatypestraceRows: any[]then comments// DecodedTraceRow[].Zone 8: contexts + services + hooks + config + chains + lib — 15 findings
exportToJson/importFromJsonzero callers.getRpcMode,isFallbackAllowed,isAlchemyAvailable,isInfuraAvailable,reset) consumed by no caller.getRpcMode,isAlchemyAvailable, etc.) only feed unused context wrappers.@deprecated export const SUPPORTED_CHAINS = CHAIN_REGISTRYis the dominant import across 13+ files.splitDecodedTraceRowsexported, internal-only.parseJson+normalizeRawTraceduplicated byte-for-byte.Zone 9: api/ — 11 findings (1 applied above)
Applied: dropped
"HEAD"fromALLOWED_METHODS× 3 files.Deferred:
PROXY_SECRET+hasValidSecretdead defensive branch in all 3 (no caller sets the header; if env var ever set in prod, every browser request 403s).createLifiProxy(base, tag)factory.JSON.stringify(body)re-serializes to measure size; post-hoc size-gate runs after Vercel body parser already accepted.Zone 10: scripts/ + root config — 10 findings (2 applied above)
Applied:
sanitizeForLoggingexport removal +TRACE_DETAIL_COMPACT_ARTIFACTSremoval + eslint ignore globs.Deferred:
scripts/perf/debug-stress-matrix.mjs,scripts/perf/live-qa-matrix.mjs,scripts/testnet-probe.js). (Already removed by PR chore: codebase cleanup — remove legacy CSS, stubs, and unused components #22.)manualChunks.walletconnect+manualChunks.wagmireference packages not inpackage.jsondependencies. (Already cleaned by PR chore: codebase cleanup — remove legacy CSS, stubs, and unused components #22.)happy-domandjsdomin devDeps; no vitest config exists. At least one is dead.baseUrl+pathsdespitefiles: []and only acting as a solution file. (Skipped due to IDE-resolution risk.)define: { "process.env": "{}", "process.env.NODE_ENV": ... }sets the same key twice; order-dependent and fragile.Recommended order of operations