Skip to content

refactor(providers): land the three Phase 8 conformance preconditions - #1105

Merged
Astro-Han merged 1 commit into
mainfrom
refactor/providers-phase8-closeout
Jul 16, 2026
Merged

Astro-Han merged 1 commit into
mainfrom
refactor/providers-phase8-closeout

Conversation

@Astro-Han

Copy link
Copy Markdown
Contributor

Summary

Part of #860 (Phase 8). Lands the three Phase 8 preconditions recorded when #974 merged, so the overlapping hand-written conformance coverage can be consolidated in a follow-up without losing any contract:

  1. Per-cell credential cases for optional_api_key discovery. The matrix plan now derives auth: 'optional' for optional_api_key providers (LocalAI), alongside 'default' and 'none'. The generated discovery executor expands optional into two executed branches: a configured key must reach the wire as Authorization: Bearer …, and an absent key must leave the request completely credential-free (no dummy value). 'none' (Ollama, LM Studio, public lists) keeps asserting that no credential header is ever sent.

  2. Executable override bindings replace the textual title check. Override cells now bind to runnable entries in packages/runtime/src/__tests__/provider-contract-overrides.ts, and the matrix suite executes each binding directly as a test. The previous mechanism asserted that a bound test title existed as an enabled test(...) call in another source file — a textual check that a fully commented-out test could still satisfy. The bound hand-written tests (GitHub Copilot discovery + subscription wire, Fireworks pagination discovery, Ollama /api/tags discovery, Cohere native V2 pagination, ZenMux streamed signed-reasoning replay) moved verbatim out of provider-conformance.test.ts / model-fetcher.test.ts into the bindings module, so each contract executes exactly once and deleting or breaking an override fails the matrix instead of leaving a silent gap. Shared scripted-HTTP plumbing moved to conformance-harness.ts.

  3. apiProtocol declaration lift retires the /^gpt-5/i routing regex in runtime. The OpenAI-adapter protocol split is now declared once in core as openAiAdapterApiProtocol() (documented against the existing ModelInfo.apiProtocol seam). model-factory routes by the connection's stored per-model apiProtocol when present (account-advertised wire, same as the GitHub Copilot case) and otherwise by the core declaration; the matrix's sample-model-id derivation consumes the same declaration instead of duplicating the regex. Behavior is unchanged: gpt-5* still goes to the Responses API, everything else to Chat Completions, now locked by a wire test.

Verification

  • npm run typecheck — all workspaces pass.
  • npm run test:scripts — 109/109 pass.
  • Workspace tests: @maka/core 1066 pass, @maka/storage 286 pass (1 skipped), @maka/runtime 1973 pass (7 skipped/todo), @maka/headless 1022 pass (1 skipped), maka-agent (CLI) 412 pass, @maka/desktop 2571 pass — 0 failures everywhere.
  • npm run check:stale — dist is fresh; git diff --check clean.
  • Matrix gap report stays green: every ready-provider dimension is generated, bound to an executed override, or justified N/A; new targeted tests cover optional derivation (localai), both LocalAI credential branches, and OpenAI gpt-5*/other wire routing.

Review focus

  • The override binding bodies are verbatim moves (imports adjusted to the shared harness); reviewing them as moves keeps the diff small.
  • getAIModel's openai case now consults connection.models[].apiProtocol first. No current discovery path stores apiProtocol for the openai provider type, so this is behavior-preserving today; it exists so an account-advertised wire wins over the static declaration, mirroring the GitHub Copilot case.

Part of #860 (Phase 8), closing the preconditions recorded in #974:

- optional_api_key discovery cells now derive auth: 'optional' and the
  generated matrix executes both credential branches (configured key
  reaches the wire; absent key sends no credential at all).
- Override cells now bind to executable runs in
  provider-contract-overrides.ts that the matrix suite executes
  directly, replacing the textual test-title source check; the bound
  hand-written tests moved out of provider-conformance.test.ts /
  model-fetcher.test.ts so each contract runs exactly once.
- The /^gpt-5/i Responses routing regex is lifted into the
  openAiAdapterApiProtocol declaration in core (ModelInfo.apiProtocol
  seam); runtime model-factory and the matrix sample-id derivation both
  consume the declaration, with a wire test locking gpt-5*->Responses
  and other ids->Chat Completions.
@Astro-Han
Astro-Han merged commit ad04d64 into main Jul 16, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the refactor/providers-phase8-closeout branch July 16, 2026 10:44
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