Uh oh!
There was an error while loading. Please reload this page.
Autophagy: drop eight orphaned type declarations - #490
Conversation
Type-only trim. Each removed declaration had exactly one occurrence in the tree (its own definition): no importer, no `@import`, no test reference, no `@ref` annotation, and no re-export from any public entry. - `src/core/runtime/types.d.ts`: `CreateKernelRuntimeArgs`, `CreateActivationContextArgs`, `CreatePluginPathsArgs`, `ActivatePluginsArgs`, `ActivatePluginsResult`. Leftovers from the paired-.d.ts consolidation (#182/#183); `activation.js` and `paths.js` spell these param shapes inline in JSDoc instead. - `src/core/types.d.ts`: `ResolveDependenciesOptions`, `ManifestLoadResult`. `manifest.js` writes `Promise<LoadedManifest|FailedManifest>` directly; both members stay. - `src/core/cli/types.d.ts`: `WalkthroughResult`, orphaned by "delete the dead walkthrough" (#241). Removing those left `PluginPaths` and `SourceWithholdResolver` as unused type imports in `src/core/runtime/types.d.ts`; dropped both. No runtime code changed. npm test: 3005 pass / 8 fail / 1 skipped, the same eight `leave-command.test.js` failures present on origin/master. npm run typecheck clean. `npm run smoke -- core_boot_noop` ok. Co-Authored-By: Claude <noreply@anthropic.com>
philcunliffe
commented
Jul 30, 2026
Neutral review - round 1/2 - |
| Check | Result |
|---|---|
npm run typecheck @ head | exit 0, clean |
npm run build:types @ master | exit 0, 176 .d.ts emitted |
npm test @ head | 3014 tests, 3005 pass / 8 fail / 1 skipped |
npm test @ pristine origin/master | 3014 tests, 3005 pass / 8 fail / 1 skipped |
The two failure sets are identical name-for-name (diff of the sorted not ok names
-> no difference). All eight are the test/core/leave-command.test.jsleave * cases, and
they fail the same way on pristine origin/master, so they are pre-existing and not
attributable to this PR - confirmed against the baseline as instructed, not inferred.
Ref hygiene passes at head: ok 901 - every @ref resolves to a live LLP document and one of its anchors, ok 903 - no @ref annotation separates its gloss with an em dash. CI is green
at this head and remains the authority; the above is corroboration.
Note on tooling
The code-review skill is not installed on this host (available project skills arellp-* and ref-* only). Rather than invoke a substitute whose first step is agh pr checkout in the read-only main checkout, I performed the audit directly with the
targeted checks above, which are narrower and stronger for a deletion PR than a generic
diff review would have been.
Bottom line
The only high-severity outcome available here - "this removed something actually
reachable" - did not occur. All eight declarations are unreferenced in source, absent
from the generated declaration tree, unreachable through any exports subpath, and carry
no cross-repo contract marker. The two import removals are exactly the stranded pair.
Nothing to fix, so nothing was pushed and the head is unchanged at 2e52ac5.
Reviewed by neutral (LLP 0028/0029). Draft status and merge remain a human's call.
Uh oh!
There was an error while loading. Please reload this page.
Autophagy idle-tick cleanup (LLP 0036), run against
origin/masterat14e2d96.This PR proposes; a human disposes. It is a draft on purpose. Everything below is
re-runnable evidence, not a summary. No runtime code changed: the whole diff is
type-only declarations plus the two type imports they were the last users of.
Method
Reachability was established by running searches, not by reading filenames.
from '...'/import('...')specifier acrosssrc/,bin/,hypaware-core/,scripts/,test/(excludingnode_modules/,the generated
types/tree, andnotes-archive/) and looked for modules with noimporter. Every hit was a plugin entry point, a smoke flow, a test file, or a
package
exportsbarrel - i.e. reachable through string-keyed dispatch, not dead.No orphan modules.
occurrences of each name tree-wide. 69 had no mention outside their defining file;
all 69 turned out to be used internally (constants read by their own module,
helpers called by their own module). None were dead. No
exportkeyword wasstripped - an export whose value is live is not dead code, and removing the keyword
would be churn.
authority rather than a hand-rolled scanner:
npx tsc -p tsconfig.json --noEmit --noUnusedLocals --noUnusedParameters-> theonly
TS6133hits are unused function parameters (argv,opts,ctx,positional placeholders in test fakes). Those are signature/arity, not dead code,
and were left alone. Zero unused imports, zero unused local declarations.
npx tsc -p tsconfig.json --noEmit --allowUnreachableCode false --allowUnusedLabels false-> zero
TS7027. No statements unreachable after areturn/throw.grep -rnE "^\s*//\s*(const|let|var|function|import|export|return|if\s*\(|await|for\s*\(|console\.)"over
src bin hypaware-core scripts test-> every hit is a prose comment whosewrapped line happens to begin with a word like "return" or "import". None.
tsc --noUnusedLocalsdoes not flag exported types, sothese were scanned separately: for every declaration in every
.d.ts, counttree-wide occurrences of the bare name. 18 had exactly one occurrence. Ten of those
were deliberately kept - see Deliberately left behind,
which is the useful half of this report.
The tree is in good shape. The eight declarations below are the entire harvest.
Removed (8 declarations + 2 imports they stranded)
The evidence command is the same for each, run from the repo root:
A result of exactly one line - the declaration itself - means no importer, no
@importJSDoc specifier, no test reference, no@refannotation, no manifest ormarkdown mention.
-wis load-bearing: it is what keepsWalkthroughResultfrommatching the live
PickerWalkthroughResult.src/core/runtime/types.d.tsgrep -rnwresultCreateKernelRuntimeArgssrc/core/runtime/types.d.ts:164:export interface CreateKernelRuntimeArgs {(1 hit)CreateActivationContextArgssrc/core/runtime/types.d.ts:179:export interface CreateActivationContextArgs {(1 hit)CreatePluginPathsArgssrc/core/runtime/types.d.ts:189:export interface CreatePluginPathsArgs {(1 hit)ActivatePluginsArgssrc/core/runtime/types.d.ts:219:export interface ActivatePluginsArgs {(1 hit)ActivatePluginsResultsrc/core/runtime/types.d.ts:227:export interface ActivatePluginsResult {(1 hit)Corroboration:
src/core/runtime/activation.jsimports exactly one name from thismodule -
@import { KernelRuntime } from '../../../src/core/runtime/types.js'(line24) - and spells its own parameter shapes inline (
@param {{ ... }}at line 38 forcreateKernelRuntime,@param {object} args+args.*at lines 117-122 forcreateActivationContext).src/core/runtime/paths.jsimports only from the kernelcontract. These are residue of the paired-
.d.tsconsolidation in #182 / #183("Drop function-only paired .d.ts; JSDoc is the source of truth") - function-only
param descriptions that survived the phase that was meant to remove them.
git log --oneline -S'CreateKernelRuntimeArgs' --allshows the same three commits forall five:
0c522e6(added),cb67c0f(#182, relocated),ba3ef45(#183) - andnothing since.
Cascade check.
ActivatePluginsArgs/ResultreferencePluginActivationEntryand
ActivationResult; both are independently live, so nothing cascaded:ActivationSuccess/ActivationFailureoccur only intypes.d.tsbut are reachablethrough the live
ActivationResultunion, so they stay.The removals did strand two type imports, which is why the diff touches the import
block. Re-verified after the edit that both had zero remaining references in the file:
PluginPaths(fromhypaware-plugin-kernel-types.d.ts) - last user wasCreateActivationContextArgs.SourceWithholdResolver(from../cache/types.d.ts) - last user wasCreateKernelRuntimeArgs.Both names remain heavily used elsewhere in the repo; only this file's import of them
is gone.
ExtendedQueryStorageServiceon the same import line is still used and stays.// --- paths ---went withCreatePluginPathsArgs: it was that section's only member.src/core/types.d.tsgrep -rnwresultResolveDependenciesOptionssrc/core/types.d.ts:92:export interface ResolveDependenciesOptions {(1 hit)ManifestLoadResultsrc/core/types.d.ts:115:export type ManifestLoadResult = LoadedManifest | FailedManifest(1 hit)ManifestLoadResultis an alias whose two members are live and stay:src/core/manifest.js:24writes
@returns {Promise<LoadedManifest|FailedManifest>}directly rather thannaming the alias, and
LoadedManifestis imported bysrc/core/cli/dispatch.js,src/core/plugin_catalog.js, andsrc/core/runtime/types.d.ts.CapabilityRegistryHandle(the only member ofResolveDependenciesOptions) stays -still used by
DepGraphResolutionin the same file, so no import was stranded here.src/core/cli/types.d.tsgrep -rnwresultWalkthroughResultsrc/core/cli/types.d.ts:89:export interface WalkthroughResult {(1 hit)git log --oneline -S'WalkthroughResult'namese902f6eas the last touch: "CLIcleanup: split core_commands, unify argv parsing, delete the dead walkthrough (#241)".
The walkthrough went; its result shape did not. The similarly-named
PickerWalkthroughResult(same file, line 245) is live and untouched.HypAwareV2Config(referenced by the removed interface) is still used elsewhere inthe file, so no import was stranded.
Deliberately left behind
These looked dead by the same one-occurrence scan and were kept. This is the part
worth reviewing - each is a case where the mechanical signal was wrong.
IngestSignal,IdentityResponse,IdentityBootstrapRequest(hypaware-core/plugins-workspace/central/src/types.d.ts)@hypaware/central⇄@hypaware/server. The server package (post-V1 Phase 10, separate repo) will import from this same file; updates here must keep both ends in sync." An in-repo search can never see the other end.PluginModule,CollectivusV2Config(hypaware-plugin-kernel-types.d.ts)package.jsonfiles, and named bysrc/core/index.d.tsas "the canonical source of truth for the design types".PluginModuleis the shape a third-party plugin's entry module must export; nothing in-repo names it precisely because the implementers are out of repo. Off-limits.ObservabilityHandle(src/core/observability/types.d.ts)installObservability... is what consumers see via the generatedindex.d.ts. This named handle is the self-contained shape of that return."./core/observabilityis a publicexportssubpath.LocalOnlyListFile(src/core/usage-policy/types.d.ts)LocalOnlyListFileV2... a baredirsarray migrates on read"). Deleting it would delete the description of a format the code still parses.ParsedNeighbors(context-graph),CreateEmbedder(embedder-openai),ShardBuildReport(vector-search),GraphRowBuildersetc. (plugintypes.d.tsfiles)central/src/types.d.tsturned out to be a cross-repo contract, my confidence that an unreferenced plugin type is dead rather than declared is not high enough to act on. Left alone.Also examined and not touched:
firstPartyPluginMetadata(src/core/config/validate.js). Carries an@deprecated Prefer buildPluginCatalog()tag, which reads as a cleanup target. Itis not: it is re-exported from
src/core/index.js(the.and./corepackageentry), referenced by
src/core/index.d.ts, used as the defaultknownPluginsatfour sites inside
validate.js, and asserted by three test files. Live public API.OAUTH_TOKEN_URL,buildUnit,cronMatches,runVerbCommand,planDaemonInstall). All are read inside their ownmodule. Their
exportkeyword may be unnecessary, but the values are not dead andnarrowing a module's surface is a refactor, not autophagy.
TS6133hits). Changing a signature is arefactor with call-site arity implications. Out of scope.
types/,node_modules/,notes-archive/. Generated, vendored, archived.Excluded from every search and untouched.
Checks
Run in a detached worktree off
origin/master.npm run typecheck- clean, exit 0.npm test- identical to baseline.origin/master, pristine)The 8 failures are pre-existing on
origin/masterand unrelated to this change.Confirmed by name against a pristine
origin/mastercheckout before any edit; theidentical set fails after:
All eight are in
test/core/leave-command.test.js. Nothing else regressed.Ref hygiene (
test/core/llp-ref-hygiene.test.js, insidenpm test) - passes. No@refannotation was in or adjacent to any removed block:npm run smoke -- core_boot_noop- ok. The runtime type module is on the kernelboot path, so this exercises it end-to-end even though the change is type-only.
Confidence
Reachability here is by static search, and static search cannot see two things that
this repo genuinely has: consumers outside the repo, and string-keyed dispatch. I
kept everything that showed either signal. What is left is eight declarations whose
names appear exactly once in the tree, in files with no public
exportssubpath andno star re-export (
grep -rn "export \*" --include=*.d.tsoversrc,bin,hypaware-core,hypaware-plugin-kernel-types.d.tsreturns onlysrc/core/index.d.ts:9: export * from './observability/index.js', which does notre-export any
types.d.ts).A reviewer who disagrees about any single row should drop that row rather than the
PR; the removals are independent.