Repository navigation
feat: characterize directed protocol compatibility with executable contracts - #11325
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The failure fixture uses the wrong error envelope, and argument-retention claims do not account for JSON defaulting empty strings or SSE dropping initial arguments.
3 open issues
What changed in this PR
Adds executable, directional compatibility contracts for the API proxy’s existing translators, supporting future fallback and diagnostics work without changing routing or translation behavior.
Changes:
- Defines six immutable, typed contracts with feature evidence and implementation hashes.
- Adds provider-free request, response, usage and streaming fixtures, including known translation gaps.
- Ships the contracts in the sidecar and validates packaging and TypeScript declarations.
| File | Description |
|---|---|
docs/api-proxy-sidecar.md |
Documents contracts, feature boundaries, known gaps and deferred consumers. |
containers/api-proxy/wire-api-compat.js |
Exports the existing Chat request translator. |
containers/api-proxy/protocol-compatibility/index.js |
Defines directed contracts and read-only feature assessment. |
containers/api-proxy/protocol-compatibility/index.d.ts |
Declares immutable contract and assessment types. |
containers/api-proxy/protocol-compatibility.test.js |
Exercises contracts against actual translator behavior. |
containers/api-proxy/protocol-compatibility.packaging.test.js |
Checks declarations and staged Docker packaging. |
containers/api-proxy/fixtures/protocol-compatibility/streams.js |
Supplies streaming, tool-call, usage and error fixtures. |
containers/api-proxy/fixtures/protocol-compatibility/responses.js |
Supplies JSON response and usage fixtures. |
containers/api-proxy/fixtures/protocol-compatibility/requests.js |
Supplies request translation and rejection fixtures. |
containers/api-proxy/fixtures/protocol-compatibility/gaps.js |
Records existing semantic discrepancies. |
containers/api-proxy/fixtures/protocol-compatibility/contract-types.ts |
Checks public types and readonly guarantees. |
containers/api-proxy/Dockerfile |
Includes the contract module in the sidecar image. |
Review effort: Balanced (auto)
| ['responses-to-chat-return', { type: 'response.failed', error: { code: 'fixture_error', message: 'upstream failed' } }], | ||
| ['messages-to-chat-return', { type: 'error', error: { type: 'fixture_error', message: 'upstream failed' } }], | ||
| ]) { | ||
| cases.push({ | ||
| name: `${contract}: upstream error without synthetic completion`, | ||
| contract, features: ['streaming'], input: frame(event), | ||
| summary: { text: '', refusal: '', calls: [], finish: null, usage: undefined, done: false, errors: [event.error] }, |
| const wireReturns = { | ||
| message_text: supported('Known text output is retained in an assistant message.'), | ||
| function_tools: conditional( | ||
| ['Only function calls with names, identifiers and string arguments are present.'], |
| ['Only function calls with names, identifiers and string arguments are present.'], | ||
| ['Function call nesting changes; IDs and argument strings are retained.'], |
|
@copilot address review feedback |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
✅ Copilot review passed with no inline comments. @copilot Add the |
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 8632353 |
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 93.81% | 93.80% | 📉 -0.01% |
| Statements | 92.35% | 92.35% | ➡️ +0.00% |
| Functions | 93.02% | 93.02% | ➡️ +0.00% |
| Branches | 86.69% | 86.69% | ➡️ +0.00% |
📁 Per-file Coverage Changes (2 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/commands/main-action.ts |
92.0% → 91.7% (-0.25%) | 91.7% → 91.4% (-0.24%) |
src/enclave/host-executor-server.ts |
91.2% → 91.2% (+0.00%) | 89.8% → 90.1% (+0.29%) |
Coverage comparison generated by scripts/ci/compare-coverage.ts
…fect' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |

Make existing translator boundaries explicit without deriving compatibility from model metadata or opposite-direction success. This slice adds executable contracts and characterization—not fallback filtering or
/reflectintegration.Directed contracts
Executable characterization
Distribution and handoff
COPYlayout.Direction asymmetry remains explicit: