Skip to content

test(cu): hold the two argument schemas against each other - #1870

Merged
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check
Aug 3, 2026
Merged

test(cu): hold the two argument schemas against each other#1870
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check

Conversation

@hqhq1025

Copy link
Copy Markdown
Contributor

Two schemas, written by hand, with nothing comparing them

SchemaWhat it isWhat a field there buys
computerWireParamsflat object the SDK validates a model's call againstthe call is accepted off the wire
computerParamsstrict discriminated union the tool narrows tothe call survives narrowing

A field has to exist in both. A field present in the union and absent from the wire makes its action unreachable.

Why that failure is silent

model sends the action
→ SDK rejects it against computerWireParams ← above the debug journal
→ never reaches the tool
unit tests construct computerParams directly ← never touch the wire
real-machine probes call the backend directly ← go around the tool entirely

Three layers of coverage, none of which can see the gap.

What this adds

A test that walks computerParams.options and asserts every arm's field names are a subset of computerWireParams.shape — walking rather than sampling, because the next gap will be an action nobody thought to sample.

It passes on main today. This is a guard, not a bug report.

The third case is a negative control: it runs the same comparison against a deliberately broken pair and asserts it reports the gap, so a green result means the check ran rather than that it had nothing to say.

computerWireParams becomes exported for this — it is the only thing that can tell the two schemas apart.

Verification

packages/runtime clean rebuild against current main; all 89 computer-use-* tests pass.

@Astro-HanAstro-Han 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.

P2. The action-name direction is not held. Test 2 is named "the union covers every action name", but its body only asserts arms.length > 0 and action !== 'undefined'. Add a new arm to computerParams (every field already exists on the wire) or add a name to CU_ACTION_TYPES without a matching arm: all three tests stay green. This is exactly the window_action failure class the file's own doc comment cites. Compare wire.shape.action.options against the arm literals in both subset directions.

P2. A third, handwritten action catalog is outside the parity test. computerUseApprovalSummary (packages/core/src/computer-use.ts:254-280, consumed at packages/runtime/src/tool-runtime.ts:775-777 and packages/runtime/src/pi-agent-backend.ts:456-458) downgrades any unknown action to unknown in persisted audit records and disables turn-level remember. An action added to both schemas passes this test while silently degrading those consumers. Either walk computerParams and assert computerUseApprovalSummary({ action }).action === action, or derive wire, union, and approval sets from one shared constant.

P3. Comparison is name-only; a field type drift (e.g. duration becomes z.string() in the union while the wire keeps z.number()) is invisible.

P3. The negative control rebuilds Set/pretend by hand and never exercises the zod introspection (unionArms, .shape, literal .value) that the real test depends on. A zod upgrade that makes extraction return empty would pass both. Have the comparator take real zod schemas and feed it a deliberately broken schema.

@hqhq1025
hqhq1025force-pushed the pr/schema-parity-check branch from 2b258da to 49751cbCompareAugust 2, 2026 08:18
`maka_computer` takes arguments through two hand-written schemas.
`computerWireParams` is the flat object the SDK validates a model's call
against — one shape covering every action, most fields optional.
`computerParams` is the strict discriminated union the tool narrows to before
it does anything. A field has to exist in both: the first to be accepted off
the wire, the second to survive narrowing.
Nothing checks that they agree, and the failure mode is silent in an unusual
way. A field present in the union and absent from the wire makes its action
unreachable, and no test notices: the SDK rejects those calls above the layer
the debug journal records, the unit tests exercise the union directly, and a
real-machine probe goes around the tool entirely.
This walks the union rather than sampling it, because the next gap will be an
action nobody thought to sample. It passes on main today — this is a guard,
not a bug report. The third case proves the comparison can fail, so that a
green result means something.
`computerWireParams` becomes exported for this. It is the only thing that can
tell the two schemas apart.
…alog too
Review found the first version did not hold the thing its own name claimed.
Test 2 was called "the union covers every action name" and asserted only that
there were arms and that each discriminated on something. Adding an arm, or a
wire action with no arm, left all three tests green — which is exactly the
`window_action` failure class the file's doc comment cites.
It now compares the wire enum against the arm literals in both directions,
because each direction is a different failure. An arm the wire cannot name is
unreachable. A wire name with no arm is accepted off the wire and then falls
through narrowing, which reaches the model as a validation error naming
nothing it did wrong. Removing one action from the wire enum now fails.
A third handwritten catalog was outside the check entirely.
`computerUseApprovalSummary` downgrades an action it does not know to
`unknown`, and that value is what lands in the persisted audit record and what
turn-level remember is keyed on. An action added to both schemas passed every
check here while silently degrading those consumers.
The negative control also built its own arrays and never touched the zod
introspection the real checks depend on, so a zod upgrade that made extraction
return nothing would have passed the control while the real checks compared
two empty sets. The control now runs the same comparator, and a separate test
asserts the readers return something from the actual schemas.
Sign up for freeto 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

@hqhq1025@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
test(cu): hold the two argument schemas against each other by hqhq1025 · Pull Request #1870 · apache/maka · GitHub
Skip to content

test(cu): hold the two argument schemas against each other - #1870

Merged
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check
Aug 3, 2026
Merged

test(cu): hold the two argument schemas against each other#1870
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check

Conversation

@hqhq1025

Copy link
Copy Markdown
Contributor

Two schemas, written by hand, with nothing comparing them

SchemaWhat it isWhat a field there buys
computerWireParamsflat object the SDK validates a model's call againstthe call is accepted off the wire
computerParamsstrict discriminated union the tool narrows tothe call survives narrowing

A field has to exist in both. A field present in the union and absent from the wire makes its action unreachable.

Why that failure is silent

model sends the action
→ SDK rejects it against computerWireParams ← above the debug journal
→ never reaches the tool
unit tests construct computerParams directly ← never touch the wire
real-machine probes call the backend directly ← go around the tool entirely

Three layers of coverage, none of which can see the gap.

What this adds

A test that walks computerParams.options and asserts every arm's field names are a subset of computerWireParams.shape — walking rather than sampling, because the next gap will be an action nobody thought to sample.

It passes on main today. This is a guard, not a bug report.

The third case is a negative control: it runs the same comparison against a deliberately broken pair and asserts it reports the gap, so a green result means the check ran rather than that it had nothing to say.

computerWireParams becomes exported for this — it is the only thing that can tell the two schemas apart.

Verification

packages/runtime clean rebuild against current main; all 89 computer-use-* tests pass.

@Astro-HanAstro-Han 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.

P2. The action-name direction is not held. Test 2 is named "the union covers every action name", but its body only asserts arms.length > 0 and action !== 'undefined'. Add a new arm to computerParams (every field already exists on the wire) or add a name to CU_ACTION_TYPES without a matching arm: all three tests stay green. This is exactly the window_action failure class the file's own doc comment cites. Compare wire.shape.action.options against the arm literals in both subset directions.

P2. A third, handwritten action catalog is outside the parity test. computerUseApprovalSummary (packages/core/src/computer-use.ts:254-280, consumed at packages/runtime/src/tool-runtime.ts:775-777 and packages/runtime/src/pi-agent-backend.ts:456-458) downgrades any unknown action to unknown in persisted audit records and disables turn-level remember. An action added to both schemas passes this test while silently degrading those consumers. Either walk computerParams and assert computerUseApprovalSummary({ action }).action === action, or derive wire, union, and approval sets from one shared constant.

P3. Comparison is name-only; a field type drift (e.g. duration becomes z.string() in the union while the wire keeps z.number()) is invisible.

P3. The negative control rebuilds Set/pretend by hand and never exercises the zod introspection (unionArms, .shape, literal .value) that the real test depends on. A zod upgrade that makes extraction return empty would pass both. Have the comparator take real zod schemas and feed it a deliberately broken schema.

@hqhq1025
hqhq1025force-pushed the pr/schema-parity-check branch from 2b258da to 49751cbCompareAugust 2, 2026 08:18
`maka_computer` takes arguments through two hand-written schemas.
`computerWireParams` is the flat object the SDK validates a model's call
against — one shape covering every action, most fields optional.
`computerParams` is the strict discriminated union the tool narrows to before
it does anything. A field has to exist in both: the first to be accepted off
the wire, the second to survive narrowing.
Nothing checks that they agree, and the failure mode is silent in an unusual
way. A field present in the union and absent from the wire makes its action
unreachable, and no test notices: the SDK rejects those calls above the layer
the debug journal records, the unit tests exercise the union directly, and a
real-machine probe goes around the tool entirely.
This walks the union rather than sampling it, because the next gap will be an
action nobody thought to sample. It passes on main today — this is a guard,
not a bug report. The third case proves the comparison can fail, so that a
green result means something.
`computerWireParams` becomes exported for this. It is the only thing that can
tell the two schemas apart.
…alog too
Review found the first version did not hold the thing its own name claimed.
Test 2 was called "the union covers every action name" and asserted only that
there were arms and that each discriminated on something. Adding an arm, or a
wire action with no arm, left all three tests green — which is exactly the
`window_action` failure class the file's doc comment cites.
It now compares the wire enum against the arm literals in both directions,
because each direction is a different failure. An arm the wire cannot name is
unreachable. A wire name with no arm is accepted off the wire and then falls
through narrowing, which reaches the model as a validation error naming
nothing it did wrong. Removing one action from the wire enum now fails.
A third handwritten catalog was outside the check entirely.
`computerUseApprovalSummary` downgrades an action it does not know to
`unknown`, and that value is what lands in the persisted audit record and what
turn-level remember is keyed on. An action added to both schemas passed every
check here while silently degrading those consumers.
The negative control also built its own arrays and never touched the zod
introspection the real checks depend on, so a zod upgrade that made extraction
return nothing would have passed the control while the real checks compared
two empty sets. The control now runs the same comparator, and a separate test
asserts the readers return something from the actual schemas.
Sign up for freeto 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

@hqhq1025@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' test(cu): hold the two argument schemas against each other by hqhq1025 · Pull Request #1870 · apache/maka · GitHub
Skip to content

test(cu): hold the two argument schemas against each other - #1870

Merged
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check
Aug 3, 2026
Merged

test(cu): hold the two argument schemas against each other#1870
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check

Conversation

@hqhq1025

Copy link
Copy Markdown
Contributor

Two schemas, written by hand, with nothing comparing them

SchemaWhat it isWhat a field there buys
computerWireParamsflat object the SDK validates a model's call againstthe call is accepted off the wire
computerParamsstrict discriminated union the tool narrows tothe call survives narrowing

A field has to exist in both. A field present in the union and absent from the wire makes its action unreachable.

Why that failure is silent

model sends the action
→ SDK rejects it against computerWireParams ← above the debug journal
→ never reaches the tool
unit tests construct computerParams directly ← never touch the wire
real-machine probes call the backend directly ← go around the tool entirely

Three layers of coverage, none of which can see the gap.

What this adds

A test that walks computerParams.options and asserts every arm's field names are a subset of computerWireParams.shape — walking rather than sampling, because the next gap will be an action nobody thought to sample.

It passes on main today. This is a guard, not a bug report.

The third case is a negative control: it runs the same comparison against a deliberately broken pair and asserts it reports the gap, so a green result means the check ran rather than that it had nothing to say.

computerWireParams becomes exported for this — it is the only thing that can tell the two schemas apart.

Verification

packages/runtime clean rebuild against current main; all 89 computer-use-* tests pass.

@Astro-HanAstro-Han 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.

P2. The action-name direction is not held. Test 2 is named "the union covers every action name", but its body only asserts arms.length > 0 and action !== 'undefined'. Add a new arm to computerParams (every field already exists on the wire) or add a name to CU_ACTION_TYPES without a matching arm: all three tests stay green. This is exactly the window_action failure class the file's own doc comment cites. Compare wire.shape.action.options against the arm literals in both subset directions.

P2. A third, handwritten action catalog is outside the parity test. computerUseApprovalSummary (packages/core/src/computer-use.ts:254-280, consumed at packages/runtime/src/tool-runtime.ts:775-777 and packages/runtime/src/pi-agent-backend.ts:456-458) downgrades any unknown action to unknown in persisted audit records and disables turn-level remember. An action added to both schemas passes this test while silently degrading those consumers. Either walk computerParams and assert computerUseApprovalSummary({ action }).action === action, or derive wire, union, and approval sets from one shared constant.

P3. Comparison is name-only; a field type drift (e.g. duration becomes z.string() in the union while the wire keeps z.number()) is invisible.

P3. The negative control rebuilds Set/pretend by hand and never exercises the zod introspection (unionArms, .shape, literal .value) that the real test depends on. A zod upgrade that makes extraction return empty would pass both. Have the comparator take real zod schemas and feed it a deliberately broken schema.

