Skip to content

Remove dead code and unwired API surface - #70

Open
charlesHetterich wants to merge 3 commits into
mainfrom
dead-code
Open

Remove dead code and unwired API surface#70
charlesHetterich wants to merge 3 commits into
mainfrom
dead-code

Conversation

@charlesHetterich

Copy link
Copy Markdown
Collaborator

Summary

Removes the dead surface identified in the repo audit. Every item below was re-verified as unused by grepping the current main (post-#65/#67/#68) before deletion; where a deletion orphaned an import or a consumer branch, the cascade was cleaned in the same commit. Two small approved conversions ride along (rendered savedPath, single-sourced constants). No refactors or dedup beyond that.

Deletions

@parity/cdm-builder

  • ContractDeployer.deployBatch + getOnChainCode — zero callers; production uses deployAndRegisterBatch. Doc comments referencing deployBatch updated.
  • Flat toposort family (toposort, DeploymentOrder, createCrateToPackageMap, detectDeploymentOrder) — production only uses the layered variants. Tests ported to the layered API: detection.test.ts now asserts against detectDeploymentOrderLayered(...).layers.flat(), and the flat suite's reverse-insertion linear-chain case was ported as a toposortLayers(g).flat() assertion; the cycle/self-loop/determinism assertions already existed in the toposortLayers suite and are retained.
  • check-cached event + "cached" summary status — never emitted anywhere (confirmed delete, not TODO). Downstream handling removed from the CLI adapter and DeployTable (incl. the now-unused Cached component and the status !== "cached" filter in the layer error path).
  • Reserved-but-dead DeployContractsOptions fields waitFor / timeoutMs / gateway — never read.
  • Sync pvmContractBuild — only the async variant is called; its doc rationale moved onto pvmContractBuildAsync.
  • computeCid — zero callers; the pipeline doc comment that cited it now correctly names computeBulletinStoreCid.
  • readSolidityAbi / artifactDisplayPath / bytecodeSize in solidity.ts — zero callers, and never re-exported from the package index.
  • normalizeCdmJson identity cast + its no-op "keeps manifests unchanged" test — readCdmJson casts directly. Real validation/round-trip tests are deferred to the tests PR.
  • MetadataPublisher: unused _client constructor param dropped (and the pipeline call site no longer passes bulletinClient); publishBatch no longer returns hardcoded fake txHash: "" / blockHash: "" — the fields are gone from its return type and from the publish-done event. Cascade: ContractStatus.publishTxHash/publishBlockHash (only ever set to "") removed, along with the DeployTable branches keyed on them, which were unreachable for the same reason.

@parity/cdm-env

  • AssetHubConnection / BulletinConnection types + index re-exports — zero references.

@parity/cdm-cli

  • PipelineStatusAdapter unwired observer API: onStatusChange / onPhaseChange / onLogChange, PhaseInfo + the phase field, addressesFromSummary(), and the unread layers / contracts fields — only onCdmPackageDetected was ever wired (verified against post-Fix error handling, network resolution, and frontend correctness bugs #68 ui.ts). The crates field became unread after the ui.ts change below and was removed too (row order now comes from statuses insertion order, which the adapter fills in layered order on detect). Misleading comments fixed: the "spinner above the table" docstring and the "runDeployWithUI logs deploy-plan to stderr" claim (it never did).
  • Dead UI states "checking" / "registering" in ContractState + the seven unreachable DeployTable conditionals that reduced to state === "done".
  • progressBar + formatDuration in ui.ts — zero callers.
  • Detection-runs-twice: precomputeBuildDisplay's up-front detectBuildOrder call deleted; the table now populates purely from the library's detect event (Ink re-renders on the 80 ms tick and re-reads the mutated statuses/displayNames maps). Docstrings reconciled. Verified via the event flow and the CLI help/tests.
  • InstallResult unused import/re-export in commands/install/index.ts (cascade: the same now-unused re-export in install-pipeline.ts).
  • postInstallRust no-op deleted along with its call site — it was an empty placeholder from the day it was added (866bdde, "Add @dotdm/cdm TypeScript client library and post-install codegen") and never gained a body; the install command already writes everything Rust consumers (cdm::import!) read from cdm.json. A comment at the hook site records why Rust needs no post-install step.

@parity/cdm-frontend

  • weeklyCalls fabricated stat: type field, both hardcoded weeklyCalls: 0 sites in registry-queries.ts, and the PackageCard render block (+ its formatCalls helper).
  • Package.versions?: {version; date}[] — fully dead after Fix error handling, network resolution, and frontend correctness bugs #68's Versions tab (which uses usePackageVersions/PackageVersionInfo); never written or read.
  • Header placeholder links: "Docs" (duplicate of Github) and "Playground" (dead playground.dot domain).
  • All 10 no-op biome-ignore comments (PackagePage, SearchPage, SkeletonCard, and one in the CLI's deploy-pipeline.ts) — biome.json has "linter": { "enabled": false }, so none of them suppress anything; the frontend ESLint config flags none of the annotated lines (verified: eslint . clean after removal).
  • App.css + index.css "intentionally left empty" husks — verified unimported (main.tsx imports neither; global styles live in styles/global.css).
  • Stock Vite README replaced with a short real one (what the dashboard is, how to run/build it).
  • Duplicate splitName in PackagePage vs splitPackageName in PackageCard — kept one, moved to src/lib/package-name.ts (approved exception to the no-dedup rule).
  • .sidebar-keyword:hover link-affordance CSS (plus the transition/text-decoration that only served it) — orphaned by Fix error handling, network resolution, and frontend correctness bugs #68's change of keyword chips to plain spans.

Conversions (approved)

  • InstallStatus.savedPath is now rendered instead of deleted: after a successful install, each row gets a dim ↳ .cdm/contracts/<name>/<version> line showing where artifacts landed (path relative to cwd, same style as the existing link fallback line).
  • Constants single-sourced: GAS_LIMIT / STORAGE_DEPOSIT_LIMIT / CONTRACTS_REGISTRY_CRATE re-exports removed from @parity/cdm-builder; the two importers (cli/commands/deploy.ts, scripts/deploy-registry.ts) now import from @parity/cdm-utils directly.

Skipped items

None — every audited item re-verified as dead on current main. (The "checking" strings remaining in toolchain.ts/setup.ts are a different, live toolchain-setup status type, untouched.)

Changeset

One changeset: @parity/cdm-builder major (removed exports, events, options, and the constants re-exports), @parity/cdm-env patch (removed dead types), @parity/cdm-cli patch (dead code removal + savedPath display). The previous cycle's changesets were consumed by the last "chore: version packages", so this is the only pending one.

Verification

  • pnpm check green end-to-end (embed:templates + format:check + typecheck + build incl. build:registry + vitest + macro + Rust tests).
  • Tests: 139 before → 136 after (−3 flat-toposort in-source tests whose assertions already exist in the layered suite, −1 deleted no-op normalizeCdmJson test, +1 ported flat-semantics chain test; all other affected tests ported in place).
  • Grep proof: zero remaining references for every deleted symbol (deployBatch, getOnChainCode, toposort, DeploymentOrder, createCrateToPackageMap, detectDeploymentOrder, check-cached, pvmContractBuild, computeCid, readSolidityAbi, artifactDisplayPath, normalizeCdmJson, AssetHubConnection, BulletinConnection, PhaseInfo, onStatusChange, onPhaseChange, onLogChange, addressesFromSummary, progressBar, formatDuration, weeklyCalls, postInstallRust, splitName, publishTxHash, biome-ignore).
  • Frontend: pnpm --filter @parity/cdm-frontend build and eslint . both pass.
  • Net delta: strongly net-negative — see the PR diffstat (~+130 / −790 lines across 35 files).

Drop never-called exports (deployBatch, getOnChainCode, the flat toposort
family, sync pvmContractBuild, computeCid, normalizeCdmJson, unused solidity
helpers), the never-emitted check-cached event and cached status, reserved
deploy options, the unused MetadataPublisher client param, hardcoded fake
publish tx/block hashes, and the AssetHubConnection/BulletinConnection types.
Constants are no longer re-exported from cdm-builder; import them from
cdm-utils. Flat toposort tests are ported to the layered API.
Delete the unwired PipelineStatusAdapter observer API (onStatusChange,
onPhaseChange, onLogChange, PhaseInfo, addressesFromSummary, unread fields),
the unreachable checking/registering/cached UI states and their DeployTable
branches, progressBar/formatDuration, the duplicate up-front detectBuildOrder
call (the table now populates from the library's detect event), the unused
InstallResult import/re-export, and the empty postInstallRust placeholder.
cdm install now prints where each contract's artifacts were saved.
Drop the fabricated weeklyCalls stat, the unused Package.versions field,
placeholder Docs/Playground header links, no-op biome-ignore comments (the
biome linter is disabled), the empty App.css/index.css husks, and the
keyword-chip hover styling orphaned by the plain-span change. Replace the
stock Vite README with a real one and share a single splitPackageName
helper between PackagePage and PackageCard.
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

CDM CLI dev release

This PR includes a @parity/cdm-cli changeset, so CI published a dev CLI release for this branch.

Install it:

curl -fsSL https://raw.githubusercontent.com/paritytech/contract-dependency-manager/59442e63d93bc889f03f1b9ce1a4f0b7ab63fa31/install.sh | CDM_TAG=cdm-cli-dev-pr-70 bash

Update an existing install:

cdm update --tag cdm-cli-dev-pr-70

Release tag: cdm-cli-dev-pr-70
Commit: 59442e63d93bc889f03f1b9ce1a4f0b7ab63fa31

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