Skip to content

chore: remove dead code and tighten the repository's gates - #107

Open
viztor wants to merge 3 commits into
claude/vigilant-mendel-bctz9n-p1afrom
claude/vigilant-mendel-bctz9n-p1b
Open

viztor wants to merge 3 commits into
claude/vigilant-mendel-bctz9n-p1afrom
claude/vigilant-mendel-bctz9n-p1b

Conversation

@viztor

@viztor viztor commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Phase P1b of docs/improvement-plan.md. It is stacked on #106 (P1a), which is stacked on #105.

Hygiene only. It removes dead code and adds gates; besides one free-tier fix (see Behaviour change), no user-facing behaviour changes.

# Change How it's pinned
1 adapter-replacement.ts and its test are deleted. Nothing imported them. docs/engineering-notes.md gains a section on two points. First, deleting another plugin's registry entry is not a host API: registerAdapter is all-or-nothing, and only the owner's handle.replace moves routes. Second, the plugin keeps pi-ai from claiming the planes through the config waterfall instead (D13). A new gate in architecture.test.ts fails the build if anything in src/'s import graph writes the llm registry map (adapters.set/delete/clear, including optional chaining).
2 The stream hook's dead prepared handling is gone. In the host's llm/src/index.ts, stream(options) passes the prepared dispatch as a separate argument, which only prepareCall's one-shot stream supplies. options.prepared is never read. A green pin on the Go-Google redirect: it forwards the caller's request unchanged apart from the provider and the Google-shape history.
3 .freebuff/ is untracked and ignored. It held a per-machine agent workspace id. none
4 The settings partition test walks Config.dict. It used Config({}), which drops keys with no default, and that is how debugFile went missing from it. debugFile is now registered as config-only. A new manifest test checks cordis.patch.yml against the schema and the field registry. That surfaced the phantom showUsagePrice, the wrong freeModelMarker: '' text and the incomplete field lists, all now fixed. Red on the base, green now.
5 utils/retry.ts takes its timer and logger as parameters. The utils purity gate now also rejects console and global timers: called or passed as values, bare or through globalThis./window./global./self.. It walks utils/ recursively. Verified by planting violations and watching the gate fail.
6 tool-fallback reads free-tier ids from the request's own plane. Go means opencode-go or an opencode-go-* route. Its unreachable Anthropic branch is gone. A red test seeds a plane-divergent live catalog. A shipped-data case pins big-pickle.
7 test/support/src.ts is the one door tests use into src/, so later module moves touch one file. This phase converts the files it touches, P2 converts the rest, and CONTRIBUTING.md states the rule. A gate requires each name in the door to be declared in its target module, not re-exported from elsewhere. Known answers are included.

Behaviour change

Free-tier detection is now plane-correct. A model the catalog marks free only on Zen, such as big-pickle, no longer gets the core-tool schema fallback on the Go plane. On Zen, and for a request with no route, nothing changes.

Review

The change went through three review lenses (correctness and host contracts, tests, repository rules). Two independent skeptics checked each finding. Over three rounds:

  • 30 findings survived: 3 medium, 27 low.
  • All of them were fixed. The registry-write gate was kept as item 1's executable form.

Verification

All run locally:

Node Step Result
26 pnpm run check 0 errors; 21 warnings, down from 23
26 unit suite 1222 tests pass, up from 1207
26 shuffled, seeds 1 / 42 / 1234 pass
26 test:mock 51 pass
26 build and scripts/check.ts pass
26 coverage 96.5% lines, 92.4% branches
24 shuffled (seed 7) and test:mock pass

The diff contains no local paths.


Generated by Claude Code

- Delete adapter-replacement.ts and its test. Nothing imported it, and
  deleting another plugin's registry entry is not a host API; the
  engineering notes record why, and what the plugin does instead.
  A gate fails the build if src/ writes the llm registry map directly.
- Delete the stream hook's `prepared` handling: the host passes the
  prepared dispatch as its own argument and never reads options.prepared.
- Untrack .freebuff/ and ignore it.
- The settings partition test walks Config.dict, which is how debugFile
  went missing from it; a manifest test checks cordis.patch.yml against
  the schema and the field registry, and the manifest's phantom
  showUsagePrice, wrong marker text and incomplete lists are fixed.
- utils/retry.ts takes its timer and logger as parameters, and the utils
  purity gate now also rejects console and global timers, walking the
  folder recursively.
- tool-fallback reads free-tier ids from the request's own plane (Go iff
  opencode-go or opencode-go-*) and loses its unreachable Anthropic
  branch. A Zen-only free model is no longer treated as free on Go.
- test/support/src.ts is the one door tests use into src/, so later
  module moves touch one file; CONTRIBUTING.md states the rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
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