@hqhq1025
hqhq1025force-pushed the pr/schema-parity-check branch from 2b258da to 49751cbCompareAugust 2, 2026 08:18
`maka_computer` takes arguments through two hand-written schemas.
`computerWireParams` is the flat object the SDK validates a model's call
against — one shape covering every action, most fields optional.
`computerParams` is the strict discriminated union the tool narrows to before
it does anything. A field has to exist in both: the first to be accepted off
the wire, the second to survive narrowing.
Nothing checks that they agree, and the failure mode is silent in an unusual
way. A field present in the union and absent from the wire makes its action
unreachable, and no test notices: the SDK rejects those calls above the layer
the debug journal records, the unit tests exercise the union directly, and a
real-machine probe goes around the tool entirely.
This walks the union rather than sampling it, because the next gap will be an
action nobody thought to sample. It passes on main today — this is a guard,
not a bug report. The third case proves the comparison can fail, so that a
green result means something.
`computerWireParams` becomes exported for this. It is the only thing that can
tell the two schemas apart.
…alog too
Review found the first version did not hold the thing its own name claimed.
Test 2 was called "the union covers every action name" and asserted only that
there were arms and that each discriminated on something. Adding an arm, or a
wire action with no arm, left all three tests green — which is exactly the
`window_action` failure class the file's doc comment cites.
It now compares the wire enum against the arm literals in both directions,
because each direction is a different failure. An arm the wire cannot name is
unreachable. A wire name with no arm is accepted off the wire and then falls
through narrowing, which reaches the model as a validation error naming
nothing it did wrong. Removing one action from the wire enum now fails.
A third handwritten catalog was outside the check entirely.
`computerUseApprovalSummary` downgrades an action it does not know to
`unknown`, and that value is what lands in the persisted audit record and what
turn-level remember is keyed on. An action added to both schemas passed every
check here while silently degrading those consumers.
The negative control also built its own arrays and never touched the zod
introspection the real checks depend on, so a zod upgrade that made extraction
return nothing would have passed the control while the real checks compared
two empty sets. The control now runs the same comparator, and a separate test
asserts the readers return something from the actual schemas.
Sign up for freeto 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

@hqhq1025@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' test(cu): hold the two argument schemas against each other by hqhq1025 · Pull Request #1870 · apache/maka · GitHub
Skip to content

test(cu): hold the two argument schemas against each other - #1870

Merged
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check
Aug 3, 2026
Merged

test(cu): hold the two argument schemas against each other#1870
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check

Conversation

@hqhq1025

Copy link
Copy Markdown
Contributor

Two schemas, written by hand, with nothing comparing them

SchemaWhat it isWhat a field there buys
computerWireParamsflat object the SDK validates a model's call againstthe call is accepted off the wire
computerParamsstrict discriminated union the tool narrows tothe call survives narrowing

A field has to exist in both. A field present in the union and absent from the wire makes its action unreachable.

Why that failure is silent

model sends the action
→ SDK rejects it against computerWireParams ← above the debug journal
→ never reaches the tool
unit tests construct computerParams directly ← never touch the wire
real-machine probes call the backend directly ← go around the tool entirely

Three layers of coverage, none of which can see the gap.

What this adds

A test that walks computerParams.options and asserts every arm's field names are a subset of computerWireParams.shape — walking rather than sampling, because the next gap will be an action nobody thought to sample.

It passes on main today. This is a guard, not a bug report.

The third case is a negative control: it runs the same comparison against a deliberately broken pair and asserts it reports the gap, so a green result means the check ran rather than that it had nothing to say.

computerWireParams becomes exported for this — it is the only thing that can tell the two schemas apart.

Verification

packages/runtime clean rebuild against current main; all 89 computer-use-* tests pass.

@Astro-HanAstro-Han 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.

P2. The action-name direction is not held. Test 2 is named "the union covers every action name", but its body only asserts arms.length > 0 and action !== 'undefined'. Add a new arm to computerParams (every field already exists on the wire) or add a name to CU_ACTION_TYPES without a matching arm: all three tests stay green. This is exactly the window_action failure class the file's own doc comment cites. Compare wire.shape.action.options against the arm literals in both subset directions.

P2. A third, handwritten action catalog is outside the parity test. computerUseApprovalSummary (packages/core/src/computer-use.ts:254-280, consumed at packages/runtime/src/tool-runtime.ts:775-777 and packages/runtime/src/pi-agent-backend.ts:456-458) downgrades any unknown action to unknown in persisted audit records and disables turn-level remember. An action added to both schemas passes this test while silently degrading those consumers. Either walk computerParams and assert computerUseApprovalSummary({ action }).action === action, or derive wire, union, and approval sets from one shared constant.

P3. Comparison is name-only; a field type drift (e.g. duration becomes z.string() in the union while the wire keeps z.number()) is invisible.

