refactor!: enforce canonical evidence and provider boundaries
Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership. Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers. BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
This commit is contained in:
@@ -49,6 +49,7 @@ describe("native UI screenshot validation", () => {
|
||||
"observe_native_ui",
|
||||
{ ...scope, screenshot: true },
|
||||
{
|
||||
environment: {},
|
||||
invoke: async () => ({
|
||||
ok: true,
|
||||
result: { ...snapshot, screenshot },
|
||||
@@ -78,6 +79,7 @@ describe("native UI screenshot validation", () => {
|
||||
"observe_native_ui",
|
||||
{ ...scope, screenshot: true },
|
||||
{
|
||||
environment: {},
|
||||
invoke: async () => ({
|
||||
ok: true,
|
||||
result: { ...snapshot, screenshot },
|
||||
@@ -102,6 +104,7 @@ describe("native UI screenshot validation", () => {
|
||||
"observe_native_ui",
|
||||
{ ...scope, screenshot: true },
|
||||
{
|
||||
environment: {},
|
||||
invoke: async () => ({
|
||||
ok: true,
|
||||
result: { ...snapshot, screenshot },
|
||||
@@ -131,7 +134,7 @@ describe("native UI screenshot validation", () => {
|
||||
target,
|
||||
"observe_native_ui",
|
||||
{ ...scope, accessibility: true },
|
||||
{ invoke: async () => ({ ok: true, result: partial }) },
|
||||
{ environment: {}, invoke: async () => ({ ok: true, result: partial }) },
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok)
|
||||
@@ -154,7 +157,7 @@ describe("native UI capture selection and budgets", () => {
|
||||
target,
|
||||
"observe_native_ui",
|
||||
{ pid: 123, window_id: 456, screenshot: false, accessibility: true },
|
||||
{ invoke },
|
||||
{ environment: {}, invoke },
|
||||
);
|
||||
expect(observed.ok).toBe(true);
|
||||
const captured = await observeNativeUi(
|
||||
@@ -167,7 +170,7 @@ describe("native UI capture selection and budgets", () => {
|
||||
accessibility: true,
|
||||
steps: [{ kind: "click", path: [] }],
|
||||
},
|
||||
{ invoke },
|
||||
{ environment: {}, invoke },
|
||||
);
|
||||
expect(captured.ok).toBe(true);
|
||||
expect(calls).toBe(3);
|
||||
@@ -190,6 +193,7 @@ describe("native UI capture selection and budgets", () => {
|
||||
steps,
|
||||
},
|
||||
{
|
||||
environment: {},
|
||||
invoke: async (parameters) => {
|
||||
nodeLimits.push(parameters.max_nodes);
|
||||
return { ok: true, result: snapshot };
|
||||
@@ -221,6 +225,7 @@ describe("native UI capture selection and budgets", () => {
|
||||
})),
|
||||
},
|
||||
{
|
||||
environment: {},
|
||||
signal: controller.signal,
|
||||
invoke: async () => {
|
||||
controller.abort();
|
||||
@@ -247,7 +252,10 @@ describe("native UI capture selection and budgets", () => {
|
||||
...scope,
|
||||
steps: [{ kind: "wait", milliseconds: 0 }],
|
||||
},
|
||||
{ invoke: async () => ({ ok: true, result: largeSnapshot }) },
|
||||
{
|
||||
environment: {},
|
||||
invoke: async () => ({ ok: true, result: largeSnapshot }),
|
||||
},
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok)
|
||||
@@ -265,6 +273,7 @@ describe("native UI target and cancellation failures", () => {
|
||||
"ambiguous-window",
|
||||
])("preserves actionable %s without fallback", async (code) => {
|
||||
const result = await observeNativeUi(target, "observe_native_ui", scope, {
|
||||
environment: {},
|
||||
invoke: async () => ({
|
||||
ok: false,
|
||||
code,
|
||||
@@ -276,6 +285,7 @@ describe("native UI target and cancellation failures", () => {
|
||||
});
|
||||
it("preserves the underlying helper failure reason in diagnostics", async () => {
|
||||
const result = await observeNativeUi(target, "observe_native_ui", scope, {
|
||||
environment: {},
|
||||
invoke: async () => {
|
||||
throw new Error(
|
||||
"Native helper returned invalid JSON: Unexpected token",
|
||||
@@ -305,6 +315,7 @@ describe("native UI target and cancellation failures", () => {
|
||||
],
|
||||
},
|
||||
{
|
||||
environment: {},
|
||||
invoke: async (parameters) => {
|
||||
calls.push(parameters);
|
||||
return calls.length === 1
|
||||
@@ -342,6 +353,7 @@ describe("native UI target and cancellation failures", () => {
|
||||
],
|
||||
},
|
||||
{
|
||||
environment: {},
|
||||
signal: controller.signal,
|
||||
invoke: async () => {
|
||||
calls++;
|
||||
@@ -354,6 +366,7 @@ describe("native UI target and cancellation failures", () => {
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok) expect(result.value.steps[0]?.outcome).toBe("cancelled");
|
||||
const replaced = await observeNativeUi(target, "observe_native_ui", scope, {
|
||||
environment: {},
|
||||
invoke: async () => ({
|
||||
ok: true,
|
||||
result: { ...snapshot, window: { ...snapshot.window, pid: 999 } },
|
||||
|
||||
Reference in New Issue
Block a user