Skip to content

feat: characterize directed protocol compatibility with executable contracts - #11325

Merged
lpcox merged 6 commits into
mainfrom
copilot/feat-characterize-directed-protocol-compatibility
Nov 8, 2026
Merged

lpcox merged 6 commits into
mainfrom
copilot/feat-characterize-directed-protocol-compatibility

Conversation

Copilot AI commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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 /reflect integration.

  • Directed contracts

    • Six implemented request/return-response directions, with typed, immutable feature evidence.
    • Explicit supported, conditional, rejected and unknown states; conditions, normalizations and sanitized reasons.
    • SHA-256 implementation pins detect translator drift. Assessments perform no inference, discovery or model selection.
  • Executable characterization

    • Provider-free fixtures exercise requests, JSON responses, usage and SSE, including chunk boundaries, tool-call assembly, completion and upstream errors.
    • Check semantic output and exact rejection code/feature.
    • Preserve known discrepancies as fixtures: nested-field loss, clamping/default insertion, ignored reasoning, multiple-refusal loss and unsupported terminal events.
  • Distribution and handoff

    • Ship the dependency-free module and TypeScript declarations in the sidecar; validate its actual Docker COPY layout.
    • Expose one existing translator function without changing translation behavior.
    • Document conditions, gaps and deferred fallback/reflection consumers.

Direction asymmetry remains explicit:

assessFeature({
  source: 'anthropic_messages',
  target: 'chat_completions',
  direction: 'request',
  feature: 'message_text',
}).status; // 'unknown' — only the return path is implemented

Copilot AI changed the title [WIP] Characterize directed protocol compatibility with contracts and fixtures feat: characterize directed protocol compatibility with executable contracts Nov 8, 2026
Copilot AI requested a review from lpcox November 8, 2026 18:20
@lpcox
lpcox marked this pull request as ready for review November 8, 2026 18:20
Copilot AI adaptive review requested due to automatic review settings November 8, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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)

Comment on lines +78 to +84
['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.'],
Comment on lines +81 to +82
['Only function calls with names, identifiers and string arguments are present.'],
['Function call nesting changes; IDs and argument strings are retained.'],
@lpcox

lpcox commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed the review feedback in 07ae082: corrected the nested response.failed fixture, narrowed JSON argument conditions, and characterized the Responses SSE argument loss.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11325 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 8632353

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

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>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.80% 93.81% 📈 +0.01%
Statements 92.35% 92.36% 📈 +0.01%
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/enclave/host-executor-server.ts 91.2% → 91.2% (+0.00%) 89.8% → 90.1% (+0.29%)
src/commands/main-action.ts 91.7% → 92.0% (+0.25%) 91.4% → 91.7% (+0.24%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox
lpcox merged commit 5d6f82a into main Nov 8, 2026
39 checks passed
@lpcox
lpcox deleted the copilot/feat-characterize-directed-protocol-compatibility branch November 8, 2026 19:43
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.

feat: characterize directed protocol compatibility with shared contracts and translator fixtures

4 participants