P3. The negative control rebuilds Set/pretend by hand and never exercises the zod introspection (unionArms, .shape, literal .value) that the real test depends on. A zod upgrade that makes extraction return empty would pass both. Have the comparator take real zod schemas and feed it a deliberately broken schema.

@hqhq1025
hqhq1025force-pushed the pr/schema-parity-check branch from 2b258da to 49751cbCompareAugust 2, 2026 08:18
`maka_computer` takes arguments through two hand-written schemas.
`computerWireParams` is the flat object the SDK validates a model's call
against — one shape covering every action, most fields optional.
`computerParams` is the strict discriminated union the tool narrows to before
it does anything. A field has to exist in both: the first to be accepted off
the wire, the second to survive narrowing.
Nothing checks that they agree, and the failure mode is silent in an unusual
way. A field present in the union and absent from the wire makes its action
unreachable, and no test notices: the SDK rejects those calls above the layer
the debug journal records, the unit tests exercise the union directly, and a
real-machine probe goes around the tool entirely.
This walks the union rather than sampling it, because the next gap will be an
action nobody thought to sample. It passes on main today — this is a guard,
not a bug report. The third case proves the comparison can fail, so that a
green result means something.
`computerWireParams` becomes exported for this. It is the only thing that can
tell the two schemas apart.
…alog too
Review found the first version did not hold the thing its own name claimed.
Test 2 was called "the union covers every action name" and asserted only that
there were arms and that each discriminated on something. Adding an arm, or a
wire action with no arm, left all three tests green — which is exactly the
`window_action` failure class the file's doc comment cites.
It now compares the wire enum against the arm literals in both directions,
because each direction is a different failure. An arm the wire cannot name is
unreachable. A wire name with no arm is accepted off the wire and then falls
through narrowing, which reaches the model as a validation error naming
nothing it did wrong. Removing one action from the wire enum now fails.
A third handwritten catalog was outside the check entirely.
`computerUseApprovalSummary` downgrades an action it does not know to
`unknown`, and that value is what lands in the persisted audit record and what
turn-level remember is keyed on. An action added to both schemas passed every
check here while silently degrading those consumers.
The negative control also built its own arrays and never touched the zod
introspection the real checks depend on, so a zod upgrade that made extraction
return nothing would have passed the control while the real checks compared
two empty sets. The control now runs the same comparator, and a separate test
asserts the readers return something from the actual schemas.
Sign up for freeto 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

@hqhq1025@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' test(cu): hold the two argument schemas against each other by hqhq1025 · Pull Request #1870 · apache/maka · GitHub
Skip to content

test(cu): hold the two argument schemas against each other - #1870

Merged
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check
Aug 3, 2026
Merged

test(cu): hold the two argument schemas against each other#1870
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check

Conversation

@hqhq1025

Copy link
Copy Markdown
Contributor

Two schemas, written by hand, with nothing comparing them

SchemaWhat it isWhat a field there buys
computerWireParamsflat object the SDK validates a model's call againstthe call is accepted off the wire
computerParamsstrict discriminated union the tool narrows tothe call survives narrowing

A field has to exist in both. A field present in the union and absent from the wire makes its action unreachable.

Why that failure is silent

model sends the action
→ SDK rejects it against computerWireParams ← above the debug journal
→ never reaches the tool
unit tests construct computerParams directly ← never touch the wire
real-machine probes call the backend directly ← go around the tool entirely

Three layers of coverage, none of which can see the gap.

What this adds

A test that walks computerParams.options and asserts every arm's field names are a subset of computerWireParams.shape — walking rather than sampling, because the next gap will be an action nobody thought to sample.

It passes on main today. This is a guard, not a bug report.

The third case is a negative control: it runs the same comparison against a deliberately broken pair and asserts it reports the gap, so a green result means the check ran rather than that it had nothing to say.

computerWireParams becomes exported for this — it is the only thing that can tell the two schemas apart.

Verification

packages/runtime clean rebuild against current main; all 89 computer-use-* tests pass.

@Astro-HanAstro-Han 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.

P2. The action-name direction is not held. Test 2 is named "the union covers every action name", but its body only asserts arms.length > 0 and action !== 'undefined'. Add a new arm to computerParams (every field already exists on the wire) or add a name to CU_ACTION_TYPES without a matching arm: all three tests stay green. This is exactly the window_action failure class the file's own doc comment cites. Compare wire.shape.action.options against the arm literals in both subset directions.

