mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 05:16:16 +00:00
fix!: preserve feature traces when owner lookup is unavailable (#8368)
* fix!: preserve feature traces when owner lookup is unavailable * test: strengthen feature trace cancellation assertions * fix: preserve feature trace provider readiness errors * test: verify all feature trace reference sources * test: verify IDA guidance at its owning boundary * style: format feature trace regression
This commit is contained in:
1 parent
f72638f6b1
commit
6e9ee97a69
16 files changed
+440
-37
No files matched your search
@@ -21,6 +21,8 @@ export const verifyKunaReferences = async ({
|
||||
address,
|
||||
expectedCaller,
|
||||
nativeIncoming,
|
||||
verifyNamedTrace = false,
|
||||
minimumTraceReferences = 1,
|
||||
}) => {
|
||||
const before = await Promise.all([
|
||||
entries(join(cacheRoot, "projects")),
|
||||
@@ -80,7 +82,44 @@ export const verifyKunaReferences = async ({
|
||||
direction: "forward",
|
||||
});
|
||||
assert.equal(path.value.goal_status, "reached");
|
||||
composed = { graph_ms: graph.ms, path_ms: path.ms };
|
||||
let traceMs;
|
||||
if (verifyNamedTrace) {
|
||||
const trace = await call("trace_feature", { query: name });
|
||||
traceMs = trace.ms;
|
||||
assert.ok(
|
||||
trace.value.matches.some(
|
||||
(match) => match.type === "procedure" && match.address === address,
|
||||
),
|
||||
`${name} was not retained in its feature trace`,
|
||||
);
|
||||
assert.ok(
|
||||
incoming.value.length >= minimumTraceReferences,
|
||||
`${name} fixture did not produce the expected incoming references`,
|
||||
);
|
||||
const references = trace.value.references.filter(
|
||||
(row) => row.target_address === address,
|
||||
);
|
||||
assert.deepEqual(
|
||||
references.map((row) => row.source_address).sort(),
|
||||
[...incoming.value].sort(),
|
||||
`${name} lost or duplicated an observed incoming reference`,
|
||||
);
|
||||
for (const reference of references) {
|
||||
assert.equal(reference.containing_procedure.status, "unavailable");
|
||||
assert.equal(reference.containing_procedure.provider_id, "kuna");
|
||||
assert.ok(
|
||||
trace.value.residual_unknowns.some((unknown) =>
|
||||
unknown.includes(reference.source_address),
|
||||
),
|
||||
);
|
||||
}
|
||||
assert.equal(trace.value.truncated, false);
|
||||
}
|
||||
composed = {
|
||||
graph_ms: graph.ms,
|
||||
path_ms: path.ms,
|
||||
...(traceMs === undefined ? {} : { feature_trace_ms: traceMs }),
|
||||
};
|
||||
}
|
||||
assert.deepEqual(
|
||||
await Promise.all([
|
||||
|
||||
@@ -115,7 +115,9 @@ __attribute__((noinline)) int rea_classify(int c) {
|
||||
}
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2) return 2;
|
||||
printf("%u %d\n", rea_checksum((const unsigned char *)argv[1], strlen(argv[1])),
|
||||
size_t length = strlen(argv[1]);
|
||||
printf("%u %u %d\n", rea_checksum((const unsigned char *)argv[1], length),
|
||||
rea_checksum((const unsigned char *)argv[1], length ? length - 1 : 0),
|
||||
rea_classify(argv[1][0]));
|
||||
return 0;
|
||||
}
|
||||
@@ -282,8 +284,12 @@ const quality = (text) => ({
|
||||
const verifyKuna = async (
|
||||
path,
|
||||
functions,
|
||||
expectedCaller,
|
||||
expectedStrings = [],
|
||||
{
|
||||
expectedCaller,
|
||||
expectedStrings = [],
|
||||
verifyNamedTrace = false,
|
||||
minimumTraceReferences = {},
|
||||
} = {},
|
||||
) => {
|
||||
const sha256 = createHash("sha256")
|
||||
.update(await readFile(path))
|
||||
@@ -320,6 +326,8 @@ const verifyKuna = async (
|
||||
name,
|
||||
address,
|
||||
expectedCaller,
|
||||
verifyNamedTrace,
|
||||
minimumTraceReferences: minimumTraceReferences[name],
|
||||
nativeIncoming: (targetAddress) =>
|
||||
nativeKunaIncomingSites({
|
||||
executable: kuna,
|
||||
@@ -549,10 +557,12 @@ try {
|
||||
for (const binary of [built, stripped])
|
||||
results.push({
|
||||
binary: binary.slice(workspace.length + 1),
|
||||
kuna: await verifyKuna(binary, [...fixtureFunctions], fixtureMain, [
|
||||
"_φ( °-°)/ REA unicode marker",
|
||||
"REA wide marker",
|
||||
]),
|
||||
kuna: await verifyKuna(binary, [...fixtureFunctions], {
|
||||
expectedCaller: fixtureMain,
|
||||
expectedStrings: ["_φ( °-°)/ REA unicode marker", "REA wide marker"],
|
||||
verifyNamedTrace: binary === built,
|
||||
minimumTraceReferences: { rea_checksum: 2 },
|
||||
}),
|
||||
});
|
||||
|
||||
// Caller-built matrix.
|
||||
|
||||
Reference in new issue
Block a user