Skip to content

Delete verified dead code: QA log, finished plans, orphan files, dead exports - #1377

Merged
ymichael merged 4 commits into
mainfrom
bb/dead-code-sweep
Aug 12, 2026
Merged

ymichael merged 4 commits into
mainfrom
bb/dead-code-sweep

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Dead-code sweep based on the de-slop audit (plans/deslop-report.md on the audit branch, section 5). Every deletion below was re-verified against the current tree by repo-wide reference counting (apps/, packages/, plugins/, examples/, tests/, scripts/, docs/ — any occurrence of the identifier anywhere, including strings, JSON, and markdown, counted as a reference). Net delta: +67 / −2,565 lines across 77 files.

1. Historical QA log

  • qa/manual-pass-log.md (668 lines) — a single manual QA run log full of dead thread/environment IDs. Zero references. The root qa/ directory is unrelated to the live tests/qa/ package; only this log was deleted (the runbooks in qa/ stay).

2. Stale plans (deleted 2 of 5, kept 3)

Plan Classification Action
environment-archive-grace-period.md Completed — its own header says "implemented 2026-06-17"; managedEnvironmentRetireGraceMs and the retireRequestedAt grace clock are live in apps/server Deleted (precedent: #958 deletes shipped plans)
composer-extraction.md Self-invalidated — its own 2026-08-03 status says the premise moved: the side-chat site now shares hooks via EmbeddedThreadChat and the motivating 4th call site never landed Deleted
bb-browser.md Never started, but deliberately kept and annotated by #958 one week ago; reads as live roadmap Kept
bb-settings.md Partially overtaken (bb settings shipped in a different shape) but its own status re-scopes it to the remaining browser-link-settings work Kept
in-app-browser-open-behavior-improvements.md Never started; companion to the two above, also kept by #958 Kept

3. Orphaned files (6 found, all with zero importers)

  • apps/app/src/lib/child-thread-environment.ts — resolveChildThreadEnvironment has no callers
  • packages/db/src/data/cursor-pagination.ts — not re-exported by the @bb/db barrel, no callers
  • apps/app/src/components/icons/CodexIcon.tsx — the codex provider renders OpenAiIcon (provider-icon.ts)
  • apps/app/src/components/promptbox/mentions/file-mention.ts (+ its test) — only its own test referenced it
  • apps/server/src/services/lib/json-parsing.ts — module never imported
  • apps/app/src/views/thread-detail/useThreadTimelinePages.ts — a pure rename-alias re-export shim over useThreadTimelineController. Its 400-line test covered merge helpers the controller's own test does not, so the test moved to apps/app/src/components/thread/timeline/useThreadTimelineController.merge.test.ts and imports the real module; only the shim was deleted.

4. Dead runtime exports (~40 symbols)

Re-verified individually: zero references outside the defining file and its own test, and unused inside the defining file (declaration-only). Symbol-level git log -S confirmed none are recent/in-flight work. Deleted, with their arg-type interfaces and now-orphaned test blocks:

  • apps/app: isPluginSlotInstanceCrashed, isFileOpenerPanelTab, PROMPT_STACK_COMPACT_INLAY_INSET_CLASS, PROMPT_STACK_COMPACT_INLAY_SEGMENT_CLASS, promptMentionArgumentHintPlaceholder, commandTriggerForComposerActions, resolveShowPanelControl (plus the now-unreachable "show-panel" action variant + presentation entry), isHostFilePreviewTab, getOpenSecondaryPanelTab, SIDEBAR_PLUGIN_WORKING_STATUS_COLOR_CLASS, isKnownSkillScope, seedSystemExecutionOptionsCache, hydrateSystemConfigCache, beginThreadTitleTransaction (alias of live beginThreadMetadataTransaction; its test retargeted to the real function), useReorderProject, usePluginCatalogStatus (plus its private fetchPluginCatalogStatus/toPluginCatalogStatus/PluginCatalogStatus chain), allThreadTabsQueryKeyPrefix, threadHostFilePreviewQueryKeyPrefix, useUpdateSkill, fetchHostId, looksLikeUrl (its test cases are fully duplicated by the resolveBrowserAddressInput suite), findFileOpenersForPath, interpretPluginFrontends (dead duplicate — plugin-frontend.ts inlines the same logic), getPluginFrontendRecords, getPullRequestSignalDisplays, buildQueuedMessageReorderRequest, getToolsRoutePath, isBusyThread, the whole workspace-open-target-preference.ts guard family (isWorkspaceDirectoryOpenTarget, isWorkspaceFileOpenTarget, isRemoteSshWorkspaceDirectoryOpenTarget, isRemoteSshWorkspaceFileOpenTarget), RootComposeRoute (routes register through SplitWorkspaceRoute in App.tsx; LegacyProjectComposeRedirect is still live and stays), reconcileLayoutForRoute, focusedThreadRoute, resolveThreadLocalWorkspaceRootPath, CreateViaPromptExamples
  • apps/host-daemon: resolveLocalBbExecutableDirectory (5-line dirname wrapper; its 4 tests covered real entry-path validation and were retargeted to resolveLocalBbExecutablePath)
  • apps/server: assertPrimaryHostId (+ private unsupportedHostError), directoryExists, swapDirIntoPlace (superseded by the durable-promote path in the same file), getTurnExecutionOptions
  • packages/db: listTrackedThreadStorageTargetsOnHost
  • packages/domain: ALL_REASONING_EFFORTS, threadProvisioningReasonSchema, turnLifecycleEventDataSchema
  • packages/host-daemon-contract: hostDaemonRetryableOnlineRpcCommandSchema (+ its private union builder and descriptor filter). Runtime-value only; the HostDaemonRetryableOnlineRpcCommand type used by online-rpc.ts is untouched, nothing on the wire changes, so no HOST_DAEMON_PROTOCOL_VERSION bump.
  • packages/host-workspace: decodeGitQuotedPath
  • packages/server-contract: environmentActionTypeSchema, domainErrorCodeSchema, and the three alias-shim consts hostPathsExistResponseSchema, hostPickFolderResponseSchema, hostProviderCliStatusResponseSchema (their type aliases are still consumed and stay)

5. BB_CLI_ENV definition orphan

packages/config/src/env-vars.ts defined BB_CLI_ENV but nothing imported it — all four call sites (bb-cli-reexec.ts, runtime-shell-env.ts, tests) read/write env.BB_CLI directly, and defineEnvVar has no global registry, so the definition served nothing. Deleted the definition only; call sites untouched.

6. .gitattributes

Marked the committed generated artifacts as linguist-generated so they collapse in review diffs:

  • packages/plugin-sdk/bundled-types/**
  • packages/templates/src/generated/**

Deliberately NOT deleted

  • packages/shared-ui/src/components/ui/** + Radix deps — intentional scaffold library, owner said keep (audit's largest line item, excluded by instruction).
  • packages/agent-runtime/** — a separate in-flight PR owns dead-code removal there (./capture subpath, resolveAdapterPermissionPolicy, test-harness exports).
  • All .stories.tsx exports — Storybook collects named exports by convention; they are framework-reachable, not dead.
  • Test seams: __testing (apps/host-daemon/src/provider-usage.ts) and getPromptDecorationSet (prompt-decoration extension) — exported only for their own tests, which verify live production behavior through them.
  • createBBSdk (packages/bb-app/src/public-sdk.ts) — a package.json exports entry point of the published bb-app package; external consumers are invisible to repo-wide grep.
  • createMachineCodeFn (apps/web/src/server/fns.ts) — unused TanStack server fn, but the file was touched yesterday by the Cloud dev-workflow PR (Add a usable local Cloud development workflow #1168); plausibly in-flight, left alone.
  • CLOUD_PAT_PREFIX (packages/connect-db/src/constants.ts) — unreferenced, but it is a documented policy constant ("token prefixes mirror bb's host-key convention") in a deliberate policy-constants file; ambiguous scaffold, left alone.
  • Exported-but-internally-used symbols (e.g. the workspaceOpenTargetPreferenceAtom atoms, storage-key consts) — de-exporting them deletes no lines; skipped to keep the diff pure deletion.
  • Anything in plugin-build/src/runtime-export-manifest.ts — the plugin runtime ABI was checked before every deletion; no deleted symbol appears in it.

Verification

  • pnpm exec turbo run typecheck — all 58 tasks pass.
  • pnpm exec turbo run test for every touched package — all pass: @bb/app 2529, @bb/server 1436, @bb/host-daemon 541, @bb/db 379, @bb/host-workspace 194, @bb/domain 128, @bb/config 106, @bb/host-daemon-contract 49, @bb/server-contract 42 tests. (One guardrail test, cache-owner-registry.test.ts, correctly flagged a stale allowlist entry for the deleted seedSystemExecutionOptionsCache import; the entry was removed.)
  • No package.json dependencies were removed, so the lockfile is unchanged.

AGENT GENERATED: by Claude Fable 5

🤖 Generated with Claude Code

ymichael and others added 3 commits August 11, 2026 21:54
qa/manual-pass-log.md was a single historical manual QA run log full of
dead thread/environment IDs; nothing references it (the root qa/
directory is unrelated to tests/qa/).

plans/environment-archive-grace-period.md documents work its own header
marks "implemented 2026-06-17" (managedEnvironmentRetireGraceMs and the
retireRequestedAt clock are live in apps/server). Repo precedent: PR
#958 deletes plans whose work shipped.

plans/composer-extraction.md is self-invalidated: its own 2026-08-03
status says the premise moved (the side-chat site now shares hooks via
EmbeddedThreadChat and the motivating 4th call site never landed).

Co-Authored-By: Claude Fable 5 <[email protected]>
Every deletion was re-verified against the current tree by repo-wide
reference counting (any occurrence of the identifier in any tracked
file, including strings, JSON, and docs, counted as a reference), plus
symbol-level git log -S checks to avoid touching in-flight work.

Orphaned files (zero importers): child-thread-environment.ts,
cursor-pagination.ts, CodexIcon.tsx (codex renders OpenAiIcon),
file-mention.ts (+ its test), json-parsing.ts, and the
useThreadTimelinePages.ts rename-alias shim. The shim's merge tests
covered helpers the controller's own test does not, so they move next
to useThreadTimelineController and import the real module.

Dead runtime exports (~40 symbols) across apps/app, apps/server,
apps/host-daemon, and packages/{db,domain,host-daemon-contract,
host-workspace,server-contract}, together with their arg-type
interfaces, orphaned private helpers, and now-orphaned test blocks.
Tests that exercised live logic through a dead alias were retargeted
(beginThreadMetadataTransaction, resolveLocalBbExecutablePath) rather
than deleted.

BB_CLI_ENV in packages/config/src/env-vars.ts was a definition orphan:
all call sites read env.BB_CLI directly and defineEnvVar has no
registry, so the definition served nothing.

The hostDaemonRetryableOnlineRpcCommandSchema removal is value-only;
the HostDaemonRetryableOnlineRpcCommand type used by online-rpc.ts is
unchanged and nothing on the wire changes, so no
HOST_DAEMON_PROTOCOL_VERSION bump.

Deliberately kept: shared-ui scaffold components, agent-runtime (owned
by a separate PR), all .stories.tsx exports (Storybook collects named
exports by convention), test seams (__testing, getPromptDecorationSet),
the published bb-app public-sdk entry, createMachineCodeFn (touched
yesterday by #1168), CLOUD_PAT_PREFIX (documented policy scaffold), and
everything in the plugin runtime ABI manifest.

Co-Authored-By: Claude Fable 5 <[email protected]>
packages/plugin-sdk/bundled-types/** and
packages/templates/src/generated/** are committed build outputs that
get re-serialized constantly; linguist-generated collapses them in
review diffs and keeps them out of language stats.

Co-Authored-By: Claude Fable 5 <[email protected]>
@SawyerHood

Copy link
Copy Markdown
Collaborator

🚨 SLOP COP 🚨 · review

ELI5: This PR removes files and code that the project no longer uses.

I am SlopCop. I am reviewing this PR under the stated review rules. I will check security, code quality, performance, architecture, and the product route.

});
}

export function useReorderProject() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — This deletion leaves the project reorder cache code unused.

Please delete ReorderProjectTransaction, the private reorder helpers, and the three transaction functions from project-cache-owner.ts. A project-wide search at this SHA finds no other use.

});
}

export function useUpdateSkill(projectId: string) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — This deletion leaves the skill content invalidation code unused.

Please delete invalidateSkillContentMutationQueries and its argument interface from skills-cache-effects.ts. A project-wide search at this SHA finds no other use.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

ELI5: This PR removes old files and code that the product does not use.

This cleanup looks safe. I found no blocking security, correctness, performance, or architecture issue.

I found two low-severity cleanup gaps:

  • The removed project reorder hook leaves its cache transaction code unused.
  • The removed skill update hook leaves its cache invalidation code unused.

I left inline comments at both deletion sites. These findings do not change behavior and do not block this PR.

The security review found no removed check or validation with a live caller. The performance review found no removed live cache, query, or worker path.

The architecture scan found no duplicate live behavior. This PR removes one duplicate plugin frontend parser and one route wrapper.

I tested the exact head SHA. Eight touched runtime packages passed the Turbo typecheck. All GitHub checks passed.

The development app started successfully. The root page loaded, the new-thread composer opened, and the right panel opened without browser errors.

git diff --check reports extra final blank lines in five files. This is a minor style issue only.

Removing the reorder-project mutation and the skill-content mutation hook
left their cache-owner support code unreferenced:

- project-cache-owner.ts: drop the ReorderProjectTransaction interface,
  begin/rollback/apply reorder transaction functions, and the two private
  project-order helpers, plus the now-unused ReorderProjectRequest,
  applyNeighborReorder, and invalidateProjectListQueries imports.
- skills-cache-effects.ts: drop invalidateSkillContentMutationQueries and
  its SkillContentInvalidationArg interface.
- query-keys.ts: drop skillContentQueryKeyPrefix, whose only caller was
  the deleted skill-content invalidation helper; remove it from the
  cache-owner-registry allowlist as well.

Also strip the stray final blank lines the sweep left in five files
(git diff --check is clean against main again).

Co-Authored-By: Claude Fable 5 <[email protected]>
@ymichael

Copy link
Copy Markdown
Collaborator Author

Addressed the SlopCop review findings in eaf22b5:

1. Orphaned reorder-project cache code — verified zero references repo-wide at the previous head, then deleted from apps/app/src/hooks/cache-owners/project-cache-owner.ts: ReorderProjectTransaction, beginReorderProjectTransaction, rollbackReorderProjectTransaction, applyReorderProjectResult, the private applyProjectOrderToProjectList/applyProjectOrderToSidebarNavigation helpers, their arg interfaces, and the now-unused ReorderProjectRequest, applyNeighborReorder, and invalidateProjectListQueries imports. The cache-owner-registry allowlist entry for this file needed no change (projectsQueryKey/sidebarNavigationQueryKey are still imported by the surviving create/delete appliers). ReorderProjectRequest and applyNeighborReorder remain alive elsewhere (server-contract/SDK reorder route; sidebar and queued-message reorder).

2. Orphaned skill-content invalidation helper — verified, then deleted invalidateSkillContentMutationQueries and SkillContentInvalidationArg from skills-cache-effects.ts.

3. Trailing blank lines — git diff --check main...HEAD flagged five files (plugin-app-definition.ts, plugin-app-definition.test.ts, pull-request-display.ts, splitThreadNavigation.ts, thread-events.ts); stripped the extra final blank line in each. The check is clean now.

4. Cascade follow-through — deleting the skill-content helper orphaned skillContentQueryKeyPrefix in query-keys.ts (its only remaining mention was the cache-owner-registry allowlist, which would have failed the guardrail test as an unused allowed import). Deleted the function and its allowlist entry. skillContentQueryKey/SKILL_CONTENT_QUERY_KEY stay — still used by useSkillContent. No further hops: everything else touched by the deletions has live references.

Verification: full-repo turbo run typecheck passes (58/58), @bb/app tests pass (2529 tests / 335 files), @bb/server tests pass.

Updated PR delta: git diff --shortstat main...HEAD is +415 / −2706 (net −2291); GitHub's header shows +35 / −2646 after excluding the linguist-generated artifacts this branch marked.

AGENT GENERATED: by Claude Fable 5

@ymichael
ymichael merged commit f267115 into main Aug 12, 2026
10 checks passed
@ymichael
ymichael deleted the bb/dead-code-sweep branch August 12, 2026 16:35
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.

2 participants