P2. A third, handwritten action catalog is outside the parity test. computerUseApprovalSummary (packages/core/src/computer-use.ts:254-280, consumed at packages/runtime/src/tool-runtime.ts:775-777 and packages/runtime/src/pi-agent-backend.ts:456-458) downgrades any unknown action to unknown in persisted audit records and disables turn-level remember. An action added to both schemas passes this test while silently degrading those consumers. Either walk computerParams and assert computerUseApprovalSummary({ action }).action === action, or derive wire, union, and approval sets from one shared constant.

P3. Comparison is name-only; a field type drift (e.g. duration becomes z.string() in the union while the wire keeps z.number()) is invisible.

P3. The negative control rebuilds Set/pretend by hand and never exercises the zod introspection (unionArms, .shape, literal .value) that the real test depends on. A zod upgrade that makes extraction return empty would pass both. Have the comparator take real zod schemas and feed it a deliberately broken schema.

@hqhq1025
hqhq1025force-pushed the pr/schema-parity-check branch from 2b258da to 49751cbCompareAugust 2, 2026 08:18
`maka_computer` takes arguments through two hand-written schemas.
`computerWireParams` is the flat object the SDK validates a model's call
against — one shape covering every action, most fields optional.
`computerParams` is the strict discriminated union the tool narrows to before
it does anything. A field has to exist in both: the first to be accepted off
the wire, the second to survive narrowing.
Nothing checks that they agree, and the failure mode is silent in an unusual
way. A field present in the union and absent from the wire makes its action
unreachable, and no test notices: the SDK rejects those calls above the layer
the debug journal records, the unit tests exercise the union directly, and a
real-machine probe goes around the tool entirely.
This walks the union rather than sampling it, because the next gap will be an
action nobody thought to sample. It passes on main today — this is a guard,
not a bug report. The third case proves the comparison can fail, so that a
green result means something.
`computerWireParams` becomes exported for this. It is the only thing that can
tell the two schemas apart.
…alog too
Review found the first version did not hold the thing its own name claimed.
Test 2 was called "the union covers every action name" and asserted only that
there were arms and that each discriminated on something. Adding an arm, or a
wire action with no arm, left all three tests green — which is exactly the
`window_action` failure class the file's doc comment cites.
It now compares the wire enum against the arm literals in both directions,
because each direction is a different failure. An arm the wire cannot name is
unreachable. A wire name with no arm is accepted off the wire and then falls
through narrowing, which reaches the model as a validation error naming
nothing it did wrong. Removing one action from the wire enum now fails.
A third handwritten catalog was outside the check entirely.
`computerUseApprovalSummary` downgrades an action it does not know to
`unknown`, and that value is what lands in the persisted audit record and what
turn-level remember is keyed on. An action added to both schemas passed every
check here while silently degrading those consumers.
The negative control also built its own arrays and never touched the zod
introspection the real checks depend on, so a zod upgrade that made extraction
return nothing would have passed the control while the real checks compared
two empty sets. The control now runs the same comparator, and a separate test
asserts the readers return something from the actual schemas.
Sign up for freeto 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

@hqhq1025@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' test(cu): hold the two argument schemas against each other by hqhq1025 · Pull Request #1870 · apache/maka · GitHub
Skip to content

test(cu): hold the two argument schemas against each other - #1870

Merged
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check
Aug 3, 2026
Merged

test(cu): hold the two argument schemas against each other#1870
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check

Conversation

@hqhq1025

Copy link
Copy Markdown
Contributor

Two schemas, written by hand, with nothing comparing them

SchemaWhat it isWhat a field there buys
computerWireParamsflat object the SDK validates a model's call againstthe call is accepted off the wire
computerParamsstrict discriminated union the tool narrows tothe call survives narrowing

A field has to exist in both. A field present in the union and absent from the wire makes its action unreachable.

Why that failure is silent

model sends the action
→ SDK rejects it against computerWireParams ← above the debug journal
→ never reaches the tool
unit tests construct computerParams directly ← never touch the wire
real-machine probes call the backend directly ← go around the tool entirely

Three layers of coverage, none of which can see the gap.

What this adds

A test that walks computerParams.options and asserts every arm's field names are a subset of computerWireParams.shape — walking rather than sampling, because the next gap will be an action nobody thought to sample.

It passes on main today. This is a guard, not a bug report.

The third case is a negative control: it runs the same comparison against a deliberately broken pair and asserts it reports the gap, so a green result means the check ran rather than that it had nothing to say.

