Skip to content

gut(config): remove remaining LLM-platform z.unknown() stubs (#2489)#2492

Merged
alexey-pelykh merged 1 commit intomainfrom
gut/2489-llm-platform-zunknown-stubs
Apr 23, 2026
Merged

gut(config): remove remaining LLM-platform z.unknown() stubs (#2489)#2492
alexey-pelykh merged 1 commit intomainfrom
gut/2489-llm-platform-zunknown-stubs

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Closes #2489. Consolidates the middleware-not-platform boundary by removing 8 z.unknown() stubs that described LLM-platform concerns (model API routing / capability flags, memory backend, memorySearch/RAG, PDF tool limits) plus all paired surfaces (TS types, help/label docs, test assertions, dead passthrough). Also reverts Option-A additions from #2478 (api/compat stubs added in the same batch where the fork pivoted to Option B).

No migration infrastructure is added — the underlying features were gutted months ago, so configs carrying these fields now fail zod strict validation with Unrecognized key, signalling a one-time manual edit.

What was removed

Cluster A — Model API routing / capability flags (zero production readers)

  • ModelDefinition.{api, compat}, ModelProvider.api in zod-schema.core.ts

Cluster B — PDF tool stubs (zero production readers, divergent TS types)

  • pdfModel, pdfMaxBytesMb, pdfMaxPages in zod-schema.agent-defaults.ts + types.agent-defaults.ts + help/labels

Cluster C — Top-level memory backend (zero production readers)

  • memory: z.unknown() at RemoteClawSchema root + top-level memory help/label/ROOT_SECTIONS entry

Cluster D — memorySearch / RAG (zero production reads; only a dead passthrough in agent-scope.ts)

  • AgentDefaults.memorySearch stub + AgentEntry.memorySearch full structured schema (including the complete MemorySearchSchema definition ~150 lines)
  • types.agent-defaults.ts + types.agents.ts memorySearch declarations
  • ~50 schema.help.ts entries + ~40 schema.labels.ts entries
  • schema.help.quality.test.ts memorySearch path assertions
  • agent-scope.ts:73,179 dead passthrough in ResolvedAgentConfig

Obsolete tests cleaned up

  • config.schema-regressions.test.ts: three compat-stub accept tests (memorySearch, pdf default, pdf legacy)
  • config.secrets-schema.test.ts: legacy api tolerance test
  • config-misc.test.ts: accepts legacy api and compat fields test
  • status.scan.test.ts: two zombie tests mocking a non-existent status.scan.deps.runtime.js module

New adversarial regression tests

config-misc.test.ts § gutted LLM-platform fields are rejected (#2489) — verifies each removed cluster is rejected by zod strict parsing.

Redact-snapshot test fixtures migrated

memorySearch.remote.apiKeymodels.providers.{openai,anthropic}.apiKey (different sensitive path, same redaction mechanism).

Generated artifacts

Regenerated via scripts/generate-base-config-schema.ts and scripts/generate-config-doc-baseline.ts:

  • src/config/schema.base.generated.ts
  • docs/.generated/config-baseline.json

Test plan

  • pnpm format:check clean
  • pnpm tsgo — no src/ errors
  • pnpm lint — 0 warnings, 0 errors
  • pnpm test — 800 files, 7014 tests pass
  • Fork-integrity gates: rebrand, zombie-import, stub-debt, throwing-stub-callers, obsolescence-audit — all pass
  • AC grep: rg "memorySearch|pdfModel|pdfMaxBytesMb|pdfMaxPages" src/ returns only references in new rejection tests

LIVE=1 pnpm test:live skipped because changes do not touch src/middleware/.

🤖 Generated with Claude Code

Consolidates middleware-not-platform boundary: removes 8 z.unknown() stubs
describing LLM-platform concerns (api/compat model routing, memory backend,
memorySearch/RAG, pdfModel/pdfMax* tool limits) and all paired surfaces
(TS types, help/label entries, test assertions, dead passthrough).

No migration infrastructure added — features were gutted months ago, so
configs carrying these fields now fail zod strict validation with
"Unrecognized key", signalling a one-time manual edit.

Removals:
- zod-schema.core.ts: ModelDefinition{.api,.compat} + ModelProvider.api
- zod-schema.agent-defaults.ts: pdfModel/pdfMaxBytesMb/pdfMaxPages + memorySearch stubs
- zod-schema.ts: top-level memory stub
- zod-schema.agent-runtime.ts: full MemorySearchSchema + AgentEntry.memorySearch
- types.agent-defaults.ts + types.agents.ts: pdfModel/pdfMax*/memorySearch declarations
- schema.help.ts (~50 entries) + schema.labels.ts (~50 entries): memorySearch/pdf/memory docs
- schema.help.quality.test.ts: memorySearch path assertions + "memory" ROOT_SECTION
- agent-scope.ts: dead memorySearch passthrough in ResolvedAgentConfig

Obsolete compat-stub tests removed:
- config.schema-regressions.test.ts: legacy memorySearch / pdf* accept tests
- config.secrets-schema.test.ts: legacy model provider api tolerance test
- config-misc.test.ts: legacy api/compat fields accept test
- status.scan.test.ts: two zombie tests mocking a non-existent deps module

Replaced sensitive-path fixtures in redact-snapshot tests: memorySearch.remote.apiKey
→ models.providers.{openai,anthropic}.apiKey (still sensitive, still exists).

New adversarial regression tests in config-misc.test.ts verify each cluster
gets rejected with "Unrecognized key": top-level memory, defaults.memorySearch,
per-agent memorySearch, defaults.pdfModel + pdf limits, ModelDefinition.api/compat,
ModelProvider.api.

Generated artifacts regenerated: schema.base.generated.ts, config-baseline.json.

Closes #2489

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit 4e7f32c into main Apr 23, 2026
15 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/2489-llm-platform-zunknown-stubs branch April 23, 2026 06:55
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.

gut(config): remove remaining LLM-platform z.unknown() stubs — middleware-not-platform consolidation

1 participant