Files
rea/experiments/atomic-codemode/fact-error.mjs
T
4f13bd6733 experiment(re)!: separate IR origins from machine instruction facts
A real model conflated an optimized CFG edge with the bytes at its instruction origin. Make provenance explicit and add bounded, batched instruction windows from the existing Kuna CLI, preserving exact bytes, per-window failures and Evidence. Record the task-cost comparison without treating the incomplete machine-path answer as an equal-quality win.

Verified 33 focused tests, targeted lint, real stock/patched MCP decoding with mixed success, and a real 4096-row capacity run under the resource observer.

BREAKING CHANGE: Experimental operation.address/addresses and block.start become origin_address/origin_addresses and origin_start. Printed CFG target_address becomes target_origin; historical source captures are unchanged.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-16 04:51:55 +00:00

25 lines
707 B
JavaScript

import { projectAnalysisError } from "../../dist/domain/analysisErrorProjection.js";
// Shared expected-failure algebra; execution adapters do not depend on native protocols.
export class FactFailure extends Error {
constructor(code, message, details = {}) {
super(message);
this.code = code;
this.details = details;
}
}
export const requireResult = (result, code = "provider_failure") => {
if (!result.ok) {
const failure = result.error?._tag
? projectAnalysisError(result.error)
: result.error;
throw new FactFailure(
failure?.code ?? code,
String(failure?.message ?? failure?.reason ?? failure),
{ failure },
);
}
return result.value;
};