computerWireParams becomes exported for this — it is the only thing that can tell the two schemas apart.

Verification

packages/runtime clean rebuild against current main; all 89 computer-use-* tests pass.

@Astro-HanAstro-Han 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.

P2. The action-name direction is not held. Test 2 is named "the union covers every action name", but its body only asserts arms.length > 0 and action !== 'undefined'. Add a new arm to computerParams (every field already exists on the wire) or add a name to CU_ACTION_TYPES without a matching arm: all three tests stay green. This is exactly the window_action failure class the file's own doc comment cites. Compare wire.shape.action.options against the arm literals in both subset directions.

P2. A third, handwritten action catalog is outside the parity test. computerUseApprovalSummary (packages/core/src/computer-use.ts:254-280, consumed at packages/runtime/src/tool-runtime.ts:775-777 and packages/runtime/src/pi-agent-backend.ts:456-458) downgrades any unknown action to unknown in persisted audit records and disables turn-level remember. An action added to both schemas passes this test while silently degrading those consumers. Either walk computerParams and assert computerUseApprovalSummary({ action }).action === action, or derive wire, union, and approval sets from one shared constant.

P3. Comparison is name-only; a field type drift (e.g. duration becomes z.string() in the union while the wire keeps z.number()) is invisible.

P3. The negative control rebuilds Set/pretend by hand and never exercises the zod introspection (unionArms, .shape, literal .value) that the real test depends on. A zod upgrade that makes extraction return empty would pass both. Have the comparator take real zod schemas and feed it a deliberately broken schema.

@hqhq1025
hqhq1025force-pushed the pr/schema-parity-check branch from 2b258da to 49751cbCompareAugust 2, 2026 08:18
`maka_computer` takes arguments through two hand-written schemas.
`computerWireParams` is the flat object the SDK validates a model's call
against — one shape covering every action, most fields optional.
`computerParams` is the strict discriminated union the tool narrows to before
it does anything. A field has to exist in both: the first to be accepted off
the wire, the second to survive narrowing.
Nothing checks that they agree, and the failure mode is silent in an unusual
way. A field present in the union and absent from the wire makes its action
unreachable, and no test notices: the SDK rejects those calls above the layer
the debug journal records, the unit tests exercise the union directly, and a
real-machine probe goes around the tool entirely.
This walks the union rather than sampling it, because the next gap will be an
action nobody thought to sample. It passes on main today — this is a guard,
not a bug report. The third case proves the comparison can fail, so that a
green result means something.
`computerWireParams` becomes exported for this. It is the only thing that can
tell the two schemas apart.
…alog too
Review found the first version did not hold the thing its own name claimed.
Test 2 was called "the union covers every action name" and asserted only that
there were arms and that each discriminated on something. Adding an arm, or a
wire action with no arm, left all three tests green — which is exactly the
`window_action` failure class the file's doc comment cites.
It now compares the wire enum against the arm literals in both directions,
because each direction is a different failure. An arm the wire cannot name is
unreachable. A wire name with no arm is accepted off the wire and then falls
through narrowing, which reaches the model as a validation error naming
nothing it did wrong. Removing one action from the wire enum now fails.
A third handwritten catalog was outside the check entirely.
`computerUseApprovalSummary` downgrades an action it does not know to
`unknown`, and that value is what lands in the persisted audit record and what
turn-level remember is keyed on. An action added to both schemas passed every
check here while silently degrading those consumers.
The negative control also built its own arrays and never touched the zod
introspection the real checks depend on, so a zod upgrade that made extraction
return nothing would have passed the control while the real checks compared
two empty sets. The control now runs the same comparator, and a separate test
asserts the readers return something from the actual schemas.
Sign up for freeto 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

@hqhq1025@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); test(cu): hold the two argument schemas against each other by hqhq1025 · Pull Request #1870 · apache/maka · GitHub
Skip to content

test(cu): hold the two argument schemas against each other - #1870

Merged
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check
Aug 3, 2026
Merged

test(cu): hold the two argument schemas against each other#1870
hqhq1025 merged 2 commits into
apache:mainfrom
hqhq1025:pr/schema-parity-check

Conversation

@hqhq1025

Copy link
Copy Markdown
Contributor

Two schemas, written by hand, with nothing comparing them

SchemaWhat it isWhat a field there buys
computerWireParamsflat object the SDK validates a model's call againstthe call is accepted off the wire
computerParamsstrict discriminated union the tool narrows tothe call survives narrowing

A field has to exist in both. A field present in the union and absent from the wire makes its action unreachable.

Why that failure is silent

model sends the action
→ SDK rejects it against computerWireParams ← above the debug journal
→ never reaches the tool
unit tests construct computerParams directly ← never touch the wire
real-machine probes call the backend directly ← go around the tool entirely

Three layers of coverage, none of which can see the gap.

What this adds

A test that walks computerParams.options and asserts every arm's field names are a subset of computerWireParams.shape — walking rather than sampling, because the next gap will be an action nobody thought to sample.

It passes on main today. This is a guard, not a bug report.

The third case is a negative control: it runs the same comparison against a deliberately broken pair and asserts it reports the gap, so a green result means the check ran rather than that it had nothing to say.

computerWireParams becomes exported for this — it is the only thing that can tell the two schemas apart.

Verification

packages/runtime clean rebuild against current main; all 89 computer-use-* tests pass.

@Astro-HanAstro-Han 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.

P2. The action-name direction is not held. Test 2 is named "the union covers every action name", but its body only asserts arms.length > 0 and action !== 'undefined'. Add a new arm to computerParams (every field already exists on the wire) or add a name to CU_ACTION_TYPES without a matching arm: all three tests stay green. This is exactly the window_action failure class the file's own doc comment cites. Compare wire.shape.action.options against the arm literals in both subset directions.

P2. A third, handwritten action catalog is outside the parity test. computerUseApprovalSummary (packages/core/src/computer-use.ts:254-280, consumed at packages/runtime/src/tool-runtime.ts:775-777 and packages/runtime/src/pi-agent-backend.ts:456-458) downgrades any unknown action to unknown in persisted audit records and disables turn-level remember. An action added to both schemas passes this test while silently degrading those consumers. Either walk computerParams and assert computerUseApprovalSummary({ action }).action === action, or derive wire, union, and approval sets from one shared constant.

P3. Comparison is name-only; a field type drift (e.g. duration becomes z.string() in the union while the wire keeps z.number()) is invisible.

P3. The negative control rebuilds Set/pretend by hand and never exercises the zod introspection (unionArms, .shape, literal .value) that the real test depends on. A zod upgrade that makes extraction return empty would pass both. Have the comparator take real zod schemas and feed it a deliberately broken schema.

@hqhq1025
hqhq1025force-pushed the pr/schema-parity-check branch from 2b258da to 49751cbCompareAugust 2, 2026 08:18
`maka_computer` takes arguments through two hand-written schemas.
`computerWireParams` is the flat object the SDK validates a model's call
against — one shape covering every action, most fields optional.
`computerParams` is the strict discriminated union the tool narrows to before
it does anything. A field has to exist in both: the first to be accepted off
the wire, the second to survive narrowing.
Nothing checks that they agree, and the failure mode is silent in an unusual
way. A field present in the union and absent from the wire makes its action
unreachable, and no test notices: the SDK rejects those calls above the layer
the debug journal records, the unit tests exercise the union directly, and a
real-machine probe goes around the tool entirely.
This walks the union rather than sampling it, because the next gap will be an
action nobody thought to sample. It passes on main today — this is a guard,
not a bug report. The third case proves the comparison can fail, so that a
green result means something.
`computerWireParams` becomes exported for this. It is the only thing that can
tell the two schemas apart.
…alog too
Review found the first version did not hold the thing its own name claimed.
Test 2 was called "the union covers every action name" and asserted only that
there were arms and that each discriminated on something. Adding an arm, or a
wire action with no arm, left all three tests green — which is exactly the
`window_action` failure class the file's doc comment cites.
It now compares the wire enum against the arm literals in both directions,
because each direction is a different failure. An arm the wire cannot name is
unreachable. A wire name with no arm is accepted off the wire and then falls
through narrowing, which reaches the model as a validation error naming
nothing it did wrong. Removing one action from the wire enum now fails.
A third handwritten catalog was outside the check entirely.
`computerUseApprovalSummary` downgrades an action it does not know to
`unknown`, and that value is what lands in the persisted audit record and what
turn-level remember is keyed on. An action added to both schemas passed every
check here while silently degrading those consumers.
The negative control also built its own arrays and never touched the zod
introspection the real checks depend on, so a zod upgrade that made extraction
return nothing would have passed the control while the real checks compared
two empty sets. The control now runs the same comparator, and a separate test
asserts the readers return something from the actual schemas.
Sign up for freeto 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

@hqhq1025@Astro-Han