Compare commits
145
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
330d37ad2f | ||
|
|
fffb074193 | ||
|
|
09e7f07108 | ||
|
|
1bbf4bd16c | ||
|
|
07a501e82c | ||
|
|
ebecf06f6e | ||
|
|
7e0c7b1244 | ||
|
|
d9cd239c5e | ||
|
|
11f64f653e | ||
|
|
9b7ec809e6 | ||
|
|
170bfc7b3f | ||
|
|
591c87c4b6 | ||
|
|
bfd76c5d16 | ||
|
|
9ac91e0c1e | ||
|
|
30a9139b87 | ||
|
|
a9588be4eb | ||
|
|
fc789d19ff | ||
|
|
4ff2dadf66 | ||
|
|
1a06c82772 | ||
|
|
7d885d632c | ||
|
|
57a23f0a2d | ||
|
|
d2a53beb3d | ||
|
|
a8887a9a85 | ||
|
|
45d5e80144 | ||
|
|
50dd9fcad1 | ||
|
|
6add17a317 | ||
|
|
8c0e431895 | ||
|
|
ceb77f6697 | ||
|
|
fc7e41ff3b | ||
|
|
cb4ff50202 | ||
|
|
b47055edbe | ||
|
|
0405c9d361 | ||
|
|
db8128dc0d | ||
|
|
2abfe53dbd | ||
|
|
efbc486b9b | ||
|
|
11b747f29d | ||
|
|
75104040df | ||
|
|
357996cc89 | ||
|
|
e79e014f23 | ||
|
|
b8510ee00b | ||
|
|
36615d9165 | ||
|
|
c5fb86d194 | ||
|
|
0df0e4f53e | ||
|
|
204b9f3ac1 | ||
|
|
a732c859dd | ||
|
|
10aa74dfed | ||
|
|
93e75bc8fe | ||
|
|
1579b6865e | ||
|
|
569ef4159d | ||
|
|
0f623732bd | ||
|
|
044fb9127a | ||
|
|
1438422dfe | ||
|
|
eb44921c4c | ||
|
|
ca1b2f8608 | ||
|
|
0f55f247cd | ||
|
|
6060de329d | ||
|
|
c0aa2e32b3 | ||
|
|
eab789aed7 | ||
|
|
790657dc0d | ||
|
|
0b4fd11c8c | ||
|
|
c99c6a89d6 | ||
|
|
3b79af28e8 | ||
|
|
cbc0e97c29 | ||
|
|
92a0edf187 | ||
|
|
1b46398795 | ||
|
|
f75b1a416b | ||
|
|
0686b07546 | ||
|
|
c2b79aa462 | ||
|
|
efe0923914 | ||
|
|
a32b4b6ac5 | ||
|
|
60c08802a7 | ||
|
|
7435e79d65 | ||
|
|
44d98de236 | ||
|
|
ba33c706d2 | ||
|
|
aade9bbcb7 | ||
|
|
0930e94e07 | ||
|
|
3f6b5755b3 | ||
|
|
45b6a7fe8f | ||
|
|
2daeff4b24 | ||
|
|
e67c3642c8 | ||
|
|
030c477328 | ||
|
|
3a34ad37bd | ||
|
|
1250aaedd8 | ||
|
|
2b60e097f2 | ||
|
|
5e79d468e5 | ||
|
|
44c9d2924d | ||
|
|
503109995f | ||
|
|
28f5761973 | ||
|
|
dae1e55381 | ||
|
|
322506d0c0 | ||
|
|
7582f0dff2 | ||
|
|
864314ac85 | ||
|
|
0351328e54 | ||
|
|
81f7638203 | ||
|
|
7e5cffa2ae | ||
|
|
1d826f304f | ||
|
|
7fb0a0cc57 | ||
|
|
e5deb832cb | ||
|
|
cf806ea02a | ||
|
|
ee5cfbe05c | ||
|
|
459c0951f2 | ||
|
|
a154b9752c | ||
|
|
ffeb2d4367 | ||
|
|
5f0065c542 | ||
|
|
7c962cc70b | ||
|
|
57290a01ac | ||
|
|
535c8ef303 | ||
|
|
e5828596c5 | ||
|
|
04345767a8 | ||
|
|
ca7450beff | ||
|
|
cd88163e42 | ||
|
|
ccd748635c | ||
|
|
12b3cdb804 | ||
|
|
eef4a0bfb4 | ||
|
|
f2f83934d2 | ||
|
|
f14c2d4df3 | ||
|
|
56128a8424 | ||
|
|
5b3400d5d9 | ||
|
|
57bb7ec5ca | ||
|
|
187f113f79 | ||
|
|
dd1c879580 | ||
|
|
c482ddd6ad | ||
|
|
69b8509602 | ||
|
|
cf6ea09711 | ||
|
|
90d4098a01 | ||
|
|
bdacd4140e | ||
|
|
307af044bc | ||
|
|
9385060f9c | ||
|
|
1c296f11a1 | ||
|
|
fb752d2293 | ||
|
|
8dde6370d0 | ||
|
|
102c5a3ae5 | ||
|
|
11d38cbc00 | ||
|
|
7777abf473 | ||
|
|
27311f88d4 | ||
|
|
eb00112a3f | ||
|
|
76fa5304a8 | ||
|
|
6396851958 | ||
|
|
b8eea783da | ||
|
|
9d00d7d7fa | ||
|
|
74afb04f32 | ||
|
|
7df85f16a0 | ||
|
|
4c401458da | ||
|
|
ada133c256 | ||
|
|
b57a054d5e |
No files matched your search
@@ -68,9 +68,9 @@ closing-issue reporters. Grouping preserves all those credits in one line.
|
||||
When Highlights, detailed entries or migrations reference the same work,
|
||||
put its thanks in one of those entries, not all of them. Include issue links.
|
||||
Direct-commit bullets carry the commit link and known human credit.
|
||||
Exclude GitHub bots and known agent accounts. REA's observed Anthropic and
|
||||
Cursor co-author trailers resolve to `@claude` and `@cursoragent` with GitHub
|
||||
type `User`; the credit policy excludes them while retaining their metadata.
|
||||
Exclude GitHub bots and known agent accounts. REA's observed Anthropic, Cursor
|
||||
and Codex co-author trailers resolve to `@claude`, `@cursoragent` and `@codex`
|
||||
with GitHub type `User`; the credit policy excludes them while retaining their metadata.
|
||||
At the REA maintainer's request, omit `@morluto` self-thanks while preserving
|
||||
authorship in the inventory. Other human contributors remain eligible.
|
||||
Use explicit GitHub links for cross-repository references to avoid ambiguous
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: Bug report
|
||||
description: Report a reproducible problem in REA
|
||||
description: Report a problem in REA with observations or source evidence
|
||||
title: "[Bug] "
|
||||
labels:
|
||||
- bug
|
||||
@@ -8,8 +8,12 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please report one primary behavior per issue. Keep observed behavior
|
||||
separate from suspected causes, and remove credentials and private paths.
|
||||
Report one primary behavior per issue. Keep answers concise and grounded
|
||||
in available evidence. Distinguish observed behavior, source-derived
|
||||
reasoning, and suspected causes; do not claim a reproduction you did not run.
|
||||
If a narrative answer is not known, write `NOT_ENOUGH_INFO` and describe
|
||||
what is missing. Intermittent failures and clearly labeled source-only
|
||||
reports are welcome. Do not include credentials or sensitive target data.
|
||||
|
||||
- type: checkboxes
|
||||
id: before-submitting
|
||||
@@ -42,7 +46,7 @@ body:
|
||||
id: observed-behavior
|
||||
attributes:
|
||||
label: Observed behavior
|
||||
description: What happened? Include the command, MCP tool, provider, target type, and conditions that matter.
|
||||
description: Describe the actual result, including the exact command or MCP request, relevant provider/target, and supporting evidence below. Label source-only findings instead of claiming execution.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -50,7 +54,7 @@ body:
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Reproduction
|
||||
description: Give the smallest realistic command, configuration, input, or event sequence that demonstrates the problem.
|
||||
description: Give the shortest steps you actually ran, with the relevant input or configuration. State how often they reproduced the problem when known. If reproduction is unavailable, say so and provide the observations or source reference you have.
|
||||
placeholder: |
|
||||
1. Configure or start ...
|
||||
2. Run ...
|
||||
@@ -62,7 +66,7 @@ body:
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: What result, contract, invariant, recovery action, or state transition should have occurred?
|
||||
description: State the expected result, contract, or recovery action. Cite documentation, source, or a known-good version when available; mark an unverified expectation or unknown reference clearly.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -70,7 +74,7 @@ body:
|
||||
id: impact-scope
|
||||
attributes:
|
||||
label: Impact and scope
|
||||
description: What is affected, what is not affected, and does this affect evidence integrity, process isolation, compatibility, or recovery?
|
||||
description: Describe observed impact and frequency, including effects on evidence integrity, process isolation, compatibility, or recovery when known. Leave untested scope and severity unknown rather than guessing.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -79,7 +83,7 @@ body:
|
||||
attributes:
|
||||
label: REA version
|
||||
description: Use `rea --version` or provide the source revision.
|
||||
placeholder: 3.1.0 or git revision
|
||||
placeholder: Exact rea --version output or source commit SHA
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -116,7 +120,7 @@ body:
|
||||
id: failure-stage
|
||||
attributes:
|
||||
label: Earliest failure stage
|
||||
description: Select where the incorrect behavior first becomes observable.
|
||||
description: Select where the incorrect behavior first becomes observable. Choose Unknown if this has not been established.
|
||||
options:
|
||||
- Request parsing or validation
|
||||
- Setup or provider admission
|
||||
@@ -133,8 +137,14 @@ body:
|
||||
id: relevant-evidence
|
||||
attributes:
|
||||
label: Relevant output or evidence
|
||||
description: Paste the smallest useful CLI output, MCP result, error, trace, or evidence excerpt. Redact sensitive values.
|
||||
render: text
|
||||
description: Include the smallest useful output, MCP result, error, screenshot, artifact, or exact source reference. Say how it was obtained and which claim it supports. If unavailable, write NOT_ENOUGH_INFO and explain what is missing. Redact credentials and sensitive target data.
|
||||
placeholder: |
|
||||
Command or MCP request actually run:
|
||||
Relevant result, error, or artifact:
|
||||
For source-only findings, link the file/revision and relevant code:
|
||||
Missing evidence or remaining uncertainty:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: typed-outcome
|
||||
@@ -146,10 +156,10 @@ body:
|
||||
id: analysis
|
||||
attributes:
|
||||
label: Analysis or suspected cause
|
||||
description: Optional. Clearly mark source-derived reasoning or a hypothesis; do not present an unverified cause as fact.
|
||||
description: Optional. Link supporting source and distinguish source-derived reasoning from a hypothesis. A root-cause analysis or proposed fix is not required.
|
||||
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add links, reduced fixtures, screenshots, or a proposed regression test.
|
||||
description: Add reduced fixtures, screenshots, or related issues. For observed regressions, include the last known good and first known bad versions when available. Label untested checks as proposals.
|
||||
@@ -41,7 +41,7 @@ body:
|
||||
id: context-evidence
|
||||
attributes:
|
||||
label: Context and evidence
|
||||
description: Explain the problem or motivation. If you have evidence, distinguish observed behavior from ideas or guesses.
|
||||
description: Explain the problem or motivation and link relevant evidence when available. Distinguish observed behavior, source-derived reasoning, proposed behavior, and unknowns. A question without measurements or a finished design is welcome.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
@@ -5,6 +5,13 @@ labels:
|
||||
- documentation
|
||||
- triage
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Report one documentation problem with the exact location and the smallest
|
||||
useful supporting passage, example, or result. Keep answers concise.
|
||||
If something is unknown, write `NOT_ENOUGH_INFO` and explain what is missing.
|
||||
|
||||
- type: checkboxes
|
||||
id: before-submitting
|
||||
attributes:
|
||||
@@ -28,7 +35,7 @@ body:
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: What is unclear, missing, outdated, or incorrect, and who is affected?
|
||||
description: Quote or describe the current content, explain what is unclear, missing, outdated, or incorrect, and say how to observe the problem. State who is affected when known.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -36,7 +43,7 @@ body:
|
||||
id: expected-content
|
||||
attributes:
|
||||
label: Expected content
|
||||
description: Describe the accurate behavior or example that should be documented.
|
||||
description: Describe the accurate behavior or example that should be documented, with a reference when available. Label a proposed clarification or unknown behavior clearly.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -44,7 +51,9 @@ body:
|
||||
id: evidence
|
||||
attributes:
|
||||
label: Supporting evidence
|
||||
description: Add source, command output, provider documentation, or a link that supports the correction.
|
||||
description: Include an exact passage, source reference, command output, provider documentation, or screenshot supporting the report. For missing or unclear guidance, point to the relevant section and explain the gap. If evidence is unavailable, write NOT_ENOUGH_INFO and explain what is missing.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
|
||||
@@ -11,6 +11,8 @@ body:
|
||||
Describe one problem and the outcome you would like. Short answers are
|
||||
welcome. Choose "Not sure yet" wherever needed; you do not need code, a
|
||||
finished design, or a complete test plan to propose an idea.
|
||||
Use concrete examples when available, distinguish current limitations
|
||||
from proposed behavior, and leave unmeasured impact or unknowns explicit.
|
||||
|
||||
Read the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope).
|
||||
Maintainers can help resolve scope and technical questions. Unresolved
|
||||
@@ -58,7 +60,7 @@ body:
|
||||
id: use-cases
|
||||
attributes:
|
||||
label: Use cases
|
||||
description: Optional additional examples of applications, targets, or callers. Leave blank if covered above.
|
||||
description: Optional examples of affected workflows, targets, or callers and their practical impact. Include observed frequency or measurements when available; do not invent them. Leave blank if covered above.
|
||||
|
||||
- type: textarea
|
||||
id: desired-outcome
|
||||
@@ -138,4 +140,4 @@ body:
|
||||
id: references
|
||||
attributes:
|
||||
label: References
|
||||
description: Link relevant provider documentation, source, measurements, artifacts, issues, or discussions.
|
||||
description: Optional supporting examples, provider documentation, source, measurements, artifacts, issues, or prior art. Distinguish observed results from expected benefits; an idea without evidence is welcome.
|
||||
@@ -0,0 +1,26 @@
|
||||
name: Prepare qualified release inputs
|
||||
description: Restore and validate the exact qualified tarball and its verifier runtime
|
||||
outputs:
|
||||
version:
|
||||
description: Package version validated against the source and qualified manifest
|
||||
value: ${{ steps.package.outputs.version }}
|
||||
tarball:
|
||||
description: Absolute path to the validated qualified npm tarball
|
||||
value: ${{ steps.package.outputs.tarball }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download the exact qualified package
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: verified-release-package
|
||||
path: .cache/verified-package/
|
||||
- name: Verify qualified package provenance and digest
|
||||
id: package
|
||||
shell: bash
|
||||
run: node scripts/ci/verified-package.mjs validate .cache/verified-package
|
||||
- name: Restore qualified verifier runtime
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: rea-test-runtime
|
||||
path: .
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Publish MCP Registry metadata
|
||||
description: Validate and publish one released server.json, preserving an identical existing version
|
||||
inputs:
|
||||
directory:
|
||||
description: Directory containing the released server.json
|
||||
default: .
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install MCP Registry publisher
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.directory }}
|
||||
env:
|
||||
MCP_PUBLISHER_VERSION: v1.8.0
|
||||
MCP_PUBLISHER_SHA256_LINUX_AMD64: 1370446bbe74d562608e8005a6ccce02d146a661fbd78674e11cc70b9618d6cf
|
||||
run: |
|
||||
archive="mcp-publisher_linux_amd64.tar.gz"
|
||||
curl -fsSLo "${archive}" \
|
||||
"https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}/${archive}"
|
||||
echo "${MCP_PUBLISHER_SHA256_LINUX_AMD64} ${archive}" | sha256sum --check --strict
|
||||
tar xzf "${archive}" mcp-publisher
|
||||
chmod +x mcp-publisher
|
||||
- name: Validate MCP Registry metadata
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.directory }}
|
||||
run: ./mcp-publisher validate
|
||||
- name: Check existing registry version
|
||||
id: registry
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.directory }}
|
||||
run: node "${GITHUB_ACTION_PATH}/registry-state.mjs"
|
||||
- name: Authenticate to MCP Registry
|
||||
if: steps.registry.outputs.exists != 'true'
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.directory }}
|
||||
run: ./mcp-publisher login github-oidc
|
||||
- name: Publish MCP Registry metadata
|
||||
if: steps.registry.outputs.exists != 'true'
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.directory }}
|
||||
run: ./mcp-publisher publish
|
||||
@@ -0,0 +1,4 @@
|
||||
export function registryPublicationState(
|
||||
server: Readonly<{ name: string; version: string } & Record<string, unknown>>,
|
||||
request?: (url: URL, init: RequestInit) => Promise<Response>,
|
||||
): Promise<"present" | "absent">;
|
||||
@@ -0,0 +1,89 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { appendFile, readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/** Exact-version routes currently return false 404s; enumerate the filtered listing. */
|
||||
export async function registryPublicationState(server, request = fetch) {
|
||||
assert.equal(typeof server?.name, "string");
|
||||
assert.equal(typeof server?.version, "string");
|
||||
const cursors = new Set();
|
||||
let cursor;
|
||||
const matches = [];
|
||||
do {
|
||||
const url = new URL(
|
||||
"https://registry.modelcontextprotocol.io/v0.1/servers",
|
||||
);
|
||||
url.search = new URLSearchParams({
|
||||
search: server.name,
|
||||
version: server.version,
|
||||
include_deleted: "true",
|
||||
limit: "100",
|
||||
}).toString();
|
||||
if (cursor !== undefined) url.searchParams.set("cursor", cursor);
|
||||
const response = await request(url, {
|
||||
signal: AbortSignal.timeout(30_000),
|
||||
});
|
||||
if (!response.ok)
|
||||
throw new Error(`Registry lookup failed: HTTP ${response.status}`);
|
||||
const page = await response.json();
|
||||
assert(Array.isArray(page?.servers), "Registry response omitted servers");
|
||||
assert(
|
||||
page.metadata && typeof page.metadata === "object",
|
||||
"Registry response omitted metadata",
|
||||
);
|
||||
for (const entry of page.servers) {
|
||||
assert(
|
||||
typeof entry?.server?.name === "string" &&
|
||||
typeof entry.server.version === "string",
|
||||
"Malformed registry server record",
|
||||
);
|
||||
if (
|
||||
entry.server.name === server.name &&
|
||||
entry.server.version === server.version
|
||||
)
|
||||
matches.push(entry);
|
||||
}
|
||||
cursor = page.metadata.nextCursor;
|
||||
if (cursor !== undefined) {
|
||||
assert(
|
||||
typeof cursor === "string" && cursor.length > 0 && !cursors.has(cursor),
|
||||
"Registry returned a non-advancing cursor",
|
||||
);
|
||||
cursors.add(cursor);
|
||||
}
|
||||
} while (cursor !== undefined);
|
||||
assert(
|
||||
matches.length <= 1,
|
||||
"Registry returned ambiguous exact-version records",
|
||||
);
|
||||
if (matches.length === 0) return "absent";
|
||||
assert.equal(
|
||||
matches[0]._meta?.["io.modelcontextprotocol.registry/official"]?.status,
|
||||
"active",
|
||||
"Existing registry version is not active",
|
||||
);
|
||||
assert.deepEqual(
|
||||
matches[0].server,
|
||||
server,
|
||||
"Existing registry version differs from released metadata",
|
||||
);
|
||||
return "present";
|
||||
}
|
||||
|
||||
if (
|
||||
process.argv[1] !== undefined &&
|
||||
resolve(process.argv[1]) === fileURLToPath(import.meta.url)
|
||||
) {
|
||||
const state = await registryPublicationState(
|
||||
JSON.parse(await readFile("server.json", "utf8")),
|
||||
);
|
||||
assert(process.env.GITHUB_OUTPUT, "GITHUB_OUTPUT is required");
|
||||
await appendFile(
|
||||
process.env.GITHUB_OUTPUT,
|
||||
`exists=${state === "present"}\n`,
|
||||
);
|
||||
process.stdout.write(
|
||||
`Registry version is ${state}; ${state === "present" ? "preserving identical published metadata" : "publication may proceed"}.\n`,
|
||||
);
|
||||
}
|
||||
@@ -24,7 +24,7 @@ Unresolved scope, authority, side effects, or required verification block
|
||||
integration. Link the required maintainer scope decision for new providers or
|
||||
capabilities involving target execution, injection, mutation, or protection
|
||||
recovery; ordinary fixes within existing boundaries may state "not applicable".
|
||||
Draft PRs may leave the scope decision pending and the final review checklist
|
||||
Draft PRs may leave the scope decision pending and the readiness and merge checklists
|
||||
unchecked. Maintainers can help resolve open questions.
|
||||
|
||||
## Contract and boundary impact
|
||||
@@ -55,7 +55,10 @@ Unchecked items do not establish absence; leave uncertainties visible.
|
||||
## Evidence and regression coverage
|
||||
|
||||
<!-- State whether evidence is executed, source-derived, or proposed. For fixes,
|
||||
explain how the regression would fail on the affected base revision when practical. -->
|
||||
show the original failure and explain how the regression would fail on the affected
|
||||
base revision when practical. Include the most useful proof inline; link long logs
|
||||
or artifacts, or put them in optional details. Documentation-only changes can use
|
||||
source, link, or rendered-document checks. -->
|
||||
|
||||
- Tests added or updated:
|
||||
- Base reproduction or other evidence:
|
||||
@@ -71,7 +74,8 @@ For evidence-bearing changes:
|
||||
## Validation performed
|
||||
|
||||
<!-- List only commands that actually ran, with observed results. Include the
|
||||
relevant real-provider or platform workflow, or explain why it was unavailable. -->
|
||||
relevant real-provider or platform workflow, or explain why it was unavailable.
|
||||
Keep these results current after changes; a command without its result is incomplete. -->
|
||||
|
||||
- `command` — result
|
||||
|
||||
@@ -90,6 +94,23 @@ limits, security/privacy/containment implications, and meaningful proof gaps. --
|
||||
- Package or release metadata impact:
|
||||
- Security, privacy, process, or containment review:
|
||||
|
||||
## Author readiness
|
||||
|
||||
<!-- The human owner completes these declarations before requesting review.
|
||||
The PR author is the owner by default. A different owner must explicitly accept
|
||||
ownership on this PR.
|
||||
AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA.
|
||||
Draft PRs may leave them unchecked. These declarations record initial readiness
|
||||
when opening the PR for review; later pushes do not require a new human sign-off.
|
||||
Keep the description and validation evidence current as the work changes.
|
||||
See CONTRIBUTING.md#pull-request-ownership-and-readiness. -->
|
||||
|
||||
Human owner: <!-- @GitHub-handle -->
|
||||
|
||||
- [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
|
||||
- [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
|
||||
- [ ] I declare this PR ready for initial maintainer review.
|
||||
|
||||
## Before merge
|
||||
|
||||
<!-- Draft PRs may leave pending items unchecked. Resolve material scope and
|
||||
|
||||
+79
-917
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,62 @@
|
||||
name: Mutation sweep
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "47 4 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: mutation-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
HUSKY: "0"
|
||||
|
||||
jobs:
|
||||
mutation:
|
||||
name: Mutation sweep (${{ matrix.suite }})
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 2
|
||||
matrix:
|
||||
include:
|
||||
- suite: reverse-tools
|
||||
config: stryker.config.mjs
|
||||
- suite: reverse-tools-semantics
|
||||
config: stryker.semantics.config.mjs
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- run: npm run test:prepare
|
||||
- name: Run the complete configuration
|
||||
env:
|
||||
MUTATION_CONFIG: ${{ matrix.config }}
|
||||
run: |
|
||||
node scripts/prepare-reverse-tools-mutation.mjs
|
||||
npx --no-install stryker run "${MUTATION_CONFIG}"
|
||||
- name: Require both reports from the completed sweep
|
||||
env:
|
||||
REPORT_BASE: reports/mutation/${{ matrix.suite }}
|
||||
run: |
|
||||
test -s "${REPORT_BASE}.json"
|
||||
test -s "${REPORT_BASE}.html"
|
||||
- name: Retain available mutation diagnostics
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: mutation-${{ matrix.suite }}-${{ github.run_attempt }}
|
||||
path: |
|
||||
reports/mutation/${{ matrix.suite }}.json
|
||||
reports/mutation/${{ matrix.suite }}.html
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,51 @@
|
||||
name: PR readiness
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [main, "release/*"]
|
||||
types:
|
||||
[
|
||||
opened,
|
||||
edited,
|
||||
synchronize,
|
||||
reopened,
|
||||
ready_for_review,
|
||||
converted_to_draft,
|
||||
]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pull_request_number:
|
||||
description: Open PR to recheck
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: pr-readiness-${{ github.event.pull_request.number || inputs.pull_request_number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
readiness:
|
||||
name: Validate author declaration
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 3
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
statuses: write
|
||||
steps:
|
||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
ref: ${{ github.event.repository.default_branch }}
|
||||
persist-credentials: false
|
||||
- name: Check initial readiness
|
||||
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
|
||||
with:
|
||||
script: |
|
||||
const { pathToFileURL } = require("node:url");
|
||||
const entry = pathToFileURL(
|
||||
`${process.env.GITHUB_WORKSPACE}/scripts/ci/pr-readiness.mjs`,
|
||||
);
|
||||
const { runReadinessCheck } = await import(entry.href);
|
||||
await runReadinessCheck({ github, context, core });
|
||||
@@ -0,0 +1,109 @@
|
||||
name: Recover published release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Existing npm and GitHub release version
|
||||
required: true
|
||||
type: string
|
||||
release_run_id:
|
||||
description: Original Release run with successful exact-source qualification and npm publication
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: release-recovery-${{ inputs.version }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: Verify existing published package
|
||||
if: github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
outputs:
|
||||
source_sha: ${{ steps.release.outputs.source_sha }}
|
||||
version: ${{ steps.release.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
package-manager-cache: false
|
||||
- run: npm ci
|
||||
- name: Validate original release authority
|
||||
id: release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RECOVERY_VERSION: ${{ inputs.version }}
|
||||
RECOVERY_RUN_ID: ${{ inputs.release_run_id }}
|
||||
run: node scripts/ci/release-recovery.mjs resolve
|
||||
- name: Check out released metadata
|
||||
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
ref: ${{ steps.release.outputs.source_sha }}
|
||||
path: .cache/release-source
|
||||
persist-credentials: false
|
||||
- name: Download original qualified package
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: verified-release-package
|
||||
run-id: ${{ steps.release.outputs.run_id }}
|
||||
github-token: ${{ github.token }}
|
||||
path: .cache/verified-package
|
||||
- name: Restore original verifier runtime
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: rea-test-runtime
|
||||
run-id: ${{ steps.release.outputs.run_id }}
|
||||
github-token: ${{ github.token }}
|
||||
path: .
|
||||
- name: Match published npm bytes to the qualified package
|
||||
env:
|
||||
RECOVERY_VERSION: ${{ steps.release.outputs.version }}
|
||||
RECOVERY_RUN_ID: ${{ steps.release.outputs.run_id }}
|
||||
RECOVERY_RUN_ATTEMPT: ${{ steps.release.outputs.run_attempt }}
|
||||
RECOVERY_SOURCE_SHA: ${{ steps.release.outputs.source_sha }}
|
||||
RECOVERY_SOURCE_DIRECTORY: .cache/release-source
|
||||
RECOVERY_ARTIFACT_DIRECTORY: .cache/verified-package
|
||||
run: node scripts/ci/release-recovery.mjs verify
|
||||
- name: Rehearse the original qualified tarball
|
||||
env:
|
||||
RECOVERY_VERSION: ${{ steps.release.outputs.version }}
|
||||
run: node scripts/verify-release-artifact.mjs .cache/verified-package/package.tgz "$RECOVERY_VERSION"
|
||||
- name: Verify published CLI, MCP and update
|
||||
env:
|
||||
RECOVERY_VERSION: ${{ steps.release.outputs.version }}
|
||||
run: node scripts/verify-published-package.mjs "$RECOVERY_VERSION"
|
||||
- name: Validate released registry metadata
|
||||
working-directory: .cache/release-source
|
||||
run: npm run mcp-registry:check
|
||||
|
||||
publish-mcp:
|
||||
name: Finish MCP Registry publication
|
||||
needs: verify
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Check out verified released metadata
|
||||
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
ref: ${{ needs.verify.outputs.source_sha }}
|
||||
path: .cache/release-source
|
||||
persist-credentials: false
|
||||
- uses: ./.github/actions/publish-mcp
|
||||
with:
|
||||
directory: .cache/release-source
|
||||
@@ -304,12 +304,41 @@ jobs:
|
||||
with:
|
||||
source_sha: ${{ needs.merged-release.outputs.sha || needs.release-please.outputs.sha }}
|
||||
|
||||
publish:
|
||||
name: Publish to npm
|
||||
rehearsal:
|
||||
name: Rehearse qualified release on a clean runner
|
||||
needs: [merged-release, release-please, qualification]
|
||||
if: >-
|
||||
always() && !cancelled() && needs.qualification.result == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
steps:
|
||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
ref: ${{ needs.merged-release.outputs.sha || needs.release-please.outputs.sha }}
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
package-manager-cache: false
|
||||
- run: npm ci
|
||||
- uses: ./.github/actions/prepare-release-package
|
||||
id: package
|
||||
- name: Exercise the exact qualified tarball
|
||||
env:
|
||||
VERIFIED_PACKAGE_TARBALL: ${{ steps.package.outputs.tarball }}
|
||||
VERIFIED_PACKAGE_VERSION: ${{ steps.package.outputs.version }}
|
||||
run: node scripts/verify-release-artifact.mjs "$VERIFIED_PACKAGE_TARBALL" "$VERIFIED_PACKAGE_VERSION"
|
||||
|
||||
publish:
|
||||
name: Publish to npm
|
||||
needs: [merged-release, release-please, qualification, rehearsal]
|
||||
if: >-
|
||||
always() && !cancelled() &&
|
||||
needs.qualification.result == 'success' && needs.rehearsal.result == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
@@ -327,58 +356,36 @@ jobs:
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Download the exact qualified package
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: verified-release-package
|
||||
path: .cache/verified-package/
|
||||
|
||||
- name: Verify qualified package provenance and digest
|
||||
- uses: ./.github/actions/prepare-release-package
|
||||
id: package
|
||||
run: node scripts/ci/verified-package.mjs validate .cache/verified-package
|
||||
|
||||
- name: Inspect existing npm version
|
||||
id: registry
|
||||
env:
|
||||
VERIFIED_PACKAGE_TARBALL: ${{ steps.package.outputs.tarball }}
|
||||
VERIFIED_PACKAGE_VERSION: ${{ steps.package.outputs.version }}
|
||||
run: node scripts/ci/npm-release.mjs inspect "$VERIFIED_PACKAGE_TARBALL" "$VERIFIED_PACKAGE_VERSION"
|
||||
|
||||
- name: Publish
|
||||
if: steps.registry.outputs.published == 'false'
|
||||
shell: bash
|
||||
env:
|
||||
VERIFIED_PACKAGE_TARBALL: ${{ steps.package.outputs.tarball }}
|
||||
VERIFIED_PACKAGE_VERSION: ${{ steps.package.outputs.version }}
|
||||
run: |
|
||||
version="$(node --input-type=module -e 'import packageJson from "./package.json" with { type: "json" }; process.stdout.write(packageJson.version)')"
|
||||
published_version="$(npm view "rea-agents@${version}" version --json 2>/dev/null || true)"
|
||||
if [ "${published_version}" = "\"${version}\"" ]; then
|
||||
echo "rea-agents@${version} is already published; verifying the existing package."
|
||||
else
|
||||
tag="$(node scripts/release-npm-tag.mjs "${version}")"
|
||||
npm publish "${VERIFIED_PACKAGE_TARBALL}" --access public --tag "${tag}"
|
||||
fi
|
||||
tag="$(node scripts/release-npm-tag.mjs "$VERIFIED_PACKAGE_VERSION")"
|
||||
npm publish "${VERIFIED_PACKAGE_TARBALL}" --access public --tag "${tag}"
|
||||
|
||||
- name: Verify published npm bytes and dist-tag
|
||||
env:
|
||||
VERIFIED_PACKAGE_TARBALL: ${{ steps.package.outputs.tarball }}
|
||||
VERIFIED_PACKAGE_VERSION: ${{ steps.package.outputs.version }}
|
||||
run: node scripts/ci/npm-release.mjs verify "$VERIFIED_PACKAGE_TARBALL" "$VERIFIED_PACKAGE_VERSION"
|
||||
|
||||
- name: Verify published CLI from npm
|
||||
shell: bash
|
||||
run: |
|
||||
version="$(node --input-type=module -e 'import packageJson from "./package.json" with { type: "json" }; process.stdout.write(packageJson.version)')"
|
||||
verification_root="$(mktemp -d)"
|
||||
trap 'rm -rf -- "${verification_root}"' EXIT
|
||||
cd "${verification_root}"
|
||||
max_attempts=120
|
||||
sleep_seconds=15
|
||||
total_window_minutes=$((max_attempts * sleep_seconds / 60))
|
||||
for attempt in $(seq 1 "${max_attempts}"); do
|
||||
published_version="$(npm view --prefer-online "rea-agents@${version}" version --json 2>/dev/null || true)"
|
||||
if [ "${published_version}" = "\"${version}\"" ]; then
|
||||
echo "rea-agents@${version} is visible on npm after attempt ${attempt}/${max_attempts}; verifying the published CLI."
|
||||
npm exec --yes --package="rea-agents@${version}" -- rea --help
|
||||
npm exec --yes --package="rea-agents@${version}" -- rea --llms
|
||||
node "${GITHUB_WORKSPACE}/scripts/verify-published-package.mjs" "${version}"
|
||||
exit 0
|
||||
else
|
||||
echo "rea-agents@${version} is not visible on npm yet (attempt ${attempt}/${max_attempts}; up to ${total_window_minutes} minutes)" >&2
|
||||
fi
|
||||
if [ "${attempt}" -lt "${max_attempts}" ]; then
|
||||
sleep "${sleep_seconds}"
|
||||
fi
|
||||
done
|
||||
echo "rea-agents@${version} did not become visible on npm within ${total_window_minutes} minutes (${max_attempts} attempts × ${sleep_seconds}s)" >&2
|
||||
echo "This indicates npm registry propagation delay, not a CLI verification failure." >&2
|
||||
exit 1
|
||||
env:
|
||||
VERIFIED_PACKAGE_VERSION: ${{ steps.package.outputs.version }}
|
||||
run: node scripts/verify-published-package.mjs "$VERIFIED_PACKAGE_VERSION"
|
||||
|
||||
publish-mcp:
|
||||
name: Publish to MCP Registry
|
||||
@@ -400,23 +407,4 @@ jobs:
|
||||
- name: Verify package and registry metadata versions
|
||||
run: npm run mcp-registry:check
|
||||
|
||||
- name: Install MCP Registry publisher
|
||||
env:
|
||||
MCP_PUBLISHER_VERSION: v1.8.0
|
||||
MCP_PUBLISHER_SHA256_LINUX_AMD64: 1370446bbe74d562608e8005a6ccce02d146a661fbd78674e11cc70b9618d6cf
|
||||
run: |
|
||||
archive="mcp-publisher_linux_amd64.tar.gz"
|
||||
curl -fsSLo "${archive}" \
|
||||
"https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}/${archive}"
|
||||
echo "${MCP_PUBLISHER_SHA256_LINUX_AMD64} ${archive}" | sha256sum --check --strict
|
||||
tar xzf "${archive}" mcp-publisher
|
||||
chmod +x mcp-publisher
|
||||
|
||||
- name: Validate MCP Registry metadata
|
||||
run: ./mcp-publisher validate
|
||||
|
||||
- name: Authenticate to MCP Registry
|
||||
run: ./mcp-publisher login github-oidc
|
||||
|
||||
- name: Publish MCP Registry metadata
|
||||
run: ./mcp-publisher publish
|
||||
- uses: ./.github/actions/publish-mcp
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "6.4.0"
|
||||
".": "6.5.0"
|
||||
}
|
||||
@@ -78,6 +78,37 @@ For test changes or provider claims, use [docs/testing.md](docs/testing.md). Pre
|
||||
|
||||
Use Conventional Commit subjects and PR titles. Mark breaking changes with `!` or a `BREAKING CHANGE:` footer. Describe behavior changes, relevant validation, and real-provider verification scope.
|
||||
|
||||
## Issue Reports
|
||||
|
||||
Follow [issue reporting guidance](CONTRIBUTING.md#reporting-issues) and the matching
|
||||
issue form. Keep reports concise and cite the smallest useful evidence.
|
||||
Distinguish observed results, source-derived reasoning, hypotheses, and proposed
|
||||
checks. Never claim runtime reproduction or measurements you did not perform.
|
||||
Use `NOT_ENOUGH_INFO` with an explanation for missing narrative answers or evidence.
|
||||
Incomplete reports, source-only findings, and early feature or design ideas are
|
||||
welcome when their limitations are explicit; a completed diagnosis or fix is not
|
||||
required to open an issue.
|
||||
|
||||
## Pull Request Readiness
|
||||
|
||||
Follow [human ownership and readiness](CONTRIBUTING.md#pull-request-ownership-and-readiness)
|
||||
when preparing a PR. AI-assisted contributions are welcome; a human must review
|
||||
and own the final diff, check the validation evidence and its limitations, and
|
||||
explicitly declare the PR ready for initial maintainer review.
|
||||
|
||||
Keep the PR body concise and current, with the concrete problem, observable
|
||||
outcome, approach, and evidence. Report only checks that actually ran as executed;
|
||||
distinguish source-derived conclusions, proposed checks, and unavailable coverage.
|
||||
Address actionable automated review findings and explain disagreements.
|
||||
|
||||
Leave the template's **Author readiness** declarations unchecked for the human
|
||||
owner to complete. Never attest to human review on their behalf. Keep the PR in
|
||||
draft until the human declares the PR initially ready. Later pushes do not
|
||||
invalidate that declaration or require another human sign-off. Keep the PR body
|
||||
and affected validation current as work changes. The readiness check validates
|
||||
the filled declaration; CI and automated review results do not establish that
|
||||
human review occurred, maintainer scope approval, or merge permission.
|
||||
|
||||
<!-- BEGIN:turborepo-agent-rules -->
|
||||
|
||||
# This is NOT the Turborepo you know
|
||||
|
||||
+113
@@ -1,5 +1,118 @@
|
||||
# Changelog
|
||||
|
||||
## [6.5.0](https://github.com/morluto/rea/compare/rea-agents-6.4.0...rea-agents-6.5.0) (2026-10-13)
|
||||
|
||||
Provider prerequisites and recorded verification scope are listed in [the testing guide](docs/testing.md).
|
||||
|
||||
### Highlights
|
||||
|
||||
- Analyze selected JavaScript files and recover cross-bundle relationships without expanding the selected source scope.
|
||||
- Read compact summaries and page retained Evidence across binary, managed, Android, Dart, WASM and network workflows.
|
||||
- Inspect SQLite snapshots, packet and signal recordings, WebAssembly, Rust dependency metadata and Electron fuses offline.
|
||||
- Keep completed Evidence and partial observations available when analysis or cleanup fails.
|
||||
|
||||
### Changes
|
||||
|
||||
- **JavaScript source selection:** analyze exact application paths without expanding imports into the selected scope. Unselected files retain identity and explicit unknown coverage; summary delivery remains separate from source selection. ([#1944](https://github.com/morluto/rea/pull/1944), [issue morluto/rea#1848](https://github.com/morluto/rea/issues/1848)). Thanks @kaoru0822-kitauji, @N0zoM1z0.
|
||||
- **Code-split recovery:** recover related bundles from multiple selected inputs, retaining per-file provenance and downstream cross-chunk imports. Recorded CLI/MCP coverage is Linux x64 with Wakaru 1.14.0 and source-owned esbuild/webpack fixtures; other hosts, releases and arbitrary application equivalence remain unverified. ([#1686](https://github.com/morluto/rea/pull/1686), [issue morluto/rea#1605](https://github.com/morluto/rea/issues/1605)). Thanks @JingHao-Leon, @pionxzh.
|
||||
- **Package imports:** resolve exact package import aliases using the selected loader and package ancestry, rather than guessing sibling files. ([#1862](https://github.com/morluto/rea/pull/1862), [issue morluto/rea#1838](https://github.com/morluto/rea/issues/1838)). Thanks @AWUQAQ, @mvanhorn.
|
||||
- **Retained analysis views:** opt into compact inventory/WASM, managed metadata, Android manifest, Dart AOT, Mach-O and EVM summaries, then page retained Evidence without rerunning analysis. Summary delivery preserves the complete recorded result and its original coverage. ([#2122](https://github.com/morluto/rea/pull/2122), [#2193](https://github.com/morluto/rea/pull/2193), [#2413](https://github.com/morluto/rea/pull/2413), [#2438](https://github.com/morluto/rea/pull/2438), [#2455](https://github.com/morluto/rea/pull/2455), [#2634](https://github.com/morluto/rea/pull/2634), [#2308](https://github.com/morluto/rea/pull/2308), [9a18251](https://github.com/morluto/rea/commit/9a18251426f891e6a24856b715ef8002ab8b9610)). Thanks @kaoru0822-kitauji, @N0zoM1z0.
|
||||
- **Managed assemblies:** Select declaring types when inspecting members, decode inspected `ldstr` literals with independent coverage, and page retained member summaries. Call and field targets expose `target_declaring_type` and `field_declaring_type`, including supported generic method targets; unresolved metadata remains unknown. ([#1706](https://github.com/morluto/rea/pull/1706), [#2125](https://github.com/morluto/rea/pull/2125), [issue morluto/rea#2121](https://github.com/morluto/rea/issues/2121), [#2162](https://github.com/morluto/rea/pull/2162), [issue morluto/rea#2158](https://github.com/morluto/rea/issues/2158), [#3061](https://github.com/morluto/rea/pull/3061), [issue morluto/rea#3010](https://github.com/morluto/rea/issues/3010), [#2163](https://github.com/morluto/rea/pull/2163), [issue morluto/rea#2160](https://github.com/morluto/rea/issues/2160)). Thanks @kaoru0822-kitauji, @N0zoM1z0, @Nelglor, @skoodster.
|
||||
- **Packet captures:** inspect saved packets with bounded TShark output, compact capture summaries and retained pages; discover installed protocol/field definitions. Recorded real-engine coverage uses Linux and Wireshark 4.6.6; native Windows/macOS and Bun behavior remain unverified. ([#2318](https://github.com/morluto/rea/pull/2318), [#2340](https://github.com/morluto/rea/pull/2340), [#2496](https://github.com/morluto/rea/pull/2496)). Thanks @3QL, @N0zoM1z0, @Olorinm.
|
||||
- **Recorded signals:** decode existing recordings and discover installed decoders/options through caller-supplied sigrok-cli 0.7.2. This is Linux-only and requires util-linux `prlimit`; it acquires no hardware samples. ([#2339](https://github.com/morluto/rea/pull/2339), [#2487](https://github.com/morluto/rea/pull/2487)). Thanks @N0zoM1z0, @Olorinm.
|
||||
- **Web captures:** derive an inferred method/origin/path-template API surface from retained HAR data including observed query-parameter names while retaining unknowns; query values, headers and bodies remain excluded. ([#1891](https://github.com/morluto/rea/pull/1891), [#2982](https://github.com/morluto/rea/pull/2982), [issue morluto/rea#2913](https://github.com/morluto/rea/issues/2913)). Thanks @mvanhorn, @wunianze666-netizen, @zhangguiping-xydt.
|
||||
- **QUIC captures:** inspect retained aioquic 1.5.0 JSON qlog 0.3 objects and page traces/streams/observations. Other qlog layouts remain unsupported; overlap and loss declarations do not prove retransmission or network loss. ([#2277](https://github.com/morluto/rea/pull/2277)). Thanks @LuisTaffelli, @N0zoM1z0.
|
||||
- **Fiddler captures:** inspect native SAZ archives with retained HTTP provenance and bounded decoding. Recorded producer coverage is the pinned public encoding corpus; current Fiddler Everywhere variants and Bun-native execution remain unverified. ([#2409](https://github.com/morluto/rea/pull/2409)). Thanks @N0zoM1z0, @zahhak.
|
||||
- **SQLite snapshots:** inspect an explicitly selected offline database with table/column selection and bounded Evidence. This operation requires Node 24.x >=24.15 or 26+ with `DatabaseSync.limits`; supported Node 22 and earlier 24 runtimes cannot use it. A live database/WAL copy does not establish an atomic snapshot. ([#2271](https://github.com/morluto/rea/pull/2271)). Thanks @N0zoM1z0, @Y0UW1SH.
|
||||
- **WASM artifacts:** Inspect local modules with bring-your-own WABT 1.0.42 without executing them. Compare imports/exports from two complete core-module inspection Evidence records without requiring an active WABT installation; unsupported signatures and duplicate identities remain unknown, and comparisons do not establish runtime compatibility. Recorded real-tool inspection coverage is macOS arm64. ([#1533](https://github.com/morluto/rea/pull/1533), [issue morluto/rea#884](https://github.com/morluto/rea/issues/884), [#2464](https://github.com/morluto/rea/pull/2464), [issue morluto/rea#2356](https://github.com/morluto/rea/issues/2356)). Thanks @matbrgz, @N0zoM1z0, @thangldw.
|
||||
- **Go binaries:** inspect embedded build metadata, including file-backed unmapped Mach-O debug segments. ([#1363](https://github.com/morluto/rea/pull/1363), [7fb097d](https://github.com/morluto/rea/commit/7fb097d72c9931dd5dfae481ad2b9d3bb6029f15)). Thanks @Y0UW1SH.
|
||||
- **Flutter APKs:** identify snapshot/engine builds and inspect AOT structure without an external engine. Recorded real APK coverage uses the documented Flutter Gallery fixture; macOS/Windows and complete pool semantics remain unverified, and pool coverage stays partial. ([#1582](https://github.com/morluto/rea/pull/1582)). Thanks @3QL.
|
||||
- **HarmonyOS packages:** inventory HAP/HSP/App Pack structures without executing code. The recorded real workflow covers one pinned HAP through repository-built CLI/MCP; installed-package and real HSP/App Pack coverage remain unverified. ([#1447](https://github.com/morluto/rea/pull/1447)). Thanks @BaaRai.
|
||||
- **Ghidra raw inputs and references:** compatible Linux/macOS Ghidra profiles accept caller-selected raw architecture/entry information and expose typed incoming references at exact addresses. Windows Ghidra P0 admits the raw NMOS 6502 profile described below; other raw targets and the incoming-reference facet remain outside Windows P0. ([#1868](https://github.com/morluto/rea/pull/1868), [issue morluto/rea#1836](https://github.com/morluto/rea/issues/1836), [#1715](https://github.com/morluto/rea/pull/1715), [issue morluto/rea#1245](https://github.com/morluto/rea/issues/1245)). Thanks @bugstan, @casesolved-co-uk, @mvanhorn, @N0zoM1z0.
|
||||
- **Ghidra MIPS:** Add bounded MIPS32r2/o32 relocatable objects, soft-float integer-register storage, admitted MIPS16 shared ELF, and a narrowly admitted recordless legacy MIPS32 executable profile. The latter pins an endian-matched 32-bit language and records inferred o32 as an analysis assumption. Admission follows each documented ABI/flag/relocation boundary. ([#1949](https://github.com/morluto/rea/pull/1949), [issue morluto/rea#1937](https://github.com/morluto/rea/issues/1937), [#1950](https://github.com/morluto/rea/pull/1950), [issue morluto/rea#1938](https://github.com/morluto/rea/issues/1938), [#1991](https://github.com/morluto/rea/pull/1991), [issue morluto/rea#1851](https://github.com/morluto/rea/issues/1851), [#1898](https://github.com/morluto/rea/pull/1898), [issue morluto/rea#1620](https://github.com/morluto/rea/issues/1620)). Thanks @AurelioB, @BaaRai, @bqw371, @kaoru0822-kitauji, @N0zoM1z0.
|
||||
- **Ghidra RISC-V:** admit little-endian RV32/RV64 `ET_EXEC` ELF declaring the supported double-float ABI. Relocatable/shared, big-endian and other ABI profiles remain refused; see [the profile and recorded lane](docs/ghidra-riscv.md). ([#2151](https://github.com/morluto/rea/pull/2151)). Thanks @NIU-123370.
|
||||
- **PSP static ELF profile:** the Ghidra profile is Linux x64, bounded little-endian ELF32 `ET_EXEC` with the documented PSP/ABI declarations and a compatible caller-installed Allegrex extension. PRX, shared/relocatable images, PBP/ISO/CSO and runtime emulation are outside scope. Historical extension experiments are separate from public-provider verification; real public Ghidra PSP coverage remains unverified. ([#1599](https://github.com/morluto/rea/pull/1599)). Thanks @jaelliot.
|
||||
- **Ghidra analysis settings:** apply validated analyzer overrides before analysis while retaining the selected analysis profile. ([#1913](https://github.com/morluto/rea/pull/1913)). Thanks @akushonkamen, @kaoru0822-kitauji, @N0zoM1z0.
|
||||
- **Attached native IDA MCP:** add an optional native bridge alongside existing legacy/headless profiles. Recorded native runs use Linux IDA Free 9.4 with a navigation correction and Windows IDA Pro 9.3 with a loopback-listener change; stock native switching, native macOS and Windows IDA Free remain unverified. Attached databases remain read-only and are never saved or closed. ([#1544](https://github.com/morluto/rea/pull/1544)). Thanks @imissapixel, @N0zoM1z0.
|
||||
- **Frida instrumentation:** add explicit local/remote target selection, caller-supplied scripts and retained messages, with script-read/input diagnostics and bounded message eviction. Recorded real coverage is the Linux local Node marker workflow; macOS, Windows and remote devices/servers remain unverified. Instrumentation executes foreign code and is destructive, not read-only. ([#1359](https://github.com/morluto/rea/pull/1359), [#2211](https://github.com/morluto/rea/pull/2211), [issue morluto/rea#2209](https://github.com/morluto/rea/issues/2209), [#2217](https://github.com/morluto/rea/pull/2217), [issue morluto/rea#2213](https://github.com/morluto/rea/issues/2213), [#2628](https://github.com/morluto/rea/pull/2628)). Thanks @dandgabr, @kaoru0822-kitauji, @N0zoM1z0.
|
||||
- **Client setup:** register Qoder, Trae, ZCode, DeepSeek Harness, Kimi Code, Factory Droid and WorkBuddy through the existing scoped setup flow. DeepSeek is included from 6.5.0; the historical npm 6.4 check did not cover it. Live Trae and DeepSeek API integration remain unverified. ([#1564](https://github.com/morluto/rea/pull/1564), [#1572](https://github.com/morluto/rea/pull/1572), [#1573](https://github.com/morluto/rea/pull/1573), [#1929](https://github.com/morluto/rea/pull/1929), [issue morluto/rea#1839](https://github.com/morluto/rea/issues/1839), [#2744](https://github.com/morluto/rea/pull/2744), [#2309](https://github.com/morluto/rea/pull/2309), [#3041](https://github.com/morluto/rea/pull/3041), [issue morluto/rea#3040](https://github.com/morluto/rea/issues/3040)). Thanks @0xRafie, @BaaRai, @cainiao1992, @IvenKooLab, @whoishaha, @ysntony.
|
||||
- **Website:** Add maintained language editions, persistent/system-aware themes, keyboard styling and nested Evidence indentation, plus the reverse-engineering models essay. A simpler home page and beginner journey connect platform prerequisites, client/provider setup and a supplied first investigation. ([#1779](https://github.com/morluto/rea/pull/1779), [issue morluto/rea#1022](https://github.com/morluto/rea/issues/1022), [#1699](https://github.com/morluto/rea/pull/1699), [#1714](https://github.com/morluto/rea/pull/1714), [#1894](https://github.com/morluto/rea/pull/1894), [#2250](https://github.com/morluto/rea/pull/2250), [#2432](https://github.com/morluto/rea/pull/2432), [#2732](https://github.com/morluto/rea/pull/2732), [#3274](https://github.com/morluto/rea/pull/3274)). Thanks @CassieFox23, @kaoru0822-kitauji, @N0zoM1z0.
|
||||
|
||||
- **Rust dependency metadata:** Inspect embedded cargo-auditable package/dependency records in ELF, PE and thin Mach-O without executing the file. Missing metadata and inferred compiler hashes retain explicit limitations; universal Mach-O requires a selected thin slice. ([#2456](https://github.com/morluto/rea/pull/2456)). Thanks @mvanhorn.
|
||||
- **Electron fuses:** Read packaged fuse bytes and per-slice runtime implications without launching or modifying the app. Missing, truncated and unknown wires remain explicit; fuse observations do not prove other Inspector-enablement paths. ([#2399](https://github.com/morluto/rea/pull/2399)). Thanks @kaoru0822-kitauji, @mvanhorn, @N0zoM1z0.
|
||||
- **Ghidra PowerPC:** Admit bounded ELF32 big-endian `ET_EXEC` PowerPC with an explicit language profile on supported Linux/macOS hosts. PPC64, DOL and other variants remain outside this lane; see [the profile and verification prerequisites](docs/ghidra-ppc.md). ([#1747](https://github.com/morluto/rea/pull/1747)). Thanks @arielfikru.
|
||||
|
||||
- **Reference-source summaries:** Use CLI `import-reference-source --detail summary` for compact manifest, count, state and path-outline output. The complete graph remains available and is still the default; hidden outline entries retain separate coverage counts. ([#2768](https://github.com/morluto/rea/pull/2768), [issue morluto/rea#2442](https://github.com/morluto/rea/issues/2442)). Thanks @matbrgz, @To3akaRin.
|
||||
|
||||
- **Recorded AArch64 crashes:** Decode 34 ABI register values per thread from supported Linux ELF64 little-endian core notes using the documented caller-provided Python dependencies. These are recorded facts, not proof of current process or library identity. ([#2505](https://github.com/morluto/rea/pull/2505), [issue morluto/rea#2353](https://github.com/morluto/rea/issues/2353)). Thanks @matbrgz, @NIU-123370.
|
||||
|
||||
- **Ghidra byte search:** Search initialized analyzed memory using wildcards, bit masks, address bounds and paged results. Unloaded, overlay and uninitialized blocks retain skipped coverage; this is not a raw-file search. ([#2341](https://github.com/morluto/rea/pull/2341)). Thanks @mvanhorn.
|
||||
|
||||
- **Raw NMOS 6502 images:** Analyze explicitly selected headerless images with Ghidra, including Windows P0, using a caller-selected entry and source mapping within the 16-bit address space. Cartridge parsing, reset-vector inference and 65C02/65816 are outside this profile. ([#2079](https://github.com/morluto/rea/pull/2079)). Thanks @Zhong-fan.
|
||||
|
||||
- **Swift String observations:** Ghidra function dossiers derive supported AArch64 Swift String literals from constant-register pairs at recognized use sites, retaining instruction/register provenance and explicit omissions. This is a bounded derivation, not a complete string inventory. ([#2049](https://github.com/morluto/rea/pull/2049), [issue morluto/rea#2030](https://github.com/morluto/rea/issues/2030)). Thanks @thefolahan.
|
||||
|
||||
- **Headless IDA procedure lookup:** Resolve addresses to canonical containing-procedure entries and identify the session’s admitted program document in the modern headless profile. Incomplete surveys remain errors; attached profiles do not advertise this containment capability. ([#2374](https://github.com/morluto/rea/pull/2374), [issue morluto/rea#2335](https://github.com/morluto/rea/issues/2335)). Thanks @nikolay-dementiev.
|
||||
|
||||
- **Passive browser attachment:** Six existing passive browser tools accept an explicit-port loopback browser WebSocket endpoint when HTTP target discovery is unavailable. Existing consent and target/origin checks remain required; this does not launch a browser or enable runtime instrumentation. ([#2346](https://github.com/morluto/rea/pull/2346)). Thanks @all-black-493.
|
||||
|
||||
- **Android DEX references:** Retain exact method descriptors and individual direct-invoke observations with source method, DEX entry, opcode and code-unit offset. These are static references; unavailable instruction facts remain separate from method-level usage totals. ([#2439](https://github.com/morluto/rea/pull/2439)). Thanks @LcokHcak.
|
||||
|
||||
- **Offline EVM metadata:** Retain bounded, lossless facts from plausible terminal Solidity CBOR root-map candidates. Candidates do not prove Solidity origin or source/compiler identity, and linked metadata is not fetched. ([#2790](https://github.com/morluto/rea/pull/2790)). Thanks @matbrgz.
|
||||
|
||||
### Fixes
|
||||
|
||||
- **JavaScript loader and export identity:** Respect import/require conditions and unavailable package metadata, keep export links separate from writes, and resolve default identifier exports to the value captured at the export statement. ([7e5cffa](https://github.com/morluto/rea/commit/7e5cffa2ae9dfc9afaeca0715110d4dd41c0dcdd), [322506d](https://github.com/morluto/rea/commit/322506d0c0d39d3cd1e2e1c285c2cc23cfa73ee7), [81f7638](https://github.com/morluto/rea/commit/81f763820319a762f003cf95651ed14ce9326a4c), [dae1e55](https://github.com/morluto/rea/commit/dae1e55381f0d6cfee7f2082d5d27b938e55704c)). Thanks @paoValle, @VarunGore36, @xu91102.
|
||||
- **JavaScript traces:** Retain nested bridge calls and surviving early-return predicates. Honor node-ID match options, match route seeds against source values, and keep ambiguous runtime candidates unknown. ([0351328](https://github.com/morluto/rea/commit/0351328e54ce70ea3f2814482e76b132774aff48), [5031099](https://github.com/morluto/rea/commit/503109995f9dcf8a955585d39a344fc846d2f59e), [44c9d29](https://github.com/morluto/rea/commit/44c9d2924d5b95d7a86595e8d7b7cf4fd4f0f6ac), [5e79d46](https://github.com/morluto/rea/commit/5e79d468e5864204cbe79a7ca2898541cee5e012)). Thanks @jpdefo.
|
||||
- **Browser comparison coverage:** Compare only known redirect response fields and retain network-selection recovery guidance alongside independent event changes. Missing response facts do not prove equality or a change. ([2b60e09](https://github.com/morluto/rea/commit/2b60e097f281f7708c69f1f7ba9263694547bcc0)).
|
||||
- **Evidence comparison and ledger input:** Report display-only bundle differences as unchanged while retaining digests, and classify noncanonical bundle records as invalid caller input. ([030c477](https://github.com/morluto/rea/commit/030c47732833c9cedcc31db1309eb3a1ca2c62e8), [3a34ad3](https://github.com/morluto/rea/commit/3a34ad37bdb7b8debba0f6515ba85b80141f2716)).
|
||||
- **Capture and admission cleanup:** Keep deleted-file observations and original bytes when a parent becomes a file, preserve unrelated I/O failures during cancellation, and require explicit pre-launch proof before releasing an unknown LLDB target owner. LLDB failure controls used simulated boundaries. ([e67c364](https://github.com/morluto/rea/commit/e67c3642c8920a2a9c0e231ee2f16f50b245df31), [2daeff4](https://github.com/morluto/rea/commit/2daeff4b243e1cd137c591ca394e18a1c05c8bbc), [45b6a7f](https://github.com/morluto/rea/commit/45b6a7fe8f51a89951aaa823ffa627f6f5453a33)). Thanks @SII-YDD, @xu91102.
|
||||
- **Client configuration:** Validate MCP output-schema profiles before setup writes, ignore untrusted Gemini workspace settings before parsing them, and identify installed skills independently of marker-only client roots. ([0930e94](https://github.com/morluto/rea/commit/0930e94e077ab7fb4d695f62785919a8a25c2e21), [aade9bb](https://github.com/morluto/rea/commit/aade9bbcb79aa8504ab6921b25f8ab082aba78e7), [ba33c70](https://github.com/morluto/rea/commit/ba33c706d26b63e43308be50c0249c72cff62cc6)). Thanks @CmsChase, @paoValle, @sx4im.
|
||||
- **Host tool discovery:** Share macOS Hopper launcher discovery across setup and runtime, preserve explicit paths, and report validated ADB and Apktool availability. ([7582f0d](https://github.com/morluto/rea/commit/7582f0dff29ae0e80c97b885ddd386ac61a92570), [e5deb83](https://github.com/morluto/rea/commit/e5deb832cb09bb524877d0df40f49d5b5bb7dea4)). Thanks @Chessing234, @kaoru0822-kitauji, @viniciusdsandrade.
|
||||
- **SAZ encoding validation:** Reject invalid XML bytes, unsupported encodings and declarations that contradict the archive bytes, including records outside the selected request. ([1250aae](https://github.com/morluto/rea/commit/1250aaedd8b4d1e471d8a382f76418bde65c05d2)).
|
||||
- **Managed member matching:** Keep malformed TypeDef list ownership unknown, distinguish constants during structural method matching, and accept legacy small exception-section sizes. ([3f6b575](https://github.com/morluto/rea/commit/3f6b5755b3e699bd9373641acffe0f2c5d2ab094), [ee5cfbe](https://github.com/morluto/rea/commit/ee5cfbe05cd309a88003c711721e67a3bee36554)).
|
||||
- **Bounded diagnostics:** Bound SDK validation messages and terminal normalization before allocation while retaining diagnostics and explicit unknown final output sizes. ([7fb0a0c](https://github.com/morluto/rea/commit/7fb0a0cc577f7c9033a2674d877d8242b5864556), [1d826f3](https://github.com/morluto/rea/commit/1d826f304f032acfe69dad3ff824b300aacaeb43)). Thanks @CRYPTONIKAV.
|
||||
|
||||
- **Windows artifact classification:** identify `.exe`, `.com`, `.bat` and `.cmd` artifacts as launchable host executables. ([#1823](https://github.com/morluto/rea/pull/1823), [#1824](https://github.com/morluto/rea/pull/1824), [issue morluto/rea#1819](https://github.com/morluto/rea/issues/1819)). Thanks @dollarsmoney, @JasonBuildAI, @kaoru0822-kitauji.
|
||||
|
||||
- **CLI/MCP delivery:** defer command-specific startup work, bundle runtime entries, retain field/input correction details across output formats and preserve shared optional-provider lifetime. MCP selectors, paging continuation and retained partial-error references remain explicit; session liveness/provider-attribution corrections retain their controlled-provider verification limits. ([#1691](https://github.com/morluto/rea/pull/1691), [issue morluto/rea#1685](https://github.com/morluto/rea/issues/1685), [#1705](https://github.com/morluto/rea/pull/1705), [issue morluto/rea#1695](https://github.com/morluto/rea/issues/1695), [#1755](https://github.com/morluto/rea/pull/1755), [issue morluto/rea#1746](https://github.com/morluto/rea/issues/1746), [#1773](https://github.com/morluto/rea/pull/1773), [issue morluto/rea#1771](https://github.com/morluto/rea/issues/1771), [#1780](https://github.com/morluto/rea/pull/1780), [#1814](https://github.com/morluto/rea/pull/1814), [#1910](https://github.com/morluto/rea/pull/1910), [issue morluto/rea#1849](https://github.com/morluto/rea/issues/1849), [#1996](https://github.com/morluto/rea/pull/1996), [#2140](https://github.com/morluto/rea/pull/2140), [issue morluto/rea#2135](https://github.com/morluto/rea/issues/2135), [#2205](https://github.com/morluto/rea/pull/2205), [issue morluto/rea#2195](https://github.com/morluto/rea/issues/2195), [#2230](https://github.com/morluto/rea/pull/2230), [issue morluto/rea#2180](https://github.com/morluto/rea/issues/2180), [#2294](https://github.com/morluto/rea/pull/2294), [#2482](https://github.com/morluto/rea/pull/2482), [a82d14e](https://github.com/morluto/rea/commit/a82d14e4db4dca989ffa2e7dbe78fd43551da256), [a4dd4e8](https://github.com/morluto/rea/commit/a4dd4e8e8700ce350e1a0c612ebd61b91ca5e585), [48c352b](https://github.com/morluto/rea/commit/48c352b6bfa34c820a530272cd36600158c37b1e), [07b36c1](https://github.com/morluto/rea/commit/07b36c148946f46b99a4ce04e55726e97d0ee03a), [570c40c](https://github.com/morluto/rea/commit/570c40cde55d31e455ef9bc484b7b908658ded58), [8fc2043](https://github.com/morluto/rea/commit/8fc2043eb8bcedbf34dce064f977e455438635d6), [7fc0b5e](https://github.com/morluto/rea/commit/7fc0b5ec9c2532bbf789d7783b7a0cab6fc054d8)). Thanks @369Apps, @chqcjq, @cold-atom, @coygeek, @JackOdegard, @kaoru0822-kitauji, @N0zoM1z0, @sx4im.
|
||||
- **Evidence import/replay:** import bundles across session transitions while authenticating selected target and file identities, preserve literal keys, metadata/mutation intent and relationship coverage, and honor cancellation before session mutation. Reuse authenticated snapshots and comparisons within their owned lifetime; reject malformed/non-object snapshots and unsupported metadata without disguising uncertainty. ([#1694](https://github.com/morluto/rea/pull/1694), [#1716](https://github.com/morluto/rea/pull/1716), [issue morluto/rea#1680](https://github.com/morluto/rea/issues/1680), [#1721](https://github.com/morluto/rea/pull/1721), [issue morluto/rea#1718](https://github.com/morluto/rea/issues/1718), [#1733](https://github.com/morluto/rea/pull/1733), [issue morluto/rea#1723](https://github.com/morluto/rea/issues/1723), [issue morluto/rea#1724](https://github.com/morluto/rea/issues/1724), [#1776](https://github.com/morluto/rea/pull/1776), [#1873](https://github.com/morluto/rea/pull/1873), [#2001](https://github.com/morluto/rea/pull/2001), [#2013](https://github.com/morluto/rea/pull/2013), [issue morluto/rea#2009](https://github.com/morluto/rea/issues/2009), [#2083](https://github.com/morluto/rea/pull/2083), [#2303](https://github.com/morluto/rea/pull/2303), [#2685](https://github.com/morluto/rea/pull/2685), [issue morluto/rea#2675](https://github.com/morluto/rea/issues/2675), [c002b89](https://github.com/morluto/rea/commit/c002b89e2d8130a3c07e25e5fd604876be18c703), [9c85114](https://github.com/morluto/rea/commit/9c8511409c0706f9979c2b68dd56aaaf9f21e191), [aada0ca](https://github.com/morluto/rea/commit/aada0ca8126bf14c60750a4ccd4a79667770a1e4), [4a4d36f](https://github.com/morluto/rea/commit/4a4d36f881861bbab3c734b0dd459f805766caec), [1c64fe3](https://github.com/morluto/rea/commit/1c64fe3eff48679c6880f42d2f0a4af46686ade7), [6fb3a34](https://github.com/morluto/rea/commit/6fb3a345fe952b8e8f59221aec993acc37ccbf31), [3bcc68c](https://github.com/morluto/rea/commit/3bcc68c037e9415c78093cb286069c1fcca6a2f8), [6bae774](https://github.com/morluto/rea/commit/6bae774328724403255590aa2ddad4d7a2aa727f), [e997085](https://github.com/morluto/rea/commit/e9970855ba16ba711816ac30212c5ca17ae085cd), [d1dcebc](https://github.com/morluto/rea/commit/d1dcebce2c0820469ed63e33497a14258971b710), [b123b2e](https://github.com/morluto/rea/commit/b123b2e51cc7d6d2157525664be2df88fb1ba3bd), [049132a](https://github.com/morluto/rea/commit/049132ab43fa962d31774f2b258c15a71217148b), [042dcaa](https://github.com/morluto/rea/commit/042dcaa1ee66f1b8668f08b193f38ab01bceaacb), [acf75e6](https://github.com/morluto/rea/commit/acf75e6700ace28bb1db25e54e56673ac15e0ed3), [1f7f808](https://github.com/morluto/rea/commit/1f7f808c4f3bb5eca6b13bcc71d5cceb2ace6614), [26bffb9](https://github.com/morluto/rea/commit/26bffb94bf80355c35e22a98a8fc629c6210307e)). Thanks @coygeek, @DeryFerd, @jiangjiang248, @kaoru0822-kitauji, @khanukov, @N0zoM1z0, @NIU-123370, @rohitg00, @sx4im.
|
||||
- **Ghidra setup and analysis:** preserve launcher/JVM diagnostics, Java-property and extension identity, stale-client recovery, UTF-8 bridge output and pending-startup progress. File-offset decompilation is Ghidra-specific; recorded coverage is Linux x64 with Ghidra 12.1.4. Startup/progress/compiler failure paths that use simulations remain unverified with a real engine. ([#1698](https://github.com/morluto/rea/pull/1698), [#1877](https://github.com/morluto/rea/pull/1877), [#1931](https://github.com/morluto/rea/pull/1931), [#2011](https://github.com/morluto/rea/pull/2011), [issue morluto/rea#1992](https://github.com/morluto/rea/issues/1992), [#2014](https://github.com/morluto/rea/pull/2014), [#2101](https://github.com/morluto/rea/pull/2101), [issue morluto/rea#2078](https://github.com/morluto/rea/issues/2078), [#2206](https://github.com/morluto/rea/pull/2206), [issue morluto/rea#2204](https://github.com/morluto/rea/issues/2204), [2187e16](https://github.com/morluto/rea/commit/2187e16f149a7a7b512a4cb45d5f468cc04091fe), [b953f96](https://github.com/morluto/rea/commit/b953f96c0aae27e1876c317a8f7db1d6f292b8ff)). Thanks @EDMND-SRC, @Ha1baraA11, @kaoru0822-kitauji, @lovecontroing, @lyly-bonbon, @N0zoM1z0, @nosmile99, @Petru101, @sx4im, @Zhong-fan.
|
||||
- **Process and cleanup ownership:** retain private runtime/file owners and detailed incomplete-cleanup observations, bound trace cycles/order state, preserve caller paths, and use monotonic time for budgets while retaining wall dates. Windows affinity/admission ([#2202](https://github.com/morluto/rea/pull/2202), [issue morluto/rea#2181](https://github.com/morluto/rea/issues/2181)) and Bun memory-enforcement paths retain their recorded native-versus-controlled-fixture limits; these fixes are not a general process-ownership guarantee. ([#1700](https://github.com/morluto/rea/pull/1700), [issue morluto/rea#1697](https://github.com/morluto/rea/issues/1697), [#1730](https://github.com/morluto/rea/pull/1730), [#1756](https://github.com/morluto/rea/pull/1756), [issue morluto/rea#1753](https://github.com/morluto/rea/issues/1753), [#1760](https://github.com/morluto/rea/pull/1760), [issue morluto/rea#1757](https://github.com/morluto/rea/issues/1757), [#1826](https://github.com/morluto/rea/pull/1826), [#1907](https://github.com/morluto/rea/pull/1907), [issue morluto/rea#1856](https://github.com/morluto/rea/issues/1856), [#1999](https://github.com/morluto/rea/pull/1999), [issue morluto/rea#1993](https://github.com/morluto/rea/issues/1993), [#2232](https://github.com/morluto/rea/pull/2232), [issue morluto/rea#2170](https://github.com/morluto/rea/issues/2170), [#2252](https://github.com/morluto/rea/pull/2252), [issue morluto/rea#2218](https://github.com/morluto/rea/issues/2218), [#2467](https://github.com/morluto/rea/pull/2467), [issue morluto/rea#2257](https://github.com/morluto/rea/issues/2257), [#2468](https://github.com/morluto/rea/pull/2468), [#2488](https://github.com/morluto/rea/pull/2488), [09b6828](https://github.com/morluto/rea/commit/09b68285166bef2b7633402c8adf7eb25823b47e), [7285e15](https://github.com/morluto/rea/commit/7285e15839a4fecf9940683699b781a60ccc4775), [b5ededd](https://github.com/morluto/rea/commit/b5ededd0f9c28d0f696a205103066928117368ee), [d8c76b6](https://github.com/morluto/rea/commit/d8c76b629639bda4405afa9ae2f7676b694f2f10), [98d8470](https://github.com/morluto/rea/commit/98d8470d36cfbf7cd25820a4ed430aebae20c0c5), [c22111e](https://github.com/morluto/rea/commit/c22111eca2c4bc84a084f12711f405b3e7422a40), [cecc6ec](https://github.com/morluto/rea/commit/cecc6ecbffe84689a173d1634f342e046b0c8ceb), [10935b7](https://github.com/morluto/rea/commit/10935b7b1136accab2a43b308ab380749da0f7ae), [63e796d](https://github.com/morluto/rea/commit/63e796d50ea323ae8dcfef80f86c8154bb106790), [d9e9fb2](https://github.com/morluto/rea/commit/d9e9fb2273543caab4eb21d896c33d462ada6971), [9049dba](https://github.com/morluto/rea/commit/9049dbaf0c3df32357419f9899965df2b611f493), [ed881c6](https://github.com/morluto/rea/commit/ed881c6d2ef6a8adba0c2a241ebc9ab4603b7868)). Thanks @Ashen00001, @charan-rathore, @coygeek, @EDMND-SRC, @JasonBuildAI, @jimpablo, @kaoru0822-kitauji, @N0zoM1z0, @NIU-123370, @Rinkia, @rudycelekli, @sx4im, @xeropresence, @XiaoBinGan, @xthunder0, @hzh666kevin-hue.
|
||||
- **Native image identity:** preserve universal Mach-O containers and selected slice/subtype identity, chained fixup locations and library ordinals, exact signing text, PE resource capacity and ELF/header framing. Mach-O summary selection and independent slice commands avoid unnecessary delivery/work. Controlled routing/parser fixtures do not establish every installed-provider path. ([#1703](https://github.com/morluto/rea/pull/1703), [issue morluto/rea#1702](https://github.com/morluto/rea/issues/1702), [#1708](https://github.com/morluto/rea/pull/1708), [#1709](https://github.com/morluto/rea/pull/1709), [#1713](https://github.com/morluto/rea/pull/1713), [#1772](https://github.com/morluto/rea/pull/1772), [issue morluto/rea#1765](https://github.com/morluto/rea/issues/1765), [#1784](https://github.com/morluto/rea/pull/1784), [issue morluto/rea#1775](https://github.com/morluto/rea/issues/1775), [#1982](https://github.com/morluto/rea/pull/1982), [#1995](https://github.com/morluto/rea/pull/1995), [issue morluto/rea#1990](https://github.com/morluto/rea/issues/1990), [#2040](https://github.com/morluto/rea/pull/2040), [#2107](https://github.com/morluto/rea/pull/2107), [#2161](https://github.com/morluto/rea/pull/2161), [issue morluto/rea#2105](https://github.com/morluto/rea/issues/2105), [#2248](https://github.com/morluto/rea/pull/2248), [issue morluto/rea#2176](https://github.com/morluto/rea/issues/2176), [#2281](https://github.com/morluto/rea/pull/2281), [issue morluto/rea#2274](https://github.com/morluto/rea/issues/2274), [#2292](https://github.com/morluto/rea/pull/2292), [#2466](https://github.com/morluto/rea/pull/2466), [#2506](https://github.com/morluto/rea/pull/2506), [#2733](https://github.com/morluto/rea/pull/2733), [issue morluto/rea#2661](https://github.com/morluto/rea/issues/2661), [f598bab](https://github.com/morluto/rea/commit/f598bab488e38c378d69346fa3c106f9e18529ed), [108b5f9](https://github.com/morluto/rea/commit/108b5f94254281639badd25b1f448cca35dc89a2), [f1924cf](https://github.com/morluto/rea/commit/f1924cf9c1910d5d29d11e7bf634b51af8d738cf), [8bd5ba2](https://github.com/morluto/rea/commit/8bd5ba2d234cbd9a5bb9dd5daeaa191c3a1cad24), [b38429c](https://github.com/morluto/rea/commit/b38429cb6a0de8f4bb5ae01633e24abe2d7cde46), [8d4d631](https://github.com/morluto/rea/commit/8d4d631606c701aac150cf009d3b80ae4a7ae7d5), [ac57c88](https://github.com/morluto/rea/commit/ac57c88efe64c3125850b54d3d833227e6b8ec51), [dc038d1](https://github.com/morluto/rea/commit/dc038d16bba9046afd28970de9c47f6259a43524), [34a4bb6](https://github.com/morluto/rea/commit/34a4bb6508006fa113463ef20ed799a2994e9ee8), [ebc22d9](https://github.com/morluto/rea/commit/ebc22d99d62225505c0a84f6e39823ba4ef2f829), [c02fb0e](https://github.com/morluto/rea/commit/c02fb0ea8055f98def2b12ad557aed0faefd3639)). Thanks @1NormalGuy, @Aliciawque, @baron, @coygeek, @dhl84, @hemanthrayuduu, @JasonBuildAI, @kaoru0822-kitauji, @N0zoM1z0, @thangldw, @viniciusdsandrade, @XiaoBinGan, @Zburgers.
|
||||
- **Archive and artifact provenance:** keep physical ZIP occurrence identity, exact signatures/names and partial inventory coverage; bound decompression and reject malformed keys/integers. Directory/ASAR/DMG reads retain ownership through cleanup and publication cancellation. Duplicate ZIP names remain explicitly ambiguous where the public projection cannot represent them; synthetic archive/cleanup cases do not prove every real Unblob or DMG failure path. ([#1726](https://github.com/morluto/rea/pull/1726), [issue morluto/rea#1725](https://github.com/morluto/rea/issues/1725), [#1854](https://github.com/morluto/rea/pull/1854), [issue morluto/rea#1844](https://github.com/morluto/rea/issues/1844), [#1865](https://github.com/morluto/rea/pull/1865), [issue morluto/rea#1860](https://github.com/morluto/rea/issues/1860), [#2069](https://github.com/morluto/rea/pull/2069), [#2106](https://github.com/morluto/rea/pull/2106), [#2144](https://github.com/morluto/rea/pull/2144), [#2365](https://github.com/morluto/rea/pull/2365), [#2493](https://github.com/morluto/rea/pull/2493), [918713a](https://github.com/morluto/rea/commit/918713af376e307ecf24d75e6a0dd9d1b544545b), [eb97da3](https://github.com/morluto/rea/commit/eb97da33881e3d1472d97a7d788ee35944fb6b07), [2260887](https://github.com/morluto/rea/commit/2260887f2092be6a3d9c79509e4ae4a3e52fce7f), [74d7da6](https://github.com/morluto/rea/commit/74d7da6ced0f869936ee0316b00616931b088066), [ed485a3](https://github.com/morluto/rea/commit/ed485a3dc8cc3a4baf8cabe01acb7aa0490b73b3), [921bb95](https://github.com/morluto/rea/commit/921bb9575505065f6cfd57b14d97d80d0f238546), [d8ceb3f](https://github.com/morluto/rea/commit/d8ceb3f276a65c181b146f68c0729ff4b6f9fa61), [9435c7a](https://github.com/morluto/rea/commit/9435c7aae279ba184937c0dfeb713fd574ba3f29), [bb54082](https://github.com/morluto/rea/commit/bb540826d65316c164d2de8ba4ef10f81a8ad073), [a73a55f](https://github.com/morluto/rea/commit/a73a55f53cc2b2e5b7618effe6ecb5cee6e0cee2), [3c57e1a](https://github.com/morluto/rea/commit/3c57e1a8b21b379fca55032d177078e1d8426e64), [ec0b081](https://github.com/morluto/rea/commit/ec0b081371f118e6e5e042fbef3479359c672ddb), [e7882b3](https://github.com/morluto/rea/commit/e7882b34f4ac4a26f903c5f49264acc2c19bb562), [b955b82](https://github.com/morluto/rea/commit/b955b825fc002a4bb408f2910b78768c566c2cd1)). Thanks @1052326311, @1NormalGuy, @baron, @Bortlesboat, @Chaoqi31, @DeryFerd, @kaoru0822-kitauji, @N0zoM1z0, @XiaoBinGan.
|
||||
- **Setup/uninstall recovery:** preserve unrelated YAML text, caller-selected roots, symlinked data and existing recovery snapshots; explain malformed configuration shapes and retain failed rollback/cleanup owners. Show terminal dry-run plans and each selected skill location. Bunx registration and fault-injected recovery cases remain simulated rather than live-client verification. ([#1731](https://github.com/morluto/rea/pull/1731), [#1754](https://github.com/morluto/rea/pull/1754), [#1821](https://github.com/morluto/rea/pull/1821), [issue morluto/rea#1816](https://github.com/morluto/rea/issues/1816), [#1983](https://github.com/morluto/rea/pull/1983), [#2118](https://github.com/morluto/rea/pull/2118), [issue morluto/rea#2111](https://github.com/morluto/rea/issues/2111), [#2154](https://github.com/morluto/rea/pull/2154), [issue morluto/rea#2152](https://github.com/morluto/rea/issues/2152), [#2157](https://github.com/morluto/rea/pull/2157), [#2182](https://github.com/morluto/rea/pull/2182), [issue morluto/rea#2159](https://github.com/morluto/rea/issues/2159), [#2481](https://github.com/morluto/rea/pull/2481), [bb50813](https://github.com/morluto/rea/commit/bb508134efbba392a404b651d6ec05be8b7eac1e), [c240768](https://github.com/morluto/rea/commit/c2407689cb04df082e8db0b6afa8f8d022f6bcd1), [dcfc5d4](https://github.com/morluto/rea/commit/dcfc5d403ac997c2b08bee4753e57a1a4a8a8538), [21eff3b](https://github.com/morluto/rea/commit/21eff3bae10f58711a35ad44f86e9f96f9bb4790), [94153f1](https://github.com/morluto/rea/commit/94153f1c757e07a6d092e00903aa8b125d4a0afa), [2397137](https://github.com/morluto/rea/commit/23971376158e7815edcbe6c04a8df7c9504650dc), [c339f9e](https://github.com/morluto/rea/commit/c339f9ebe7bd1f30608d6ccb7175da523dd3c485), [f6775a3](https://github.com/morluto/rea/commit/f6775a36694a6a9c620f4248638e8056a6cbcb66)). Thanks @BeqaKs, @Jax367, @kaoru0822-kitauji, @NIU-123370, @shoyann, @viniciusdsandrade, @xeropresence, @zaydiscold.
|
||||
- **Bun updates:** locate global installations before changing directories and reuse parsed client activation during maintenance. The update flow is covered with package-manager/filesystem simulations; a real Bun global installation update remains unverified. ([#1735](https://github.com/morluto/rea/pull/1735), [e90acae](https://github.com/morluto/rea/commit/e90acaea674f5f7f9f17ea472104afdc1422ada6), [b045df1](https://github.com/morluto/rea/commit/b045df100e1489e08a36d6ff04cea7feecf1332c)). Thanks @xeropresence.
|
||||
- **JavaScript relationships:** preserve loader-specific package/TypeScript/CommonJS boundaries, exact file-URL and source-map identity, Electron intrinsic receivers/IPC guards and chunk metadata. Index repeated lookups and retain completed facts through resource limits and cancellation. Real Electron integration, Bun worker integration and failure-path cleanup remain unverified where the recorded lanes use fixtures. ([#1740](https://github.com/morluto/rea/pull/1740), [#1759](https://github.com/morluto/rea/pull/1759), [issue morluto/rea#1748](https://github.com/morluto/rea/issues/1748), [#1762](https://github.com/morluto/rea/pull/1762), [issue morluto/rea#1761](https://github.com/morluto/rea/issues/1761), [#1767](https://github.com/morluto/rea/pull/1767), [#1788](https://github.com/morluto/rea/pull/1788), [issue morluto/rea#1781](https://github.com/morluto/rea/issues/1781), [issue morluto/rea#1782](https://github.com/morluto/rea/issues/1782), [#1789](https://github.com/morluto/rea/pull/1789), [#1799](https://github.com/morluto/rea/pull/1799), [issue morluto/rea#1793](https://github.com/morluto/rea/issues/1793), [#1827](https://github.com/morluto/rea/pull/1827), [issue morluto/rea#1802](https://github.com/morluto/rea/issues/1802), [#1833](https://github.com/morluto/rea/pull/1833), [issue morluto/rea#1831](https://github.com/morluto/rea/issues/1831), [#1857](https://github.com/morluto/rea/pull/1857), [issue morluto/rea#1842](https://github.com/morluto/rea/issues/1842), [#1871](https://github.com/morluto/rea/pull/1871), [#1874](https://github.com/morluto/rea/pull/1874), [#1905](https://github.com/morluto/rea/pull/1905), [#1912](https://github.com/morluto/rea/pull/1912), [issue morluto/rea#1909](https://github.com/morluto/rea/issues/1909), [#1915](https://github.com/morluto/rea/pull/1915), [issue morluto/rea#1911](https://github.com/morluto/rea/issues/1911), [#1916](https://github.com/morluto/rea/pull/1916), [#1921](https://github.com/morluto/rea/pull/1921), [#1934](https://github.com/morluto/rea/pull/1934), [#1939](https://github.com/morluto/rea/pull/1939), [issue morluto/rea#1881](https://github.com/morluto/rea/issues/1881), [issue morluto/rea#1882](https://github.com/morluto/rea/issues/1882), [issue morluto/rea#1883](https://github.com/morluto/rea/issues/1883), [#1941](https://github.com/morluto/rea/pull/1941), [#2062](https://github.com/morluto/rea/pull/2062), [issue morluto/rea#2058](https://github.com/morluto/rea/issues/2058), [#2104](https://github.com/morluto/rea/pull/2104), [#2422](https://github.com/morluto/rea/pull/2422), [#2475](https://github.com/morluto/rea/pull/2475), [#2737](https://github.com/morluto/rea/pull/2737), [issue morluto/rea#2663](https://github.com/morluto/rea/issues/2663), [d3088c3](https://github.com/morluto/rea/commit/d3088c3795f6c37cb3b6aec0bb0c371dd0640ee8), [1dfb933](https://github.com/morluto/rea/commit/1dfb933e47db0156cf1cb61f28715b81e740c57b), [f8513a4](https://github.com/morluto/rea/commit/f8513a42dc44451a621127f06edde5d38bc93f69), [b8fab74](https://github.com/morluto/rea/commit/b8fab7429771bb17a7ca0297661de3c9935212af), [42b0ed1](https://github.com/morluto/rea/commit/42b0ed126df7d5b908ac369715378d5e519051b7), [c0904b4](https://github.com/morluto/rea/commit/c0904b4c1aabfccf2f0ab12f44960a0a1fbbbfae), [9f67e44](https://github.com/morluto/rea/commit/9f67e44e5d451d705bae9a579ad9802d5c9f097c), [e4532b5](https://github.com/morluto/rea/commit/e4532b537663026c3e5b784380eecd009c959a36), [1c37914](https://github.com/morluto/rea/commit/1c37914306b3ff257d7a0360f11c9bf2a3f2cac7), [5ab0cbb](https://github.com/morluto/rea/commit/5ab0cbb48ea5a4f11542eac44479b9af48f1dabd), [b7169c8](https://github.com/morluto/rea/commit/b7169c8b747cbc032913b31f008a3b81c77b6219), [f43fc02](https://github.com/morluto/rea/commit/f43fc0247527aebb8efc7d9db04276fe2d489323), [3ae826c](https://github.com/morluto/rea/commit/3ae826ceba6f25b08bce50bcb51001209bc16b57), [1b95302](https://github.com/morluto/rea/commit/1b953021eadf4cac09e20be388d79536903633b3), [eaa9616](https://github.com/morluto/rea/commit/eaa961658578522cecfbba7c7be1acf1c64da65a), [c923fb0](https://github.com/morluto/rea/commit/c923fb0dc9462e302b84a15770131ff899f89455), [c7a890d](https://github.com/morluto/rea/commit/c7a890d12987d9b2d496119c1fbf1a88c0fc298e)). Thanks @Aurantium-47, @baron, @chqcjq, @coygeek, @cyanseek, @fengdwx, @flitzrrr, @immanuwell, @kaoru0822-kitauji, @N0zoM1z0, @Nelglor, @ranmori, @rudycelekli, @shoyann, @xu91102.
|
||||
- **Browser observations:** preserve effective source-map URLs, empty query/fragment identity, response-body provenance, service-worker policies and explicit uncertainty for malformed events. Bound discovery lifetimes and retain cleanup ownership. Interrupt/retry/failure cases validated with controlled CDP/session fixtures do not establish those paths in real Chromium. ([#1742](https://github.com/morluto/rea/pull/1742), [issue morluto/rea#1729](https://github.com/morluto/rea/issues/1729), [#1829](https://github.com/morluto/rea/pull/1829), [#2074](https://github.com/morluto/rea/pull/2074), [#2099](https://github.com/morluto/rea/pull/2099), [#2239](https://github.com/morluto/rea/pull/2239), [issue morluto/rea#2169](https://github.com/morluto/rea/issues/2169), [#2477](https://github.com/morluto/rea/pull/2477), [486b567](https://github.com/morluto/rea/commit/486b56724c4eaba50719177bcb9eae84d6907297), [a82e37c](https://github.com/morluto/rea/commit/a82e37c8065cc200a0ca3e14e7c4f85e4e468580), [a8d4984](https://github.com/morluto/rea/commit/a8d4984404b611e60b88bc42289c0ba07eee4578), [966f7cc](https://github.com/morluto/rea/commit/966f7cc84b4a8bb0043641cb64d7a7aaf8715e05), [221c856](https://github.com/morluto/rea/commit/221c85648108e9846d9920b0964dafa7f108d581), [951b095](https://github.com/morluto/rea/commit/951b095e11adf9faa9c4a27e212260060aa6b095), [f09bb8a](https://github.com/morluto/rea/commit/f09bb8a99773f79c7306b8799c86f856fe2c0d4b), [6bd2b28](https://github.com/morluto/rea/commit/6bd2b28161411f70ed5dc72e42c2736a1aab758b)). Thanks @1052326311, @chAng-L19, @chqcjq, @coygeek, @evenafterallisaid, @fisforfaheem, @itsF4LCON, @N0zoM1z0, @shayanxcyber.
|
||||
- **Managed metadata/CIL:** preserve ExportedType and pointer-table ownership, generic/array/function-pointer/modifier signatures, ReadyToRun host identity, metadata ExtraData and signed zero. Charge retained facts and decoded instruction counts instead of broad decoding bounds; malformed layouts remain caller input errors. ([#1743](https://github.com/morluto/rea/pull/1743), [issue morluto/rea#1736](https://github.com/morluto/rea/issues/1736), [#1768](https://github.com/morluto/rea/pull/1768), [#1822](https://github.com/morluto/rea/pull/1822), [issue morluto/rea#1801](https://github.com/morluto/rea/issues/1801), [#1828](https://github.com/morluto/rea/pull/1828), [issue morluto/rea#1812](https://github.com/morluto/rea/issues/1812), [#1835](https://github.com/morluto/rea/pull/1835), [issue morluto/rea#1832](https://github.com/morluto/rea/issues/1832), [#1886](https://github.com/morluto/rea/pull/1886), [#1893](https://github.com/morluto/rea/pull/1893), [#1897](https://github.com/morluto/rea/pull/1897), [issue morluto/rea#1878](https://github.com/morluto/rea/issues/1878), [#1943](https://github.com/morluto/rea/pull/1943), [issue morluto/rea#1940](https://github.com/morluto/rea/issues/1940), [#1985](https://github.com/morluto/rea/pull/1985), [#2194](https://github.com/morluto/rea/pull/2194), [issue morluto/rea#2191](https://github.com/morluto/rea/issues/2191), [#2437](https://github.com/morluto/rea/pull/2437), [52e76c5](https://github.com/morluto/rea/commit/52e76c5d39b58d1685bb5e22bd40d19524dfa2cb)). Thanks @ac1982, @chqcjq, @fisHarly0, @flitzrrr, @JasonBuildAI, @JayOfTheKeyboard, @jhuang-tw, @kaoru0822-kitauji, @N0zoM1z0, @Nelglor.
|
||||
- **Hopper failure ownership:** preserve startup/process outcomes, retain cleanup leases across one-shot failures, wait for late bridges, and stop owned Linux demo children when their REA owner exits. Denied/crashed/late-bridge/queued-request failure paths use simulated process or bridge fixtures; they are not fresh installed-Hopper verification. ([#1763](https://github.com/morluto/rea/pull/1763), [issue morluto/rea#1751](https://github.com/morluto/rea/issues/1751), [#1817](https://github.com/morluto/rea/pull/1817), [#1866](https://github.com/morluto/rea/pull/1866), [#1927](https://github.com/morluto/rea/pull/1927), [#2474](https://github.com/morluto/rea/pull/2474), [#2499](https://github.com/morluto/rea/pull/2499), [issue morluto/rea#2459](https://github.com/morluto/rea/issues/2459)). Thanks @coygeek, @Joshwong1908, @kaoru0822-kitauji, @N0zoM1z0, @rudycelekli.
|
||||
- **IDA session boundaries:** retain non-x86 call coverage and unresolved-procedure uncertainty, and bound private universal-Mach-O inputs to the exact selected slice. Transient headless busy recovery was exercised on macOS arm64 IDA Pro 9.1; Linux headless, attached GUI navigation and worker-reaped cleanup paths retain their documented verification gaps. ([#1764](https://github.com/morluto/rea/pull/1764), [issue morluto/rea#1712](https://github.com/morluto/rea/issues/1712), [#1778](https://github.com/morluto/rea/pull/1778), [issue morluto/rea#1766](https://github.com/morluto/rea/issues/1766), [#1785](https://github.com/morluto/rea/pull/1785), [issue morluto/rea#1769](https://github.com/morluto/rea/issues/1769), [#1906](https://github.com/morluto/rea/pull/1906), [issue morluto/rea#1794](https://github.com/morluto/rea/issues/1794), [#2201](https://github.com/morluto/rea/pull/2201), [issue morluto/rea#2139](https://github.com/morluto/rea/issues/2139), [#2291](https://github.com/morluto/rea/pull/2291), [issue morluto/rea#2285](https://github.com/morluto/rea/issues/2285), [#2324](https://github.com/morluto/rea/pull/2324), [12fa8fd](https://github.com/morluto/rea/commit/12fa8fd9f986dbd4ff58165c3ec71a46dc8a8a3b)). Thanks @akushonkamen, @coygeek, @kaoru0822-kitauji, @N0zoM1z0, @nikolay-dementiev, @zecaro.
|
||||
- **Input and capability diagnostics:** identify invalid paths, format refusals, missing host tools and non-retryable errors without losing caller selections or retryable capability facts. Foreign execution/device mutation annotations remain destructive, analysis-target text is untrusted, and output ordering follows code points rather than host locale. ([#1770](https://github.com/morluto/rea/pull/1770), [#1867](https://github.com/morluto/rea/pull/1867), [#1869](https://github.com/morluto/rea/pull/1869), [issue morluto/rea#1855](https://github.com/morluto/rea/issues/1855), [#1872](https://github.com/morluto/rea/pull/1872), [#1879](https://github.com/morluto/rea/pull/1879), [issue morluto/rea#1853](https://github.com/morluto/rea/issues/1853), [#1899](https://github.com/morluto/rea/pull/1899), [#1902](https://github.com/morluto/rea/pull/1902), [#1904](https://github.com/morluto/rea/pull/1904), [#1908](https://github.com/morluto/rea/pull/1908), [#1925](https://github.com/morluto/rea/pull/1925), [#1987](https://github.com/morluto/rea/pull/1987), [issue morluto/rea#1979](https://github.com/morluto/rea/issues/1979), [#2004](https://github.com/morluto/rea/pull/2004), [issue morluto/rea#2002](https://github.com/morluto/rea/issues/2002), [#2026](https://github.com/morluto/rea/pull/2026), [#2091](https://github.com/morluto/rea/pull/2091), [#2133](https://github.com/morluto/rea/pull/2133), [issue morluto/rea#2129](https://github.com/morluto/rea/issues/2129), [#2145](https://github.com/morluto/rea/pull/2145), [issue morluto/rea#2143](https://github.com/morluto/rea/issues/2143), [#2472](https://github.com/morluto/rea/pull/2472), [#2478](https://github.com/morluto/rea/pull/2478), [issue morluto/rea#2454](https://github.com/morluto/rea/issues/2454), [#2494](https://github.com/morluto/rea/pull/2494), [#2507](https://github.com/morluto/rea/pull/2507), [#2509](https://github.com/morluto/rea/pull/2509), [#2708](https://github.com/morluto/rea/pull/2708), [3d83135](https://github.com/morluto/rea/commit/3d8313598785359c424d7305f503cb69fc8639a6), [c9fed50](https://github.com/morluto/rea/commit/c9fed50691ae014890e91a72534773d2fb58ce44), [8b18171](https://github.com/morluto/rea/commit/8b181716aca2cb467be499cba226abfb5ae19141), [7a2cd1e](https://github.com/morluto/rea/commit/7a2cd1ea0a63e8c44166860b7ee9c7a1aa43492b)). Thanks @astralyx0129, @CassieFox23, @DeryFerd, @dollarsmoney, @fisforfaheem, @flitzrrr, @Ha1baraA11, @jimpablo, @kaoru0822-kitauji, @larinyo, @N0zoM1z0, @rudycelekli, @SII-YDD, @viniciusdsandrade, @XiaoBinGan.
|
||||
- **Android analysis:** retain decoded values, duplicate-class inventories and executable static initializers, reject malformed JADX UTF-8, and keep inline search provenance. Apktool accepts `--no-strings` and explains host requirements. Windows batch-launcher selection also resolves PATH/PATHEXT before choosing its launch mode. Recorded Apktool coverage is Linux/OpenJDK, and changed JADX/batch failure paths do not establish native Windows behavior. ([#1777](https://github.com/morluto/rea/pull/1777), [issue morluto/rea#1774](https://github.com/morluto/rea/issues/1774), [#1876](https://github.com/morluto/rea/pull/1876), [issue morluto/rea#1846](https://github.com/morluto/rea/issues/1846), [#1890](https://github.com/morluto/rea/pull/1890), [issue morluto/rea#1850](https://github.com/morluto/rea/issues/1850), [#1946](https://github.com/morluto/rea/pull/1946), [issue morluto/rea#1945](https://github.com/morluto/rea/issues/1945), [#2707](https://github.com/morluto/rea/pull/2707), [issue morluto/rea#2672](https://github.com/morluto/rea/issues/2672), [0677468](https://github.com/morluto/rea/commit/0677468877465c8dfbe25c72f142a7b5bc8a3212), [fe8d0bd](https://github.com/morluto/rea/commit/fe8d0bdd36fe12bc0836468d1a702a34fbdc219b), [#2802](https://github.com/morluto/rea/pull/2802)). Thanks @akushonkamen, @coygeek, @HeadmasterEggy, @kaoru0822-kitauji, @N0zoM1z0, @psipher.
|
||||
- **ADB acquisition:** preserve device paths and directory identity, prevent host destination collisions/overwrites, count UTF-8 logcat bytes and restricted permissions, and evaluate the complete Activity Manager start report. Launch attempts, status, activity and raw failure output remain observations; real-device timeout/mixed-report and Android 8 directory-read paths remain unverified beyond the documented fixtures. ([#1962](https://github.com/morluto/rea/pull/1962), [#2212](https://github.com/morluto/rea/pull/2212), [issue morluto/rea#2175](https://github.com/morluto/rea/issues/2175), [#2221](https://github.com/morluto/rea/pull/2221), [issue morluto/rea#2220](https://github.com/morluto/rea/issues/2220), [#2359](https://github.com/morluto/rea/pull/2359), [c42232f](https://github.com/morluto/rea/commit/c42232f566d55fe7191763649755148c768eef9f), [55b6148](https://github.com/morluto/rea/commit/55b61485e9f7568b69597eef8696ff6abfe53cfd), [3bdc873](https://github.com/morluto/rea/commit/3bdc8730bd98e073522bcb8ba86527be402c0cbe), [c89972c](https://github.com/morluto/rea/commit/c89972c8777d0114566fe76a060849a18bdd2659), [e1cd292](https://github.com/morluto/rea/commit/e1cd292aa6e8f5f13441d408c66126782c8dbb0d)). Thanks @coygeek, @dakjdakd, @DeryFerd, @huiq777, @sx4im.
|
||||
- **WASM names and diagnostics:** preserve debug/custom-section names including NUL and leading BOM, accept unpadded WABT section rows, and avoid irrelevant tool-remediation advice on unrelated runtime-root failures. ([#1963](https://github.com/morluto/rea/pull/1963), [issue morluto/rea#1956](https://github.com/morluto/rea/issues/1956), [#1967](https://github.com/morluto/rea/pull/1967), [#1981](https://github.com/morluto/rea/pull/1981), [#2084](https://github.com/morluto/rea/pull/2084), [#2102](https://github.com/morluto/rea/pull/2102)). Thanks @1052326311, @bugstan, @N0zoM1z0, @sathariels, @STiFLeR7, @viniciusdsandrade.
|
||||
|
||||
- **Source-map and path handling:** retain source-map entries when embedded-content counts differ or an optional `sourceMappingURL` is used, and keep `file:` URLs out of operator-relative path resolution. ([#2873](https://github.com/morluto/rea/pull/2873), [#2886](https://github.com/morluto/rea/pull/2886), [#2882](https://github.com/morluto/rea/pull/2882), [issue morluto/rea#2821](https://github.com/morluto/rea/issues/2821), [issue morluto/rea#2883](https://github.com/morluto/rea/issues/2883), [issue morluto/rea#2577](https://github.com/morluto/rea/issues/2577)). Thanks @JFSAS, @rileygramlich, @shoyann, @shubhamahuja9999, @coygeek.
|
||||
- **Native metadata:** accept declared facts in native dispatch inventories and share native verification input diagnostics. ([#2906](https://github.com/morluto/rea/pull/2906), [#2901](https://github.com/morluto/rea/pull/2901), [issue morluto/rea#2564](https://github.com/morluto/rea/issues/2564), [issue morluto/rea#2621](https://github.com/morluto/rea/issues/2621)). Thanks @ShitK, @coygeek.
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
- **Runtime attachment state:** `attached` may be `null` in JavaScript, browser and Electron discovery/inspection results. Treat null as unknown; do not coerce it to false. ([e55ef72](https://github.com/morluto/rea/commit/e55ef7213515ba204c3d88a4487b4ee6a2773b06)).
|
||||
- **Source maps:** original-source and mapping rows preserve a null source name when unavailable. Handle null explicitly instead of expecting an invented unknown-source string; new index fields remain optional when reading older Evidence. ([ee50ed1](https://github.com/morluto/rea/commit/ee50ed121e38cc6e1a2ff0dc8b789f15f71c5402)).
|
||||
- **Streamed filtered JSON:** `--filter-output` now emits JSON `null` instead of `{}` when the selected value is null; consumers must distinguish a present null from a missing selection. Use `--full-output` when an object envelope is required. ([#2333](https://github.com/morluto/rea/pull/2333)). Thanks @Jackmeson1.
|
||||
- **Call graphs:** `get_call_graph.normalized_result` is now `{ graph, limitations }`; read traversal-depth groups under `graph` and retain relationship-specific caveats. Contract/fixture validation does not establish new Ghidra or IDA engine coverage. ([5dfb9d0](https://github.com/morluto/rea/commit/5dfb9d050c2cc44a61b183dae765bef4d22a53b7)).
|
||||
- **MCP discovery:** `binary_session` no longer repeats `server_identity.catalog.tools`. Use the connected server tool list, grouped `tool_availability` and provider capabilities; see [MCP contracts](docs/mcp-contracts.md). Origin: [6395e8d](https://github.com/morluto/rea/commit/6395e8d3007d5ee453477460e7ee1c51cff76be0). ([#1988](https://github.com/morluto/rea/pull/1988)). Thanks @kaoru0822-kitauji, @N0zoM1z0.
|
||||
|
||||
- **Provider admission:** MIPS targets with unresolved GNU ABI attributes are refused. Supply supported ABI declarations. Saved Hopper databases on macOS are unavailable because the launcher cannot run the analysis bridge when opening a database; select an executable target instead. Database support requires a script-capable database launch route. ([d4bd65c](https://github.com/morluto/rea/commit/d4bd65c53c0254d0195cc7ab8da163dcadfd3b9b)).
|
||||
- **Segment extents:** `binary_overview` segment length may be null when Hopper coordinates cannot establish a finite extent in one address space. Preserve unknown rather than converting it to zero or a saturated value. ([36db19c](https://github.com/morluto/rea/commit/36db19c59)).
|
||||
- **Invocation identity:** `server.command_path` may be null, and registration/setup statuses or doctor classifications may be unknown. Preserve these states and establish the actual invocation before treating a registration as aligned. ([187f113](https://github.com/morluto/rea/commit/187f113f7)). Thanks @hemv-857, @qorvr.
|
||||
- **ADB installation:** the optional `replace` input is unchanged. Results now require `replace_requested` to record the requested `adb install -r` mode; `replaced` is nullable because prior device package state was not observed. Update result readers to accept null instead of treating reinstall intent as proof of replacement. ([864314a](https://github.com/morluto/rea/commit/864314ac857924a7e6e65bfb37e8dc720fcc21e7)).
|
||||
- **Managed/native verification:** unresolved P/Invoke results may retain `matched_native` and candidate facts when module identity is unknown. Interpret `status`, `basis` and `limitations`; `module-identity-unknown` does not verify correspondence, and unresolved no longer implies empty observations. ([3f6b575](https://github.com/morluto/rea/commit/3f6b5755b3e699bd9373641acffe0f2c5d2ab094)).
|
||||
|
||||
Full contribution record: [893 commits and 529 merged PRs](https://github.com/morluto/rea/blob/rea-agents-6.5.0/docs/releases/6.5.0.contributions.json).
|
||||
|
||||
|
||||
## [6.4.0](https://github.com/morluto/rea/compare/rea-agents-6.3.0...rea-agents-6.4.0) (2026-10-11)
|
||||
|
||||
### Highlights
|
||||
|
||||
@@ -24,6 +24,82 @@ costs change.
|
||||
|
||||
When adding or changing an MCP tool, follow the [tool design guide](docs/tool-design.md) and preserve the canonical contracts and generated catalog.
|
||||
|
||||
## Reporting issues
|
||||
|
||||
Use the issue form that fits the report and keep it concise. For bugs, include
|
||||
the actual result, the shortest reproduction you ran, the tested version and
|
||||
environment, and the smallest useful output, artifact, screenshot, or source
|
||||
reference. Ground expected behavior in documentation, source, or a known-good
|
||||
version when available. State observed impact and frequency; keep untested scope
|
||||
and suspected causes explicit.
|
||||
|
||||
Incomplete reports and intermittent failures are welcome. If a narrative answer
|
||||
or supporting evidence is unavailable, write `NOT_ENOUGH_INFO` and explain the
|
||||
gap. Clearly label source-only findings and proposed checks; do not claim runtime
|
||||
reproduction or results you did not observe. A root-cause analysis or fix is not
|
||||
required to report a problem. Documentation reports should identify the relevant
|
||||
passage or missing guidance and explain the correction or confusion.
|
||||
|
||||
Feature and design proposals can start with a problem and desired outcome.
|
||||
Examples, prior art, and measurements help when available; ideas without them
|
||||
are welcome. Maintainers can investigate reports and help resolve open questions.
|
||||
Human ownership and readiness declarations apply to PRs as described below.
|
||||
|
||||
## Pull request ownership and readiness
|
||||
|
||||
AI-assisted contributions are welcome. Every PR must have a human owner who
|
||||
takes responsibility for the complete change, including code, tests,
|
||||
documentation, and claims produced with AI assistance. The PR author is the
|
||||
owner unless another human is named in the PR and explicitly accepts ownership.
|
||||
These requirements also apply to maintainer-authored PRs.
|
||||
|
||||
Before requesting maintainer review, the human owner must:
|
||||
|
||||
- Review the final diff and relevant existing code. Be able to explain the
|
||||
problem, the chosen approach, how it fits REA, and meaningful edge cases.
|
||||
- Provide evidence that the change works. Summarize what was checked, the
|
||||
observed results, and meaningful gaps in the PR body. Use focused tests,
|
||||
representative CLI/MCP output, CI artifacts, screenshots, or other checks
|
||||
appropriate to the change. For fixes, show the original failure and why the
|
||||
regression coverage catches it when practical. Documentation-only changes
|
||||
can use source, link, or rendered-document checks. Label source-derived
|
||||
conclusions and proposed checks accurately; never report an unrun check as
|
||||
passing. Follow the [verification requirements](#development-feedback-and-pr-verification)
|
||||
for required checks and real-provider coverage.
|
||||
- Complete the **Author readiness** declaration in the PR template, explicitly
|
||||
stating that the PR is ready for initial review.
|
||||
|
||||
Keep the PR description concise and current. Explain the problem, observable
|
||||
outcome, approach, and useful evidence; link long logs or put them in optional
|
||||
details. Address actionable automated review findings and explain disagreements.
|
||||
Human ownership and review remain required when CI or an automated reviewer
|
||||
reports success. Readiness requests maintainer review; it does not grant scope
|
||||
approval or permission to merge.
|
||||
|
||||
Draft PRs may request early feedback with open questions and incomplete checks.
|
||||
Leave the readiness declaration unchecked until the human owner has completed
|
||||
it. The declaration records initial readiness; later pushes do not invalidate
|
||||
it or require another human sign-off. Keep the PR description and affected
|
||||
validation current as work changes. AI agents must leave human declarations to
|
||||
the human owner and must not attest to a human review on their behalf.
|
||||
|
||||
The `PR readiness` check reports pending for drafts and requires a named human
|
||||
owner and all three template declarations for non-drafts. It checks that the
|
||||
declaration is filled, not whether the code or evidence is correct. Existing PRs
|
||||
can copy the **Author readiness** section from the current template.
|
||||
Open PRs must have distinct head commits because GitHub shares commit statuses.
|
||||
|
||||
Maintainers enable merge enforcement after the workflow is merged: run
|
||||
`gh workflow run pr-readiness.yml -f pull_request_number=NUMBER` for existing
|
||||
open PRs, then add `PR readiness` from GitHub Actions to the branch's required
|
||||
status checks alongside its existing checks. Deploy the workflow to each
|
||||
protected target branch before requiring it there. The workflow reads PR
|
||||
metadata using trusted default-branch code and writes only a commit status.
|
||||
|
||||
Maintainers may return a PR to the author or close it when the problem is
|
||||
unsupported, validation is missing, or the owner cannot explain the change.
|
||||
Contributors are responsible for completing this work before requesting review.
|
||||
|
||||
## Contribution scope
|
||||
|
||||
REA focuses on software structure, runtime behavior, and evidence through
|
||||
|
||||
@@ -1340,7 +1340,8 @@ public final class ReaGhidraBridge extends HeadlessScript {
|
||||
ReferenceIterator incomingIterator = currentProgram.getReferenceManager().getReferencesTo(address);
|
||||
while (incomingIterator.hasNext()) {
|
||||
monitor.checkCancelled();
|
||||
addReference(incoming, incomingIterator.next());
|
||||
Reference reference = incomingIterator.next();
|
||||
if (!reference.isEntryPointReference()) addReference(incoming, reference);
|
||||
}
|
||||
List<Reference> orderedIncoming = new ArrayList<>(incoming.values());
|
||||
orderedIncoming.sort(REFERENCE_ORDER);
|
||||
|
||||
@@ -567,18 +567,27 @@ def trace(debugger, config):
|
||||
before_digest = _hash_file(config["executable"])
|
||||
before_identity = _file_identity(config["executable"])
|
||||
except OSError as error:
|
||||
return {"status": "target-integrity-error", "error": str(error)}
|
||||
return {
|
||||
"status": "target-integrity-error",
|
||||
"error": str(error),
|
||||
"target_process_created": False,
|
||||
}
|
||||
if before_digest != config["expected_sha256"]:
|
||||
return {
|
||||
"status": "target-integrity-error",
|
||||
"error": "selected executable digest changed before LLDB target creation",
|
||||
"target_process_created": False,
|
||||
}
|
||||
error = lldb.SBError()
|
||||
target = debugger.CreateTarget(
|
||||
config["executable"], config["architecture"], None, False, error
|
||||
)
|
||||
if not target.IsValid():
|
||||
return {"status": "target-error", "error": error.GetCString()}
|
||||
return {
|
||||
"status": "target-error",
|
||||
"error": error.GetCString(),
|
||||
"target_process_created": False,
|
||||
}
|
||||
module_path_before, module_file_identity_before, module_uuid_before = (
|
||||
_module_identity(target)
|
||||
)
|
||||
@@ -589,6 +598,7 @@ def trace(debugger, config):
|
||||
return {
|
||||
"status": "target-integrity-error",
|
||||
"error": "LLDB executable module resolved to a different pre-launch file identity",
|
||||
"target_process_created": False,
|
||||
}
|
||||
created = [_create_breakpoints(target, spec) for spec in config["breakpoints"]]
|
||||
breakpoint_index = {}
|
||||
@@ -622,12 +632,24 @@ def trace(debugger, config):
|
||||
if not error.Success() or not process.IsValid():
|
||||
stdout.close()
|
||||
stderr.close()
|
||||
return {"status": "launch-error", "error": error.GetCString()}
|
||||
return {
|
||||
"status": "launch-error",
|
||||
"error": error.GetCString(),
|
||||
**(
|
||||
{"target_process_created": True}
|
||||
if process.IsValid()
|
||||
else {}
|
||||
),
|
||||
}
|
||||
launch_failure = _failed_launch_description(process)
|
||||
if launch_failure is not None:
|
||||
stdout.close(expected_exit=True)
|
||||
stderr.close(expected_exit=True)
|
||||
return {"status": "launch-error", "error": launch_failure}
|
||||
return {
|
||||
"status": "launch-error",
|
||||
"error": launch_failure,
|
||||
"target_process_created": True,
|
||||
}
|
||||
stdout.mark_launched()
|
||||
stderr.mark_launched()
|
||||
# Publish the PID before any post-launch file or module inspection. The
|
||||
@@ -644,6 +666,7 @@ def trace(debugger, config):
|
||||
return {
|
||||
"status": "target-identity-unavailable",
|
||||
"error": "host could not establish the launched process identity; target was stopped",
|
||||
"target_process_created": True,
|
||||
}
|
||||
try:
|
||||
after_digest = _hash_file(config["executable"])
|
||||
@@ -652,7 +675,11 @@ def trace(debugger, config):
|
||||
process.Kill()
|
||||
stdout.close(expected_exit=process.GetState() == lldb.eStateExited)
|
||||
stderr.close(expected_exit=process.GetState() == lldb.eStateExited)
|
||||
return {"status": "target-integrity-error", "error": str(identity_error)}
|
||||
return {
|
||||
"status": "target-integrity-error",
|
||||
"error": str(identity_error),
|
||||
"target_process_created": True,
|
||||
}
|
||||
if after_digest != config["expected_sha256"] or after_identity != before_identity:
|
||||
process.Kill()
|
||||
_wait_for_exit(listener, process, 5)
|
||||
@@ -661,6 +688,7 @@ def trace(debugger, config):
|
||||
return {
|
||||
"status": "target-integrity-error",
|
||||
"error": "selected executable digest or file identity changed during LLDB launch",
|
||||
"target_process_created": True,
|
||||
}
|
||||
module_path_after, module_file_identity_after, module_uuid_after = (
|
||||
_module_identity(target)
|
||||
@@ -676,6 +704,7 @@ def trace(debugger, config):
|
||||
return {
|
||||
"status": "target-integrity-error",
|
||||
"error": "LLDB executable module resolved to a different file identity",
|
||||
"target_process_created": True,
|
||||
}
|
||||
if (
|
||||
module_uuid_before is not None
|
||||
@@ -689,6 +718,7 @@ def trace(debugger, config):
|
||||
return {
|
||||
"status": "target-integrity-error",
|
||||
"error": "LLDB executable module identity changed during launch",
|
||||
"target_process_created": True,
|
||||
}
|
||||
context = {
|
||||
"target": target,
|
||||
@@ -748,7 +778,11 @@ def trace(debugger, config):
|
||||
# exit code; preserve the debugger's concrete launch denial.
|
||||
launch_failure = _failed_launch_description(process)
|
||||
if launch_failure is not None:
|
||||
return {"status": "launch-error", "error": launch_failure}
|
||||
return {
|
||||
"status": "launch-error",
|
||||
"error": launch_failure,
|
||||
"target_process_created": True,
|
||||
}
|
||||
launch_identity_stable = (
|
||||
module_path_before is not None
|
||||
and module_path_after == module_path_before
|
||||
|
||||
@@ -8,6 +8,7 @@ import sys
|
||||
import tempfile
|
||||
import types
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
fake_lldb = sys.modules.setdefault("lldb", types.ModuleType("lldb"))
|
||||
@@ -22,6 +23,42 @@ spec.loader.exec_module(tracer)
|
||||
|
||||
|
||||
class NativeTraceBudgetTests(unittest.TestCase):
|
||||
def test_pre_target_integrity_failure_reports_no_process_created(self):
|
||||
original_debugger = getattr(tracer.lldb, "SBDebugger", None)
|
||||
|
||||
class DebuggerApi:
|
||||
@staticmethod
|
||||
def SetInternalVariable(*_arguments):
|
||||
return None
|
||||
|
||||
class Debugger:
|
||||
def SetAsync(self, _enabled):
|
||||
return None
|
||||
|
||||
def GetInstanceName(self):
|
||||
return "fixture"
|
||||
|
||||
def CreateTarget(self, *_arguments):
|
||||
raise AssertionError("integrity failure precedes target creation")
|
||||
|
||||
tracer.lldb.SBDebugger = DebuggerApi
|
||||
try:
|
||||
with patch.object(tracer, "_hash_file", return_value="changed"), patch.object(
|
||||
tracer, "_file_identity", return_value=(1, 2)
|
||||
):
|
||||
result = tracer.trace(
|
||||
Debugger(),
|
||||
{"executable": "fixture", "expected_sha256": "expected"},
|
||||
)
|
||||
finally:
|
||||
if original_debugger is None:
|
||||
del tracer.lldb.SBDebugger
|
||||
else:
|
||||
tracer.lldb.SBDebugger = original_debugger
|
||||
|
||||
self.assertEqual(result["status"], "target-integrity-error")
|
||||
self.assertIs(result["target_process_created"], False)
|
||||
|
||||
def test_journal_checks_exact_byte_budget_before_writing(self):
|
||||
record = {"kind": "other-stop", "reason": "signal"}
|
||||
encoded_size = len((tracer.json.dumps(record) + "\n").encode("utf-8"))
|
||||
|
||||
@@ -26,6 +26,9 @@ Readiness is `rea inspect-adb-client`: it runs `adb version` and reports the
|
||||
resolved binary, its version, and where it was selected from. A missing
|
||||
binary reports `capability_unavailable` with the `REA_ADB_PATH` remediation
|
||||
rather than attempting an installation.
|
||||
The `binary_session` inventory uses the same bounded client-version probe; it
|
||||
does not query devices, start the adb server, or establish that a requested
|
||||
serial is reachable. Device state is checked by each device operation.
|
||||
|
||||
## Answer an analyst question
|
||||
|
||||
@@ -94,12 +97,17 @@ existing analysis families directly, for example
|
||||
| `capture_adb_screen` | read | One `screencap -p` frame (exec-out, no device-side file) with dimensions |
|
||||
| `collect_adb_bugreport` | read | Device-generated bugreport zip, digested |
|
||||
| `push_adb_file` | **mutates device** | One local file to a device path (e.g. pushing tools into `/data/local/tmp`); checks for existing targets and refuses them without explicit overwrite (the check is not atomic); compares digests when device `sha256sum` is available |
|
||||
| `install_adb_package` | **mutates device** | Local APK via `adb install [-r]`; preserves the device's Success/Failure verdict |
|
||||
| `install_adb_package` | **mutates device** | Local APK via `adb install [-r]`; preserves its Success/Failure verdict, records `replace_requested`, and leaves actual replacement `null` because prior package state is not observed |
|
||||
| `uninstall_adb_package` | **mutates device** | Removes a package and its data for user 0 |
|
||||
| `start_adb_app` | **mutates device** | Resolves the package's launcher activity (`cmd package resolve-activity --brief`) and starts it (`am start -n`) |
|
||||
| `start_adb_activity` | **mutates device** | Starts an intent (`am start -a` with optional URI, component, and up to 16 typed extras); preserves the activity manager's verdict |
|
||||
| `stop_adb_app` | **mutates device** | Force-stops every process of a package, ending a dynamic-analysis run |
|
||||
|
||||
For `install_adb_package`, `replace_requested` records whether `-r` was sent.
|
||||
The `replaced` result is `null`: the successful install response does not say
|
||||
whether the package was installed fresh or replaced, and REA does not query the
|
||||
device first. The install verdict and host APK digest remain available.
|
||||
|
||||
## Interpret the result
|
||||
|
||||
- **Directory names retain whitespace and newlines.** Symlink targets do too,
|
||||
|
||||
@@ -21,6 +21,8 @@ Readiness is `rea inspect-apktool-client`: it runs `apktool --version` and
|
||||
reports the resolved launcher, its selection source, and its version. A
|
||||
missing launcher reports `capability_unavailable` with the
|
||||
`REA_APKTOOL_COMMAND` remediation rather than attempting an installation.
|
||||
`binary_session` uses the same host probe for tool availability; it does not
|
||||
validate a particular APK or guarantee that the selected input can be decoded.
|
||||
|
||||
On Windows, a `.bat` or `.cmd` launcher (such as Chocolatey's `apktool.bat`)
|
||||
runs through an explicit `cmd.exe /d /s /c` call. That call has no AutoRun,
|
||||
|
||||
@@ -20,6 +20,17 @@ Inspect native SAZ or HAR 1.2 offline with REA, or connect Everywhere's separate
|
||||
- `observe_web_session` / `rea observe-web-session` arms an observation window of the requested duration for an external user action and records ordered reload, SPA navigation, redirect, failure, lifecycle, and target-termination metadata.
|
||||
- `discover_webmcp_tools` / `rea discover-webmcp-tools` uses the experimental CDP WebMCP domain to return every in-scope registration and its complete observed `input_schema` declaration and canonical `input_schema_sha256` digest inline. Declarations are untrusted JSON data, including declared types, required fields, enums, examples and reference URLs. REA does not resolve schema references. These fields replace `input_schema_shape`. Registrations with the same name and URL in distinct observed frames retain separate identities. `tool_key` includes the observed frame ID; it is not a stable identity across navigation or browser sessions. Same-frame registration updates replace that owner only, and removal leaves other owners intact. Declared `readOnly`, `untrustedContent`, `consequential`, and `autosubmit` annotation hints are reported per registration: `true`/`false` are declared values, `null` means the declaration did not provide the hint in that capture, and a missing `consequential` key means the hint was not recorded, either in a historical capture or because the observed annotation was invalid. Consult discovery completeness and exclusions to distinguish these cases. Malformed annotation values retain the registration with incomplete coverage and an `invalid_protocol_value` exclusion. Other malformed protocol payloads can fail discovery explicitly. REA never exposes `WebMCP.invokeTool`.
|
||||
- `compare_web_captures` / `rea compare-web-captures` compares passive captures or exact-step-aligned browser scenarios. Scenario results commit reproducible literal normalization and expose alignment failures plus artifact-level action, screenshot, DOM, accessibility, URL, history, storage, and event differences. Missing or truncated evidence is never treated as equivalence.
|
||||
|
||||
Passive DOM comparison checks complete node inventories and complete frame
|
||||
parent/child structure independently. Frame IDs and sibling enumeration order
|
||||
are capture-local and do not establish a change; duplicate IDs, missing parents,
|
||||
and cyclic ancestry remain unknown. A complete frame difference can still prove
|
||||
change when DOM nodes are incomplete, and vice versa. Partial DOM or metadata
|
||||
collection digests do not prove modification: a missing node or link can result
|
||||
from a protocol omission. Rejected DOM facts also mark derived URL and agent-hint
|
||||
metadata incomplete, while valid facts from other nodes and documents remain
|
||||
available in the capture.
|
||||
|
||||
- `capture_web_screenshot` / `rea capture-web-screenshot` returns a content-addressed visible-viewport PNG.
|
||||
- `compare_web_screenshots` / `rea compare-web-screenshots` performs bounded local PNG pixel comparison without OCR or external services.
|
||||
- The CLI comparison commands accept each capture, screenshot artifact or normalization policy as inline JSON or a JSON file path. Use files for screenshot artifacts and scenario captures, whose embedded PNG bytes can exceed the host's command-line length limit.
|
||||
@@ -270,6 +281,32 @@ REA retains local observation data and removes only URL userinfo credentials, ex
|
||||
- Accessibility structure and roles are retained by default, while names and descriptions require `include_accessibility_text: true`.
|
||||
- Network observations retain method, status, MIME type, size, type, initiator stack location, and complete URLs with userinfo credentials removed. Redirects reported by CDP are attached as ordered `redirects` on the one request ID, with the prior request URL, CDP response URL, method/type, response status/MIME/encoded length, request timestamp, and the next `requestWillBeSent` event timestamp. CDP delivers `redirectResponse` with that next request event, so the latter is an event boundary rather than an exact response timestamp. Redirect response headers and bodies are discarded; hops outside the selected origins are discarded with the request chain. Headers are discarded after an allowlisted projection of length/encoding, structured CSP/Link/policy fields, and untrusted agent hints. Cookies and authorization headers are never retained.
|
||||
- Request/response bodies are not requested or parsed by default. When selected, only allowed-origin JSON media types are read, converted immediately to complete value-free typed paths, types and observation counts, and discarded. Each path segment is either `{ "kind": "property", "name": "raw property name" }` or `{ "kind": "array-element" }`; array-element types include primitives and nested arrays. Literal `*` properties remain distinct from array elements. `Network.getResponseBody` is never sent unless JSON body shape capture is selected. Comparison uses body shapes only when both captures selected them, and compares request/response shapes only where both observations provide those facts. Unavailable or truncated selected coverage makes equivalence unknown; observed differences still report changed.
|
||||
For normalized passive inputs with complete request inventories on both sides,
|
||||
request additions and removals remain observable even when selected body shapes,
|
||||
response metadata, or WebSocket coverage are unavailable. HTTP request and
|
||||
WebSocket inventory coverage are evaluated separately; complete HTTP coverage
|
||||
cannot prove a missing WebSocket connection. Limited request inventory still
|
||||
prevents request-absence claims. This comparison rule does not make live CDP's
|
||||
attach-limited inventory complete or establish body-shape equality.
|
||||
An unavailable HTTP resource type also leaves request identity incomplete:
|
||||
observations with the same method and URL remain possible matches across types,
|
||||
and identical unknown types cannot establish complete equality. Ambiguous type
|
||||
groups cannot prove membership or content changes either: a missing type may
|
||||
redistribute repeated requests between buckets without changing the requests.
|
||||
Their comparison remains unknown, while independently identified groups retain
|
||||
proven changes. Different methods/URLs and complete empty peer inventories still
|
||||
support absence claims.
|
||||
Relevant dropped-event counts also limit inventory completeness even when no
|
||||
section is listed as truncated: HTTP uses `network_requests`, while WebSocket
|
||||
uses `websocket_connections` and `websocket_frames`. Drops in other event kinds
|
||||
and the aggregate total do not by themselves limit HTTP inventory. Proven
|
||||
modifications remain reportable despite incomplete inventory.
|
||||
Repeated identical HTTP content samples establish multiplicity changes only
|
||||
with complete request inventories; limited inventories retain known content
|
||||
comparisons without interpreting duplicate sample counts as changes.
|
||||
WebSocket stream inventories and connection counts likewise require complete
|
||||
WebSocket coverage. Redirect resource types use only shared known metadata:
|
||||
an omitted type leaves equality unknown rather than proving a modification.
|
||||
- Console observations with a stack source retain call type, argument types, timestamp, and source location. When console text capture is selected, already-delivered primitive values are retained verbatim; objects, getters, and remote properties are never expanded.
|
||||
- WebSocket observations retain direction, opcode, and payload byte length. When shape capture is selected, text frames are classified as text or complete value-free JSON shape; binary bytes, hashes, prefixes, and raw frames are never retained.
|
||||
- Storage observations always redact values. Key names, IndexedDB names, and cache names require `include_storage_keys`; stable content fingerprints require the additional `include_storage_fingerprints` selection. Cookie fingerprints cover cookies applicable to the current main-frame URL, including its path, rather than every cookie path on that origin. Other storage remains scoped to the origin. Cache bodies above 64 KiB and partial IndexedDB remote objects make fingerprint coverage incomplete, so identical observations remain `unknown`.
|
||||
@@ -294,6 +331,18 @@ validation and resource bounds. Omitted script metadata makes its affected
|
||||
section explicitly truncated.
|
||||
Disallowed-origin entries are filtered before retention.
|
||||
|
||||
Resource-tree inventories distinguish a valid empty `resources` array from a
|
||||
missing or malformed collection. Invalid resource entries are omitted with
|
||||
incomplete coverage, while valid resources from that frame and other frames
|
||||
remain available. Comparing an incomplete resource inventory cannot prove
|
||||
addition, removal, or equality; a complete empty inventory can prove removal.
|
||||
Resource records require a nonempty type and a string MIME type; absent or
|
||||
malformed required fields are recorded as omissions instead of invented defaults.
|
||||
An explicitly empty MIME type is valid. The optional content size may be absent;
|
||||
an invalid supplied size remains unknown with incomplete resource coverage while
|
||||
the resource's other facts are retained. Zero and nonnegative fractional sizes
|
||||
are preserved.
|
||||
|
||||
CDP discovery, connection, and commands wait for the peer or caller cancellation;
|
||||
a stalled peer can leave an operation waiting. WebSocket messages remain subject
|
||||
to the [64 MiB limit](#request-boundary). REA does not impose a message-count or
|
||||
|
||||
@@ -23,9 +23,9 @@ that rejection does not roll back browser effects. REA removes its owned
|
||||
future-document scripts, restores live frame methods, then disconnects.
|
||||
Add secret declarations, storage seeds, and additional artifact or event
|
||||
capture only when needed. Action, secret, and storage counts are not capped.
|
||||
Duration, action, and navigation
|
||||
timeouts remain fixed provider-owned liveness limits; the request does not
|
||||
accept a caller-controlled `limits` object.
|
||||
Duration, action, and navigation timeouts remain fixed provider-owned liveness
|
||||
limits. `capture.limits` controls retained event and network-content budgets;
|
||||
it does not change those liveness deadlines.
|
||||
|
||||
## Minimal launch example
|
||||
|
||||
@@ -179,12 +179,44 @@ declared action. Each step reports action status, elapsed time, sanitized URLs,
|
||||
event bounds, and independently typed capture states for screenshot, DOM,
|
||||
accessibility, URL, history, and storage. Console, page-error, network,
|
||||
WebSocket, frame, worker, popup, and cancelled-download events are attributed to
|
||||
steps and all observed events and requested artifacts are returned inline.
|
||||
There are no event, frame, worker, popup, WebSocket, DOM-node,
|
||||
accessibility-node, storage-entry, screenshot-count, or cumulative
|
||||
metadata-byte caps. Requested artifacts and observed events are returned
|
||||
inline without application-defined size ceilings. Other missing sections
|
||||
remain explicit and make the capture ineligible for equality claims.
|
||||
steps. Retained events and requested artifacts are returned inline; omitted
|
||||
events are counted by kind and identify affected network transactions.
|
||||
Event and selected network-content retention have caller-selected limits under
|
||||
`capture.limits`. Omitted values use the defaults below; every supplied value
|
||||
must be a positive safe integer, and callers can raise or lower a default.
|
||||
Byte limits are conservative allocation-cost estimates for retained event
|
||||
values, including UTF-16 storage and JSON expansion, rather than serialized
|
||||
bytes or a promise about exact process memory. `events.omissions.by_kind`
|
||||
reports counts and reasons for omitted event kinds. Its
|
||||
`network_transactions` rows identify affected transaction IDs and omitted
|
||||
event kinds; `network_transaction_range` identifies the contiguous IDs beyond
|
||||
the transaction limit. Omission metadata is bounded by the selected
|
||||
transaction limit. Other missing sections remain explicit and make the capture
|
||||
ineligible for equality claims.
|
||||
|
||||
The default limits are 10,000 events, 4 MiB estimated allocation for one
|
||||
event, 16 MiB estimated allocation across retained events, 1,024 network
|
||||
transactions, 64 KiB of body bytes per transaction phase, 1 MiB estimated
|
||||
allocation for body redaction/base64, 1 MiB for retained header values, and
|
||||
1 MiB for network metadata. The same limits are included in the capture
|
||||
Evidence. Playwright materializes response bodies before REA can inspect their
|
||||
byte length; `max_network_body_bytes` bounds subsequent retained copies and
|
||||
does not bound the browser API read itself. A body that exceeds its selected
|
||||
limit has an explicit `body-size-limit` or `body-allocation-limit` unavailable
|
||||
state with the observed and allowed values.
|
||||
|
||||
Additional implementation bounds are 16 simultaneous network-content reads,
|
||||
a 5-second deadline for each provider API read, and 2,048 live event-listener
|
||||
owners. These are not caller-selectable. The concurrency bound queues admitted
|
||||
content jobs and does not itself omit observations; a provider read timeout
|
||||
produces a typed unavailable state, while exceeding listener capacity produces
|
||||
event-kind omission counts. A preflight avoids body redaction and base64 copies
|
||||
when the currently available event budget already rejects the body.
|
||||
Concurrent reads may each pass that check before their events are retained;
|
||||
their retained-copy work is bounded by 16 times the selected per-body
|
||||
allocation limit. The Playwright response Buffer itself is materialized before
|
||||
REA can apply that limit. Requested artifacts and retained events are returned
|
||||
inline within the declared limits.
|
||||
Attach-mode captures also declare the unavoidable pre-attach event gap.
|
||||
|
||||
Selected event families are observed on the root page and discovered descendant
|
||||
@@ -288,16 +320,21 @@ retained representation after redaction.
|
||||
|
||||
Only completed responses are read. At the end of the final step, observation
|
||||
stops; requests still in flight emit `request-unfinished`, and their observed
|
||||
responses have explicitly unavailable bodies. This cutoff does not wait for
|
||||
long-lived streaming connections. Already-started content reads settle before
|
||||
browser cleanup, with a provider-owned five-second timeout per read and
|
||||
cancellation support. Failed or unexposed reads retain per-content states and make selected
|
||||
event coverage incomplete. Body events can arrive during later steps or final
|
||||
drain; event bounds describe receipt during the step, while the source event
|
||||
reference establishes the transaction phase. Comparison attributes content, like
|
||||
every other event of its transaction, to the step that sent the request (the
|
||||
receipt step when that request was not observed) and excludes the sequence
|
||||
reference from normalization.
|
||||
responses have explicitly unavailable bodies. Already-admitted content reads
|
||||
drain before browser cleanup. At most 16 reads run at once; queued work is
|
||||
bounded by the selected network-transaction limit and by successful admission
|
||||
of its request or response event. Each provider API read has its own five-second
|
||||
timeout once it starts, so queue wait adds to total drain and cleanup time; this
|
||||
is not a five-second total capture cutoff. Cancellation interrupts active reads
|
||||
and queued jobs produce cancelled states without calling their provider APIs.
|
||||
This drain does not wait for long-lived unfinished streaming connections and
|
||||
does not refetch unfinished response bodies. Failed or unexposed reads retain
|
||||
per-content states and make selected event coverage incomplete. Body events can
|
||||
arrive during later steps or final drain; event bounds describe receipt during
|
||||
the step, while the source event reference establishes the transaction phase.
|
||||
Comparison attributes content, like every other event of its transaction, to
|
||||
the step that sent the request (the receipt step when that request was not
|
||||
observed) and excludes the sequence reference from normalization.
|
||||
Playwright scenario capture does not supply initiator stacks; passive CDP
|
||||
observation retains its own initiator evidence.
|
||||
|
||||
|
||||
+45
-8
@@ -152,9 +152,13 @@ overrides it. In MCP, pass `provider_id` to `open_binary`:
|
||||
The selected provider remains bound to the session until an explicit switch
|
||||
or close. Provider failures are returned with their original reason. For an
|
||||
`ambiguous` selection error, choose from `details.candidate_ids`; for
|
||||
`provider_unavailable`, run `rea doctor --provider ID --json` to diagnose the
|
||||
selected engine. See [task readiness](installation.md#check-readiness-for-your-task)
|
||||
and [provider selection](mcp-contracts.md#identity-and-discovery).
|
||||
`provider_unavailable`, follow `message`, `remediation.action`, and the original
|
||||
reasons in `details.rejections`. For Hopper, Ghidra, IDA, and JADX, run
|
||||
`rea doctor --provider ID --json` to diagnose the selected engine. Other adapters,
|
||||
such as `pwntools-elf`, report their configuration requirements directly and are
|
||||
not accepted by `doctor --provider`. See
|
||||
[task readiness](installation.md#check-readiness-for-your-task) and
|
||||
[provider selection](mcp-contracts.md#identity-and-discovery).
|
||||
|
||||
The session reports work still in progress through `analysis_activity`.
|
||||
A client timeout can end its wait while the provider continues analyzing.
|
||||
@@ -315,11 +319,44 @@ redirected, which keeps large results smaller for agents and scripts; pipe
|
||||
through `jq .` for indented files. Output selection and formatting do not change
|
||||
operation status.
|
||||
|
||||
| Status | Meaning |
|
||||
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `0` | The operation completed. Its result may include partial evidence, warnings or unresolved questions. |
|
||||
| `1` | The operation could not complete. Structured output identifies invalid input, permissions, cancellation, timeouts or another failure when available. |
|
||||
| `128 + N` | Signal `N` ended the process, where the shell or runtime preserves the conventional signal-derived status. |
|
||||
For `cutter-command`, `--json-output` requests command-specific JSON from
|
||||
Cutter when available. This is separate from `--format json`, which selects the
|
||||
CLI result representation; the global `--json` flag selects that same CLI
|
||||
representation.
|
||||
|
||||
Cutter still accepts deprecated `--json=true` and `--json=false` compatibility
|
||||
values. When both forms are present, `--json-output` takes precedence in either
|
||||
argument order. Bare `--json` retains its global meaning of selecting JSON CLI
|
||||
output formatting.
|
||||
|
||||
| Status | Meaning |
|
||||
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `0` | The operation completed. Its result may include partial evidence, warnings or unresolved questions. |
|
||||
| `1` | The operation could not complete. Structured output identifies invalid input, permissions, cancellation, timeouts or another failure when available. |
|
||||
| `128 + N` | Signal-derived status. An unhandled signal may have ended the process, with the shell or runtime preserving the conventional status; a command may instead have handled the signal, waited for its operation and cleanup to settle, and assigned the same status (`130` for SIGINT, `143` for SIGTERM). In the handled case, it may also have printed a structured `cancelled` result. |
|
||||
|
||||
A `cancelled` result does not by itself determine the exit status; it depends on
|
||||
the command's signal handling. Commands routed through the shared
|
||||
`withCommandCancellation` handler in the CLI set status `130` for SIGINT or
|
||||
`143` for SIGTERM after their operation settles. Current source registrations
|
||||
use that handler for process capture and comparison (`capture-process`,
|
||||
`compare-process-captures`), JavaScript application analysis (`analyze` when it
|
||||
selects the JavaScript lane, and `analyze-javascript-application`), selected
|
||||
browser, web and Electron commands (including `analyze-web-bundle`,
|
||||
`observe-web-execution`, `capture-browser-scenario` and
|
||||
`capture-electron-scenario`), and the platform and provider command families
|
||||
for Android/ADB, Apktool/JEB/Flutter, firmware, PCAP and signal analysis,
|
||||
WASM/EVM, Go/Rust and binary diagnostics, Frida instrumentation, the Cutter
|
||||
command, objdump, Rizin and GDB. In these paths, a returned structured
|
||||
`cancelled` result can be printed before the wrapper assigns the
|
||||
signal-derived status. This describes the current source routing; it is not a
|
||||
claim that every command or provider runtime has been independently exercised.
|
||||
|
||||
`inspect-artifact` also returns a structured cancelled result, but its direct
|
||||
analysis cancellation path does not set a signal-derived exit status, so it
|
||||
exits `1`. Setup has its own contract: cancellation exits `0`. Treat the
|
||||
structured result and process status as separate signals when scripting
|
||||
cancellation.
|
||||
|
||||
`setup --dry-run` returns `planned` and exits `0`; a cancelled setup also exits
|
||||
`0`. Setup returns `1` for `needs_confirmation` or `needs_human`.
|
||||
|
||||
@@ -142,6 +142,18 @@ Setup registers `rea` in `~/.kimi-code/mcp.json`, or
|
||||
creating a `.rea.backup` before updating an existing file. Kimi Code infers
|
||||
stdio from the `command` entry, so setup does not add a `type` field. The
|
||||
registration includes `startupTimeoutMs = 30000` and `toolTimeoutMs = 120000`.
|
||||
Setup selects the compact input-schema advertisement for new or refreshed Kimi
|
||||
registrations unless their stored configuration or setup environment explicitly
|
||||
selects `REA_MCP_INPUT_SCHEMA_PROFILE=full` or `compact`. This keeps REA's
|
||||
canonical tool validation unchanged while avoiding a Moonshot Kimi Code 2.2.0
|
||||
failure observed with the full catalog: its request was rejected because a
|
||||
single tool schema exceeded the provider's size limit. The limit is
|
||||
provider-specific and not an MCP protocol limit. `rea doctor --client kimi`
|
||||
reports an older registration with no explicit profile as stale. To restore the
|
||||
compact profile, run `rea setup --client kimi` or add
|
||||
`REA_MCP_INPUT_SCHEMA_PROFILE=compact` to the registration's `env`, then restart
|
||||
Kimi Code. An explicit `full` profile remains respected and can still exceed
|
||||
Moonshot's limit.
|
||||
Kimi Code also discovers personal skills in `~/.agents/skills` and project-local
|
||||
`.agents/skills`, so no separate skill root is required; setup still installs
|
||||
and verifies the matching skill files through the normal shared-skill flow.
|
||||
|
||||
@@ -6,6 +6,28 @@ and provider lanes. Each record below states its host, client version, model
|
||||
fixture, and remaining coverage; a native-client run with a loopback model does
|
||||
not establish live model-service acceptance.
|
||||
|
||||
## Published Pi code-mode renderer limit
|
||||
|
||||
A separate probe of the published `@earendil-works/pi-codemode` 1.1.0 and 1.2.0
|
||||
declaration renderers rendered the full `compare_web_captures` input as
|
||||
`args: unknown`: its generated TypeScript type exceeds Pi's 16,000-character
|
||||
default. REA keeps the full advertisement's fields by inlining references when
|
||||
the shared form would exceed Pi's 32-reference expansion limit; retaining that
|
||||
shared form would leave later fields unknown instead. The existing
|
||||
`REA_MCP_INPUT_SCHEMA_PROFILE=compact` profile lets callers stay below
|
||||
its character limit by advertising reduced nested validation structure, while
|
||||
REA continues to validate calls against the complete canonical input schema.
|
||||
Compact applies to the server's advertised inputs and is not an automatic
|
||||
full-profile fallback; see the [compact input schema profile](mcp-contracts.md#compact-input-schema-profile)
|
||||
for details of its reduced forms.
|
||||
|
||||
Custom renderer hosts can raise `inputMaxChars` through `renderToolSignature` or
|
||||
`renderToolSample`; `renderDeclarations` does not expose that override. The
|
||||
probe exercised the published renderer code, not a native Pi host or model, and
|
||||
does not establish broader Pi compatibility. See the pinned upstream
|
||||
[`declarations.ts`](https://github.com/earendil-works/pi/blob/b45e0ebcc5ae2fc42a6f2f23104d10e656e6bedb/packages/codemode/src/declarations.ts)
|
||||
and [renderer usage notes](https://github.com/earendil-works/pi/blob/b45e0ebcc5ae2fc42a6f2f23104d10e656e6bedb/packages/codemode/README.md#declarations-for-the-model).
|
||||
|
||||
## End-to-end, integration and golden evidence
|
||||
|
||||
The optional `verify:qwen-client`, `verify:pi-client`, and `verify:hermes-client`
|
||||
|
||||
+37
-13
@@ -122,6 +122,16 @@ See [client configuration](client-configuration.md) for client-specific roots,
|
||||
profiles, and environment overrides. A mixed selection plans each distinct
|
||||
destination. Selecting the skill without a client uses `~/.agents/skills`.
|
||||
Setup leaves existing skill copies in other locations untouched.
|
||||
Setup refuses symbolic links at the selected skill directory or its managed
|
||||
`references` directory, matching uninstall and update's ownership rules. Use a
|
||||
regular skill directory, or select `--skill=false` to configure the client
|
||||
registration without installing the bundled skill.
|
||||
The final selected directories are checked before approval and again before
|
||||
setup changes any client or Hopper installation. Unselected client destinations
|
||||
do not block other setup choices. Doctor reports linked or non-directory skill
|
||||
paths as `unmanaged`, names the affected paths, and provides those alternatives;
|
||||
an unreadable skill identity remains `unknown`. Uninstall retains and reports
|
||||
files it cannot safely remove, including their ownership manifest.
|
||||
|
||||
`rea setup --skill-client claude_code --yes --json` refreshes and verifies the
|
||||
selected skill destination independently of MCP registration selection. The
|
||||
@@ -249,14 +259,14 @@ Register with the variable unset:
|
||||
<!-- x-release-please-start-version -->
|
||||
|
||||
```bash
|
||||
claude mcp add --scope local rea -- npx -y rea-agents@6.4.0 mcp
|
||||
claude mcp add --scope local rea -- npx -y rea-agents@6.5.0 mcp
|
||||
```
|
||||
|
||||
On native Windows, use the same project directory and wrap the package-runner
|
||||
shim so the stdio client can launch it:
|
||||
|
||||
```powershell
|
||||
claude mcp add --scope local rea -- cmd.exe /d /c npx -y rea-agents@6.4.0 mcp
|
||||
claude mcp add --scope local rea -- cmd.exe /d /c npx -y rea-agents@6.5.0 mcp
|
||||
```
|
||||
|
||||
<!-- x-release-please-end -->
|
||||
@@ -388,8 +398,9 @@ The npm release checked on **2026-10-11** was **6.4.0**, published from
|
||||
[`a56f7bb6`](https://github.com/morluto/rea/commit/a56f7bb668ab23fec8d33f7af353ac7ed2fe1895).
|
||||
The actual registry package accepted dry-run setup plans for the 17 client IDs
|
||||
in that release, including Qwen Code, Pi and Hermes. DeepSeek Harness (`dsh`)
|
||||
is on main and is not in npm 6.4.0; `rea setup --client dsh` against `@latest`
|
||||
reports an unsupported client until a release containing it is published.
|
||||
is included from 6.5.0 and was absent from the checked npm 6.4.0 package.
|
||||
The 6.4.0 registry check does not establish 6.5.0 publication or live DeepSeek
|
||||
API integration.
|
||||
OpenCode's plan selected
|
||||
`OPENCODE_CONFIG_DIR` even when that directory did not yet exist. These checks
|
||||
used an isolated home on macOS with Node 24; they verify planning and argument
|
||||
@@ -567,8 +578,15 @@ sessions before removing that recovery directory and retrying.
|
||||
|
||||
### Launcher paths and troubleshooting
|
||||
|
||||
On macOS, REA uses
|
||||
`/Applications/Hopper Disassembler.app/Contents/MacOS/hopper` by default.
|
||||
On macOS, REA checks executable Hopper launchers in this order: the canonical
|
||||
system application, the canonical application installed by `rea setup` under
|
||||
`~/Applications`, then other `Hopper*.app` bundles in `/Applications` and
|
||||
`~/Applications`. The Homebrew cask location is an optional `rea doctor`
|
||||
diagnostic; to use a Homebrew-installed launcher for CLI/MCP startup, set
|
||||
`HOPPER_LAUNCHER_PATH` to the path reported by doctor. REA does not run Homebrew
|
||||
while loading runtime configuration.
|
||||
Automatic discovery accepts executable regular files, including file symlinks,
|
||||
and skips directories.
|
||||
On Linux, it prefers executable `/opt/hopper/bin/Hopper`, then executable
|
||||
`~/.local/share/rea/hopper/bin/Hopper`, followed by `/opt/hopper-v4/bin/hopper`
|
||||
and `/usr/bin/hopper`; if none exists, the former remains the diagnostic
|
||||
@@ -629,12 +647,18 @@ memory has no original file offset. For FAT Mach-O, offsets refer to the origina
|
||||
container file. Results retain Hopper's image-relative offset, the observed slice
|
||||
base, and the source executable path.
|
||||
Loader selection reads the Mach-O container header, including FAT files with a
|
||||
single architecture. For FAT64, REA validates the architecture table and selected
|
||||
Mach-O header, prepares a private thin image, and loads it with Hopper's native
|
||||
Mach-O loader. It checks the entire source's SHA-256 while copying the slice;
|
||||
source identity and reported offsets still refer to the original container.
|
||||
An ambiguous architecture subtype requires an explicitly extracted thin image;
|
||||
REA does not guess. Configured loader arguments remain explicit overrides.
|
||||
single architecture. For FAT32 and FAT64 containers, REA validates the
|
||||
architecture table and selected Mach-O header, prepares a private thin image,
|
||||
and loads it with Hopper's native Mach-O loader instead of Hopper's implicit
|
||||
FAT slice choice. For arm64 targets, REA ranks subtype bases 0 (plain arm64) and
|
||||
2 (arm64e), ignoring capability bits for ranking while retaining the raw subtype
|
||||
for slice identity. These slices' function-entry encodings decode under
|
||||
`--aarch64`, ahead of Apple's arm64e.x1 variant (base subtype 12), which is
|
||||
selected only when it is the arm64 family's only candidate. REA checks the
|
||||
entire source's SHA-256 while copying the slice; source identity and reported
|
||||
offsets still refer to the original container. Any other ambiguous architecture
|
||||
subtype requires an explicitly extracted thin image; REA does not guess.
|
||||
Configured loader arguments remain explicit overrides.
|
||||
FAT64 is distinct from the CPU architecture: FAT32 containers can contain 64-bit
|
||||
executable images. This preparation avoids the Raw Binary loader dialog observed
|
||||
with native FAT64 loading on Hopper 6.1.0-demo.
|
||||
@@ -1033,7 +1057,7 @@ For a client that requires manual configuration, use:
|
||||
"mcpServers": {
|
||||
"rea": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "rea-agents@6.4.0", "mcp"]
|
||||
"args": ["-y", "rea-agents@6.5.0", "mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ provider implicitly.
|
||||
`trace_javascript_semantics` queries the authenticated companion graph without
|
||||
rereading mutable files. A seed may identify a semantic or application node,
|
||||
literal, function fingerprint, property, endpoint, event, or boundary field.
|
||||
For a recovered parse, coercion, or validation boundary, its field value is the
|
||||
static operation's method name (for example, `Number`).
|
||||
The query declares backward provenance, forward influence, callers, or
|
||||
ownership and can restrict admitted relation kinds. REA returns every matching
|
||||
seed and the complete reachable subgraph; callers do not choose node, relation,
|
||||
@@ -83,10 +85,22 @@ callee bodies and built-ins such as `Object.assign`, `Reflect.set`, and
|
||||
values. This uncertainty does not prove that a call actually mutated a value.
|
||||
Interprocedural aliasing beyond the supported call-site references remains
|
||||
outside this mutation pass.
|
||||
For process configuration, only known environment value slots and canonical
|
||||
argument indexes are treated as primitive when passed to calls. Unknown or
|
||||
inherited selections can expose a mutable prototype, so later reads of that
|
||||
configuration container retain uncertainty; earlier top-level reads and unrelated
|
||||
configuration containers remain independent.
|
||||
|
||||
Function fingerprints commit normalized syntax, control-flow shape, relation
|
||||
shape, literal sets, arity, and detected effects without using local names or
|
||||
source offsets. Equal duplicate fingerprints remain ambiguous. Dynamic
|
||||
source offsets. Function-local directive literals contribute their values while
|
||||
preserving escape spelling: `"use\x20strict"` differs from `"use strict"`.
|
||||
Quote style, formatting, and local names remain normalized. Equal duplicate
|
||||
fingerprints remain ambiguous.
|
||||
Fingerprints are static candidates, not behavioral-equivalence proofs or a
|
||||
version-independent identity. Re-analyze affected sources and obtain new seeds
|
||||
after analyzer corrections; previously retained Evidence remains queryable using
|
||||
its original component commitments. Dynamic
|
||||
calls/properties/names, parser recovery, unresolved handles, and unsupported API
|
||||
shapes stay explicit unknowns; a missing relation is never reported as proven
|
||||
behavioral absence.
|
||||
|
||||
@@ -273,6 +273,12 @@ RPC client syntax also contributes network endpoint candidates, in both
|
||||
`OperationDefinition` document object. A graphql-tag `loc.source.body` copy is
|
||||
not reported twice. Anonymous operations are not reported.
|
||||
|
||||
Literal link options and precompiled document fields follow object property
|
||||
order: the final definition owns the key. A later spread, dynamic computed key,
|
||||
method, or accessor can make a field unknown, so an overwritten literal is not
|
||||
reported as the endpoint or operation. A final explicit property after a spread
|
||||
or dynamic key remains usable.
|
||||
|
||||
A procedure path is the server-side procedure name, not a resolved URL; the
|
||||
transport URL depends on the link configuration and batching. When the proxy is
|
||||
reached through a member expression, such as a webpack module binding
|
||||
|
||||
@@ -16,6 +16,12 @@ URL after validating its syntax. That validation does not establish that the
|
||||
JEB service is reachable or that a project is open; use the existing
|
||||
`inspect-jeb-client` command for a read-only service query.
|
||||
|
||||
MCP `binary_session` probes the live JEB service and its advertised tool catalog.
|
||||
Availability is reported per operation: a reachable headless client can support
|
||||
inspection and decompilation while refusing `open_jeb_project`. Catalog discovery
|
||||
uses one 60-second deadline across connection and pagination; a responsive server
|
||||
cannot keep discovery running indefinitely by returning more pages.
|
||||
|
||||
Verified against JEB 5.48.0 (Linux x64, licensed build) serving `jeb-mcp-server` 1.3.0 over streamable HTTP.
|
||||
|
||||
## Operations
|
||||
|
||||
@@ -167,7 +167,14 @@ MCP uses `inspect_managed_members` with
|
||||
Repeat `--type` or supply multiple unique `type_names` for several types.
|
||||
Names match the reported `full_name` exactly. Top-level names are namespace
|
||||
qualified; nested types currently report bare names, which can select several
|
||||
types with that name.
|
||||
types with that name. Each type's `enclosing_type_token` records its enclosing
|
||||
TypeDef. `nesting_read` distinguishes complete source rows (true), incomplete
|
||||
current rows (false), and historical Evidence (null). A null enclosing token
|
||||
alone does not establish that a type is top-level.
|
||||
Each selected type also retains `name_sha256`, a framed digest of its namespace,
|
||||
name and enclosing names. It uses the same bounded, cached owner as signature
|
||||
type operands and remains available when selection omits the enclosing types.
|
||||
It adds one fixed-size digest per returned type rather than repeated name paths.
|
||||
|
||||
The result preserves the requested names in `selection.type_names` and reports
|
||||
unmatched names separately. If metadata names are unreadable, limitations retain
|
||||
@@ -243,9 +250,16 @@ native/runtime questions retain their own authority and coverage.
|
||||
Names and semantic labels do not establish durable member identity. Comparison
|
||||
preserves observed differences, structural inferences, and unknowns separately.
|
||||
|
||||
Cross-version matching first pairs members of the same declared type and name:
|
||||
methods by exact CIL/signature identity, then by raw signature, then by
|
||||
structural body shape; fields by raw signature. Exact CIL/signature identity
|
||||
Cross-version matching first pairs members of the same declared type and name.
|
||||
A current declared type uses its observed `name_sha256`, so same-named nested
|
||||
types in different enclosing types stay distinct even in selected inventories.
|
||||
Malformed, missing, contradictory, cyclic or over-deep enclosing identity remains unknown;
|
||||
the comparison preserves display names without using them to repair that gap.
|
||||
Historical observations retain an explicitly limited bare-name mode when either
|
||||
side predates the identity facts. A known current identity gap still remains
|
||||
unknown beside a historical observation. Matching then pairs
|
||||
methods by exact CIL/signature identity, then by signature, then by
|
||||
structural body shape; fields by signature. Exact CIL/signature identity
|
||||
requires equal raw CIL digests and decoded fingerprints. Equal decoded
|
||||
fingerprints alone cannot establish an exact match: they omit switch targets
|
||||
and collapse distinct NaN encodings. Only then may a remap pair a
|
||||
@@ -253,23 +267,56 @@ renamed or moved member across declared types or names: a method by exact
|
||||
CIL/signature identity or structural body shape, a field by exact decoded
|
||||
signature. A remap never takes a member whose own declared type and name remain
|
||||
unpaired on the other side, so a member is never taken from its own changed
|
||||
counterpart. A member whose declaring type is unresolved could belong to any
|
||||
type, so it pairs by name only when no other member shares its exact
|
||||
CIL/signature key, never by structural shape alone, and any remap group it
|
||||
joins stays ambiguous. The exact-signature key uses names only as part of that
|
||||
counterpart. A member whose declared identity is unresolved could belong to any type. It
|
||||
never makes a declared-identity pair, and any remap group it joins stays
|
||||
ambiguous. Unresolved same-named counterparts prevent definitive added/removed
|
||||
claims, while observed names and tokens remain available in the result.
|
||||
The exact-signature key uses names only as part of that
|
||||
full tuple; names alone never select a pair. Duplicate tuples remain ambiguous
|
||||
rather than being paired by token order. The raw signature is exact whether or
|
||||
rather than being paired by token order. Every round compares signatures by
|
||||
`resolved_sha256`: the raw signature with each TypeDef or TypeRef operand
|
||||
replaced by a digest of that type's namespace and name, hashed as separate
|
||||
values so `A` + `B.C` differs from `A.B` + `C`, after its enclosing types for a
|
||||
nested type (`Outer/Inner`). The defining assembly is not part of the name:
|
||||
a TypeDef and a TypeRef with the same namespace and name compare as the
|
||||
same nominal name, and a TypeRef's ResolutionScope assembly is ignored, so a type
|
||||
forwarded from one assembly to another still pairs. Two different types with
|
||||
the same full name in different assemblies therefore have equal name digests.
|
||||
Comparison reports this scope limitation inline; it does not establish CLR
|
||||
type identity or runtime binding equivalence.
|
||||
Nesting deeper than 64 levels is not named, and such a signature compares by
|
||||
its raw digest. Comparison keys keep resolved and raw digests apart, so a raw
|
||||
digest never pairs with an equal resolved one.
|
||||
Raw signature bytes name types by metadata row, and rows are build-local, so
|
||||
the same signature usually has different raw bytes in two builds. A signature
|
||||
that names no types resolves to its raw digest. When an operand cannot be
|
||||
resolved, such as a TypeSpec, or when REA could not parse the signature, the
|
||||
raw digest stands in. Missing or unreadable TypeDef and TypeRef operands are
|
||||
reported as coverage issues. Invalid NestedClass rows retain their failure
|
||||
reasons and withhold TypeDef signature identities; type names and nesting are
|
||||
parsed once by their shared owner. Each current inspection records
|
||||
`signature_resolution: "type-names-v1"`, even when none of its operands can be
|
||||
resolved. Historical Evidence defaults this attestation to `null`. When either
|
||||
observation predates resolution, both sides compare raw digests, which pair only where type rows agree,
|
||||
and the comparison reports that limitation. The signature is exact whether or
|
||||
not REA decoded it, so undecoded signatures pair by that tuple too, but they
|
||||
never enter structural rounds. An unmatched member is therefore reported as
|
||||
`unknown`, not added or removed, when its own signature was not decoded or when
|
||||
the other side has an unpaired member, one-sided or ambiguous, with the same
|
||||
declared type and name whose signature was not decoded.
|
||||
declared type and name whose signature was not decoded. When both observations
|
||||
attest type-name resolution, a decoded signature that still compares by its raw
|
||||
digest is treated the same way: an unmatched member with one, or beside an
|
||||
unpaired same-named member with one, is `unknown`, because its raw bytes name
|
||||
types by build-local row. A matched unresolved signature also remains unknown
|
||||
unless another observed dimension establishes a change; identical row bytes
|
||||
can reference different TypeSpec contents. Its resolution limitation is retained
|
||||
even when another dimension changes.
|
||||
|
||||
For a matched method, an unavailable or partial body makes body-shape facets
|
||||
unknown while preserving observed signature differences. For complete bodies,
|
||||
a difference in either the raw CIL digest or the decoded fingerprint is reported
|
||||
in the `cil` dimension, including reordered switch targets with equal decoded
|
||||
fingerprints. Structural identity compares normalized signatures, the limited
|
||||
fingerprints. Structural identity compares resolved signatures, the limited
|
||||
decoded-CIL tuple fingerprint,
|
||||
constants, and bounded shape context. It reports all candidates at the winning
|
||||
score and remains ambiguous when the evidence does not distinguish them. The
|
||||
@@ -323,6 +370,9 @@ function implements a specific managed method.
|
||||
`verify_managed_native_boundaries` compares declared P/Invoke module and entry
|
||||
point identities with supplied native export or function evidence. Name/module
|
||||
matches establish declaration links; they do not establish that a call executed.
|
||||
When either side lacks a usable module identity, a matching name remains
|
||||
unresolved and retains the candidate evidence; REA reports a module mismatch
|
||||
only when both identities are available and differ.
|
||||
|
||||
Metadata tokens are not native addresses. Native body mapping for C++/CLI,
|
||||
ReadyToRun, NativeAOT, and IL2CPP requires separately verified format and provider
|
||||
@@ -360,8 +410,9 @@ these indirections for member ownership and local attribute-constructor types;
|
||||
field and method tokens still identify the original definition rows.
|
||||
`field_list` and `method_list` retain the metadata's list coordinates, which
|
||||
refer to the pointer table when present rather than necessarily contiguous
|
||||
definition rows. Malformed or ambiguous pointers leave the owner unknown with
|
||||
partial coverage while preserving readable member and attribute facts.
|
||||
definition rows. Invalid or nonmonotonic list coordinates and malformed or
|
||||
ambiguous pointers leave affected owners unknown with partial coverage while
|
||||
preserving readable member and attribute facts.
|
||||
The retained inverse indexes are admitted against the existing representation
|
||||
budget before allocation.
|
||||
|
||||
|
||||
+24
-17
@@ -38,13 +38,10 @@ socket and device entries are not opened. Case-distinct archive members remain
|
||||
separate observations. Their case-insensitive materialization diagnostic does
|
||||
not reduce traversal coverage when both spellings were read.
|
||||
|
||||
Current output also retains `coverage_status` (`complete` or `partial`) for existing clients, derived from the scoped traversal status. The owning parser normalizes retained `coverage_status` records to scoped coverage and rejects conflicting declarations.
|
||||
|
||||
The coverage field is optional when reading older retained Evidence. The owning
|
||||
inventory parser recognizes historical REA scope notices for compatibility;
|
||||
unfamiliar legacy limitations remain conservative. Typed records do not derive
|
||||
coverage from limitation text. Pages from one inventory must carry the same
|
||||
coverage declaration.
|
||||
Current inventory Evidence requires scoped `coverage` with a `complete` or
|
||||
`unknown` status. Consumers use this producer-owned fact and reject records
|
||||
without it; limitations are explanatory and do not supply or infer coverage.
|
||||
Pages from one inventory must carry the same coverage declaration.
|
||||
|
||||
Function dossiers can declare per-facet coverage in the optional
|
||||
`normalized_result.facet_availability` map. Each supplied facet is either
|
||||
@@ -664,10 +661,14 @@ advertised. Every advertised example is a distinct valid canonical input.
|
||||
|
||||
Root object unions are presented as
|
||||
one object without root `anyOf`, `oneOf`, or `allOf` for model API compatibility.
|
||||
The projection merges properties, retains shared required fields and
|
||||
group-specific field dependencies, and describes the accepted input groups.
|
||||
Canonical runtime validation enforces the exact union, including exclusions
|
||||
that the advertised projection does not express. Tests validate the schemas
|
||||
The projection merges properties, retains shared required fields, and
|
||||
describes the accepted input groups. Which fields belong together is guidance
|
||||
in that description rather than a `dependentRequired` or `dependencies`
|
||||
keyword, because Gemini function declarations reject both and one unknown
|
||||
keyword fails the client's whole tool catalog. Canonical runtime validation
|
||||
enforces the exact union, including partner fields and exclusions that the
|
||||
advertised projection does not express, so a client must not rely on the
|
||||
advertised schema to reject an incomplete group. Tests validate the schemas
|
||||
after SDK conversion and check advertised validation and actual calls.
|
||||
Individual model APIs can impose additional nesting limits; complete producer
|
||||
captures can exceed ten structural levels.
|
||||
@@ -711,9 +712,9 @@ JSON Schema:
|
||||
in a reduced form: property names, reference-resolved types (including union
|
||||
alternatives), first-level guidance, and the root's required-field constraints,
|
||||
with nested validation detail elided. The
|
||||
canonical schema still rejects malformed calls server-side, so callers
|
||||
following the reduced advertisement receive the canonical typed error
|
||||
instead of silent acceptance.
|
||||
registered canonical schema still rejects malformed calls before invoking a
|
||||
handler. That rejection can use the MCP SDK's input-validation diagnostic;
|
||||
it does not guarantee the application's typed input error.
|
||||
- Schemas deeper than ten nodes use the same reduced projection, with
|
||||
root-property names, types, guidance, and required fields retained. The
|
||||
server continues to enforce the full canonical input contract.
|
||||
@@ -732,6 +733,11 @@ identity. Explicit schema IDs and relative external reference bases are
|
||||
preserved. This keeps every tool and validation rule in discovery and does not
|
||||
change the SDK's catalog invalidation or availability checks.
|
||||
|
||||
The server identity's tool-schema digest includes both the canonical output
|
||||
contracts and the selected output-schema profile. `full` and `off` therefore
|
||||
have distinct identities even though `off` keeps the same canonical output
|
||||
validation on the server.
|
||||
|
||||
Some stdio hosts reject a complete `tools/list` frame before they load any
|
||||
tools. The opt-in `REA_MCP_OUTPUT_SCHEMA_PROFILE=off` setting omits `outputSchema`
|
||||
from the advertised catalog for hosts with a small frame limit (the measured
|
||||
@@ -768,9 +774,10 @@ identities remains unknown.
|
||||
`normalization` defaults to `{ "rules": [] }`.
|
||||
|
||||
The advertised schema includes complete nested capture fields and rejects
|
||||
incomplete pairs and structurally malformed captures. Mixed comparison families
|
||||
can pass advertised validation; the SDK rejects them against the canonical
|
||||
input schema before invoking the handler. Domain validation additionally checks
|
||||
incomplete pairs and structurally malformed captures. Mixed comparison families,
|
||||
and `normalization` without both scenario captures, can pass advertised
|
||||
validation; the SDK rejects them against the canonical input schema before
|
||||
invoking the handler. Domain validation additionally checks
|
||||
relationships such as event sequence references and retained counts; JSON
|
||||
Schema does not express those cross-field invariants.
|
||||
|
||||
|
||||
@@ -481,8 +481,9 @@ user's permissions and may change files, show UI or use the network.
|
||||
|
||||
Debugging must be allowed for the user (Developer Tools access). A
|
||||
hardened-runtime target without `com.apple.security.get-task-allow` cannot be
|
||||
debugged; `inspect_signature` reports this as the debugger-attach facet, and
|
||||
the tool fails with a `debugger-attach-denied` reason.
|
||||
debugged; `inspect_signature` reports the signature's `hardened_runtime` value
|
||||
and its `entitlements`, including `com.apple.security.get-task-allow` when it
|
||||
is present. A denied trace reports the `debugger-attach-denied` reason.
|
||||
|
||||
## Provider and verification boundaries
|
||||
|
||||
|
||||
@@ -54,6 +54,22 @@ resource limit; use selected fields, a display filter or an input-packet limit
|
||||
when dissection output is too large. Each call checks the recording's current
|
||||
digest, so pages from different source digests must not be combined.
|
||||
|
||||
For a question about a known input prefix, select `packet_limit` for that
|
||||
prefix, the fields needed for the answer, and a matching output window. For
|
||||
example, a question about the first twelve PostgreSQL TCP packets within
|
||||
original frames 1–2,000 can use fields `tcp.srcport`, `tcp.dstport`, `tcp.flags`,
|
||||
filter `tcp.port == 5432`, `packet_limit: 2000` and `match_limit: 12`.
|
||||
The matching count then describes that input prefix. A filter containing
|
||||
`frame.number <= 2000` without an input limit still reads the entire capture;
|
||||
returning twelve rows does not limit producer output. These controls answer a
|
||||
bounded question and must not be used to infer whole-capture absence.
|
||||
|
||||
Discover unfamiliar field names with `inspect_packet_fields`, using an exact
|
||||
protocol and a narrow query. If the installed names are already established,
|
||||
direct field selection avoids an additional glossary probe. Count discovery
|
||||
and any retries when comparing investigation cost; a small page alone does
|
||||
not establish a faster workflow.
|
||||
|
||||
Additional selections:
|
||||
|
||||
- `display_filter`: Wireshark display-filter syntax; omitted means no filter.
|
||||
|
||||
+14
-3
@@ -383,13 +383,24 @@ exit comparison like `settlement.elapsed_ms`.
|
||||
Every capture requires `truncation_details`, with separate accounting for:
|
||||
|
||||
- `raw_terminal`: original UTF-8 PTY chunk bytes and observed/retained chunk
|
||||
counts. A chunk that does not fit `limits.output_bytes` is omitted whole;
|
||||
a later smaller chunk can still fit.
|
||||
counts. A chunk that does not fit either its remaining original-text budget
|
||||
or normalized-text budget is omitted whole; a later smaller chunk can still
|
||||
fit. A normalized-text omission also omits its original chunk, so raw and
|
||||
normalized coverage can both be incomplete for that event.
|
||||
- `normalized_terminal`: normalized comparison-text bytes retained from raw
|
||||
chunks. This is optional when reading historical captures. A raw-fitting
|
||||
chunk is omitted if an ordered normalization stage would exceed the remaining
|
||||
`output_bytes` budget before the final normalized size is known. Its final
|
||||
size is unknown, not assumed to equal the budget. The capture records the
|
||||
omitted-frame count and a limitation; later smaller chunks remain eligible.
|
||||
- `rendered_terminal`: cumulative UTF-8 serialized-state and visible-line
|
||||
bytes, plus observed/retained frame counts. This is independent of the raw
|
||||
chunk budget and does not count JSON encoding. Repeated screen snapshots can
|
||||
exhaust it even when all raw output fits. Rendered states use retained PTY
|
||||
input, so raw omissions also limit rendered coverage.
|
||||
input, so raw omissions also limit rendered coverage. When bounded
|
||||
normalization omits a rendered frame before its final size is known,
|
||||
`unknown_size_frames` reports that count; `observed_bytes` includes only
|
||||
rendered frame sizes that were determined exactly.
|
||||
- `filesystem_before` and `filesystem_after`: file-count/depth limits,
|
||||
enumeration failures, whole-file hash budget and bytes successfully hashed.
|
||||
Directory names are read incrementally within the remaining entry capacity.
|
||||
|
||||
@@ -66,6 +66,8 @@ REA는 에이전트를 분석 도구에 연결해 네이티브 바이너리, Jav
|
||||
|
||||
## 빠른 시작
|
||||
|
||||
Linux에서 Ghidra, JADX, 펌웨어 도구를 실행하거나 정적 JavaScript/Electron 분석을 하려면, 프로세스 소유권 확인을 위해 REA의 `PATH`에 procps 호환 `ps`가 있어야 합니다. 해결 방법은 `docs/installation.md`의 "Linux owned-process prerequisite" 항목에 있습니다.
|
||||
|
||||
### 에이전트 설정
|
||||
|
||||
Node.js와 npm이 설치된 환경에서 다음 명령을 실행하세요.
|
||||
@@ -151,7 +153,7 @@ REA에는 Node.js 22.x(>=22.19), 24.x(>=24.11) 또는 26+와 npm이 필요합니
|
||||
| EVM 바이트코드 | 디스패치 선택자, 바이트 오프셋, 추론한 인자와 상태 변경 가능 여부 | Linux x64의 로컬 원시 바이트/16진수 입력 파일; [오프라인 EVM 가이드](../evm-bytecode.md) |
|
||||
| SQLite 데이터베이스 | 테이블, 열, 인덱스, 뷰, 트리거, 선택한 일반 테이블의 행 | 로컬 데이터베이스/WAL 스냅샷; Node.js 24.15 이상의 24.x 또는 26 이상(네이티브 SQLite 한도 적용) |
|
||||
| 기록된 Linux 크래시 | 원시 note 레코드, 기록된 모든 스레드의 레지스터/시그널, 선택적 매핑 후보 | Linux x64에서 호출자가 제공하는 pwntools; GDB/pwndbg는 선택 사항; [기록된 크래시](../recorded-crashes.md) |
|
||||
| JavaScript / Electron | 모듈, 임포트, 소스 맵, 라우트, IPC, 네이티브 애드온 관계 | Node.js와 npm; [애플리케이션 분석](../javascript-application-workflows.md) |
|
||||
| JavaScript / Electron | 모듈, 임포트, 소스 맵, 라우트, IPC, 네이티브 애드온 관계 | Node.js와 npm; Linux: procps 호환 `ps`; [애플리케이션 분석](../javascript-application-workflows.md) |
|
||||
| 웹사이트 | 페이지 구조, 스크립트, 네트워크 관찰 결과, 요청한 스크린샷 | Chrome 계열 브라우저; [브라우저 분석](../browser-observation.md) |
|
||||
| 저장된 네트워크 캡처 | 요청, 응답, 접근 가능한 페이로드, 소스 위치 | HAR 또는 Fiddler Everywhere SAZ; mitmproxy 네이티브 캡처에는 Linux의 mitmdump; [캡처 가이드](../web-network-captures.md) |
|
||||
| .NET 어셈블리 | 메타데이터, CIL 명령, 선언된 네이티브 의존성, 빌드 비교 | 별도 도구 불필요(정적 검사만); [관리 코드 가이드](../managed-code-analysis.md) |
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -10,11 +10,64 @@ SHA returned by Release Please. Before either registry is published, the release
|
||||
run calls full CI qualification at that exact revision, including coverage,
|
||||
portable providers, and every native package host. Later main commits cannot
|
||||
change or cancel that proof.
|
||||
After qualification, a separate runner with read-only repository/actions
|
||||
permissions restores the retained tarball and verifier runtime. It installs
|
||||
that exact archive into an empty prefix, then exercises CLI help/discovery and
|
||||
the real stdio MCP catalog/session contract. Installation finishes before the
|
||||
protocol deadline begins, with dependency lifecycle scripts disabled. Only a
|
||||
successful rehearsal enables the job with npm publishing authority. Both jobs
|
||||
use the same release-input action; neither rebuilds or repacks the archive.
|
||||
This rehearsal checks package consumption on the Linux release runner;
|
||||
qualification retains its broader native-host and real-provider checks.
|
||||
|
||||
Before publishing, npm lookup failures and malformed metadata stop the job.
|
||||
An existing version must match the qualified tarball's SHA-512 and intended
|
||||
`latest`/`next` dist-tag before it can be reused. Publication never overwrites
|
||||
an existing version or silently changes a dist-tag. After publication, only
|
||||
confirmed registry absence is retried within the propagation window. Content
|
||||
or tag mismatches fail immediately. The post-publication verifier installs
|
||||
from npm and repeats the same CLI/MCP checks; it also exercises a real update
|
||||
from an older stable release. For a prerelease on `next`, that updater still
|
||||
targets stable `latest`, as the public update command does.
|
||||
|
||||
The required reverse-tools lane runs fresh coverage and both mutation
|
||||
preflights. Complete mutation sweeps run separately on a schedule or manual
|
||||
dispatch and do not block publication; see [the testing guide](testing.md).
|
||||
Ordinary main pushes and closed, unmerged PRs cannot publish packages. Check
|
||||
both publication jobs and the published-package canary; a merged PR or GitHub
|
||||
tag alone does not establish that publication finished. Retry failed jobs in
|
||||
the original run after a partial publication.
|
||||
|
||||
### Recover an already published npm release
|
||||
|
||||
Rerunning a job uses its original workflow and source revision. When a verifier
|
||||
or publishing workflow needs a code fix, land that fix on main first, then use
|
||||
the separate recovery workflow instead of repeating release creation:
|
||||
|
||||
```bash
|
||||
gh workflow run release-recovery.yml --ref main \
|
||||
-f version=6.5.0 -f release_run_id=38564502044
|
||||
```
|
||||
|
||||
Select the existing version and its original automatic Release run. Recovery
|
||||
requires that run's successful exact-source CI gate and npm publish step. It
|
||||
uses the existing release tag, original qualified tarball and verifier runtime;
|
||||
expired or missing artifacts stop recovery. The archive's source, version,
|
||||
original run/attempt and Node version must match, and its SHA-512 must equal
|
||||
npm's published integrity. The corrected controller runs the public CLI, MCP
|
||||
catalog/session and previous-version update canary against that released runtime.
|
||||
The installation completes before MCP's handshake begins; dependency lifecycle
|
||||
scripts are disabled as in the installed-package verifier.
|
||||
|
||||
Only after verification succeeds does recovery publish the released
|
||||
`server.json` to MCP Registry. It does not create tags or GitHub releases,
|
||||
publish npm bytes, or change dist-tags. Both publication paths share the same
|
||||
MCP publisher: a paginated registry lookup preserves an identical active
|
||||
version, refuses conflicting/inactive metadata, and fails on lookup errors.
|
||||
The original failed run remains a historical failure; the recovery run records
|
||||
the new verification and remaining registry publication. Manual frozen-branch
|
||||
releases are outside this recovery path.
|
||||
|
||||
For a release that needs an independently frozen application checkpoint, use
|
||||
the optional manual path below. It retains explicit prepare and publish phases.
|
||||
|
||||
|
||||
@@ -98,6 +98,18 @@ isolated filesystem boundary tests because it loads both source and compiled
|
||||
module graphs. Adapter, other boundary, acceptance, and process-global projects
|
||||
retain per-file isolation. See `vitest.config.ts` for current settings.
|
||||
|
||||
Inject producer faults through scoped dependencies in shared workers: a module
|
||||
mock cannot replace a consumer that was imported earlier. Check these tests
|
||||
with the consumer preloaded as well as alone. For simulated protocol traces,
|
||||
use an acknowledged event barrier before asserting complete observations;
|
||||
a zero-duration capture does not guarantee queued events have arrived.
|
||||
|
||||
Check advertised schemas after SDK conversion for every supported schema
|
||||
profile. Meta-schema validity does not establish client acceptance or useful
|
||||
rendered declarations. Keep canonical rejection checks separate from the
|
||||
intentionally reduced compact advertisement, and probe actual client renderers
|
||||
when changing schema representations.
|
||||
|
||||
The reused CLI boundary workers cap V8 old space at 384 MiB, based on their
|
||||
profiled allocation and cleanup behavior. This encourages collection between
|
||||
files; spawned REA processes retain their own heap settings.
|
||||
@@ -280,6 +292,33 @@ focused suite also exercises affected MCP routes and the Python Cutter bridge.
|
||||
Contract, integration, and real-provider lanes complement these focused tests;
|
||||
simulated providers do not establish real-provider behavior.
|
||||
|
||||
Required CI retains fresh reverse-tools coverage and preflights both canonical
|
||||
Stryker configurations with `--dryRunOnly`. These preflights resolve the owned
|
||||
targets, instrument the source, and execute the real initial tests. Invalid
|
||||
configuration, target resolution, and initial test failures still fail the job.
|
||||
Preflights execute no mutants and produce no mutation-outcome report. Both fast
|
||||
feedback and full qualification, including exact-revision release qualification,
|
||||
require coverage and both preflights. A failed, canceled, skipped or missing
|
||||
selected quality job still fails the required gate.
|
||||
|
||||
The separate **Mutation sweep** workflow runs both complete configurations daily
|
||||
and on manual dispatch, in two isolated jobs. It is a maintenance check outside
|
||||
the PR and release publication gates. `ci:full` requests full regression,
|
||||
coverage and provider qualification; it does not request a complete mutation
|
||||
sweep. Use the Mutation sweep workflow to request that result. Targets,
|
||||
checkers, concurrency, deadlines and the existing non-blocking mutation-score
|
||||
threshold are unchanged. `npm run test:mutation:reverse-tools` also retains both
|
||||
complete passes for local callers.
|
||||
|
||||
The two passes write separate JSON and HTML reports under `reports/mutation/`:
|
||||
`reverse-tools` and `reverse-tools-semantics`. Required CI retains focused
|
||||
coverage; the sweep retains each configuration's JSON/HTML reports separately.
|
||||
Both retain available diagnostics for seven days after failure and skip uploads
|
||||
on cancellation. Artifact names identify the tier or configuration and run
|
||||
attempt. A successful sweep requires both jobs and their nonempty reports;
|
||||
partial diagnostics and preflights do not establish complete mutation outcomes
|
||||
or qualify the release revision for mutation coverage.
|
||||
|
||||
Fast CI starts the source-only projects after classification, independently of
|
||||
build and static checks, and runs five built-dependent shards after the build.
|
||||
The six test jobs still select every portable test. Full qualification keeps six
|
||||
|
||||
@@ -87,6 +87,12 @@ malformed, unavailable, cancellation, and partial outcomes through affected
|
||||
consumers. Real-engine claims require the matching provider lane; see
|
||||
[testing.md](testing.md).
|
||||
|
||||
For fixed tuples in public contracts, use `src/domain/fixedTupleSchema.ts`:
|
||||
Zod's tuple projection omits implicit length bounds and Draft 2020-12 `items`,
|
||||
which some clients require even alongside `prefixItems`. Tuples with a rest
|
||||
schema also need explicit minimum lengths. Check parser/schema parity for empty,
|
||||
short, overlong, and malformed values in both input and output projections.
|
||||
|
||||
When discoverability changes, evaluate representative broad, direct, and negative
|
||||
tasks on the intended host. Record host/model/catalog, selected tools, arguments,
|
||||
errors, retries, and task outcomes. Schema validity and keyword heuristics do not
|
||||
|
||||
@@ -69,6 +69,13 @@ The observed mitmproxy 12.2.3 `SaveHar` profile can emit `postData.text: null`
|
||||
for a missing request body. REA preserves that reported null, omitting the
|
||||
optional field only from its validation copy for this exact producer profile;
|
||||
it does not invent an empty string or body bytes.
|
||||
The observed Playwright 1.58.2 profile can report a bracketed IPv6
|
||||
`serverIPAddress`, forwarded from Chromium's `remoteIPAddress` through
|
||||
[Playwright's HAR tracer](https://github.com/microsoft/playwright/blob/v1.58.2/packages/playwright-core/src/server/har/harTracer.ts).
|
||||
REA preserves the original spelling in reported Evidence and removes brackets
|
||||
only from its validation copy, only for this declared producer and a valid IPv6
|
||||
literal. Invalid addresses, bracketed IPv4, ports and zone identifiers remain
|
||||
validation failures. Producer declarations do not authenticate origin.
|
||||
|
||||
Native mitmproxy decoding requires a caller-supplied **mitmdump 12.2.3 on
|
||||
Linux**. Set its absolute executable path:
|
||||
@@ -110,7 +117,11 @@ gRPC message bytes. Missing members remain null, distinct from empty bodies.
|
||||
See Telerik's [SAZ format reference](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/knowledge-base/fiddler-archives).
|
||||
|
||||
The existing ZIP reader verifies read members; expanded archive contents are
|
||||
limited to 32 MiB in addition to the input/output budgets below. Encrypted
|
||||
limited to 32 MiB in addition to the input/output budgets below. Exceeding this
|
||||
expanded-byte budget returns `invalid_request` / `invalid_input` through both
|
||||
CLI and MCP, with an `out_of_range` issue at
|
||||
`capture_path` and `maximum_expanded_capture_bytes`. Selecting records does not
|
||||
bypass the complete-archive admission check or return partial Evidence. Encrypted
|
||||
archives and unrecognized raw session members are unsupported. SAZ requires an
|
||||
enforced decoder memory bound: Node's fixed heap, or the Windows Job Object
|
||||
commit limit. Bun on hosts without that Job Object limit returns capability
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Analysis efficiency measurements
|
||||
|
||||
For genuine Fiddler captures, see the [SAZ selection checkpoint](saz-selection-workflows.md).
|
||||
`measure.mjs --saz-selection baseline|focused|retained` compares default complete
|
||||
delivery (including retained-reference recovery), caller-selected ordinals, and
|
||||
summary/preview/complete/repeated pages. Each failed RPC remains in task costs.
|
||||
The body question uses stored bytes, not decoded HTTP application payloads.
|
||||
|
||||
Tracks the experiments for [#2016](https://github.com/morluto/rea/issues/2016).
|
||||
The production CLI/MCP contracts and defaults remain the compatibility baseline.
|
||||
Downloaded artifacts, runtime copies, exported Evidence, transcripts and detailed
|
||||
@@ -72,6 +78,18 @@ checkpoint commits retain their original receipts; no history was rewritten.
|
||||
|
||||
## Optimization priorities and gradual migration
|
||||
|
||||
The [larger/non-HTTP packet checkpoint](packet-field-workflows.md) records
|
||||
same-question SDK and actual Codex comparisons using existing input limits,
|
||||
field/filter selection, discovery and output windows. Lower delivered JSON did
|
||||
not establish stable total-token or speed gains; failed plans and negative
|
||||
controls remain visible.
|
||||
|
||||
The [sigrok selection checkpoint](signal-selection-workflows.md) records two
|
||||
real hardware recordings, independently verified bytes, repeated decoder/pages,
|
||||
and an eight-task Codex cohort with mixed token/time results. Existing annotation
|
||||
controls reduce replies; these measurements introduce no production cache,
|
||||
default or API changes.
|
||||
|
||||
Agent token consumption and end-to-end task time are the primary objectives.
|
||||
Memory and CPU consumption are also measured and controlled. Correctness,
|
||||
Evidence provenance, caller choices and existing-user compatibility are
|
||||
|
||||
@@ -181,6 +181,9 @@ def main():
|
||||
'inspect_android_class', 'inspect_android_method',
|
||||
'inspect_firmware_regions', 'inspect_managed_artifact',
|
||||
'inspect_sqlite_database', 'inspect_pcap_capture',
|
||||
'inspect_web_network_capture',
|
||||
'inspect_packet_capture', 'inspect_packet_fields',
|
||||
'decode_signal_recording', 'inspect_signal_decoders',
|
||||
'inspect_managed_members', 'inspect_managed_native_boundaries',
|
||||
'inspect_artifact', 'inspect_wasm_artifact',
|
||||
'inspect_evm_interface', 'get_evidence_bundle', 'export_evidence_bundle',
|
||||
|
||||
@@ -2,6 +2,8 @@ import { isDeepStrictEqual } from "node:util";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { parseArgs } from "node:util";
|
||||
import { PACKET_ARTIFACTS } from "./packet-entry.mjs";
|
||||
import { SIGNAL_ARTIFACTS } from "./signal-entry.mjs";
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
@@ -33,6 +35,10 @@ const sameSettings = [
|
||||
"provider_environment_policy_sha256",
|
||||
"measure_source_sha256",
|
||||
"native_workflow_source_sha256",
|
||||
"packet_workflow_source_sha256",
|
||||
"packet_oracle_source_sha256",
|
||||
"signal_workflow_source_sha256",
|
||||
"signal_oracle_source_sha256",
|
||||
"package_lock_sha256",
|
||||
"node_version",
|
||||
"sdk_client_version",
|
||||
@@ -70,12 +76,14 @@ for (const [side, answer] of [
|
||||
value: answer.evidence_ids,
|
||||
});
|
||||
}
|
||||
// PCAP delivery observations preserve each actual receipt's identity, limitations
|
||||
// Recording delivery observations preserve each actual receipt's identity, limitations
|
||||
// and view coverage. Summary/page scopes differ from complete source scope;
|
||||
// retain them separately rather than equating page exhaustion with capture
|
||||
// coverage. Repeated equivalent deliveries must also match every observation
|
||||
// field except the receipt and parent IDs, which identify their own invocations.
|
||||
if (
|
||||
Object.hasOwn(PACKET_ARTIFACTS, left.artifact) ||
|
||||
Object.hasOwn(SIGNAL_ARTIFACTS, left.artifact) ||
|
||||
["wireshark-http.cap", "wireshark-http_redirects.pcapng"].includes(
|
||||
left.artifact,
|
||||
)
|
||||
@@ -88,13 +96,19 @@ if (
|
||||
!Array.isArray(answer.delivery_observations) ||
|
||||
!answer.delivery_observations.length
|
||||
)
|
||||
throw new Error("Missing original PCAP delivery observations");
|
||||
throw new Error("Missing original recording delivery observations");
|
||||
runSpecific.push({
|
||||
side,
|
||||
path: ["delivery_observations"],
|
||||
value: answer.delivery_observations,
|
||||
});
|
||||
if (left.delivery === right.delivery) {
|
||||
if (
|
||||
left.delivery === right.delivery &&
|
||||
(!Object.hasOwn(PACKET_ARTIFACTS, left.artifact) ||
|
||||
left.packet_selection === right.packet_selection) &&
|
||||
(!Object.hasOwn(SIGNAL_ARTIFACTS, left.artifact) ||
|
||||
left.signal_selection === right.signal_selection)
|
||||
) {
|
||||
answer.delivery_observations = answer.delivery_observations.map(
|
||||
(observation) =>
|
||||
Object.fromEntries(
|
||||
|
||||
@@ -291,6 +291,148 @@
|
||||
"upstream_expected_digest": null,
|
||||
"derivation": "Unmodified capture published by official Wireshark wiki. Local digest pins downloaded bytes; no independently published upstream digest is claimed."
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "wireshark-pgsql-jdbc.pcap",
|
||||
"file": "pgsql-jdbc.pcap",
|
||||
"bytes": 4906316,
|
||||
"sha256": "6e68b8b792a0f4336092f98856abc7de8c54b55a29112854d28d676f9093c16b",
|
||||
"provenance": {
|
||||
"project": "Wireshark public sample captures",
|
||||
"source_page": "https://wiki.wireshark.org/SampleCaptures",
|
||||
"url": "https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/pgsql-jdbc.pcap.gz",
|
||||
"resolved_url": "https://gitlab.com/wireshark/wireshark/-/wikis/uploads/__moin_import__/attachments/SampleCaptures/pgsql-jdbc.pcap.gz",
|
||||
"upstream_expected_digest": null,
|
||||
"license": "not stated in inspected upstream catalogue",
|
||||
"derivation": "Unmodified official saved sample; decompressed gzip where indicated. Local digest pins acquired bytes, not an upstream-published digest.",
|
||||
"compressed_source": {
|
||||
"name": "pgsql-jdbc.pcap.gz",
|
||||
"bytes": 590093,
|
||||
"sha256": "15b51bb4cc197753c1ac6b7dc3cf5697f22a81e3bb5d2e1d24d15de469c3a06b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "wireshark-dns.cap",
|
||||
"file": "dns.cap",
|
||||
"bytes": 4338,
|
||||
"sha256": "041eeb6f98bb398f1ee8b09651b5b5a84f6a62639f95bf226f9e7b77355d9f28",
|
||||
"provenance": {
|
||||
"project": "Wireshark public sample captures",
|
||||
"source_page": "https://wiki.wireshark.org/SampleCaptures",
|
||||
"url": "https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dns.cap",
|
||||
"resolved_url": "https://gitlab.com/wireshark/wireshark/-/wikis/uploads/__moin_import__/attachments/SampleCaptures/dns.cap",
|
||||
"upstream_expected_digest": null,
|
||||
"license": "not stated in inspected upstream catalogue",
|
||||
"derivation": "Unmodified official saved sample; decompressed gzip where indicated. Local digest pins acquired bytes, not an upstream-published digest.",
|
||||
"compressed_source": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "wireshark-dhcp.pcap",
|
||||
"file": "dhcp.pcap",
|
||||
"bytes": 1400,
|
||||
"sha256": "2471b5420bdac826eecf8f61a2bbb4a3eb20dbfab7c02ff2be502f349f368214",
|
||||
"provenance": {
|
||||
"project": "Wireshark public sample captures",
|
||||
"source_page": "https://wiki.wireshark.org/SampleCaptures",
|
||||
"url": "https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dhcp.pcap",
|
||||
"resolved_url": "https://gitlab.com/wireshark/wireshark/-/wikis/uploads/__moin_import__/attachments/SampleCaptures/dhcp.pcap",
|
||||
"upstream_expected_digest": null,
|
||||
"license": "not stated in inspected upstream catalogue",
|
||||
"derivation": "Unmodified official saved sample; decompressed gzip where indicated. Local digest pins acquired bytes, not an upstream-published digest.",
|
||||
"compressed_source": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "sigrok-uart-max3232e.sr",
|
||||
"file": "uart-max3232e.sr",
|
||||
"bytes": 12742,
|
||||
"sha256": "f797d60d6b8e12d2a1549b9a5a499ef389f44cb9e870e8610af26b57c3b2be76",
|
||||
"provenance": {
|
||||
"project": "sigrok-dumps",
|
||||
"version": "0ad13477abc959d37fc9a5acbd23901c371c9c76",
|
||||
"upstreamFile": "uart/maxim_max3232e/max3232e_hello_world_57600_8n1.sr",
|
||||
"url": "https://raw.githubusercontent.com/sigrokproject/sigrok-dumps/0ad13477abc959d37fc9a5acbd23901c371c9c76/uart/maxim_max3232e/max3232e_hello_world_57600_8n1.sr",
|
||||
"git_blob_sha1": "52e47b3014819471a2f348a0d8c7694fe304e052",
|
||||
"reference": "https://raw.githubusercontent.com/sigrokproject/sigrok-dumps/0ad13477abc959d37fc9a5acbd23901c371c9c76/uart/maxim_max3232e/README",
|
||||
"license_scope": "Repository README declares dumps public domain unless otherwise noted; selected READMEs state no exception; decoder software licensing is separate."
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "sigrok-i2c-nunchuk.sr",
|
||||
"file": "i2c-nunchuk.sr",
|
||||
"bytes": 20373,
|
||||
"sha256": "0fa6adb8297d7f3fe5ba19c94ee655c9b0f952a8b5e48a17aaa499a2f6d10d70",
|
||||
"provenance": {
|
||||
"project": "sigrok-dumps",
|
||||
"version": "0ad13477abc959d37fc9a5acbd23901c371c9c76",
|
||||
"upstreamFile": "i2c/wii_nunchuk/wii_nunchuk_init_reg_3xdata.sr",
|
||||
"url": "https://raw.githubusercontent.com/sigrokproject/sigrok-dumps/0ad13477abc959d37fc9a5acbd23901c371c9c76/i2c/wii_nunchuk/wii_nunchuk_init_reg_3xdata.sr",
|
||||
"git_blob_sha1": "a7232fce7b54e68e2be44e15946c90a3c756e8e9",
|
||||
"reference": "https://raw.githubusercontent.com/sigrokproject/sigrok-dumps/0ad13477abc959d37fc9a5acbd23901c371c9c76/i2c/wii_nunchuk/README",
|
||||
"license_scope": "Repository README declares dumps public domain unless otherwise noted; selected READMEs state no exception; decoder software licensing is separate."
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "xbox-clear_nomp.saz",
|
||||
"file": "clear_nomp.saz",
|
||||
"bytes": 43515,
|
||||
"sha256": "3e808663a99cbb9160186f7419633248200fbc6863d2c897f5d4d9972dde0375",
|
||||
"provenance": {
|
||||
"project": "Microsoft Xbox Live Trace Analyzer",
|
||||
"version": "ad880ff00b26c4cae5e3c8864d3df438a03890ba",
|
||||
"url": "https://raw.githubusercontent.com/microsoft/xbox-live-trace-analyzer/ad880ff00b26c4cae5e3c8864d3df438a03890ba/Source/TestData/CertWarnings/clear_nomp.saz",
|
||||
"git_blob": "2f1ba66dacb8f8bac290cab59dff8fe750a46ce7",
|
||||
"license": "MIT; upstream LICENSE.md",
|
||||
"producer_archive_comment": "Fiddler (v4.5.1.2) Session Archive. See http://fiddler2.com"
|
||||
},
|
||||
"saz_question": {
|
||||
"record_ordinals": [12, 0, 6],
|
||||
"total_records": 13,
|
||||
"members": 42,
|
||||
"expanded_bytes": 62609
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "xbox-clear_mp_cs10.saz",
|
||||
"file": "clear_mp_cs10.saz",
|
||||
"bytes": 5223519,
|
||||
"sha256": "4021b201848e4feea3402c380fda5d2df43fd0bf1c72ea550e60f2da3b3d5b44",
|
||||
"provenance": {
|
||||
"project": "Microsoft Xbox Live Trace Analyzer",
|
||||
"version": "ad880ff00b26c4cae5e3c8864d3df438a03890ba",
|
||||
"url": "https://raw.githubusercontent.com/microsoft/xbox-live-trace-analyzer/ad880ff00b26c4cae5e3c8864d3df438a03890ba/Source/TestData/CertWarnings/clear_mp_cs10.saz",
|
||||
"git_blob": "dac534d625594c7a1d57b0b12ed12ea9c6cb6a5b",
|
||||
"license": "MIT; upstream LICENSE.md",
|
||||
"producer_archive_comment": "Fiddler (v4.6.2.0) Session Archive. See https://fiddler2.com"
|
||||
},
|
||||
"saz_question": {
|
||||
"record_ordinals": [1310, 0, 655],
|
||||
"total_records": 1311,
|
||||
"members": 3939,
|
||||
"expanded_bytes": 9223820
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "xbox-x49_mp_cs21.saz",
|
||||
"file": "x49_mp_cs21.saz",
|
||||
"bytes": 572224,
|
||||
"sha256": "97cdca8b0608e3f11995fd64b64390b9fd8d8e3efcac89f517f24b44968047f6",
|
||||
"provenance": {
|
||||
"project": "Microsoft Xbox Live Trace Analyzer",
|
||||
"version": "ad880ff00b26c4cae5e3c8864d3df438a03890ba",
|
||||
"url": "https://raw.githubusercontent.com/microsoft/xbox-live-trace-analyzer/ad880ff00b26c4cae5e3c8864d3df438a03890ba/Source/TestData/CertWarnings/x49_mp_cs21.saz",
|
||||
"git_blob": "e7794c44892ca4fa1729fa012e698e8284337f15",
|
||||
"license": "MIT; upstream LICENSE.md",
|
||||
"producer_archive_comment": "Fiddler (v4.6.2.26757) Session Archive. See https://fiddler2.com"
|
||||
},
|
||||
"saz_question": {
|
||||
"record_ordinals": [102, 0, 51],
|
||||
"total_records": 103,
|
||||
"members": 315,
|
||||
"expanded_bytes": 1301927
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -12,6 +12,9 @@ import {
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { Ajv2020 } from "ajv/dist/2020.js";
|
||||
import { PACKET_ARTIFACTS, measurePacketEntry } from "./packet-entry.mjs";
|
||||
import { SIGNAL_ARTIFACTS, measureSignalEntry } from "./signal-entry.mjs";
|
||||
import { SAZ_ARTIFACTS, measureSazEntry } from "./saz-entry.mjs";
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const { values } = parseArgs({
|
||||
@@ -29,6 +32,9 @@ const { values } = parseArgs({
|
||||
"managed-question": { type: "string", default: "inventory" },
|
||||
schemas: { type: "string", default: "default" },
|
||||
"sqlite-selection": { type: "string", default: "all" },
|
||||
"packet-selection": { type: "string", default: "baseline" },
|
||||
"signal-selection": { type: "string", default: "baseline" },
|
||||
"saz-selection": { type: "string", default: "baseline" },
|
||||
},
|
||||
});
|
||||
if (
|
||||
@@ -39,12 +45,33 @@ if (
|
||||
!isAbsolute(values.path) ||
|
||||
!isAbsolute(values.output) ||
|
||||
!["complete", "summary"].includes(values.delivery) ||
|
||||
!["baseline", "focused", "retained"].includes(values["saz-selection"]) ||
|
||||
(!Object.hasOwn(SAZ_ARTIFACTS, values.artifact) &&
|
||||
values["saz-selection"] !== "baseline") ||
|
||||
(Object.hasOwn(SAZ_ARTIFACTS, values.artifact) &&
|
||||
values.delivery !== "complete") ||
|
||||
!["baseline", "focused", "discovery", "pages"].includes(
|
||||
values["signal-selection"],
|
||||
) ||
|
||||
(!Object.hasOwn(SIGNAL_ARTIFACTS, values.artifact) &&
|
||||
values["signal-selection"] !== "baseline") ||
|
||||
(Object.hasOwn(SIGNAL_ARTIFACTS, values.artifact) &&
|
||||
values.delivery !== "complete") ||
|
||||
!["entry", "entry-and-main", "entry-views"].includes(
|
||||
values["native-question"],
|
||||
) ||
|
||||
!["inventory", "selected"].includes(values["javascript-question"]) ||
|
||||
!["default", "selected"].includes(values.schemas) ||
|
||||
!["all", "columns"].includes(values["sqlite-selection"]) ||
|
||||
!["baseline", "focused", "discovery", "pages"].includes(
|
||||
values["packet-selection"],
|
||||
) ||
|
||||
(!Object.hasOwn(PACKET_ARTIFACTS, values.artifact) &&
|
||||
values["packet-selection"] !== "baseline") ||
|
||||
(Object.hasOwn(PACKET_ARTIFACTS, values.artifact) &&
|
||||
values.delivery !== "complete") ||
|
||||
(values["packet-selection"] === "pages" &&
|
||||
values.artifact !== "wireshark-pgsql-jdbc.pcap") ||
|
||||
(values.artifact !== "qgis-world-map.gpkg" &&
|
||||
values["sqlite-selection"] !== "all") ||
|
||||
(values.artifact === "qgis-world-map.gpkg" &&
|
||||
@@ -142,6 +169,24 @@ const fingerprints = {
|
||||
native_workflow_source_sha256: await fileSha(
|
||||
fileURLToPath(new URL("./native-entry.mjs", import.meta.url)),
|
||||
),
|
||||
packet_workflow_source_sha256: await fileSha(
|
||||
fileURLToPath(new URL("./packet-entry.mjs", import.meta.url)),
|
||||
),
|
||||
packet_oracle_source_sha256: await fileSha(
|
||||
fileURLToPath(new URL("./packet-oracle.py", import.meta.url)),
|
||||
),
|
||||
signal_workflow_source_sha256: await fileSha(
|
||||
fileURLToPath(new URL("./signal-entry.mjs", import.meta.url)),
|
||||
),
|
||||
signal_oracle_source_sha256: await fileSha(
|
||||
fileURLToPath(new URL("./signal-oracle.py", import.meta.url)),
|
||||
),
|
||||
saz_workflow_source_sha256: await fileSha(
|
||||
fileURLToPath(new URL("./saz-entry.mjs", import.meta.url)),
|
||||
),
|
||||
saz_oracle_source_sha256: await fileSha(
|
||||
fileURLToPath(new URL("./saz-oracle.py", import.meta.url)),
|
||||
),
|
||||
runtime_files_sha256: sha(JSON.stringify(runtimeFiles)),
|
||||
runtime_dispatcher_sha256: await fileSha(
|
||||
resolve(values["runtime-root"], "scripts/rea.mjs"),
|
||||
@@ -722,6 +767,24 @@ const inspectPcapTarget = async () => {
|
||||
};
|
||||
|
||||
const workflows = {
|
||||
...Object.fromEntries(
|
||||
Object.keys(SAZ_ARTIFACTS).map((artifact) => [
|
||||
artifact,
|
||||
() => measureSazEntry({ values, call, inputSha }),
|
||||
]),
|
||||
),
|
||||
...Object.fromEntries(
|
||||
Object.keys(SIGNAL_ARTIFACTS).map((artifact) => [
|
||||
artifact,
|
||||
() => measureSignalEntry({ values, call, inputSha, catalogDefinitions }),
|
||||
]),
|
||||
),
|
||||
...Object.fromEntries(
|
||||
Object.keys(PACKET_ARTIFACTS).map((artifact) => [
|
||||
artifact,
|
||||
() => measurePacketEntry({ values, call, inputSha, catalogDefinitions }),
|
||||
]),
|
||||
),
|
||||
"wireshark-http.cap": inspectPcapTarget,
|
||||
"wireshark-http_redirects.pcapng": inspectPcapTarget,
|
||||
"qgis-world-map.gpkg": async () => {
|
||||
@@ -1144,6 +1207,9 @@ const report = {
|
||||
artifact_sha256: inputSha,
|
||||
artifact_sha256_after: finalInputSha,
|
||||
delivery: values.delivery,
|
||||
saz_selection: Object.hasOwn(SAZ_ARTIFACTS, values.artifact)
|
||||
? values["saz-selection"]
|
||||
: null,
|
||||
sdk_schema_mode: values.schemas,
|
||||
retained_verification: values["verify-retained"],
|
||||
native_question: NATIVE_ARTIFACTS.includes(values.artifact)
|
||||
@@ -1160,6 +1226,12 @@ const report = {
|
||||
values.artifact === "qgis-world-map.gpkg"
|
||||
? values["sqlite-selection"]
|
||||
: null,
|
||||
packet_selection: Object.hasOwn(PACKET_ARTIFACTS, values.artifact)
|
||||
? values["packet-selection"]
|
||||
: null,
|
||||
signal_selection: Object.hasOwn(SIGNAL_ARTIFACTS, values.artifact)
|
||||
? values["signal-selection"]
|
||||
: null,
|
||||
provider_settings_sha256: sha(JSON.stringify(selectedProviders)),
|
||||
provider_search_path_sha256: sha(
|
||||
selectedProviders.PATH ?? process.env.PATH ?? "",
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
import { isDeepStrictEqual } from "node:util";
|
||||
import { resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
export const verifyPacketPage = (first, next, oracle) => {
|
||||
if (
|
||||
first.artifact.sha256 !== oracle.sha256 ||
|
||||
next.artifact.sha256 !== oracle.sha256 ||
|
||||
first.output_window.matching_packets !== oracle.matching_packets ||
|
||||
next.output_window.matching_packets !== oracle.matching_packets ||
|
||||
!isDeepStrictEqual(
|
||||
packetFacts("postgres", first).rows,
|
||||
oracle.rows.slice(0, 12),
|
||||
) ||
|
||||
!isDeepStrictEqual(
|
||||
packetFacts("postgres", next).rows,
|
||||
oracle.rows.slice(12, 24),
|
||||
)
|
||||
)
|
||||
throw new Error(
|
||||
"Packet pages differ from independently parsed original matches",
|
||||
);
|
||||
};
|
||||
|
||||
export const PACKET_ARTIFACTS = {
|
||||
"wireshark-pgsql-jdbc.pcap": {
|
||||
kind: "postgres",
|
||||
fields: ["tcp.srcport", "tcp.dstport", "tcp.flags"],
|
||||
extra: ["tcp.len"],
|
||||
protocol: "tcp",
|
||||
query: "tcp.flags",
|
||||
discovered: "tcp.flags",
|
||||
filter: "tcp.port == 5432",
|
||||
},
|
||||
"wireshark-dns.cap": {
|
||||
kind: "dns",
|
||||
fields: [
|
||||
"dns.id",
|
||||
"dns.flags.response",
|
||||
"dns.flags.rcode",
|
||||
"dns.qry.name",
|
||||
"dns.qry.type",
|
||||
],
|
||||
extra: ["dns.resp.name", "dns.resp.ttl", "udp.srcport", "udp.dstport"],
|
||||
protocol: "dns",
|
||||
query: "dns.flags.rcode",
|
||||
discovered: "dns.flags.rcode",
|
||||
filter: "dns.flags.response == 1 && dns.flags.rcode != 0",
|
||||
},
|
||||
"wireshark-dhcp.pcap": {
|
||||
kind: "dhcp",
|
||||
fields: [
|
||||
"dhcp.id",
|
||||
"dhcp.option.dhcp",
|
||||
"dhcp.ip.your",
|
||||
"dhcp.option.dhcp_server_id",
|
||||
],
|
||||
extra: [
|
||||
"dhcp.type",
|
||||
"dhcp.ip.client",
|
||||
"dhcp.hw.mac_addr",
|
||||
"udp.srcport",
|
||||
"udp.dstport",
|
||||
],
|
||||
protocol: "dhcp",
|
||||
query: "Option 53:",
|
||||
discovered: "dhcp.option.dhcp",
|
||||
filter: "dhcp",
|
||||
},
|
||||
};
|
||||
|
||||
export const packetRequest = (artifact, path, selection) => {
|
||||
const descriptor = PACKET_ARTIFACTS[artifact];
|
||||
if (!descriptor) throw new Error("Unknown pinned packet question");
|
||||
const baseline = selection === "baseline";
|
||||
return {
|
||||
path,
|
||||
fields: baseline
|
||||
? [...descriptor.fields, ...descriptor.extra]
|
||||
: descriptor.fields,
|
||||
display_filter:
|
||||
descriptor.kind === "postgres" && baseline
|
||||
? `${descriptor.filter} && frame.number <= 2000`
|
||||
: descriptor.kind === "dns" && baseline
|
||||
? "dns"
|
||||
: descriptor.filter,
|
||||
...(descriptor.kind === "postgres" && !baseline
|
||||
? { packet_limit: 2000, match_limit: 12 }
|
||||
: {}),
|
||||
};
|
||||
};
|
||||
|
||||
const number = (row, field) => {
|
||||
const value = row[field];
|
||||
if (
|
||||
!Array.isArray(value) ||
|
||||
value.length !== 1 ||
|
||||
!/^(?:[0-9]+|0x[0-9a-f]+)$/iu.test(value[0])
|
||||
)
|
||||
throw new Error(`Expected one recorded integer for ${field}`);
|
||||
const parsed = Number(value[0]);
|
||||
if (!Number.isSafeInteger(parsed))
|
||||
throw new Error(`Unsafe recorded integer for ${field}`);
|
||||
return parsed;
|
||||
};
|
||||
|
||||
export const packetFacts = (kind, report) => {
|
||||
let packets = report.packets;
|
||||
if (kind === "postgres") packets = packets.slice(0, 12);
|
||||
if (kind === "dns")
|
||||
packets = packets.filter(
|
||||
(row) =>
|
||||
number(row, "dns.flags.response") === 1 &&
|
||||
number(row, "dns.flags.rcode") !== 0,
|
||||
);
|
||||
return {
|
||||
kind,
|
||||
matching_packets:
|
||||
kind === "dns" ? packets.length : report.output_window.matching_packets,
|
||||
rows: packets.map((row) => {
|
||||
const frame = number(row, "frame.number");
|
||||
if (kind === "postgres")
|
||||
return {
|
||||
frame,
|
||||
source_port: number(row, "tcp.srcport"),
|
||||
destination_port: number(row, "tcp.dstport"),
|
||||
flags: number(row, "tcp.flags"),
|
||||
};
|
||||
if (kind === "dns") {
|
||||
const names = row["dns.qry.name"];
|
||||
const types = row["dns.qry.type"];
|
||||
if (
|
||||
!Array.isArray(names) ||
|
||||
names.length === 0 ||
|
||||
!Array.isArray(types) ||
|
||||
types.length !== names.length
|
||||
)
|
||||
throw new Error(
|
||||
"The fixed DNS question requires recorded names and types; missing fields are unknown",
|
||||
);
|
||||
return {
|
||||
frame,
|
||||
id: number(row, "dns.id"),
|
||||
rcode: number(row, "dns.flags.rcode"),
|
||||
names,
|
||||
types: types.map((value) => number({ type: [value] }, "type")),
|
||||
};
|
||||
}
|
||||
const server = row["dhcp.option.dhcp_server_id"];
|
||||
const address = row["dhcp.ip.your"];
|
||||
if (
|
||||
!Array.isArray(address) ||
|
||||
address.length !== 1 ||
|
||||
(server !== undefined &&
|
||||
(!Array.isArray(server) || server.length !== 1))
|
||||
)
|
||||
throw new Error("Expected recorded DHCP address scalar");
|
||||
return {
|
||||
frame,
|
||||
id: number(row, "dhcp.id"),
|
||||
message_type: number(row, "dhcp.option.dhcp"),
|
||||
your_address: address[0],
|
||||
...(server === undefined ? {} : { server_identifier: server[0] }),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
export const measurePacketEntry = async ({
|
||||
values,
|
||||
call,
|
||||
inputSha,
|
||||
catalogDefinitions,
|
||||
}) => {
|
||||
const descriptor = PACKET_ARTIFACTS[values.artifact];
|
||||
const { parseEvidence } = await import(
|
||||
pathToFileURL(resolve(values["runtime-root"], "dist/domain/evidence.js"))
|
||||
.href
|
||||
);
|
||||
const { inspectPacketCaptureInputSchema, packetCaptureSchema } = await import(
|
||||
pathToFileURL(
|
||||
resolve(values["runtime-root"], "dist/domain/captures/packetCapture.js"),
|
||||
).href
|
||||
);
|
||||
const { inspectPacketFieldsInputSchema, packetFieldsCatalogSchema } =
|
||||
await import(
|
||||
pathToFileURL(
|
||||
resolve(values["runtime-root"], "dist/domain/captures/packetFields.js"),
|
||||
).href
|
||||
);
|
||||
const observations = [];
|
||||
const selection = values["packet-selection"];
|
||||
const checked = (evidence, operation, input, schema) => {
|
||||
parseEvidence(evidence);
|
||||
const report = schema.parse(evidence.normalized_result);
|
||||
if (
|
||||
evidence.operation !== operation ||
|
||||
!isDeepStrictEqual(evidence.parameters, input) ||
|
||||
!isDeepStrictEqual(report.selection, input)
|
||||
)
|
||||
throw new Error(
|
||||
"Packet Evidence operation or choices differs from the request",
|
||||
);
|
||||
if (
|
||||
operation === "inspect_packet_capture" &&
|
||||
(evidence.subject?.local_path !== values.path ||
|
||||
evidence.subject?.digest?.sha256 !== inputSha ||
|
||||
report.artifact.path !== values.path ||
|
||||
report.artifact.sha256 !== inputSha)
|
||||
)
|
||||
throw new Error("Packet Evidence identifies different capture bytes");
|
||||
if (
|
||||
operation === "inspect_packet_fields" &&
|
||||
(evidence.subject?.local_path !== report.tool.path ||
|
||||
evidence.subject?.digest?.sha256 !== report.tool.sha256)
|
||||
)
|
||||
throw new Error("Field discovery identifies a different executable");
|
||||
observations.push({
|
||||
evidence_id: evidence.evidence_id,
|
||||
operation,
|
||||
selection: report.selection,
|
||||
output_window: report.output_window,
|
||||
read_scope: report.read_scope ?? null,
|
||||
limitations: evidence.limitations,
|
||||
});
|
||||
return report;
|
||||
};
|
||||
if (selection === "discovery") {
|
||||
const input = inspectPacketFieldsInputSchema.parse({
|
||||
kind: "fields",
|
||||
protocol: descriptor.protocol,
|
||||
query: descriptor.query,
|
||||
limit: 1,
|
||||
});
|
||||
const found = checked(
|
||||
await call("inspect_packet_fields", input),
|
||||
"inspect_packet_fields",
|
||||
input,
|
||||
packetFieldsCatalogSchema,
|
||||
);
|
||||
if (
|
||||
!found.records.some((row) => row.abbreviation === descriptor.discovered)
|
||||
)
|
||||
throw new Error(
|
||||
"Selected installation does not advertise the required protocol field",
|
||||
);
|
||||
}
|
||||
const input = inspectPacketCaptureInputSchema.parse(
|
||||
packetRequest(values.artifact, values.path, selection),
|
||||
);
|
||||
for (const name of [
|
||||
"inspect_packet_capture",
|
||||
...(selection === "discovery" ? ["inspect_packet_fields"] : []),
|
||||
])
|
||||
if (!catalogDefinitions.has(name))
|
||||
throw new Error(`Missing live packet contract ${name}`);
|
||||
const report = checked(
|
||||
await call("inspect_packet_capture", input),
|
||||
"inspect_packet_capture",
|
||||
input,
|
||||
packetCaptureSchema,
|
||||
);
|
||||
const facts = packetFacts(descriptor.kind, report);
|
||||
if (selection === "pages") {
|
||||
const { stdout } = await promisify(execFile)(
|
||||
"python3",
|
||||
[
|
||||
fileURLToPath(new URL("./packet-oracle.py", import.meta.url)),
|
||||
"postgres",
|
||||
values.path,
|
||||
"--row-limit",
|
||||
"24",
|
||||
],
|
||||
{ timeout: 30_000, maxBuffer: 128 * 1024 },
|
||||
);
|
||||
const oracle = JSON.parse(stdout);
|
||||
const nextInput = inspectPacketCaptureInputSchema.parse({
|
||||
...input,
|
||||
match_offset: 12,
|
||||
});
|
||||
const next = checked(
|
||||
await call("inspect_packet_capture", nextInput),
|
||||
"inspect_packet_capture",
|
||||
nextInput,
|
||||
packetCaptureSchema,
|
||||
);
|
||||
const repeated = checked(
|
||||
await call("inspect_packet_capture", input),
|
||||
"inspect_packet_capture",
|
||||
input,
|
||||
packetCaptureSchema,
|
||||
);
|
||||
verifyPacketPage(report, next, oracle);
|
||||
if (
|
||||
!isDeepStrictEqual(report.packets, repeated.packets) ||
|
||||
!isDeepStrictEqual(report.output_window, repeated.output_window) ||
|
||||
next.artifact.sha256 !== report.artifact.sha256 ||
|
||||
next.output_window.matching_packets !==
|
||||
report.output_window.matching_packets ||
|
||||
Number(next.packets[0]?.["frame.number"]?.[0]) <=
|
||||
Number(report.packets.at(-1)?.["frame.number"]?.[0])
|
||||
)
|
||||
throw new Error(
|
||||
"Packet page order, digest or repeated observations changed",
|
||||
);
|
||||
}
|
||||
return {
|
||||
artifact_sha256: inputSha,
|
||||
facts,
|
||||
delivery_observations: observations,
|
||||
evidence_ids: [...new Set(observations.map((row) => row.evidence_id))],
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,226 @@
|
||||
# Larger and non-HTTP packet investigation costs
|
||||
|
||||
This closes the bounded experiment in [#3130](https://github.com/morluto/rea/issues/3130).
|
||||
Existing field, filter and input/output-window controls substantially reduce
|
||||
delivered JSON for the selected questions. Actual Codex total input and elapsed
|
||||
time are less consistent. Requiring field discovery for a known field adds cost.
|
||||
These results support documenting caller-selected controls, while retaining the
|
||||
current API, defaults and uncached provider behavior.
|
||||
|
||||
## Runtime and public corpus
|
||||
|
||||
Measurements use immutable main
|
||||
`ec67aebed02dbd20fa5c7703fcd183ad0b1c343c`, Node 24.18.0, the locked MCP client and
|
||||
server, Linux, TShark/capinfos 4.0.17 and util-linux prlimit. The SDK captures live
|
||||
advertised contracts and passes selected definitions to actual public MCP calls.
|
||||
Runtime-file, dispatcher, lockfile, experiment-source and explicit provider
|
||||
configuration digests remain with the private trial records. Subsequent main
|
||||
integration checks do not relabel these measurements.
|
||||
|
||||
Three additional saved recordings come from the
|
||||
[official Wireshark catalogue](https://wiki.wireshark.org/SampleCaptures).
|
||||
`corpus.json` pins their acquisition URLs, exact bytes and SHA-256 values.
|
||||
The PostgreSQL recording is described upstream as a JDBC test session; it is
|
||||
not a representative production workload. Capture-specific licenses were not
|
||||
stated in the inspected catalogue. No captures or raw trial records are
|
||||
redistributed in Git.
|
||||
|
||||
| Recording | Acquired/analyzed size | Recorded frames | Fixed question |
|
||||
| -------------------- | --------------------------------------------: | --------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `pgsql-jdbc.pcap.gz` | 590,093 compressed / 4,906,316 expanded bytes | 18,472 | Within original frames 1–2,000, report the first twelve TCP packets using port 5432, their source/destination ports and flags, and the matching count. |
|
||||
| `dns.cap` | 4,338 bytes | 38 | Report nonzero-RCODE DNS responses, transaction IDs and question names/types. |
|
||||
| `dhcp.pcap` | 1,400 bytes | 4 | Report message types, transaction IDs, offered address and present server identifiers in frame order. |
|
||||
|
||||
The larger application recording and two small non-HTTP controls expand the
|
||||
question/protocol coverage. Large DNS/DHCP, PCAPNG non-HTTP, USB, Bluetooth,
|
||||
Windows and macOS provider performance remain unverified.
|
||||
|
||||
`packet-oracle.py` independently reads classic PCAP, Ethernet/IPv4 and selected
|
||||
TCP/UDP headers. It does not consume TShark output. Its narrow supported scope
|
||||
fails on truncation, IP fragmentation, DNS compression cycles, duplicate DHCP
|
||||
options or DHCP overload. TCP header facts follow
|
||||
[RFC 9293](https://www.rfc-editor.org/rfc/rfc9293.html), DNS names/header fields
|
||||
[RFC 1035](https://www.rfc-editor.org/rfc/rfc1035.html), and DHCP options
|
||||
[RFC 2132](https://www.rfc-editor.org/rfc/rfc2132.html).
|
||||
SQL interpretation, TCP reassembly and network completeness are outside the
|
||||
oracle. The question and oracle were fixed before measured cohorts.
|
||||
|
||||
The oracle establishes 1,337 selected PostgreSQL TCP packets in the input prefix
|
||||
and six DNS error responses. DHCP records contain Discover/Offer with transaction
|
||||
ID 15645 and Request/ACK with ID 15646. An absent server identifier stays omitted;
|
||||
the recording does not establish a single transaction containing all four steps.
|
||||
|
||||
## Equivalent questions and SDK measurements
|
||||
|
||||
Each arm uses fresh actual MCP sessions; heavy trials run sequentially.
|
||||
Two interleaved repetitions cover each arm and each recording. Discovery, catalog,
|
||||
RPC, schema checking, encoding and cleanup costs are retained. JSON bytes describe
|
||||
serialized SDK replies, not raw transport bytes or model tokens.
|
||||
|
||||
The PostgreSQL baseline selects `tcp.srcport`, `tcp.dstport`, `tcp.flags` and
|
||||
`tcp.len`, retains the default fifty-row output window and reads to EOF with
|
||||
`tcp.port == 5432 && frame.number <= 2000`. The focused arm selects the three
|
||||
required fields, uses `packet_limit: 2000`, filter `tcp.port == 5432` and
|
||||
`match_limit: 12`. Both establish the same requested prefix facts and count.
|
||||
Their source read scopes differ explicitly: to EOF versus an input limit.
|
||||
Neither scope establishes whole-network completeness.
|
||||
|
||||
DNS focuses the nine-field baseline on five requested fields and the error-response
|
||||
filter. DHCP selects four required fields from the nine-field baseline; all four
|
||||
records are still read. The discovery arm adds one narrow installed-field probe
|
||||
before the focused request. It tests the cost of validating an already specified
|
||||
field, rather than proving a benefit for a previously unknown field or guessing
|
||||
that an installed registration appears in traffic.
|
||||
|
||||
| Question | Baseline reply bytes | Focused reply bytes | Focused change | Discovery + focused bytes | Discovery change |
|
||||
| ----------------- | -------------------: | ------------------: | -------------: | ------------------------: | ---------------: |
|
||||
| PostgreSQL prefix | 23,054 | 13,304 | −42.29% | 21,096 | −8.49% |
|
||||
| DNS errors | 29,002 | 13,424 | −53.71% | 21,226 | −26.81% |
|
||||
| DHCP sequence | 13,770 | 12,020 | −12.71% | 19,840 | +44.08% |
|
||||
|
||||
Both repetitions produce the same reply size in each cell and pass the independent
|
||||
fact comparison. Authentication uses the selected runtime's `parseEvidence` and
|
||||
named input/output schemas, checking operation, normalized caller choices,
|
||||
artifact or executable identity, original frame order and omission semantics.
|
||||
|
||||
| Question | Baseline tool-call time, ms | Focused tool-call time, ms | Discovery + focused tool-call time, ms |
|
||||
| ----------------- | --------------------------- | -------------------------- | -------------------------------------- |
|
||||
| PostgreSQL prefix | 1,670 / 2,255 | 1,708 / 933 | 3,549 / 2,674 |
|
||||
| DNS errors | 892 / 786 | 889 / 778 | 2,506 / 2,608 |
|
||||
| DHCP sequence | 763 / 759 | 755 / 731 | 2,502 / 2,502 |
|
||||
|
||||
Whole SDK workflow times, including connection/catalog, vary from 4.23–8.79 seconds
|
||||
for these arms. The PostgreSQL focused tool time improves in one repetition and
|
||||
regresses slightly in the other. Discovery consistently adds tool work. Two
|
||||
repetitions are descriptive observations, not a statistical speed guarantee.
|
||||
|
||||
A separate first-page, next-page and repeated-first-page sequence costs
|
||||
922 / 804 / 1,244 ms and returns 39,918 reply bytes in total. Each call repeats
|
||||
dissection, reports the same 1,337 matching count and capture digest, and preserves
|
||||
the original frame order. Identical repeated observations retain the same
|
||||
content-addressed Evidence ID; distinct pages have distinct IDs. Page delivery
|
||||
does not establish capture or network completeness. This narrow repeat does not
|
||||
justify introducing a generic cache or weakening provider identity/cleanup rules.
|
||||
|
||||
The two original HTTP controls were also replayed with two SDK pairs each on the
|
||||
new pinned runtime. Useful summary/prefix facts remain equivalent. For `http.cap`,
|
||||
complete delivery returns 7,601 bytes and summary plus a two-URI retained page
|
||||
17,540 bytes (+130.76%); for `http_redirects.pcapng`, 7,535 versus 17,240 bytes
|
||||
(+128.80%). These remain negative controls. The original model observations in
|
||||
[the earlier checkpoint](pcap-small-captures.md) keep their original runtime pin.
|
||||
|
||||
## Actual Codex CLI observations
|
||||
|
||||
Six actual Codex CLI 0.161.0 runs use requested alias `gpt-5.6-terra`, reasoning
|
||||
`high`, a disposable configuration and the pinned REA MCP runtime. Resolved
|
||||
server-side model identity is not inferred. Both tool names are enabled in every
|
||||
arm, exact-name discovery guidance is identical, shell/browser/other-agent tools
|
||||
are disabled and copied authentication is removed after each run.
|
||||
The shared question and generated plans contain no oracle answers.
|
||||
|
||||
Order is baseline 1, focused 1, discovery 1, focused 2, baseline 2, discovery 2.
|
||||
The rubric checks authenticated actual tool results, exact header-derived facts,
|
||||
citations and the planned calls. Answer correctness and adherence to the plan
|
||||
are reported separately. Limitation wording is reviewed in transcripts; a string
|
||||
or string array is accepted because the prompt does not require one representation.
|
||||
|
||||
| Trial | Total input tokens | Cached input tokens | Output tokens | Elapsed seconds | Actual MCP calls | Facts / plan |
|
||||
| ----------- | -----------------: | ------------------: | ------------: | --------------: | ---------------: | ---------------------------------- |
|
||||
| Baseline 1 | 40,649 | 27,904 | 1,574 | 27.989 | 1 | pass / pass |
|
||||
| Focused 1 | 36,642 | 19,968 | 943 | 38.542 | 1 | pass / pass |
|
||||
| Discovery 1 | 52,802 | 33,024 | 1,089 | 44.398 | 2 | pass / pass |
|
||||
| Focused 2 | 40,912 | 22,016 | 726 | 32.520 | 1 | pass / pass |
|
||||
| Baseline 2 | 40,181 | 19,968 | 896 | 40.299 | 1 | pass / pass |
|
||||
| Discovery 2 | 48,754 | 30,976 | 1,780 | 76.081 | 1 | pass / **fail: discovery omitted** |
|
||||
|
||||
The two eligible baseline/focused pairs show total-input changes of −9.86% and
|
||||
+1.82%, and elapsed changes of +37.70% and −19.30%. Thus reduced SDK reply size
|
||||
does not establish a stable total-token or speed improvement in these runs.
|
||||
The first complete discovery comparison adds 29.90% input and 58.63% elapsed time.
|
||||
The second discovery attempt is retained as a workflow failure and cannot serve
|
||||
as a successful two-call discovery comparison. Its cost is not discarded or
|
||||
counted as a passing trial. No model-side recovery or retries occurred in these
|
||||
six attempts.
|
||||
|
||||
An earlier configuration preflight rejected the packet tool under Codex's
|
||||
`approval_policy: never`: 36,651 input tokens, 549 output tokens, 21.603 seconds,
|
||||
one rejected call and no packet observations. The experiment runner now explicitly
|
||||
preapproves the two authorized passive packet tools, consistently across all arms.
|
||||
That failed preflight remains separate from the corrected cohort and its cost is
|
||||
reported here; CLI exit zero alone is never a factual or workflow pass.
|
||||
|
||||
## Resource and compatibility scope
|
||||
|
||||
All engine/model workloads use an owned Linux resource scope with one CPU,
|
||||
3 GiB early-stop threshold, 4 GiB hard memory ceiling, no swap and a 192-task cap.
|
||||
Node's heap is additionally limited to 512 MiB. The nineteen non-HTTP SDK trials
|
||||
have a maximum observed payload-exit memory peak of 860,909,568 bytes; the six model
|
||||
attempts peak at 940,806,144 bytes. Payload-exit counters and cleanup were verified
|
||||
with the observer still alive and report no memory-limit/OOM events in that phase.
|
||||
Final whole-scope counters remain unavailable, so no stronger whole-scope claim
|
||||
is made. CPU usage and observed process ownership remain in each private receipt.
|
||||
|
||||
A full PostgreSQL probe with four selected fields and no input prefix exceeds the
|
||||
existing 4 MiB producer-output ceiling even with the default fifty-row window.
|
||||
It correctly fails instead of delivering partial success. The SDK error retains
|
||||
large truncated diagnostics (5,790,979 serialized bytes); this separate product
|
||||
concern is recorded privately for later repair, outside #3130. Paging alone cannot
|
||||
prevent producer expansion. The successful prefix experiment does not prove that
|
||||
the full recording can be inspected with those selections.
|
||||
|
||||
Only experiment sources, corpus provenance, a question template and guidance
|
||||
change. Production schemas, provider limits, CLI/MCP defaults, Evidence identity
|
||||
and session/resource ownership stay as before. Eight parser regressions retain
|
||||
malformed/truncated-input and omission checks. Existing clients need no migration.
|
||||
|
||||
## Reproduction
|
||||
|
||||
Acquire the exact corpus outside the repository and verify the pinned hashes.
|
||||
Use the pinned Node/npm toolchain, locked dependencies, `npm run build:cached` and
|
||||
an external resource guard before invoking actual engines/models. Supply explicit
|
||||
provider settings in a private JSON file. An example SDK arm is:
|
||||
|
||||
```sh
|
||||
node experiments/analysis-efficiency/measure.mjs \
|
||||
--runtime-root /absolute/pinned/runtime --revision PINNED_SHA \
|
||||
--artifact wireshark-pgsql-jdbc.pcap --path /private/pgsql-jdbc.pcap \
|
||||
--providers /private/providers.json --schemas selected \
|
||||
--packet-selection focused --output /private/new-trial
|
||||
```
|
||||
|
||||
Use `baseline`, `focused`, `discovery`, or the PostgreSQL-only `pages` diagnostic.
|
||||
Run `packet-oracle.py postgres PATH` independently and compare `answer.json` facts.
|
||||
Generate each model prompt with `packet-model-prompt.mjs --selection ARM`, then use
|
||||
the existing `agent-trial.py` with those two enabled tools and context capture.
|
||||
Run `review-packet.mjs` against the actual trial, oracle, runtime and selected arm.
|
||||
Its nonzero exit includes a plan failure even when all requested facts are correct.
|
||||
Retain failed attempts, actual usage, digests, coverage, cleanup and resource
|
||||
receipts alongside passing observations. No raw results need to be committed.
|
||||
|
||||
## Review verification
|
||||
|
||||
The comparator now recognizes the three non-HTTP questions: observations remain
|
||||
attached to each run, while different plans compare requested facts. Repeated
|
||||
identical plans still compare stable observation scope. Capture grading authenticates
|
||||
Evidence against the actual call and assesses plan differences separately; an
|
||||
actual 24-row SDK window replay retains a factual pass and a plan failure. This
|
||||
is a grading replay, not an additional model trial. The stricter header oracle
|
||||
preserves all original sample facts and rejects truncated IPv4/TCP options and
|
||||
unsupported Ethernet protocols. The page diagnostic now derives matches 13–24
|
||||
independently before accepting the second page; skipped, reversed and changed-byte
|
||||
pages are rejected. Original cohort measurements retain their recorded source
|
||||
digests and runtime pin; review checks do not relabel them.
|
||||
|
||||
Capture grading keeps authenticated facts by Evidence ID and evaluates the cited
|
||||
observations. Four replays using actual first-page and second-page SDK Evidence
|
||||
verify that later or reordered pages and repeated reads preserve a correct cited
|
||||
answer, while citing only the wrong page fails factual grading. Extra calls still
|
||||
fail the fixed workflow plan. Regrading all six original model records preserves
|
||||
their outcomes and recorded costs; these replays are not new model trials.
|
||||
|
||||
Failed or malformed calls remain workflow failures and never become authenticated
|
||||
Evidence. Nine failure-injection and answer-shape replays using an actual successful
|
||||
capture verify that later recovery preserves supported facts, while failed-only
|
||||
attempts and missing or unobserved citations fail factual grading. Missing
|
||||
limitations and extra answer keys fail the fixed plan without changing correct
|
||||
recorded facts. Successful original-model outcomes remain unchanged.
|
||||
@@ -0,0 +1,40 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { parseArgs } from "node:util";
|
||||
import { packetRequest } from "./packet-entry.mjs";
|
||||
|
||||
const { values } = parseArgs({ options: { selection: { type: "string" } } });
|
||||
if (!["baseline", "focused", "discovery"].includes(values.selection))
|
||||
throw new Error("Select baseline, focused or discovery");
|
||||
const question = await readFile(
|
||||
new URL("./questions/packet-postgres.txt", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const plan = [
|
||||
...(values.selection === "discovery"
|
||||
? [
|
||||
{
|
||||
tool: "inspect_packet_fields",
|
||||
arguments: {
|
||||
kind: "fields",
|
||||
protocol: "tcp",
|
||||
query: "tcp.flags",
|
||||
limit: 1,
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
tool: "inspect_packet_capture",
|
||||
arguments: packetRequest(
|
||||
"wireshark-pgsql-jdbc.pcap",
|
||||
"{{artifact_path}}",
|
||||
values.selection,
|
||||
),
|
||||
},
|
||||
];
|
||||
process.stdout.write(
|
||||
question +
|
||||
"\nExecute this fixed public REA MCP plan in order. These are input selections, not expected answers. Preserve omitted defaults. All calls count toward the comparison.\n" +
|
||||
JSON.stringify(plan, null, 2) +
|
||||
"\n",
|
||||
);
|
||||
@@ -0,0 +1,180 @@
|
||||
"""Independent, narrow oracle for the three pinned Ethernet/IPv4 PCAPs.
|
||||
|
||||
Reads header bytes, not TShark output. No PCAPNG, IP fragmentation or TCP
|
||||
reassembly support is claimed. DNS compression follows RFC 1035; DHCP options
|
||||
53/54 follow RFC 2132. Unsupported selected traffic fails rather than guessing.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import struct
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def require(condition, reason):
|
||||
if not condition:
|
||||
raise ValueError(reason)
|
||||
|
||||
|
||||
def packets(data):
|
||||
require(len(data) >= 24, 'truncated PCAP header')
|
||||
magic = data[:4]
|
||||
require(magic in (b'\xd4\xc3\xb2\xa1', b'\xa1\xb2\xc3\xd4'),
|
||||
'oracle requires microsecond classic PCAP')
|
||||
endian = '<' if magic == b'\xd4\xc3\xb2\xa1' else '>'
|
||||
require(struct.unpack_from(endian + 'HH', data, 4) == (2, 4),
|
||||
'unsupported PCAP version')
|
||||
require(struct.unpack_from(endian + 'I', data, 20)[0] == 1,
|
||||
'oracle requires Ethernet')
|
||||
offset, frame = 24, 0
|
||||
while offset < len(data):
|
||||
require(offset + 16 <= len(data), 'truncated PCAP record header')
|
||||
captured, original = struct.unpack_from(endian + 'II', data, offset + 8)
|
||||
offset += 16
|
||||
require(captured <= original and offset + captured <= len(data),
|
||||
'invalid captured packet length')
|
||||
frame += 1
|
||||
yield frame, data[offset:offset + captured]
|
||||
offset += captured
|
||||
|
||||
|
||||
def transport(packet):
|
||||
require(len(packet) >= 14, 'truncated Ethernet header')
|
||||
if packet[12:14] == b'\x08\x06':
|
||||
return None # ARP cannot contain the selected TCP/UDP messages.
|
||||
require(packet[12:14] == b'\x08\x00', 'unsupported Ethernet protocol')
|
||||
ip = packet[14:]
|
||||
require(len(ip) >= 20 and ip[0] >> 4 == 4, 'invalid IPv4 header')
|
||||
header = (ip[0] & 15) * 4
|
||||
total = struct.unpack_from('!H', ip, 2)[0]
|
||||
require(20 <= header <= len(ip) and total >= header, 'invalid IPv4 lengths')
|
||||
require(total <= len(ip), 'truncated IPv4 packet')
|
||||
require(struct.unpack_from('!H', ip, 6)[0] & 0x3fff == 0,
|
||||
'fragmentation is outside oracle scope')
|
||||
return ip[9], ip[header:min(total, len(ip))]
|
||||
|
||||
|
||||
def dns_name(message, offset):
|
||||
labels, visited, end = [], set(), None
|
||||
while True:
|
||||
require(offset < len(message) and offset not in visited,
|
||||
'invalid DNS name or compression cycle')
|
||||
visited.add(offset)
|
||||
size = message[offset]
|
||||
if size & 0xc0 == 0xc0:
|
||||
require(offset + 1 < len(message), 'truncated DNS compression pointer')
|
||||
if end is None:
|
||||
end = offset + 2
|
||||
offset = ((size & 0x3f) << 8) | message[offset + 1]
|
||||
continue
|
||||
require(size & 0xc0 == 0 and offset + 1 + size <= len(message),
|
||||
'invalid DNS label')
|
||||
offset += 1
|
||||
if size == 0:
|
||||
return '.'.join(labels), end if end is not None else offset
|
||||
labels.append(message[offset:offset + size].decode('ascii'))
|
||||
require(sum(len(label) + 1 for label in labels) <= 255,
|
||||
'DNS name exceeds protocol length')
|
||||
offset += size
|
||||
|
||||
|
||||
def dhcp_options(payload):
|
||||
require(len(payload) >= 240 and payload[236:240] == b'\x63\x82\x53\x63',
|
||||
'invalid DHCP fixed header or cookie')
|
||||
options, offset = {}, 240
|
||||
while offset < len(payload):
|
||||
kind = payload[offset]
|
||||
offset += 1
|
||||
if kind == 255:
|
||||
return options
|
||||
if kind == 0:
|
||||
continue
|
||||
require(offset < len(payload), 'missing DHCP option length')
|
||||
size = payload[offset]
|
||||
offset += 1
|
||||
require(offset + size <= len(payload), 'truncated DHCP option')
|
||||
require(kind not in options, 'duplicate DHCP options outside oracle scope')
|
||||
options[kind] = payload[offset:offset + size]
|
||||
offset += size
|
||||
raise ValueError('DHCP end option missing')
|
||||
|
||||
|
||||
def analyze(data, kind, row_limit=12):
|
||||
rows, matching, count = [], 0, 0
|
||||
for frame, packet in packets(data):
|
||||
count = frame
|
||||
decoded = transport(packet)
|
||||
if decoded is None:
|
||||
continue
|
||||
protocol, segment = decoded
|
||||
if kind == 'postgres' and protocol == 6 and frame <= 2000:
|
||||
require(len(segment) >= 20, 'truncated TCP header')
|
||||
tcp_header = (segment[12] >> 4) * 4
|
||||
require(20 <= tcp_header <= len(segment), 'invalid or truncated TCP header/options')
|
||||
source, destination = struct.unpack_from('!HH', segment)
|
||||
if 5432 not in (source, destination):
|
||||
continue
|
||||
matching += 1
|
||||
if len(rows) < row_limit:
|
||||
rows.append({'frame': frame, 'source_port': source,
|
||||
'destination_port': destination,
|
||||
'flags': struct.unpack_from('!H', segment, 12)[0] & 0xfff})
|
||||
elif kind in ('dns', 'dhcp') and protocol == 17:
|
||||
require(len(segment) >= 8, 'truncated UDP header')
|
||||
source, destination, length = struct.unpack_from('!HHH', segment)
|
||||
selected = 53 in (source, destination) if kind == 'dns' else (
|
||||
source, destination) in ((67, 68), (68, 67))
|
||||
if not selected:
|
||||
continue
|
||||
require(8 <= length <= len(segment), 'truncated selected UDP message')
|
||||
payload = segment[8:length]
|
||||
if kind == 'dns':
|
||||
require(len(payload) >= 12, 'truncated DNS header')
|
||||
identifier, flags, questions = struct.unpack_from('!HHH', payload)
|
||||
if not flags & 0x8000 or flags & 15 == 0:
|
||||
continue
|
||||
matching += 1
|
||||
offset, names, types = 12, [], []
|
||||
for _ in range(questions):
|
||||
name, offset = dns_name(payload, offset)
|
||||
require(offset + 4 <= len(payload), 'truncated DNS question')
|
||||
types.append(struct.unpack_from('!H', payload, offset)[0])
|
||||
names.append(name)
|
||||
offset += 4
|
||||
rows.append({'frame': frame, 'id': identifier, 'rcode': flags & 15,
|
||||
'names': names, 'types': types})
|
||||
else:
|
||||
options = dhcp_options(payload)
|
||||
require(53 in options and len(options[53]) == 1,
|
||||
'missing DHCP message type')
|
||||
server = options.get(54)
|
||||
require(server is None or len(server) == 4, 'invalid DHCP server ID')
|
||||
require(52 not in options, 'DHCP overload outside oracle scope')
|
||||
matching += 1
|
||||
row = {'frame': frame, 'id': struct.unpack_from('!I', payload, 4)[0],
|
||||
'message_type': options[53][0],
|
||||
'your_address': '.'.join(map(str, payload[16:20]))}
|
||||
if server is not None:
|
||||
row['server_identifier'] = '.'.join(map(str, server))
|
||||
rows.append(row)
|
||||
return {'kind': kind, 'capture_frames': count, 'matching_packets': matching,
|
||||
'question_input_frames': min(2000, count) if kind == 'postgres' else count,
|
||||
'rows': rows, 'scope': 'selected recorded headers; no network completeness claim'}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('kind', choices=['postgres', 'dns', 'dhcp'])
|
||||
parser.add_argument('path', type=Path)
|
||||
parser.add_argument('--row-limit', type=int, choices=[12, 24], default=12,
|
||||
help='PostgreSQL rows; 24 independently checks the second page')
|
||||
args = parser.parse_args()
|
||||
with args.path.open('rb') as source:
|
||||
data = source.read(32 * 1024 * 1024 + 1)
|
||||
require(len(data) <= 32 * 1024 * 1024, 'oracle input budget exceeded')
|
||||
print(json.dumps({'sha256': hashlib.sha256(data).hexdigest(),
|
||||
**analyze(data, args.kind, args.row_limit)}, indent=2))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,3 @@
|
||||
Inspect the selected saved PostgreSQL capture {{artifact_path}} with REA. Within original capture frames 1 through 2000, return the first 12 TCP packets with source or destination port 5432 in original frame order. For each return integer frame, source_port, destination_port and flags (the numeric TCP flags word, not prose). Also report the matching packet count within this 2000-frame question scope.
|
||||
|
||||
Do not claim whole-capture or network completeness. Return a single JSON object with exactly kind ("postgres"), matching_packets, rows, evidence_ids and limitations. Use actual successful REA Evidence IDs. Include a concise limitation explaining the recorded input scope; no extra claims or tool calls are needed.
|
||||
@@ -0,0 +1,247 @@
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { isDeepStrictEqual, parseArgs } from "node:util";
|
||||
import { packetFacts, packetRequest } from "./packet-entry.mjs";
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
trial: { type: "string" },
|
||||
oracle: { type: "string" },
|
||||
"runtime-root": { type: "string" },
|
||||
selection: { type: "string" },
|
||||
},
|
||||
});
|
||||
if (
|
||||
!values.trial ||
|
||||
!values.oracle ||
|
||||
!values["runtime-root"] ||
|
||||
!["baseline", "focused", "discovery"].includes(values.selection)
|
||||
)
|
||||
throw new Error(
|
||||
"Use --trial DIR --oracle JSON --runtime-root DIR --selection baseline|focused|discovery",
|
||||
);
|
||||
|
||||
const root = values["runtime-root"];
|
||||
const { parseEvidence } = await import(
|
||||
pathToFileURL(resolve(root, "dist/domain/evidence.js")).href
|
||||
);
|
||||
const { inspectPacketCaptureInputSchema, packetCaptureSchema } = await import(
|
||||
pathToFileURL(resolve(root, "dist/domain/captures/packetCapture.js")).href
|
||||
);
|
||||
const { inspectPacketFieldsInputSchema, packetFieldsCatalogSchema } =
|
||||
await import(
|
||||
pathToFileURL(resolve(root, "dist/domain/captures/packetFields.js")).href
|
||||
);
|
||||
const oracle = JSON.parse(await readFile(values.oracle, "utf8"));
|
||||
const settings = JSON.parse(
|
||||
await readFile(resolve(values.trial, "trial-settings.json"), "utf8"),
|
||||
);
|
||||
const summary = JSON.parse(
|
||||
await readFile(resolve(values.trial, "summary.json"), "utf8"),
|
||||
);
|
||||
const expected = Object.fromEntries(
|
||||
["kind", "matching_packets", "rows"].map((key) => [key, oracle[key]]),
|
||||
);
|
||||
const calls = (await readFile(resolve(values.trial, "events.jsonl"), "utf8"))
|
||||
.split("\n")
|
||||
.filter(Boolean)
|
||||
.map(JSON.parse)
|
||||
.filter(
|
||||
(event) =>
|
||||
event.type === "item.completed" && event.item?.type === "mcp_tool_call",
|
||||
)
|
||||
.map((event) => event.item);
|
||||
const reasons = [];
|
||||
const workflowReasons = [];
|
||||
let answer;
|
||||
const captures = new Map();
|
||||
try {
|
||||
if (oracle.kind !== "postgres")
|
||||
throw new Error("This model rubric is the fixed PostgreSQL question only");
|
||||
const expectedCalls =
|
||||
values.selection === "discovery"
|
||||
? ["inspect_packet_fields", "inspect_packet_capture"]
|
||||
: ["inspect_packet_capture"];
|
||||
if (
|
||||
!isDeepStrictEqual(
|
||||
calls.map((call) => call.tool),
|
||||
expectedCalls,
|
||||
) ||
|
||||
calls.some(
|
||||
(call) =>
|
||||
call.server !== "rea" || call.status !== "completed" || call.error,
|
||||
)
|
||||
)
|
||||
workflowReasons.push(
|
||||
"Completed public REA call sequence differs from the fixed plan",
|
||||
);
|
||||
const ids = new Set();
|
||||
const conflictingIds = new Set();
|
||||
for (const call of calls) {
|
||||
if (call.server !== "rea" || call.status !== "completed" || call.error)
|
||||
continue;
|
||||
try {
|
||||
const result = call.result;
|
||||
if (result?.isError)
|
||||
throw new Error("Tool failure is not observed packet evidence");
|
||||
const text =
|
||||
result?.content?.filter((item) => item.type === "text") ?? [];
|
||||
if (!result?.structuredContent && text.length !== 1)
|
||||
throw new Error("No unambiguous captured Evidence envelope");
|
||||
const evidence = result.structuredContent ?? JSON.parse(text[0].text);
|
||||
parseEvidence(evidence);
|
||||
if (conflictingIds.has(evidence.evidence_id))
|
||||
throw new Error("Previously conflicting Evidence identity");
|
||||
if (call.tool === "inspect_packet_fields") {
|
||||
const input = inspectPacketFieldsInputSchema.parse({
|
||||
kind: "fields",
|
||||
protocol: "tcp",
|
||||
query: "tcp.flags",
|
||||
limit: 1,
|
||||
});
|
||||
const report = packetFieldsCatalogSchema.parse(
|
||||
evidence.normalized_result,
|
||||
);
|
||||
if (
|
||||
!isDeepStrictEqual(
|
||||
inspectPacketFieldsInputSchema.parse(call.arguments),
|
||||
input,
|
||||
) ||
|
||||
!isDeepStrictEqual(evidence.parameters, input) ||
|
||||
!isDeepStrictEqual(report.selection, input) ||
|
||||
evidence.operation !== call.tool ||
|
||||
!report.records.some((row) => row.abbreviation === "tcp.flags") ||
|
||||
evidence.subject?.local_path !== report.tool.path ||
|
||||
evidence.subject?.digest?.sha256 !== report.tool.sha256
|
||||
)
|
||||
throw new Error(
|
||||
"Discovery Evidence does not establish the requested installed field",
|
||||
);
|
||||
} else if (call.tool === "inspect_packet_capture") {
|
||||
const planned = inspectPacketCaptureInputSchema.parse(
|
||||
packetRequest(
|
||||
"wireshark-pgsql-jdbc.pcap",
|
||||
settings.selected_artifact_path,
|
||||
values.selection,
|
||||
),
|
||||
);
|
||||
const input = inspectPacketCaptureInputSchema.parse(call.arguments);
|
||||
if (!isDeepStrictEqual(input, planned))
|
||||
workflowReasons.push("Capture selection differs from the fixed plan");
|
||||
const report = packetCaptureSchema.parse(evidence.normalized_result);
|
||||
if (
|
||||
!isDeepStrictEqual(evidence.parameters, input) ||
|
||||
!isDeepStrictEqual(report.selection, input) ||
|
||||
evidence.operation !== call.tool ||
|
||||
evidence.subject?.local_path !== input.path ||
|
||||
evidence.subject?.digest?.sha256 !== oracle.sha256 ||
|
||||
report.artifact.path !== input.path ||
|
||||
report.artifact.sha256 !== oracle.sha256
|
||||
)
|
||||
throw new Error(
|
||||
"Capture Evidence differs from the fixed input/byte identity",
|
||||
);
|
||||
const observed = packetFacts("postgres", report);
|
||||
if (
|
||||
captures.has(evidence.evidence_id) &&
|
||||
!isDeepStrictEqual(captures.get(evidence.evidence_id), observed)
|
||||
) {
|
||||
captures.delete(evidence.evidence_id);
|
||||
ids.delete(evidence.evidence_id);
|
||||
conflictingIds.add(evidence.evidence_id);
|
||||
throw new Error("Repeated Evidence identity has inconsistent facts");
|
||||
}
|
||||
captures.set(evidence.evidence_id, observed);
|
||||
} else {
|
||||
throw new Error("Call is not a packet observation tool");
|
||||
}
|
||||
ids.add(evidence.evidence_id);
|
||||
} catch (error) {
|
||||
workflowReasons.push(
|
||||
`Call ${call.tool} did not provide authenticated packet observations: ${String(error)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
answer = JSON.parse(
|
||||
(await readFile(resolve(values.trial, "answer.txt"), "utf8")).trim(),
|
||||
);
|
||||
if (
|
||||
!isDeepStrictEqual(
|
||||
Object.keys(answer).sort(),
|
||||
[
|
||||
"kind",
|
||||
"matching_packets",
|
||||
"rows",
|
||||
"evidence_ids",
|
||||
"limitations",
|
||||
].sort(),
|
||||
)
|
||||
)
|
||||
workflowReasons.push("Final answer shape differs from the fixed plan");
|
||||
if (
|
||||
!isDeepStrictEqual(
|
||||
Object.fromEntries(
|
||||
Object.keys(expected).map((key) => [key, answer[key]]),
|
||||
),
|
||||
expected,
|
||||
)
|
||||
)
|
||||
throw new Error("Final answer is not the exact requested recorded facts");
|
||||
if (
|
||||
!Array.isArray(answer.evidence_ids) ||
|
||||
answer.evidence_ids.some((id) => !ids.has(id)) ||
|
||||
new Set(answer.evidence_ids).size !== answer.evidence_ids.length
|
||||
)
|
||||
throw new Error("Final citations lack the authenticated packet Evidence");
|
||||
const supportingFacts = answer.evidence_ids
|
||||
.map((id) => captures.get(id))
|
||||
.find((observed) => isDeepStrictEqual(observed, expected));
|
||||
if (!supportingFacts)
|
||||
throw new Error(
|
||||
"Cited observations differ from independent raw header oracle",
|
||||
);
|
||||
const limitations =
|
||||
typeof answer.limitations === "string"
|
||||
? [answer.limitations]
|
||||
: answer.limitations;
|
||||
if (
|
||||
!Array.isArray(limitations) ||
|
||||
limitations.length === 0 ||
|
||||
limitations.some((item) => typeof item !== "string" || !item.trim())
|
||||
)
|
||||
workflowReasons.push("Final answer omits investigation limitations");
|
||||
if (
|
||||
summary.exit_code !== 0 ||
|
||||
summary.timeout ||
|
||||
summary.selected_artifact_bytes_unchanged !== true ||
|
||||
settings.selected_artifact_sha256_before !== oracle.sha256 ||
|
||||
summary.selected_artifact_sha256_after !== oracle.sha256
|
||||
)
|
||||
workflowReasons.push(
|
||||
"Trial did not complete with the selected artifact unchanged",
|
||||
);
|
||||
} catch (error) {
|
||||
reasons.push(String(error));
|
||||
}
|
||||
const review = {
|
||||
factual_correctness: reasons.length ? "failed" : "passed",
|
||||
scope:
|
||||
"Fixed first-2000-frame PostgreSQL question; authenticated tool observations and independent raw header oracle",
|
||||
workflow_correctness:
|
||||
reasons.length || workflowReasons.length ? "failed" : "passed",
|
||||
reasons,
|
||||
workflow_reasons: workflowReasons,
|
||||
completed_calls: calls.length,
|
||||
wall_seconds: summary.wall_seconds,
|
||||
usage: summary.usage,
|
||||
selected_artifact_sha256: oracle.sha256,
|
||||
limitation_prose:
|
||||
"Presence checked; wording requires transcript review, not heuristic factual certification",
|
||||
};
|
||||
await writeFile(
|
||||
resolve(values.trial, "packet-review.json"),
|
||||
JSON.stringify(review, null, 2) + "\n",
|
||||
);
|
||||
console.log(JSON.stringify(review));
|
||||
if (reasons.length || workflowReasons.length) process.exitCode = 1;
|
||||
@@ -0,0 +1,266 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { isDeepStrictEqual, parseArgs } from "node:util";
|
||||
import {
|
||||
sazRequest,
|
||||
verifySazRecords,
|
||||
verifySazOracleIdentity,
|
||||
sazEvidenceParameters,
|
||||
} from "./saz-entry.mjs";
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
trial: { type: "string" },
|
||||
oracle: { type: "string" },
|
||||
"runtime-root": { type: "string" },
|
||||
artifact: { type: "string" },
|
||||
selection: { type: "string" },
|
||||
},
|
||||
});
|
||||
if (
|
||||
!values.trial ||
|
||||
!values.oracle ||
|
||||
!values["runtime-root"] ||
|
||||
!["baseline", "focused"].includes(values.selection)
|
||||
)
|
||||
throw new Error(
|
||||
"Use --trial DIR --oracle JSON --runtime-root DIR --artifact ID --selection baseline|focused",
|
||||
);
|
||||
const load = async (file) =>
|
||||
JSON.parse(await readFile(resolve(values.trial, file), "utf8"));
|
||||
const settings = await load("trial-settings.json"),
|
||||
summary = await load("summary.json");
|
||||
const oracle = JSON.parse(await readFile(values.oracle, "utf8"));
|
||||
verifySazOracleIdentity(values.artifact, oracle);
|
||||
const runtime = (file) =>
|
||||
pathToFileURL(resolve(values["runtime-root"], file)).href;
|
||||
const { parseEvidence } = await import(runtime("dist/domain/evidence.js"));
|
||||
const { inspectWebNetworkCaptureInputSchema, webNetworkCaptureSchema } =
|
||||
await import(runtime("dist/domain/webNetworkCapture.js"));
|
||||
const { inspectAnalysisViewInputSchema, analysisViewResultSchema } =
|
||||
await import(runtime("dist/domain/analysisView/analysisView.js"));
|
||||
const calls = (await readFile(resolve(values.trial, "events.jsonl"), "utf8"))
|
||||
.split("\n")
|
||||
.filter(Boolean)
|
||||
.map(JSON.parse)
|
||||
.filter(
|
||||
(event) =>
|
||||
event.type === "item.completed" && event.item?.type === "mcp_tool_call",
|
||||
)
|
||||
.map((event) => event.item);
|
||||
const planned = inspectWebNetworkCaptureInputSchema.parse(
|
||||
sazRequest(
|
||||
values.artifact,
|
||||
settings.selected_artifact_path,
|
||||
values.selection,
|
||||
),
|
||||
);
|
||||
const reasons = [],
|
||||
workflowReasons = [],
|
||||
authenticated = new Map(),
|
||||
parents = new Set(),
|
||||
conflicts = new Set();
|
||||
let transportRecovery = false;
|
||||
for (const call of calls) {
|
||||
try {
|
||||
assert.equal(call.server, "rea");
|
||||
assert.equal(call.status, "completed");
|
||||
assert.ok(!call.error, "RPC did not provide observations");
|
||||
const text = call.result.content.filter((item) => item.type === "text");
|
||||
assert.equal(text.length, 1, "Ambiguous Evidence text carrier");
|
||||
let evidence = JSON.parse(text[0].text);
|
||||
if (call.result.isError) {
|
||||
const limits = evidence.error?.details?.reported_limits;
|
||||
assert.equal(call.tool, "inspect_web_network_capture");
|
||||
assert.equal(evidence.error?.code, "resource_constraint");
|
||||
assert.equal(
|
||||
evidence.error.details.operation,
|
||||
"inspect_web_network_capture",
|
||||
);
|
||||
assert.equal(limits?.boundary, "mcp-response");
|
||||
const input = inspectWebNetworkCaptureInputSchema.parse(call.arguments);
|
||||
assert.deepEqual(input, planned);
|
||||
const source = inspectAnalysisViewInputSchema.parse({
|
||||
source: limits.evidence_reference,
|
||||
view: { kind: "summary" },
|
||||
}).source;
|
||||
assert.equal(source.kind, "retained-evidence");
|
||||
parents.add(source.evidence_id);
|
||||
transportRecovery = true;
|
||||
continue;
|
||||
}
|
||||
if (call.result.structuredContent !== undefined)
|
||||
assert.deepEqual(evidence, call.result.structuredContent);
|
||||
evidence = parseEvidence(evidence);
|
||||
assert.equal(evidence.subject.local_path, settings.selected_artifact_path);
|
||||
assert.equal(evidence.subject.digest.sha256, oracle.sha256);
|
||||
let records;
|
||||
if (call.tool === "inspect_web_network_capture") {
|
||||
const { detail, ...arguments_ } = call.arguments;
|
||||
const input = inspectWebNetworkCaptureInputSchema.parse(arguments_);
|
||||
assert.equal(input.capture_path, settings.selected_artifact_path);
|
||||
assert.equal(input.format, "saz");
|
||||
if (!isDeepStrictEqual(input, planned))
|
||||
workflowReasons.push(
|
||||
"Inspection selection differs from planned arguments",
|
||||
);
|
||||
if (detail === "summary") {
|
||||
workflowReasons.push(
|
||||
"Summary delivery differs from the fixed complete-delivery plan",
|
||||
);
|
||||
assert.equal(evidence.operation, "inspect_analysis_view");
|
||||
const report = analysisViewResultSchema.parse(
|
||||
evidence.normalized_result,
|
||||
);
|
||||
assert.equal(report.kind, "summary");
|
||||
assert.equal(report.parent_operation, "inspect_web_network_capture");
|
||||
assert.equal(report.summary.format, "saz");
|
||||
assert.equal(report.summary.total_records, oracle.total_records);
|
||||
assert.deepEqual(evidence.parameters, {
|
||||
parent_evidence_id: report.parent_evidence_id,
|
||||
view: { kind: "summary" },
|
||||
});
|
||||
parents.add(report.parent_evidence_id);
|
||||
authenticated.set(evidence.evidence_id, []);
|
||||
continue;
|
||||
}
|
||||
assert.ok(detail === undefined || detail === "complete");
|
||||
assert.equal(evidence.operation, "inspect_web_network_capture");
|
||||
assert.deepEqual(
|
||||
evidence.parameters,
|
||||
sazEvidenceParameters(input, oracle.total_records),
|
||||
);
|
||||
const report = webNetworkCaptureSchema.parse(evidence.normalized_result);
|
||||
assert.equal(report.total_records, oracle.total_records);
|
||||
assert.equal(report.format, "saz");
|
||||
records = report.records;
|
||||
parents.add(evidence.evidence_id);
|
||||
} else {
|
||||
assert.equal(call.tool, "inspect_analysis_view");
|
||||
const input = inspectAnalysisViewInputSchema.parse(call.arguments);
|
||||
assert.equal(input.source.kind, "retained-evidence");
|
||||
assert.ok(
|
||||
parents.has(input.source.evidence_id),
|
||||
"Unknown retained parent",
|
||||
);
|
||||
assert.equal(evidence.operation, "inspect_analysis_view");
|
||||
assert.deepEqual(evidence.parameters, {
|
||||
parent_evidence_id: input.source.evidence_id,
|
||||
view: input.view,
|
||||
});
|
||||
const page = analysisViewResultSchema.parse(evidence.normalized_result);
|
||||
assert.deepEqual(page.view, input.view);
|
||||
assert.equal(page.parent_evidence_id, input.source.evidence_id);
|
||||
assert.equal(page.parent_operation, "inspect_web_network_capture");
|
||||
if (page.kind === "summary") {
|
||||
assert.equal(page.summary.total_records, oracle.total_records);
|
||||
assert.equal(page.summary.format, "saz");
|
||||
records = [];
|
||||
} else {
|
||||
assert.equal(page.kind, "capture");
|
||||
records = page.view.detail === "complete" ? page.items : [];
|
||||
}
|
||||
}
|
||||
const prior = authenticated.get(evidence.evidence_id);
|
||||
if (prior && !isDeepStrictEqual(prior, records)) {
|
||||
conflicts.add(evidence.evidence_id);
|
||||
authenticated.delete(evidence.evidence_id);
|
||||
parents.delete(evidence.evidence_id);
|
||||
throw new Error("Conflicting observations share an Evidence ID");
|
||||
}
|
||||
if (!conflicts.has(evidence.evidence_id))
|
||||
authenticated.set(evidence.evidence_id, records);
|
||||
} catch (cause) {
|
||||
workflowReasons.push(String(cause));
|
||||
}
|
||||
}
|
||||
if (
|
||||
calls[0]?.tool !== "inspect_web_network_capture" ||
|
||||
calls.filter((call) => call.tool === "inspect_web_network_capture").length !==
|
||||
1 ||
|
||||
(!transportRecovery && calls.length !== 1)
|
||||
)
|
||||
workflowReasons.push(
|
||||
"Completed call sequence differs from the fixed initial call/recovery plan",
|
||||
);
|
||||
try {
|
||||
const raw = (await readFile(resolve(values.trial, "answer.txt"), "utf8"))
|
||||
.trim()
|
||||
.replace(/^```(?:json)?\s*|\s*```$/g, "");
|
||||
const answer = JSON.parse(raw);
|
||||
assert.ok(
|
||||
Array.isArray(answer.evidence_ids) && answer.evidence_ids.length > 0,
|
||||
"Missing Evidence citations",
|
||||
);
|
||||
const observed = new Map();
|
||||
for (const id of answer.evidence_ids) {
|
||||
assert.ok(authenticated.has(id), "Unknown/failed cited Evidence");
|
||||
for (const row of authenticated.get(id)) {
|
||||
const prior = observed.get(row.ordinal);
|
||||
assert.ok(
|
||||
!prior || isDeepStrictEqual(prior, row),
|
||||
"Conflicting cited record identities",
|
||||
);
|
||||
observed.set(row.ordinal, row);
|
||||
}
|
||||
}
|
||||
const facts = verifySazRecords(
|
||||
oracle.record_ordinals.map((ordinal) => observed.get(ordinal)),
|
||||
oracle,
|
||||
);
|
||||
assert.equal(answer.records.length, facts.length, "Answer coverage differs");
|
||||
assert.deepEqual(
|
||||
[...answer.records].sort((a, b) => a.ordinal - b.ordinal),
|
||||
[...facts].sort((a, b) => a.ordinal - b.ordinal),
|
||||
"Answer facts differ from cited stored bytes",
|
||||
);
|
||||
if (
|
||||
!isDeepStrictEqual(
|
||||
answer.records.map((row) => row.ordinal),
|
||||
oracle.record_ordinals,
|
||||
)
|
||||
)
|
||||
workflowReasons.push("Final answer changes caller-selected order");
|
||||
if (
|
||||
!Array.isArray(answer.limitations) ||
|
||||
answer.limitations.length === 0 ||
|
||||
answer.limitations.some(
|
||||
(value) => typeof value !== "string" || !value.trim(),
|
||||
)
|
||||
)
|
||||
workflowReasons.push("Final answer omits limitations");
|
||||
assert.equal(settings.selected_artifact_sha256_before, oracle.sha256);
|
||||
assert.equal(summary.selected_artifact_sha256_after, oracle.sha256);
|
||||
if (
|
||||
summary.exit_code !== 0 ||
|
||||
summary.timeout ||
|
||||
summary.selected_artifact_bytes_unchanged !== true
|
||||
)
|
||||
workflowReasons.push(
|
||||
"Trial did not complete with original bytes unchanged",
|
||||
);
|
||||
} catch (cause) {
|
||||
reasons.push(String(cause));
|
||||
}
|
||||
const report = {
|
||||
factual_correctness: reasons.length ? "failed" : "passed",
|
||||
workflow_correctness:
|
||||
reasons.length || workflowReasons.length ? "failed" : "passed",
|
||||
reasons,
|
||||
workflow_reasons: workflowReasons,
|
||||
completed_calls: calls.length,
|
||||
wall_seconds: summary.wall_seconds,
|
||||
usage: summary.usage,
|
||||
selected_artifact_sha256: oracle.sha256,
|
||||
scope:
|
||||
"Authenticated cited stored HTTP records and independent raw-byte checks; no live attribution, body decompression or certificate interpretation",
|
||||
limitation_prose: "Presence checked; wording requires transcript review",
|
||||
};
|
||||
await writeFile(
|
||||
resolve(values.trial, "saz-review.json"),
|
||||
JSON.stringify(report, null, 2) + "\n",
|
||||
);
|
||||
console.log(JSON.stringify(report));
|
||||
if (report.workflow_correctness !== "passed") process.exitCode = 1;
|
||||
@@ -0,0 +1,237 @@
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { isDeepStrictEqual, parseArgs } from "node:util";
|
||||
import {
|
||||
SIGNAL_ARTIFACTS,
|
||||
signalRequest,
|
||||
signalDataRows,
|
||||
signalFacts,
|
||||
verifySignalRows,
|
||||
verifySignalOracleIdentity,
|
||||
} from "./signal-entry.mjs";
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
trial: { type: "string" },
|
||||
oracle: { type: "string" },
|
||||
"runtime-root": { type: "string" },
|
||||
artifact: { type: "string" },
|
||||
selection: { type: "string" },
|
||||
},
|
||||
});
|
||||
if (
|
||||
!values.trial ||
|
||||
!values.oracle ||
|
||||
!values["runtime-root"] ||
|
||||
!Object.hasOwn(SIGNAL_ARTIFACTS, values.artifact ?? "") ||
|
||||
!["baseline", "focused"].includes(values.selection)
|
||||
)
|
||||
throw new Error(
|
||||
"Use --trial DIR --oracle JSON --runtime-root DIR --artifact ID --selection baseline|focused",
|
||||
);
|
||||
const json = async (name) =>
|
||||
JSON.parse(await readFile(resolve(values.trial, name), "utf8"));
|
||||
const settings = await json("trial-settings.json"),
|
||||
summary = await json("summary.json");
|
||||
const oracle = JSON.parse(await readFile(values.oracle, "utf8"));
|
||||
const kind = SIGNAL_ARTIFACTS[values.artifact].kind;
|
||||
const expectedRows =
|
||||
kind === "uart"
|
||||
? oracle.rows
|
||||
: oracle.reads.flatMap((read) => read.bytes.slice(1));
|
||||
const expected = signalFacts(kind, expectedRows);
|
||||
const runtime = (file) =>
|
||||
pathToFileURL(resolve(values["runtime-root"], file)).href;
|
||||
const { parseEvidence } = await import(runtime("dist/domain/evidence.js"));
|
||||
const { decodeSignalRecordingInputSchema, signalRecordingSchema } =
|
||||
await import(runtime("dist/domain/signals/signalRecording.js"));
|
||||
const { inspectSignalDecodersInputSchema, signalDecodersSchema } = await import(
|
||||
runtime("dist/domain/signals/signalDecoders.js")
|
||||
);
|
||||
const calls = (await readFile(resolve(values.trial, "events.jsonl"), "utf8"))
|
||||
.split("\n")
|
||||
.filter(Boolean)
|
||||
.map(JSON.parse)
|
||||
.filter(
|
||||
(event) =>
|
||||
event.type === "item.completed" && event.item?.type === "mcp_tool_call",
|
||||
)
|
||||
.map((event) => event.item);
|
||||
const reasons = [],
|
||||
workflowReasons = [],
|
||||
authenticated = new Map(),
|
||||
conflicting = new Set();
|
||||
try {
|
||||
verifySignalOracleIdentity(values.artifact, oracle);
|
||||
if (oracle.kind !== kind)
|
||||
throw new Error("Wrong independent signal question oracle");
|
||||
if (calls.length !== 1 || calls[0]?.tool !== "decode_signal_recording")
|
||||
workflowReasons.push(
|
||||
"Completed public call sequence differs from the fixed single-call plan",
|
||||
);
|
||||
const planned = decodeSignalRecordingInputSchema.parse(
|
||||
signalRequest(
|
||||
values.artifact,
|
||||
settings.selected_artifact_path,
|
||||
values.selection,
|
||||
),
|
||||
);
|
||||
for (const call of calls) {
|
||||
try {
|
||||
if (
|
||||
call.server !== "rea" ||
|
||||
call.status !== "completed" ||
|
||||
call.error ||
|
||||
call.result?.isError
|
||||
)
|
||||
throw new Error("Call did not return successful REA observations");
|
||||
const text =
|
||||
call.result?.content?.filter((item) => item.type === "text") ?? [];
|
||||
if (!call.result?.structuredContent && text.length !== 1)
|
||||
throw new Error("No unambiguous Evidence envelope");
|
||||
const evidence =
|
||||
call.result.structuredContent ?? JSON.parse(text[0].text);
|
||||
parseEvidence(evidence);
|
||||
const capture = call.tool === "decode_signal_recording";
|
||||
if (!capture && call.tool !== "inspect_signal_decoders")
|
||||
throw new Error("Not a signal observation tool");
|
||||
const input = (
|
||||
capture
|
||||
? decodeSignalRecordingInputSchema
|
||||
: inspectSignalDecodersInputSchema
|
||||
).parse(call.arguments);
|
||||
const report = (
|
||||
capture ? signalRecordingSchema : signalDecodersSchema
|
||||
).parse(evidence.normalized_result);
|
||||
if (
|
||||
evidence.operation !== call.tool ||
|
||||
!isDeepStrictEqual(evidence.parameters, input) ||
|
||||
!isDeepStrictEqual(report.selection, input)
|
||||
)
|
||||
throw new Error(
|
||||
"Evidence differs from actual operation or caller choices",
|
||||
);
|
||||
if (
|
||||
capture
|
||||
? evidence.subject?.local_path !== input.path ||
|
||||
evidence.subject?.digest?.sha256 !== oracle.sha256 ||
|
||||
report.artifact.path !== input.path ||
|
||||
report.artifact.sha256 !== oracle.sha256
|
||||
: evidence.subject?.local_path !== report.tool.path ||
|
||||
evidence.subject?.digest?.sha256 !== report.tool.sha256
|
||||
)
|
||||
throw new Error("Evidence identifies different recording/tool bytes");
|
||||
if (capture && !isDeepStrictEqual(input, planned))
|
||||
workflowReasons.push("Capture selection differs from the fixed plan");
|
||||
const observation = {
|
||||
operation: call.tool,
|
||||
input,
|
||||
report,
|
||||
rows: capture ? signalDataRows(kind, report.annotations_text) : null,
|
||||
};
|
||||
const id = evidence.evidence_id;
|
||||
if (conflicting.has(id))
|
||||
throw new Error("Previously conflicting Evidence identity");
|
||||
if (
|
||||
authenticated.has(id) &&
|
||||
!isDeepStrictEqual(authenticated.get(id), observation)
|
||||
) {
|
||||
authenticated.delete(id);
|
||||
conflicting.add(id);
|
||||
throw new Error(
|
||||
"Repeated Evidence identity has inconsistent observations",
|
||||
);
|
||||
}
|
||||
authenticated.set(id, observation);
|
||||
} catch (error) {
|
||||
workflowReasons.push(
|
||||
`Call ${call.tool} did not provide authenticated observations: ${String(error)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
const answer = JSON.parse(
|
||||
(await readFile(resolve(values.trial, "answer.txt"), "utf8")).trim(),
|
||||
);
|
||||
if (
|
||||
!isDeepStrictEqual(
|
||||
Object.keys(answer).sort(),
|
||||
[...Object.keys(expected), "evidence_ids", "limitations"].sort(),
|
||||
)
|
||||
)
|
||||
workflowReasons.push("Final answer shape differs from the fixed plan");
|
||||
if (
|
||||
!isDeepStrictEqual(
|
||||
Object.fromEntries(
|
||||
Object.keys(expected).map((key) => [key, answer[key]]),
|
||||
),
|
||||
expected,
|
||||
)
|
||||
)
|
||||
throw new Error("Final answer differs from independent sample facts");
|
||||
if (
|
||||
!Array.isArray(answer.evidence_ids) ||
|
||||
new Set(answer.evidence_ids).size !== answer.evidence_ids.length ||
|
||||
answer.evidence_ids.some((id) => !authenticated.has(id))
|
||||
)
|
||||
throw new Error(
|
||||
"Final citations are not authenticated signal observations",
|
||||
);
|
||||
const rows = new Map();
|
||||
for (const id of answer.evidence_ids) {
|
||||
for (const row of authenticated.get(id).rows ?? []) {
|
||||
const old = rows.get(row.start);
|
||||
if (old && !isDeepStrictEqual(old, row))
|
||||
throw new Error("Cited sample ranges have conflicting decoded data");
|
||||
rows.set(row.start, row);
|
||||
}
|
||||
}
|
||||
verifySignalRows(
|
||||
kind,
|
||||
[...rows.values()].sort((a, b) => a.start - b.start),
|
||||
oracle,
|
||||
oracle.sha256,
|
||||
);
|
||||
const limitations =
|
||||
typeof answer.limitations === "string"
|
||||
? [answer.limitations]
|
||||
: answer.limitations;
|
||||
if (
|
||||
!Array.isArray(limitations) ||
|
||||
limitations.length === 0 ||
|
||||
limitations.some((value) => typeof value !== "string" || !value.trim())
|
||||
)
|
||||
workflowReasons.push("Final answer omits investigation limitations");
|
||||
if (
|
||||
summary.exit_code !== 0 ||
|
||||
summary.timeout ||
|
||||
summary.selected_artifact_bytes_unchanged !== true ||
|
||||
settings.selected_artifact_sha256_before !== oracle.sha256 ||
|
||||
summary.selected_artifact_sha256_after !== oracle.sha256
|
||||
)
|
||||
workflowReasons.push(
|
||||
"Trial did not complete with original selected bytes unchanged",
|
||||
);
|
||||
} catch (error) {
|
||||
reasons.push(String(error));
|
||||
}
|
||||
const report = {
|
||||
factual_correctness: reasons.length ? "failed" : "passed",
|
||||
workflow_correctness:
|
||||
reasons.length || workflowReasons.length ? "failed" : "passed",
|
||||
reasons,
|
||||
workflow_reasons: workflowReasons,
|
||||
completed_calls: calls.length,
|
||||
wall_seconds: summary.wall_seconds,
|
||||
usage: summary.usage,
|
||||
selected_artifact_sha256: oracle.sha256,
|
||||
scope:
|
||||
"Two pinned single-device recordings; independently sampled bytes and authenticated cited decoder observations; hardware behavior is not inferred",
|
||||
limitation_prose: "Presence checked; wording requires transcript review",
|
||||
};
|
||||
await writeFile(
|
||||
resolve(values.trial, "signal-review.json"),
|
||||
JSON.stringify(report, null, 2) + "\n",
|
||||
);
|
||||
console.log(JSON.stringify(report));
|
||||
if (reasons.length || workflowReasons.length) process.exitCode = 1;
|
||||
@@ -0,0 +1,326 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { execFile } from "node:child_process";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
const corpus = JSON.parse(
|
||||
await readFile(new URL("./corpus.json", import.meta.url), "utf8"),
|
||||
);
|
||||
export const SAZ_ARTIFACTS = Object.fromEntries(
|
||||
corpus.artifacts
|
||||
.filter((entry) => entry.saz_question)
|
||||
.map((entry) => [entry.id, entry]),
|
||||
);
|
||||
|
||||
export function sazRequest(artifact, path, selection) {
|
||||
const question = Object.hasOwn(SAZ_ARTIFACTS, artifact)
|
||||
? SAZ_ARTIFACTS[artifact].saz_question
|
||||
: undefined;
|
||||
if (!question) throw new Error("Select a pinned SAZ question");
|
||||
return {
|
||||
capture_path: path,
|
||||
format: "saz",
|
||||
...(selection === "baseline"
|
||||
? {}
|
||||
: { record_ordinals: question.record_ordinals }),
|
||||
sensitive_values: [],
|
||||
};
|
||||
}
|
||||
|
||||
export function verifySazOracleIdentity(artifact, oracle) {
|
||||
assert.ok(
|
||||
Object.hasOwn(SAZ_ARTIFACTS, artifact),
|
||||
"Unknown pinned SAZ question",
|
||||
);
|
||||
const entry = SAZ_ARTIFACTS[artifact];
|
||||
assert.equal(oracle.kind, "saz");
|
||||
assert.equal(oracle.artifact, artifact);
|
||||
assert.equal(oracle.sha256, entry.sha256, "Wrong immutable corpus");
|
||||
assert.equal(oracle.total_records, entry.saz_question.total_records);
|
||||
assert.deepEqual(oracle.record_ordinals, entry.saz_question.record_ordinals);
|
||||
}
|
||||
|
||||
export function sazEvidenceParameters(input, totalRecords) {
|
||||
return {
|
||||
capture_path: input.capture_path,
|
||||
format: input.format,
|
||||
record_ordinals:
|
||||
input.record_ordinals ??
|
||||
Array.from({ length: totalRecords }, (_, index) => index),
|
||||
sensitive_value_count: input.sensitive_values.length,
|
||||
};
|
||||
}
|
||||
|
||||
export function verifySazRecords(records, oracle) {
|
||||
assert.equal(oracle.kind, "saz", "Wrong independent question");
|
||||
assert.equal(
|
||||
records.length,
|
||||
oracle.records.length,
|
||||
"Selected coverage differs",
|
||||
);
|
||||
return records.map((record, index) => {
|
||||
const raw = oracle.records[index];
|
||||
assert.equal(record.ordinal, raw.ordinal, "Caller order/ordinal differs");
|
||||
assert.equal(
|
||||
record.reported.session_id,
|
||||
raw.session_id,
|
||||
"Padded source identity differs",
|
||||
);
|
||||
assert.deepEqual(
|
||||
record.location,
|
||||
{ kind: "archive-members", members: raw.members },
|
||||
"Original member coordinates differ",
|
||||
);
|
||||
for (const side of ["request", "response"]) {
|
||||
const expected = raw[side],
|
||||
reported = record.reported[side];
|
||||
if (expected === null) {
|
||||
assert.equal(reported, null, "Absent message invented");
|
||||
assert.ok(
|
||||
!record.binary_fields.some(
|
||||
(field) => field.pointer === `/${side}/body`,
|
||||
),
|
||||
"Absent body invented",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
assert.equal(reported.member, expected.member);
|
||||
for (const field of side === "request"
|
||||
? ["method", "url", "http_version"]
|
||||
: ["status", "reason", "http_version"])
|
||||
assert.equal(
|
||||
reported[field],
|
||||
expected[field],
|
||||
"Stored HTTP start line differs",
|
||||
);
|
||||
const contentTypes = (headers) =>
|
||||
headers.filter(
|
||||
(header) => header.name.toLowerCase() === "content-type",
|
||||
);
|
||||
assert.deepEqual(
|
||||
contentTypes(reported.headers),
|
||||
contentTypes(expected.headers),
|
||||
"Content-Type order/spelling/values differ",
|
||||
);
|
||||
const bodies = record.binary_fields.filter(
|
||||
(field) => field.pointer === `/${side}/body`,
|
||||
);
|
||||
assert.equal(bodies.length, 1, "Stored body representation differs");
|
||||
const body = bodies[0];
|
||||
assert.equal(body.state, "retained", "Stored body unexpectedly unknown");
|
||||
assert.equal(
|
||||
body.representation,
|
||||
"producer-bytes",
|
||||
"Encoded source representation differs",
|
||||
);
|
||||
for (const field of ["bytes", "sha256", "content_base64"])
|
||||
assert.equal(
|
||||
body[field],
|
||||
expected.body[field],
|
||||
"Stored encoded body bytes differ",
|
||||
);
|
||||
assert.equal(
|
||||
reported.body,
|
||||
expected.body.text,
|
||||
"UTF-8 projection or empty body differs",
|
||||
);
|
||||
}
|
||||
const response = raw.response;
|
||||
return {
|
||||
ordinal: record.ordinal,
|
||||
session_id: raw.session_id,
|
||||
members: raw.members,
|
||||
request:
|
||||
raw.request === null
|
||||
? null
|
||||
: { method: raw.request.method, url: raw.request.url },
|
||||
response:
|
||||
response === null
|
||||
? null
|
||||
: {
|
||||
status: response.status,
|
||||
http_version: response.http_version,
|
||||
content_types: response.headers.filter(
|
||||
(header) => header.name.toLowerCase() === "content-type",
|
||||
),
|
||||
body: {
|
||||
bytes: response.body.bytes,
|
||||
sha256: response.body.sha256,
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export async function measureSazEntry({ values, call, inputSha }) {
|
||||
const runtime = (file) =>
|
||||
pathToFileURL(resolve(values["runtime-root"], file)).href;
|
||||
const { parseEvidence } = await import(runtime("dist/domain/evidence.js"));
|
||||
const { inspectWebNetworkCaptureInputSchema, webNetworkCaptureSchema } =
|
||||
await import(runtime("dist/domain/webNetworkCapture.js"));
|
||||
const { inspectAnalysisViewInputSchema, analysisViewResultSchema } =
|
||||
await import(runtime("dist/domain/analysisView/analysisView.js"));
|
||||
const read = await promisify(execFile)(
|
||||
"python3",
|
||||
[
|
||||
fileURLToPath(new URL("./saz-oracle.py", import.meta.url)),
|
||||
values.artifact,
|
||||
values.path,
|
||||
],
|
||||
{ maxBuffer: 2 * 1024 * 1024, timeout: 30_000 },
|
||||
);
|
||||
const oracle = JSON.parse(read.stdout);
|
||||
verifySazOracleIdentity(values.artifact, oracle);
|
||||
assert.equal(oracle.sha256, inputSha);
|
||||
const input = inspectWebNetworkCaptureInputSchema.parse(
|
||||
sazRequest(values.artifact, values.path, values["saz-selection"]),
|
||||
);
|
||||
const observations = [];
|
||||
const checked = (evidence, schema) => {
|
||||
evidence = parseEvidence(evidence);
|
||||
assert.equal(evidence.subject.local_path, values.path);
|
||||
assert.equal(evidence.subject.digest.sha256, inputSha);
|
||||
const report = schema.parse(evidence.normalized_result);
|
||||
observations.push({
|
||||
evidence_id: evidence.evidence_id,
|
||||
operation: evidence.operation,
|
||||
parameters: evidence.parameters,
|
||||
limitations: evidence.limitations,
|
||||
coverage: report.coverage ?? {
|
||||
total_records: report.total_records,
|
||||
retained_records: report.records.length,
|
||||
},
|
||||
});
|
||||
return report;
|
||||
};
|
||||
const readView = async (source, view) => {
|
||||
const request = inspectAnalysisViewInputSchema.parse({ source, view });
|
||||
const evidence = await call("inspect_analysis_view", request);
|
||||
assert.equal(evidence.operation, "inspect_analysis_view");
|
||||
assert.deepEqual(evidence.parameters, {
|
||||
parent_evidence_id: source.evidence_id,
|
||||
view: request.view,
|
||||
});
|
||||
const result = checked(evidence, analysisViewResultSchema);
|
||||
assert.equal(result.kind, request.view.kind);
|
||||
assert.equal(result.parent_evidence_id, source.evidence_id);
|
||||
assert.equal(result.parent_operation, "inspect_web_network_capture");
|
||||
assert.deepEqual(result.view, request.view);
|
||||
return result;
|
||||
};
|
||||
let records, decoder;
|
||||
if (values["saz-selection"] !== "retained") {
|
||||
let evidence;
|
||||
try {
|
||||
evidence = await call("inspect_web_network_capture", input);
|
||||
} catch (failure) {
|
||||
const error = failure.value?.error;
|
||||
const limits = error?.details?.reported_limits;
|
||||
if (
|
||||
values["saz-selection"] !== "baseline" ||
|
||||
error?.code !== "resource_constraint" ||
|
||||
error.details.operation !== "inspect_web_network_capture" ||
|
||||
limits?.boundary !== "mcp-response" ||
|
||||
!limits.evidence_reference
|
||||
)
|
||||
throw failure;
|
||||
// Recover only the exact retained reference returned by this failed call.
|
||||
// The failed RPC remains in the shared measurement log and task costs.
|
||||
const source = limits.evidence_reference;
|
||||
assert.equal(source.kind, "retained-evidence");
|
||||
const summary = await readView(source, { kind: "summary" });
|
||||
assert.equal(summary.summary.format, "saz");
|
||||
assert.equal(summary.summary.total_records, oracle.total_records);
|
||||
assert.equal(summary.summary.retained_records, oracle.total_records);
|
||||
decoder = summary.summary.decoder;
|
||||
records = [];
|
||||
for (const ordinal of oracle.record_ordinals) {
|
||||
const page = await readView(source, {
|
||||
kind: "capture",
|
||||
detail: "complete",
|
||||
offset: ordinal,
|
||||
limit: 1,
|
||||
});
|
||||
assert.equal(page.coverage.total, oracle.total_records);
|
||||
assert.equal(page.items.length, 1);
|
||||
records.push(page.items[0]);
|
||||
}
|
||||
}
|
||||
if (evidence !== undefined) {
|
||||
assert.equal(evidence.operation, "inspect_web_network_capture");
|
||||
assert.deepEqual(
|
||||
evidence.parameters,
|
||||
sazEvidenceParameters(input, oracle.total_records),
|
||||
);
|
||||
const report = checked(evidence, webNetworkCaptureSchema);
|
||||
assert.equal(report.format, "saz");
|
||||
assert.equal(report.total_records, oracle.total_records);
|
||||
assert.equal(
|
||||
report.records.length,
|
||||
values["saz-selection"] === "baseline"
|
||||
? oracle.total_records
|
||||
: oracle.records.length,
|
||||
);
|
||||
if (values["saz-selection"] === "baseline")
|
||||
assert.deepEqual(
|
||||
report.records.map((record) => record.ordinal),
|
||||
Array.from({ length: oracle.total_records }, (_, index) => index),
|
||||
);
|
||||
records =
|
||||
values["saz-selection"] === "baseline"
|
||||
? oracle.record_ordinals.map((ordinal) =>
|
||||
report.records.find((record) => record.ordinal === ordinal),
|
||||
)
|
||||
: report.records;
|
||||
decoder = report.decoder;
|
||||
}
|
||||
} else {
|
||||
const initial = await call("inspect_web_network_capture", {
|
||||
...input,
|
||||
detail: "summary",
|
||||
});
|
||||
const summary = checked(initial, analysisViewResultSchema);
|
||||
assert.equal(summary.kind, "summary");
|
||||
assert.equal(initial.operation, "inspect_analysis_view");
|
||||
assert.deepEqual(initial.parameters, {
|
||||
parent_evidence_id: summary.parent_evidence_id,
|
||||
view: { kind: "summary" },
|
||||
});
|
||||
assert.equal(summary.summary.format, "saz");
|
||||
assert.equal(summary.parent_operation, "inspect_web_network_capture");
|
||||
assert.equal(summary.summary.total_records, oracle.total_records);
|
||||
assert.equal(summary.summary.retained_records, oracle.records.length);
|
||||
decoder = summary.summary.decoder;
|
||||
const source = {
|
||||
kind: "retained-evidence",
|
||||
evidence_id: summary.parent_evidence_id,
|
||||
};
|
||||
const page = async (detail, offset, limit) => {
|
||||
return readView(source, { kind: "capture", detail, offset, limit });
|
||||
};
|
||||
const preview = await page("preview", 0, 3);
|
||||
assert.deepEqual(
|
||||
preview.items.map((record) => record.ordinal),
|
||||
oracle.record_ordinals,
|
||||
);
|
||||
const first = await page("complete", 0, 2),
|
||||
next = await page("complete", 2, 2),
|
||||
repeated = await page("complete", 0, 2);
|
||||
assert.deepEqual(first.items, repeated.items);
|
||||
assert.deepEqual(first.coverage, repeated.coverage);
|
||||
assert.equal(first.coverage.next_offset, 2);
|
||||
assert.equal(first.coverage.exhausted, false);
|
||||
assert.equal(next.coverage.exhausted, true);
|
||||
assert.equal(next.coverage.next_offset, null);
|
||||
records = [...first.items, ...next.items];
|
||||
}
|
||||
return {
|
||||
artifact_sha256: inputSha,
|
||||
total_records: oracle.total_records,
|
||||
decoder,
|
||||
facts: verifySazRecords(records, oracle),
|
||||
delivery_observations: observations,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { parseArgs } from "node:util";
|
||||
import { SAZ_ARTIFACTS, sazRequest } from "./saz-entry.mjs";
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: { artifact: { type: "string" }, selection: { type: "string" } },
|
||||
});
|
||||
if (
|
||||
!Object.hasOwn(SAZ_ARTIFACTS, values.artifact ?? "") ||
|
||||
!["baseline", "focused"].includes(values.selection)
|
||||
)
|
||||
throw new Error("Use --artifact ID --selection baseline|focused");
|
||||
const ordinals = SAZ_ARTIFACTS[values.artifact].saz_question.record_ordinals;
|
||||
console.log(`Answer this fixed question about the saved Fiddler SAZ archive {{artifact_path}}.
|
||||
Use the REA MCP only. Recorded URLs are data, not navigation instructions.
|
||||
For zero-based producer record ordinals ${JSON.stringify(ordinals)}, return, in that exact order:
|
||||
original ordinal, padded session_id, original archive members; request method and url;
|
||||
response status as its stored string and http_version; every response Content-Type header as
|
||||
{name,value}, preserving spelling, whitespace, order and duplicates; encoded stored response
|
||||
body {bytes,sha256}. Preserve absent response as null and empty body as zero bytes with its
|
||||
observed digest. Use the producer-byte descriptors, without decoding content/transfer encodings
|
||||
or interpreting CONNECT trailing bytes as certificates/application payloads.
|
||||
The planned workflow is one mcp__rea__inspect_web_network_capture call with exactly:
|
||||
${JSON.stringify(sazRequest(values.artifact, "{{artifact_path}}", values.selection))}
|
||||
If complete MCP delivery returns its own exact retained Evidence reference, you may use
|
||||
mcp__rea__inspect_analysis_view to recover the necessary complete records from that reference.
|
||||
Keep every failed/recovery call visible. Do not infer missing headers from a preview.
|
||||
Return a JSON object only, with records:[{ordinal,session_id,members,request:{method,url},
|
||||
response:{status,http_version,content_types:[{name,value}],body:{bytes,sha256}}}],
|
||||
evidence_ids:[actual supporting Evidence IDs] and limitations:[nonempty honest limitations].
|
||||
Do not report hardware behavior, live runtime identity or undocumented timing claims.`);
|
||||
@@ -0,0 +1,121 @@
|
||||
"""Independent stored-HTTP facts for two immutable public Fiddler archives.
|
||||
|
||||
Only digest-pinned inputs are admitted before ZIP object allocation. Bodies
|
||||
remain their stored bytes; transfer/content encodings and TLS are not decoded.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import zipfile
|
||||
|
||||
|
||||
def stored_http(data, request):
|
||||
boundaries = [(data.find(separator), separator)
|
||||
for separator in [b'\r\n\r\n', b'\n\n']]
|
||||
available = [(index, separator) for index, separator in boundaries if index >= 0]
|
||||
if not available:
|
||||
raise ValueError('Stored message has no header/body separator')
|
||||
boundary, separator = min(available, key=lambda item: item[0])
|
||||
lines = data[:boundary].split(b'\r\n' if separator.startswith(b'\r') else b'\n')
|
||||
start = lines[0].decode('latin1')
|
||||
fields = start.split(' ')
|
||||
if request:
|
||||
if len(fields) != 3 or fields[2] not in ['HTTP/1.0', 'HTTP/1.1']:
|
||||
raise ValueError('Unsupported stored request line')
|
||||
result = dict(zip(['method', 'url', 'http_version'], fields))
|
||||
else:
|
||||
fields = start.split(' ', 2)
|
||||
if len(fields) < 2 or fields[0] not in ['HTTP/1.0', 'HTTP/1.1'] or not re.fullmatch(r'[0-9]{3}', fields[1]):
|
||||
raise ValueError('Unsupported stored response line')
|
||||
result = {'http_version': fields[0], 'status': fields[1],
|
||||
'reason': fields[2] if len(fields) == 3 else ''}
|
||||
headers = []
|
||||
newline = '\r\n' if separator.startswith(b'\r') else '\n'
|
||||
for raw in lines[1:]:
|
||||
line = raw.decode('latin1')
|
||||
if line.startswith((' ', '\t')):
|
||||
if not headers:
|
||||
raise ValueError('Header continuation has no owning field')
|
||||
headers[-1]['value'] += newline + line
|
||||
continue
|
||||
name, delimiter, value = line.partition(':')
|
||||
if not delimiter or not name:
|
||||
raise ValueError('Stored header has no field delimiter')
|
||||
headers.append({'name': name, 'value': value})
|
||||
body = data[boundary + len(separator):]
|
||||
try:
|
||||
body_text = body.decode('utf8', errors='strict')
|
||||
except UnicodeDecodeError:
|
||||
body_text = None
|
||||
return result | {'headers': headers, 'body': {
|
||||
'content_base64': base64.b64encode(body).decode('ascii'),
|
||||
'bytes': len(body), 'sha256': hashlib.sha256(body).hexdigest(),
|
||||
'text': body_text,
|
||||
}}
|
||||
|
||||
|
||||
def read_saz(artifact, path):
|
||||
corpus = json.loads(Path(__file__).with_name('corpus.json').read_text())
|
||||
entry = next((item for item in corpus['artifacts']
|
||||
if item['id'] == artifact and 'saz_question' in item), None)
|
||||
if entry is None:
|
||||
raise ValueError('Select a pinned SAZ artifact')
|
||||
# Real source sizes bound the snapshot; size/digest gate ZIP allocation.
|
||||
if path.stat().st_size != entry['bytes']:
|
||||
raise ValueError('Selected file size differs from pinned SAZ corpus')
|
||||
with path.open('rb') as source:
|
||||
data = source.read(entry['bytes'] + 1)
|
||||
digest = hashlib.sha256(data).hexdigest()
|
||||
if len(data) != entry['bytes'] or digest != entry['sha256']:
|
||||
raise ValueError('Selected bytes differ from pinned SAZ corpus')
|
||||
question = entry['saz_question']
|
||||
with zipfile.ZipFile(io.BytesIO(data)) as archive:
|
||||
inventory = archive.infolist()
|
||||
if (len(inventory) != question['members'] or
|
||||
sum(item.file_size for item in inventory) != question['expanded_bytes']):
|
||||
raise ValueError('Pinned directory coverage differs')
|
||||
groups = {}
|
||||
for item in inventory:
|
||||
match = re.fullmatch(r'raw/(\d+)_(c\.txt|s\.txt|m\.xml|w\.txt|g\.txt)', item.filename)
|
||||
if match:
|
||||
groups.setdefault(match[1], []).append(item)
|
||||
if len(groups) != question['total_records']:
|
||||
raise ValueError('Pinned session coverage differs')
|
||||
ordered = list(groups.items())
|
||||
records = []
|
||||
for ordinal in question['record_ordinals']:
|
||||
session_id, members = ordered[ordinal]
|
||||
result = {'ordinal': ordinal, 'session_id': session_id,
|
||||
'members': [item.filename for item in members],
|
||||
'request': None, 'response': None}
|
||||
for item in members:
|
||||
side = 'request' if item.filename.endswith('_c.txt') else 'response' if item.filename.endswith('_s.txt') else None
|
||||
if side is None:
|
||||
continue
|
||||
with archive.open(item) as source:
|
||||
content = source.read(item.file_size + 1)
|
||||
if len(content) != item.file_size:
|
||||
raise ValueError('Stored member size differs')
|
||||
result[side] = {'member': item.filename, **stored_http(content, side == 'request')}
|
||||
records.append(result)
|
||||
with path.open('rb') as source:
|
||||
after = source.read(entry['bytes'] + 1)
|
||||
if hashlib.sha256(after).hexdigest() != digest:
|
||||
raise ValueError('Selected archive changed during independent read')
|
||||
return {'kind': 'saz', 'artifact': artifact, 'sha256': digest,
|
||||
'total_records': len(groups), 'record_ordinals': question['record_ordinals'],
|
||||
'records': records,
|
||||
'scope': 'Stored HTTP bytes and ZIP member coordinates; no body decompression, live attribution or certificate interpretation'}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('artifact')
|
||||
parser.add_argument('path', type=Path)
|
||||
args = parser.parse_args()
|
||||
print(json.dumps(read_saz(args.artifact, args.path)))
|
||||
@@ -0,0 +1,214 @@
|
||||
# Fiddler SAZ selection checkpoint
|
||||
|
||||
This experiment addresses [#3132](https://github.com/morluto/rea/issues/3132).
|
||||
Its runtime baseline is `ca1b2f8608c52ed721d3576ba5eeb1d66717b08c`.
|
||||
Production APIs and defaults are unchanged. The measured cohort establishes no
|
||||
stable whole-task token/time benefit; no new production preset, cache or API is
|
||||
justified by this checkpoint.
|
||||
|
||||
## Genuine public corpus
|
||||
|
||||
Both archives come from Microsoft's
|
||||
[Xbox Live Trace Analyzer](https://github.com/microsoft/xbox-live-trace-analyzer/tree/ad880ff00b26c4cae5e3c8864d3df438a03890ba/Source/TestData/CertWarnings)
|
||||
at immutable revision `ad880ff00b26c4cae5e3c8864d3df438a03890ba`.
|
||||
The repository's [MIT license](https://github.com/microsoft/xbox-live-trace-analyzer/blob/ad880ff00b26c4cae5e3c8864d3df438a03890ba/LICENSE.md)
|
||||
and original source files remain upstream. No sample binaries, raw HTTP material,
|
||||
authentication values, configs or detailed results are committed.
|
||||
|
||||
| Artifact | Archive bytes | Expanded member bytes | Sessions | Members | Producer archive comment |
|
||||
| ------------------------ | ------------: | --------------------: | -------: | ------: | ------------------------ |
|
||||
| `xbox-clear_nomp.saz` | 43,515 | 62,609 | 13 | 42 | Fiddler v4.5.1.2 |
|
||||
| `xbox-clear_mp_cs10.saz` | 5,223,519 | 9,223,820 | 1,311 | 3,939 | Fiddler v4.6.2.0 |
|
||||
|
||||
`corpus.json` pins download URLs, file sizes, SHA-256, Git blob IDs, directory
|
||||
coverage and question ordinals. Downloaded bytes match their Git blob and
|
||||
SHA-256. A third public 103-session archive is pinned as an admission-negative
|
||||
probe, outside completed-question comparisons. Archive comments report their producer
|
||||
versions; no local Fiddler installation or independent producer-version proof
|
||||
is claimed.
|
||||
|
||||
## Fixed analyst question
|
||||
|
||||
Before examining transaction facts, select ordinals `[12, 0, 6]` in the control
|
||||
and `[1310, 0, 655]` in the larger archive. Return that caller-selected order,
|
||||
original padded session IDs and archive-member coordinates, request method/URL,
|
||||
response status/version, all recorded Content-Type pairs in their original
|
||||
spelling/order, and stored response-body byte length/SHA-256.
|
||||
|
||||
Bodies retain their archived encoding. CONNECT trailing bytes are stored data,
|
||||
not an inferred HTTP application body or certificate interpretation. Empty bodies
|
||||
have zero bytes and the empty digest; an absent response remains absent. Header
|
||||
duplication/folding, Latin-1 spelling and binary body bytes are independently
|
||||
read without REA imports. Synthetic reader tests cover those semantics and
|
||||
malformed input; they establish no provider coverage.
|
||||
|
||||
The oracle admits only immutable corpus size/digest matches before constructing
|
||||
ZIP objects, preserves central-directory session/member order, reads selected
|
||||
members with size sentinels and CRC validation, and checks the source digest
|
||||
again. Necessary facts are independently checked for all six selected records.
|
||||
|
||||
```sh
|
||||
python3 experiments/analysis-efficiency/test_saz_oracle.py
|
||||
python3 experiments/analysis-efficiency/saz-oracle.py xbox-clear_nomp.saz /absolute/clear_nomp.saz
|
||||
python3 experiments/analysis-efficiency/saz-oracle.py xbox-clear_mp_cs10.saz /absolute/clear_mp_cs10.saz
|
||||
```
|
||||
|
||||
The baseline build, five oracle regressions and the SDK checker semantics passed
|
||||
on Linux. Real MCP preflight checks verify control retained pages/repeated reads,
|
||||
the large ordinal-selected result, and large complete-workflow recovery. The
|
||||
default large MCP return completes analysis but exceeds the existing 10 MiB stdio
|
||||
receive-buffer budget; its exact returned retained Evidence reference supports
|
||||
summary and complete pages. Recovery preserves the failed RPC and every follow-up
|
||||
call, and matches the independently checked necessary facts from direct selection.
|
||||
This transport limit is not a decoding timeout. Formal repetitions and actual
|
||||
model tasks are reported below; preflight observations are not eligible cost pairs.
|
||||
|
||||
The 103-session `xbox-x49_mp_cs21.saz` candidate contains an empty stored response
|
||||
member `raw/099_s.txt`, lacking an HTTP header/body separator. On this baseline,
|
||||
whole-capture admission fails with `invalid_request` / `invalid_format`. Its
|
||||
ordinals `[102, 0, 51]` were fixed before inspecting its transaction facts. The
|
||||
failed attempt/source member is preserved as a negative probe; no parser repair
|
||||
or successful-task comparison is claimed for that archive.
|
||||
|
||||
Other platform behavior remains unverified.
|
||||
Detailed outputs stay private; missing resource counters remain unknown.
|
||||
|
||||
The large selected CLI workflow also matches independent bytes and MCP facts,
|
||||
parameters and Evidence ID. A separate default complete CLI attempt hit the
|
||||
provider's 30-second timeout under the one-CPU guard; that failed attempt is
|
||||
preserved separately from the successful-analysis MCP receive-buffer failure.
|
||||
It does not prove a general CLI failure or identify an engine-stage cause.
|
||||
|
||||
Ten grading preflight cases cover valid actual Evidence, wrong final digests,
|
||||
unknown citations, missing limitations, answer order, failed calls before/after
|
||||
valid data, semantic-ID corruption and actual large retained recovery. Their
|
||||
answers/events are injected checker tests, not actual model trials. An invalid
|
||||
later duplicate is rejected by the domain's semantic-ID owner and does not erase
|
||||
earlier authenticated observations.
|
||||
|
||||
## SDK and model reproduction
|
||||
|
||||
```sh
|
||||
node experiments/analysis-efficiency/measure.mjs \
|
||||
--runtime-root /absolute/frozen-runtime --revision ca1b2f8608c52ed721d3576ba5eeb1d66717b08c \
|
||||
--artifact xbox-clear_nomp.saz --path /absolute/clear_nomp.saz \
|
||||
--output /absolute/new-result-dir --schemas selected --saz-selection focused
|
||||
node experiments/analysis-efficiency/saz-model-prompt.mjs \
|
||||
--artifact xbox-clear_nomp.saz --selection focused > /absolute/prompt.txt
|
||||
```
|
||||
|
||||
Use the same runtime, inputs, explicit provider settings and resource profile
|
||||
within a cost cohort; retain runtime/workflow/oracle/settings fingerprints. Repeat
|
||||
both core archives with baseline/focused/focused/baseline order and retain all
|
||||
failures/recovery RPCs. The `retained` diagnostic workflow also measures preview,
|
||||
two complete pages and a repeated first page. Preview omits headers, so preview
|
||||
alone is not equivalent to the complete header/body question.
|
||||
|
||||
Run real Codex tasks through `agent-trial.py` with an isolated temporary profile,
|
||||
the two exact `inspect_web_network_capture` / `inspect_analysis_view` tools,
|
||||
the same requested model/reasoning and at least two baseline/focused pairs for
|
||||
the control. Grade cited observations with `review-saz.mjs`, an independently
|
||||
produced oracle and the tested runtime. Count whole-task input/output tokens,
|
||||
cached input, elapsed time and all calls; parsed JSON bytes are not model tokens.
|
||||
The executed scope and all failed/deviating trials follow below.
|
||||
|
||||
## Executed SDK cohort
|
||||
|
||||
Runtime is frozen at `ca1b2f8608c52ed721d3576ba5eeb1d66717b08c`; corrected
|
||||
experiment source is `286c3e48ad50d9e84baa3af00ca522a8cef36e95`. All corrected
|
||||
SDK runtime/workflow/oracle/provider-setting fingerprints match. Node is 24.18.0
|
||||
and MCP SDK is 2.3.1. SDK processes have a 1 GiB Node heap ceiling; model MCP
|
||||
profiles separately record 512 MiB. Compare within each cohort.
|
||||
|
||||
The initial batch preserves 12 workflows / 36 RPCs. Two control baseline collectors
|
||||
incorrectly expected omitted request ordinals to remain omitted in Evidence;
|
||||
the owning application records the resolved full scope. Original RPC arguments
|
||||
preserve omission. Both saved replies independently validate correct typed
|
||||
Evidence/facts after the checker correction. Original failures, hashes and costs
|
||||
remain unchanged and are not pooled into the corrected batch.
|
||||
|
||||
The corrected batch executes 12 workflows / 32 RPCs: **11 workflows pass** all necessary
|
||||
byte/header/member checks with equal facts across successful arms. One large
|
||||
default complete query hits `provider_timeout` at the 30-second provider budget.
|
||||
Failed complete-return RPCs in successful retained recovery also stay in cost.
|
||||
|
||||
| Archive / workflow | Repetition outcomes | All parsed reply bytes | RPC ms | Whole runner ms |
|
||||
| ------------------ | ------------------- | ---------------------: | --------------------- | --------------------- |
|
||||
| control / baseline | passed / passed | 249272 / 249272 | 817.904 / 817.032 | 5393.982 / 4922.524 |
|
||||
| control / focused | passed / passed | 65390 / 65390 | 805.492 / 835.598 | 4897.670 / 4924.772 |
|
||||
| control / retained | passed / passed | 146981 / 146981 | 1846.344 / 8258.135 | 5861.567 / 18108.568 |
|
||||
| large / baseline | failed / passed | 520 / 114294 | 32303.203 / 13623.033 | 52432.342 / 18064.360 |
|
||||
| large / focused | passed / passed | 535767 / 535767 | 32917.417 / 23536.051 | 52933.865 / 37045.394 |
|
||||
| large / retained | passed / passed | 174477 / 174477 | 10970.973 / 11550.158 | 15140.224 / 15669.775 |
|
||||
|
||||
Control direct selection reduces parsed replies **73.8%**. Large complete-result
|
||||
recovery delivers 114,294 bytes, while direct ordinal selection retains the original
|
||||
container inventory and delivers 535,767 bytes. The five-call retained diagnostic
|
||||
delivers 174,477 bytes, including preview and repeated-page verification. A smaller
|
||||
record set alone does not guarantee less delivery; bytes are not wire bytes or
|
||||
model tokens.
|
||||
|
||||
Initial RPCs combine decoding, validation, canonicalization and delivery; no
|
||||
decode-only/format-only attribution is claimed. First-use and repeated retained
|
||||
reads remain separate RPC observations. Fresh client/server processes do not
|
||||
establish cold OS/provider caches. Substantial time variation precludes a stable
|
||||
general speedup claim.
|
||||
|
||||
## Actual Codex outcomes
|
||||
|
||||
Four actual Codex CLI 0.161.0 trials request `gpt-5.6-terra`/`high` with the same
|
||||
two enabled/preapproved passive tools in baseline/focused/focused/baseline order.
|
||||
The requested alias is pinned; resolved backend identity is unknown. Temporary
|
||||
profiles preserve original bytes. The requested mode is `direct`, but owned
|
||||
tool-context logs show actual `exec` discovery/dispatch; neither guaranteed direct
|
||||
presentation nor exact submitted model requests are established.
|
||||
|
||||
| Trial | Facts / fixed plan | MCP calls | Total input | Cached input | Uncached input, derived | Output | Seconds |
|
||||
| ---------- | ------------------ | --------: | ----------: | -----------: | ----------------------: | -----: | ------: |
|
||||
| baseline-1 | passed / failed | 4 | 97,988 | 53,504 | 44,484 | 1,556 | 51.266 |
|
||||
| focused-1 | passed / failed | 2 | 96,433 | 51,456 | 44,977 | 1,400 | 52.288 |
|
||||
| focused-2 | failed / failed | 0 | 21,379 | 9,984 | 11,395 | 317 | 16.301 |
|
||||
| baseline-2 | passed / failed | 4 | 172,043 | 125,696 | 46,347 | 1,943 | 62.570 |
|
||||
|
||||
**Three of four tasks answer correctly.** All three add compatible retained-view
|
||||
calls and differ from the initially prescribed single MCP-call plan. These
|
||||
successful completed-task costs stay visible separately from plan conformance.
|
||||
Baselines read three exact record views; the successful focus reads one complete
|
||||
selected-parent page.
|
||||
|
||||
The second focus makes zero MCP calls and reports unavailable tools. Its owned
|
||||
exact-name discovery returns an empty list, while the same names work in other
|
||||
trials; stderr is empty. The cause is unknown, not proof of a REA outage. Keep
|
||||
its 21,379 input tokens / 16.301 seconds as a failed task, without a replacement retry
|
||||
or an apparent speed win.
|
||||
|
||||
Only the first pair completes both questions: total input decreases **1.6%**,
|
||||
time increases **2.0%**, and derived uncached input increases **1.1%**. The second
|
||||
pair has no completed focused question; no paired speed/token claim is valid.
|
||||
Limitation prose was inspected: successful answers qualify stored bytes,
|
||||
ZIP-directory order and absent transfer/content decoding. This small mixed cohort
|
||||
justifies **no production optimization**.
|
||||
|
||||
## Resource and compatibility scope
|
||||
|
||||
Heavy work is serial with one CPU, 3 GiB early stop / 4 GiB hard family memory, no swap,
|
||||
task ceilings and host-availability/ownership checks. Corrected SDK payload-exit
|
||||
peak is 906,825,728 bytes (**865 MiB**); model peak is 873,148,416 bytes (**833 MiB**).
|
||||
All 16 corrected SDK/model payload phases verify cleanup, no observed OOM/abort
|
||||
and captured CPU counters. Terminal whole-scope counters remain unknown. Failed
|
||||
tool/model tasks do not become correct because their process exits cleanly.
|
||||
|
||||
Family CPU seconds at payload exit span 5.898–44.331 for corrected SDK workflows
|
||||
(median 15.808), including failed/recovered attempts. Model baseline/focus/focus/
|
||||
baseline observations are 7.573 / 7.303 / 5.810 / 7.618 CPU seconds; the third
|
||||
model task failed and cannot establish an efficiency gain. These counters include
|
||||
the owned runner/client/server/observer family, not decoder-only CPU.
|
||||
|
||||
Verification covers Linux, two immutable positive archives plus one genuine
|
||||
partial-message negative source, one installed parser stack and one requested
|
||||
model alias. Other platforms, Fiddler acquisition/import, live deployment or
|
||||
certificate semantics, arbitrary layouts, direct presentation guarantees and
|
||||
unmeasured engine stages remain unknown. Complete defaults, caller choices,
|
||||
encoded bytes, redactions, semantic Evidence identity and session-owned views
|
||||
remain the compatibility baseline. Reuse existing selectors/views; expand
|
||||
SDK/cache/default behavior only after completed tasks show a benefit.
|
||||
@@ -0,0 +1,264 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { isDeepStrictEqual, promisify } from "node:util";
|
||||
|
||||
const corpus = JSON.parse(
|
||||
await readFile(new URL("./corpus.json", import.meta.url), "utf8"),
|
||||
);
|
||||
|
||||
export const SIGNAL_ARTIFACTS = {
|
||||
"sigrok-uart-max3232e.sr": {
|
||||
kind: "uart",
|
||||
decoders: "uart:rx=MAX3232E DOUT1:baudrate=57600:format=hex:invert_rx=yes",
|
||||
annotations: "uart=rx-data",
|
||||
query: "rx-data",
|
||||
firstPage: 32,
|
||||
},
|
||||
"sigrok-i2c-nunchuk.sr": {
|
||||
kind: "i2c",
|
||||
decoders: "i2c:scl=SCL:sda=SDA",
|
||||
annotations: "i2c=data-read",
|
||||
query: "data-read",
|
||||
firstPage: 9,
|
||||
},
|
||||
};
|
||||
|
||||
export function signalRequest(artifact, path, selection) {
|
||||
const descriptor = SIGNAL_ARTIFACTS[artifact];
|
||||
if (!descriptor) throw new Error("Unknown fixed signal question");
|
||||
return {
|
||||
path,
|
||||
decoders: descriptor.decoders,
|
||||
input_format: null,
|
||||
annotations: selection === "baseline" ? null : descriptor.annotations,
|
||||
line_offset: 0,
|
||||
line_limit: selection === "pages" ? descriptor.firstPage : null,
|
||||
};
|
||||
}
|
||||
|
||||
export function signalDataRows(kind, text) {
|
||||
const pattern =
|
||||
kind === "uart"
|
||||
? /^(\d+)-(\d+) uart-1: ([0-9A-F]{2})$/
|
||||
: /^(\d+)-(\d+) i2c-1: Data read: ([0-9A-F]{2})$/;
|
||||
const rows = [];
|
||||
for (const line of text.split("\n")) {
|
||||
const match = pattern.exec(line);
|
||||
if (!match) continue;
|
||||
const start = Number(match[1]),
|
||||
end = Number(match[2]);
|
||||
if (
|
||||
!Number.isSafeInteger(start) ||
|
||||
!Number.isSafeInteger(end) ||
|
||||
start > end
|
||||
)
|
||||
throw new Error("Unsupported decoded sample interval");
|
||||
rows.push({ start, end, byte: Number.parseInt(match[3], 16) });
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
export function signalFacts(kind, rows) {
|
||||
if (kind === "uart") return { kind, bytes: rows.map((row) => row.byte) };
|
||||
if (kind !== "i2c" || rows.length !== 18)
|
||||
throw new Error(
|
||||
"The fixed I2C question requires three complete six-byte reads",
|
||||
);
|
||||
return {
|
||||
kind,
|
||||
reads: [0, 6, 12].map((offset) =>
|
||||
rows.slice(offset, offset + 6).map((row) => row.byte),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
export function verifySignalOracleIdentity(artifact, oracle) {
|
||||
const pinned = corpus.artifacts.find((entry) => entry.id === artifact);
|
||||
if (
|
||||
!pinned ||
|
||||
oracle.kind !== SIGNAL_ARTIFACTS[artifact]?.kind ||
|
||||
oracle.sha256 !== pinned.sha256
|
||||
)
|
||||
throw new Error(
|
||||
"Independent oracle does not identify the pinned signal corpus",
|
||||
);
|
||||
}
|
||||
|
||||
export function verifySignalRows(kind, rows, oracle, digest) {
|
||||
const expected =
|
||||
kind === "uart"
|
||||
? oracle.rows
|
||||
: oracle.reads.flatMap((read) =>
|
||||
read.bytes.slice(1).map((byte, index) => ({
|
||||
...byte,
|
||||
after_previous: read.bytes[index].last_clock,
|
||||
before_next: read.bytes[index + 2]?.first_clock ?? read.stop,
|
||||
})),
|
||||
);
|
||||
if (
|
||||
oracle.kind !== kind ||
|
||||
oracle.sha256 !== digest ||
|
||||
rows.length !== expected.length
|
||||
)
|
||||
throw new Error(
|
||||
"Signal observations differ from independent sample identity/coverage",
|
||||
);
|
||||
for (let index = 0; index < rows.length; index++) {
|
||||
const observed = rows[index],
|
||||
raw = expected[index];
|
||||
if (
|
||||
observed.byte !== raw.byte ||
|
||||
observed.start < 0 ||
|
||||
observed.end >= oracle.total_samples
|
||||
)
|
||||
throw new Error("Decoded data differs from independent sample bits");
|
||||
if (
|
||||
kind === "uart"
|
||||
? !Number.isSafeInteger(raw.first_data_sample) ||
|
||||
!Number.isSafeInteger(raw.last_data_sample) ||
|
||||
observed.start < raw.start ||
|
||||
observed.end >= raw.end_exclusive ||
|
||||
observed.start > raw.first_data_sample ||
|
||||
observed.end < raw.last_data_sample
|
||||
: !Number.isSafeInteger(raw.after_previous) ||
|
||||
!Number.isSafeInteger(raw.before_next) ||
|
||||
observed.start <= raw.after_previous ||
|
||||
observed.end >= raw.before_next ||
|
||||
observed.start > raw.first_clock ||
|
||||
observed.end < raw.last_clock
|
||||
)
|
||||
throw new Error(
|
||||
"Decoded interval does not identify the independently read byte",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function measureSignalEntry({
|
||||
values,
|
||||
call,
|
||||
inputSha,
|
||||
catalogDefinitions,
|
||||
}) {
|
||||
const descriptor = SIGNAL_ARTIFACTS[values.artifact];
|
||||
const runtime = (file) =>
|
||||
pathToFileURL(resolve(values["runtime-root"], file)).href;
|
||||
const { parseEvidence } = await import(runtime("dist/domain/evidence.js"));
|
||||
const { decodeSignalRecordingInputSchema, signalRecordingSchema } =
|
||||
await import(runtime("dist/domain/signals/signalRecording.js"));
|
||||
const { inspectSignalDecodersInputSchema, signalDecodersSchema } =
|
||||
await import(runtime("dist/domain/signals/signalDecoders.js"));
|
||||
const observations = [];
|
||||
const checked = (evidence, operation, input, schema) => {
|
||||
parseEvidence(evidence);
|
||||
const report = schema.parse(evidence.normalized_result);
|
||||
if (
|
||||
evidence.operation !== operation ||
|
||||
!isDeepStrictEqual(evidence.parameters, input) ||
|
||||
!isDeepStrictEqual(report.selection, input)
|
||||
)
|
||||
throw new Error(
|
||||
"Signal Evidence differs from the actual requested operation or choices",
|
||||
);
|
||||
if (
|
||||
operation === "decode_signal_recording"
|
||||
? evidence.subject?.local_path !== values.path ||
|
||||
evidence.subject?.digest?.sha256 !== inputSha ||
|
||||
report.artifact.path !== values.path ||
|
||||
report.artifact.sha256 !== inputSha
|
||||
: evidence.subject?.local_path !== report.tool.path ||
|
||||
evidence.subject?.digest?.sha256 !== report.tool.sha256
|
||||
)
|
||||
throw new Error(
|
||||
"Signal Evidence identifies different recording/tool bytes",
|
||||
);
|
||||
observations.push({
|
||||
evidence_id: evidence.evidence_id,
|
||||
operation,
|
||||
selection: report.selection,
|
||||
output_window: report.output_window,
|
||||
limitations: evidence.limitations,
|
||||
});
|
||||
return report;
|
||||
};
|
||||
const selection = values["signal-selection"];
|
||||
for (const name of [
|
||||
"decode_signal_recording",
|
||||
...(selection === "discovery" ? ["inspect_signal_decoders"] : []),
|
||||
])
|
||||
if (!catalogDefinitions.has(name))
|
||||
throw new Error(`Missing live signal contract ${name}`);
|
||||
if (selection === "discovery") {
|
||||
const input = inspectSignalDecodersInputSchema.parse({
|
||||
decoder: descriptor.kind,
|
||||
query: descriptor.query,
|
||||
limit: 5,
|
||||
});
|
||||
const report = checked(
|
||||
await call("inspect_signal_decoders", input),
|
||||
"inspect_signal_decoders",
|
||||
input,
|
||||
signalDecodersSchema,
|
||||
);
|
||||
if (!report.help_lines.some((line) => line.text.includes(descriptor.query)))
|
||||
throw new Error(
|
||||
"Installed decoder help does not establish the selected annotation class",
|
||||
);
|
||||
}
|
||||
const input = decodeSignalRecordingInputSchema.parse(
|
||||
signalRequest(values.artifact, values.path, selection),
|
||||
);
|
||||
const first = checked(
|
||||
await call("decode_signal_recording", input),
|
||||
"decode_signal_recording",
|
||||
input,
|
||||
signalRecordingSchema,
|
||||
);
|
||||
let rows = signalDataRows(descriptor.kind, first.annotations_text);
|
||||
if (selection === "pages") {
|
||||
const nextInput = decodeSignalRecordingInputSchema.parse({
|
||||
...input,
|
||||
line_offset: descriptor.firstPage,
|
||||
line_limit: null,
|
||||
});
|
||||
const next = checked(
|
||||
await call("decode_signal_recording", nextInput),
|
||||
"decode_signal_recording",
|
||||
nextInput,
|
||||
signalRecordingSchema,
|
||||
);
|
||||
const repeated = checked(
|
||||
await call("decode_signal_recording", input),
|
||||
"decode_signal_recording",
|
||||
input,
|
||||
signalRecordingSchema,
|
||||
);
|
||||
if (
|
||||
first.annotations_text !== repeated.annotations_text ||
|
||||
!isDeepStrictEqual(first.output_window, repeated.output_window) ||
|
||||
first.output_window.total_lines !== next.output_window.total_lines
|
||||
)
|
||||
throw new Error("Repeated/next display pages changed observation scope");
|
||||
rows = [...rows, ...signalDataRows(descriptor.kind, next.annotations_text)];
|
||||
}
|
||||
const { stdout } = await promisify(execFile)(
|
||||
"python3",
|
||||
[
|
||||
fileURLToPath(new URL("./signal-oracle.py", import.meta.url)),
|
||||
descriptor.kind,
|
||||
values.path,
|
||||
...(descriptor.kind === "uart" ? ["--invert"] : []),
|
||||
],
|
||||
{ timeout: 30_000, maxBuffer: 256 * 1024 },
|
||||
);
|
||||
const oracle = JSON.parse(stdout);
|
||||
verifySignalOracleIdentity(values.artifact, oracle);
|
||||
verifySignalRows(descriptor.kind, rows, oracle, inputSha);
|
||||
return {
|
||||
artifact_sha256: inputSha,
|
||||
facts: signalFacts(descriptor.kind, rows),
|
||||
delivery_observations: observations,
|
||||
evidence_ids: [...new Set(observations.map((item) => item.evidence_id))],
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { parseArgs } from "node:util";
|
||||
import { signalRequest, SIGNAL_ARTIFACTS } from "./signal-entry.mjs";
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: { artifact: { type: "string" }, selection: { type: "string" } },
|
||||
});
|
||||
if (
|
||||
!Object.hasOwn(SIGNAL_ARTIFACTS, values.artifact ?? "") ||
|
||||
!["baseline", "focused"].includes(values.selection)
|
||||
)
|
||||
throw new Error(
|
||||
"Use --artifact fixed-signal-ID --selection baseline|focused",
|
||||
);
|
||||
const kind = SIGNAL_ARTIFACTS[values.artifact].kind;
|
||||
const question =
|
||||
kind === "uart"
|
||||
? "Report every decoded RX data octet on the specified DOUT1 channel, in recording order, as decimal integer bytes. Include all repetitions; do not deduplicate data."
|
||||
: "Report every I2C READ data payload in recording order, grouped into consecutive six-byte payloads. Exclude address bytes and write data. Do not infer button or hardware behavior.";
|
||||
console.log(`${question}
|
||||
Use the configured REA MCP and make exactly one decode_signal_recording call with this selection:
|
||||
${JSON.stringify(signalRequest(values.artifact, "{{artifact_path}}", values.selection))}
|
||||
Return one JSON object with exactly these keys: kind (${JSON.stringify(kind)}), ${kind === "uart" ? "bytes (an array of decimal octets)" : "reads (an array of six-octet decimal arrays)"}, evidence_ids (unique actual returned Evidence IDs), limitations (nonempty investigation limitations). Preserve source identity and recorded order. Output lines are not sample or annotation counts; selected decoder observations do not prove complete hardware traffic or original application behavior. Do not run shell commands, browse, acquire hardware samples, invent missing data, or fabricate citations.`);
|
||||
@@ -0,0 +1,211 @@
|
||||
"""Independent readers for the two pinned, single-device digital SR recordings."""
|
||||
|
||||
import argparse
|
||||
from bisect import bisect_right
|
||||
import configparser
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import struct
|
||||
import zipfile
|
||||
|
||||
|
||||
def read_edges(path, channels):
|
||||
size = path.stat().st_size
|
||||
if size > 32 * 1024 * 1024:
|
||||
raise ValueError('Compressed SR input exceeds the experiment budget')
|
||||
with path.open('rb') as source:
|
||||
admitted = source.read(size + 1)
|
||||
if len(admitted) != size:
|
||||
raise ValueError('SR input size changed during admission')
|
||||
marker = admitted.rfind(b'PK\x05\x06', max(0, len(admitted) - 65557))
|
||||
if marker < 0 or len(admitted) - marker < 22:
|
||||
raise ValueError('Missing classic ZIP directory receipt')
|
||||
header = struct.unpack_from('<4s4H2IH', admitted, marker)
|
||||
if (marker >= 20 and admitted[marker-20:marker-16] == b'PK\x06\x07'):
|
||||
raise ValueError('ZIP64 directory is unsupported')
|
||||
if header[1] or header[2] or header[3] != header[4] or not 1 <= header[4] <= 64 or header[5] > 65536 or marker + 22 + header[7] != len(admitted) or header[6] + header[5] != marker:
|
||||
raise ValueError('Unsupported or excessive ZIP directory representation')
|
||||
directory = memoryview(admitted)[header[6]:marker]
|
||||
position = count = 0
|
||||
while position < len(directory):
|
||||
if count >= 64 or len(directory) - position < 46 or directory[position:position+4] != b'PK\x01\x02':
|
||||
raise ValueError('Unsupported or excessive actual ZIP directory records')
|
||||
name_size, extra_size, comment_size = struct.unpack_from('<3H', directory, position + 28)
|
||||
end = position + 46 + name_size + extra_size + comment_size
|
||||
if end > len(directory):
|
||||
raise ValueError('Incomplete actual ZIP directory record')
|
||||
extra = position + 46 + name_size
|
||||
extra_end = extra + extra_size
|
||||
while extra < extra_end:
|
||||
if extra_end - extra < 4:
|
||||
raise ValueError('Incomplete ZIP extra field')
|
||||
tag, length = struct.unpack_from('<2H', directory, extra)
|
||||
if tag == 1:
|
||||
raise ValueError('ZIP64 member is unsupported')
|
||||
extra += 4 + length
|
||||
if extra > extra_end:
|
||||
raise ValueError('Incomplete ZIP extra field')
|
||||
count += 1
|
||||
position = end
|
||||
if count != header[4]:
|
||||
raise ValueError('Declared and actual ZIP directory counts differ')
|
||||
before = hashlib.sha256(admitted).hexdigest()
|
||||
# Admission and ZipFile parse the same bounded snapshot, not a reopened path.
|
||||
with zipfile.ZipFile(io.BytesIO(admitted), allowZip64=False) as archive:
|
||||
entries = archive.infolist()
|
||||
names = [item.filename for item in entries]
|
||||
if len(names) != len(set(names)) or len(names) > 64:
|
||||
raise ValueError("Ambiguous or excessive SR members")
|
||||
if sum(item.file_size for item in entries) > 32 * 1024 * 1024:
|
||||
raise ValueError("Expanded SR input exceeds the experiment budget")
|
||||
if archive.getinfo('metadata').file_size > 8192:
|
||||
raise ValueError("Excessive SR metadata")
|
||||
# Declared sizes are untrusted. A bounded read also caps each inflater
|
||||
# step; logic members below likewise use bounded block reads.
|
||||
with archive.open('metadata') as source:
|
||||
metadata_bytes = source.read(8193)
|
||||
if len(metadata_bytes) > 8192:
|
||||
raise ValueError("Expanded SR metadata exceeds the experiment budget")
|
||||
metadata = metadata_bytes.decode('utf-8')
|
||||
config = configparser.ConfigParser(interpolation=None)
|
||||
config.read_string(metadata)
|
||||
if set(config.sections()) != {'global', 'device 1'}:
|
||||
raise ValueError("Only the pinned single-device profile is supported")
|
||||
device = config['device 1']
|
||||
unit = int(device['unitsize'])
|
||||
probes = int(device['total probes'])
|
||||
if unit not in [1, 2] or not 1 <= probes <= unit * 8:
|
||||
raise ValueError("Unsupported digital sample geometry")
|
||||
rate = re.fullmatch(r'(\d+)\s+(Hz|kHz|MHz)', device['samplerate'])
|
||||
if rate is None or int(rate[1]) <= 0:
|
||||
raise ValueError("Unsupported sample-rate representation")
|
||||
samplerate = int(rate[1]) * {'Hz': 1, 'kHz': 1000, 'MHz': 1000000}[rate[2]]
|
||||
bits = []
|
||||
for channel in channels:
|
||||
matches = [index - 1 for index in range(1, probes + 1)
|
||||
if device.get(f'probe{index}') == channel]
|
||||
if len(matches) != 1:
|
||||
raise ValueError("Channel identity is missing or ambiguous")
|
||||
bits.append(matches[0])
|
||||
prefix = device['capturefile']
|
||||
chunks = [name for name in names if re.fullmatch(re.escape(prefix) + r'-\d+', name)]
|
||||
if prefix in names and chunks:
|
||||
raise ValueError("Ambiguous direct and chunked logic data")
|
||||
if prefix in names:
|
||||
chunks = [prefix]
|
||||
else:
|
||||
chunks.sort(key=lambda name: int(name.rsplit('-', 1)[1]))
|
||||
if [int(name.rsplit('-', 1)[1]) for name in chunks] != list(range(1, len(chunks) + 1)):
|
||||
raise ValueError("Missing or ambiguous logic chunk order")
|
||||
if not chunks or any(archive.getinfo(name).file_size % unit for name in chunks):
|
||||
raise ValueError("Missing or incomplete digital samples")
|
||||
edges = [[] for _ in channels]
|
||||
previous = None
|
||||
sample = 0
|
||||
mask = sum(1 << bit for bit in bits)
|
||||
for name in chunks:
|
||||
with archive.open(name) as source:
|
||||
while block := source.read(65536):
|
||||
values = block if unit == 1 else (item[0] for item in struct.iter_unpack('<H', block))
|
||||
for value in values:
|
||||
selected = value & mask
|
||||
if selected != previous:
|
||||
for index, bit in enumerate(bits):
|
||||
level = (selected >> bit) & 1
|
||||
if not edges[index] or edges[index][-1][1] != level:
|
||||
if sum(map(len, edges)) >= 65536:
|
||||
raise ValueError('Selected transitions exceed the experiment representation budget')
|
||||
edges[index].append((sample, level))
|
||||
previous = selected
|
||||
sample += 1
|
||||
with path.open('rb') as source:
|
||||
after = source.read(size + 1)
|
||||
if len(after) != size or hashlib.sha256(after).hexdigest() != before:
|
||||
raise ValueError("Recording bytes changed during the independent read")
|
||||
return {'sha256': before, 'metadata': metadata, 'sample_rate_hz': samplerate,
|
||||
'total_samples': sample, 'channels': dict(zip(channels, bits))}, edges
|
||||
|
||||
|
||||
def uart(path, invert):
|
||||
metadata, traces = read_edges(path, ['MAX3232E DOUT1'])
|
||||
edges = [(sample, level ^ invert) for sample, level in traces[0]]
|
||||
positions = [sample for sample, _ in edges]
|
||||
rate, baud = metadata['sample_rate_hz'], 57600
|
||||
def level(sample):
|
||||
return edges[bisect_right(positions, sample) - 1][1]
|
||||
rows = []
|
||||
busy_until = 0
|
||||
for index, (start, value) in enumerate(edges):
|
||||
if index == 0 or value != 0 or start < busy_until:
|
||||
continue
|
||||
center = lambda halfbits: start + (halfbits * rate) // (2 * baud)
|
||||
if center(19) >= metadata['total_samples']:
|
||||
raise ValueError("Incomplete UART frame at the capture boundary")
|
||||
if level(center(1)) != 0 or level(center(19)) != 1:
|
||||
raise ValueError(f"UART framing differs from selected polarity at sample {start}")
|
||||
byte = sum(level(center(3 + 2 * bit)) << bit for bit in range(8))
|
||||
# A UART receiver becomes ready after sampling the stop bit. Waiting
|
||||
# a full nominal ten bits would miss a valid slightly faster sender.
|
||||
rows.append({'start': start, 'end_exclusive': center(19) + 1, 'byte': byte,
|
||||
'first_data_sample': center(3), 'last_data_sample': center(17)})
|
||||
busy_until = center(19) + 1
|
||||
return metadata | {'kind': 'uart', 'baud_rate': baud, 'invert': bool(invert),
|
||||
'complete_frames': len(rows), 'rows': rows}
|
||||
|
||||
|
||||
def i2c(path):
|
||||
metadata, traces = read_edges(path, ['SCL', 'SDA'])
|
||||
transitions = {}
|
||||
for channel, edges in enumerate(traces):
|
||||
for sample, value in edges:
|
||||
transitions.setdefault(sample, {})[channel] = value
|
||||
clock = data = None
|
||||
active = None
|
||||
bits = []
|
||||
transactions = []
|
||||
for sample, changes in sorted(transitions.items()):
|
||||
next_clock, next_data = changes.get(0, clock), changes.get(1, data)
|
||||
if clock is not None and data is not None:
|
||||
if clock == next_clock == 1 and next_data != data:
|
||||
if next_data == 0:
|
||||
if active is not None:
|
||||
raise ValueError("The pinned profile does not contain repeated START")
|
||||
active = {'start': sample, 'bytes': []}
|
||||
bits = []
|
||||
elif active is not None:
|
||||
# SCL may rise with SDA low to prepare STOP; that final
|
||||
# rise is not the first bit of a new data byte.
|
||||
if len(bits) == 1 and bits[0][1] == 0:
|
||||
bits = []
|
||||
if bits:
|
||||
raise ValueError("Incomplete I2C byte before STOP")
|
||||
active['stop'] = sample
|
||||
transactions.append(active)
|
||||
active = None
|
||||
elif active is not None and clock == 0 and next_clock == 1:
|
||||
if next_data != data:
|
||||
raise ValueError("Ambiguous simultaneous clock/data transition")
|
||||
bits.append((sample, next_data))
|
||||
if len(bits) == 9:
|
||||
byte = sum(bit << (7-index) for index, (_, bit) in enumerate(bits[:8]))
|
||||
active['bytes'].append({'byte': byte, 'first_clock': bits[0][0],
|
||||
'last_clock': bits[7][0], 'ack': bits[8][1] == 0})
|
||||
bits = []
|
||||
clock, data = next_clock, next_data
|
||||
if active is not None or bits:
|
||||
raise ValueError("Incomplete I2C transaction at capture end")
|
||||
reads = [transaction for transaction in transactions
|
||||
if transaction['bytes'] and transaction['bytes'][0]['byte'] & 1]
|
||||
return metadata | {'kind': 'i2c', 'transactions': transactions, 'reads': reads}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('kind', choices=['uart', 'i2c'])
|
||||
parser.add_argument('path', type=Path)
|
||||
parser.add_argument('--invert', action='store_true')
|
||||
args = parser.parse_args()
|
||||
print(json.dumps(uart(args.path, args.invert) if args.kind == 'uart' else i2c(args.path)))
|
||||
@@ -0,0 +1,188 @@
|
||||
# Sigrok selection and repeated-page checkpoint (#3131)
|
||||
|
||||
This experiment preserves production APIs, defaults, caller selections and Evidence
|
||||
semantics. Existing annotation selectors substantially reduce replies, but this
|
||||
small real-model cohort does **not** establish a consistent reduction in total
|
||||
input tokens or elapsed task time. No decoder cache or new production preset is
|
||||
introduced. Complete necessary output stays available through existing explicit
|
||||
null limits; original defaults remain 50 display lines.
|
||||
|
||||
## Immutable corpus and independent questions
|
||||
|
||||
The runtime is pinned to `ca7450beffff59325ce3bddc78e181693ce77177`, with Node
|
||||
24.18.0, SDK 2.3.1 and Linux x86-64. Experiment driver code for model trials is
|
||||
`23317a58d`; each SDK result separately records workflow/oracle source hashes,
|
||||
runtime-file and lockfile digests, explicit provider settings and original bytes.
|
||||
Later integration checks must remain separate from this cohort.
|
||||
|
||||
Two official sigrok-dumps recordings are pinned to upstream commit
|
||||
`0ad13477abc959d37fc9a5acbd23901c371c9c76` in [corpus.json](corpus.json).
|
||||
Original Git blob IDs, SHA-256, sizes and immutable reference/download URLs are
|
||||
recorded there. No sample binaries or raw output are committed. The upstream
|
||||
repository declares dumps public domain unless otherwise noted; the inspected
|
||||
sample READMEs state no exception. Decoder software licensing is separate.
|
||||
|
||||
- MAX3232E UART: 12,742 compressed bytes, 10,000,000 logic bytes, 5,000,000 samples
|
||||
at the recorded nominal 100 MHz. Stored DOUT1 is bit 1; DIN1 is bit 2. The exact
|
||||
question requests all RX octets in order, including repetitions. Independent
|
||||
57,600-baud 8N1 stop-bit sampling with DOUT1 inversion yields 65 bytes: five
|
||||
copies of `Hello world\r\n`. The source metadata and physical probe numbers
|
||||
remain distinct from stored bit positions.
|
||||
- Wii Nunchuk I2C: 20,373 compressed bytes, 20,000,000 samples at nominal 1 MHz.
|
||||
The source README's physical probes 3/7 are repacked as stored named channels
|
||||
SCL/SDA at bits 0/1. The question asks every read payload as consecutive
|
||||
six-byte arrays, excluding address/write bytes and hardware/button inference.
|
||||
Independent START/STOP, rising-clock, byte and ACK/NACK reading identifies seven
|
||||
transactions and three read payloads, matching the upstream reference:
|
||||
`75 7F 77 4F 82 3B`, `75 7F 75 44 82 34`, `75 7F 77 43 83 5D`.
|
||||
|
||||
The independent reader accepts the scoped single-device classic-ZIP profile,
|
||||
checks directory representation before object allocation, bounds compressed and
|
||||
expanded input to 32 MiB, and limits selected transitions to 65,536. It preserves
|
||||
source metadata/digest, chunk ordering and channel identity; incomplete samples,
|
||||
ambiguous names, partial bytes and unsupported transactions fail explicitly.
|
||||
Receiver rearming follows the verified UART stop sample, accommodating the
|
||||
recording's slightly faster sender. I2C STOP preparation is distinct from data.
|
||||
These checks do not establish other formats, decoders, OSes or physical acquisition.
|
||||
|
||||
An initial DOUT1 decode without inversion exited successfully but produced wrong
|
||||
bytes. Its cost/output is retained privately as configuration exploration, outside
|
||||
eligible measurements. An independent sample oracle prevents equal-but-wrong
|
||||
producer results from passing. Correct inversion was established before the cohort.
|
||||
|
||||
## Actual CLI and SDK evidence
|
||||
|
||||
sigrok-cli 0.7.2 reports libsigrok 0.5.2 and libsigrokdecode 0.5.3. Its executable
|
||||
SHA-256 is `e1b1eb2f25edc17d24a78acbab16ff7e1dfdee74bb2cccb7ad00497ccc7a0c44`.
|
||||
Selected installed UART/I2C decoder module bytes are fingerprinted privately.
|
||||
The banner and executable digest do not fingerprint the complete installation;
|
||||
modules and libraries remain trusted. Both actual CLI and MCP results match raw
|
||||
sample bytes; data intervals correlate with the independently examined samples.
|
||||
|
||||
Fourteen actual SDK workflows comprise two interleaved repetitions per recording
|
||||
and arm (baseline/focused/discovery), plus first/next/repeated pages. All 22 calls
|
||||
preserve source bytes and necessary decoded facts. Baseline returns all necessary
|
||||
annotation output. Focused selects `uart=rx-data` or `i2c=data-read`, with explicit
|
||||
null line limits because the task needs the entire selected payload. Discovery
|
||||
first queries the installed decoder help for the already specified class; it does
|
||||
not establish discovery benefits for unknown protocols.
|
||||
|
||||
| Recording | Baseline bytes | Focused bytes | Discovery + focused bytes | First + next + repeat bytes |
|
||||
| --------- | -------------: | ------------: | ------------------------: | --------------------------: |
|
||||
| UART | 49,417 | 12,441 | 18,839 | 31,779 |
|
||||
| I2C | 26,829 | 9,928 | 16,274 | 27,623 |
|
||||
|
||||
Focused reply reductions are 74.8% and 63.0%. These are parsed SDK JSON bytes,
|
||||
not wire bytes or model tokens. Baseline/focused RPC times (ms, repetitions 1/2)
|
||||
are UART 2010/582 versus 1459/911, and I2C 2851/676 versus 2330/685; n=2,
|
||||
with order/cold/warm variation, does not establish a general speedup. Pages retain
|
||||
input/class/window coverage separately, rather than equating display exhaustion
|
||||
with a complete protocol decode. Repeated first pages match their original text
|
||||
and scope; reused content-based Evidence identities are valid.
|
||||
|
||||
## Complete real-model task costs
|
||||
|
||||
Eight actual Codex CLI 0.161.0 tasks requested `gpt-5.6-terra` / `high`, in isolated
|
||||
profiles using this runtime's REA MCP. Both tools were enabled and preapproved
|
||||
identically in all arms; shell, browser and extra agents were disabled. The model
|
||||
alias is a requested identifier, not independently resolved backend identity.
|
||||
Questions contain no expected payloads. Trial order is baseline 1, focused 1,
|
||||
focused 2, baseline 2, with UART then I2C in each step.
|
||||
|
||||
| Trial | Total input | Cached input | Uncached input (derived) | Output | Seconds | Completed tool calls | Facts / fixed plan |
|
||||
| --------------- | ----------: | -----------: | -----------------------: | -----: | ------: | -------------------: | ------------------ |
|
||||
| uart baseline 1 | 92,399 | 49,408 | 42,991 | 1,295 | 86.411 | 1 | passed / passed |
|
||||
| uart focused 1 | 130,029 | 98,048 | 31,981 | 780 | 49.623 | 1 | passed / passed |
|
||||
| uart focused 2 | 98,894 | 78,592 | 20,302 | 878 | 73.861 | 1 | passed / passed |
|
||||
| uart baseline 2 | 90,395 | 48,384 | 42,011 | 926 | 43.974 | 1 | passed / passed |
|
||||
| i2c baseline 1 | 172,162 | 121,344 | 50,818 | 1,194 | 36.330 | 2 | passed / failed |
|
||||
| i2c focused 1 | 74,815 | 49,408 | 25,407 | 937 | 114.515 | 1 | passed / passed |
|
||||
| i2c focused 2 | 74,684 | 48,384 | 26,300 | 668 | 73.877 | 1 | passed / passed |
|
||||
| i2c baseline 2 | 86,241 | 49,408 | 36,833 | 778 | 41.084 | 1 | passed / passed |
|
||||
|
||||
All eight answers match independent raw samples and cite authenticated decoder
|
||||
observations. I2C baseline 1 also queried generic MCP resources before its single
|
||||
required decode. The predeclared strict single-call grader marks its plan failed;
|
||||
its actual 172,162 input tokens and 36.330 seconds remain recorded, separately
|
||||
from the eligible fixed-plan pairs. It is not retried into a better result.
|
||||
|
||||
UART eligible pairs increase total input by 40.7% and 9.4%; elapsed changes are
|
||||
-42.6% and +68.0%. The one eligible I2C pair reduces total input by 13.4% but
|
||||
increases elapsed time by 79.8%. Reduced uncached input does not replace total
|
||||
input as the primary token measure. No reliable whole-task token/time benefit is
|
||||
established across these two questions; reply projection alone is insufficient.
|
||||
|
||||
## Producer, window and resource scope
|
||||
|
||||
Eight separately bounded direct producer runs preserve source bytes and render
|
||||
correct stdout: UART baseline 159/131 ms versus focused 163/130 ms; I2C baseline
|
||||
355/298 ms versus focused 317/290 ms. This isolates the producer process from REA
|
||||
RPC, version probing and snapshot work, but startup/decoding/annotation formatting
|
||||
remain combined. Decoding-only versus formatting-only time is unmeasured.
|
||||
|
||||
REA literal-window extraction and JSON encoding were measured separately from
|
||||
retained producer text (one cold observation and 200 warm iterations per arm).
|
||||
Warm mean extraction ranges from 0.0040 to 0.1794 ms; JSON encoding from 0.0021 to 0.0121 ms. These exclude file reads, RPC and decoding.
|
||||
|
||||
Every page still invokes decoding. Retained output might help repeated inspection,
|
||||
but this fixed cohort does not demonstrate a completed-task improvement warranting
|
||||
a new cache. Any future work should own bounded output explicitly by original
|
||||
Evidence identity and lifetime, with cancellation/cleanup, rather than use a
|
||||
CLI-digest-only generic cache of an incompletely fingerprinted installation.
|
||||
|
||||
Heavy work ran serially under one CPU, 3 GiB early stop / 4 GiB hard memory,
|
||||
no swap and host-availability checks. Verified payload-exit peak bytes were
|
||||
SDK 587,513,856; model 889,323,520; direct producer 26,288,128. No OOM/OOM-kill or resource abort occurred in that verified phase; task descendants
|
||||
were cleaned. Terminal whole-scope counters are unavailable and remain unknown.
|
||||
|
||||
## Verification and replay
|
||||
|
||||
Eleven independent-oracle regressions and 12 comparator/sample-interval tests pass.
|
||||
Twenty-four private replays using actual SDK Evidence cover valid answers, failed
|
||||
calls before/after recovery, wrong bytes, unknown citations and missing limitations.
|
||||
These are grading checks with injected state, not additional model/provider trials.
|
||||
The grader retains authenticated observations by identity, rejects conflicts,
|
||||
combines cited pages in sample order and keeps failed calls/plan deviations separate
|
||||
from supported facts. Relevant typecheck/lint and pre-push checks pass.
|
||||
|
||||
Review hardening ties the oracle to the named corpus digest, bounds each I2C
|
||||
interval against neighboring byte clocks/transaction STOP, and counts actual
|
||||
classic-ZIP directory records on the same bounded snapshot before allocating
|
||||
`ZipFile` objects; ZIP64 is rejected. Forged-count and ZIP64 admission regressions
|
||||
fail on the original implementation. Replaying all eight original model trials
|
||||
and 24 injected grading cases with these checks preserves their factual/plan
|
||||
grades and recorded usage/time; these replays are not new model measurements.
|
||||
|
||||
Metadata reads cap inflater output even when ZIP sizes are forged. A streamed
|
||||
8 MiB malformed metadata member declaring 8 KiB is rejected with traced Python
|
||||
allocation below 1 MiB; the same regression fails on the preceding implementation.
|
||||
Compressed snapshots use actual file size plus one growth-detection byte rather
|
||||
than preallocating the entire admission budget. Both genuine waveform oracles
|
||||
retain identical bytes, metadata, sample intervals and source digests.
|
||||
|
||||
UART interval checks also require coverage of the first and last independently
|
||||
sampled data-bit centers within the owning frame. Shortened, shifted and
|
||||
single-sample intervals are rejected even when the decoded byte is correct.
|
||||
The added oracle coordinates retain the original byte/frame facts; replaying
|
||||
saved real Evidence and all eight model transcripts preserves the original
|
||||
grades and costs. This is stronger retrospective verification, not a new cohort.
|
||||
|
||||
After rebasing onto main `44d98de2367b99808d78db732ec7d72533266233`,
|
||||
`npm run build:cached` and the 16 focused comparator/sample-interval/MCP-boundary
|
||||
tests passed. Two additional real focused MCP workflows independently verified
|
||||
UART/I2C bytes and intervals on that base. These integration checks are separate
|
||||
from the original cost cohort and do not replace or extend its measurements.
|
||||
|
||||
A subsequent rebase onto main `3b79af28e80785afce9f5998d8f03289402a1847`
|
||||
passed the 17 focused tests, including the upstream-fixed Hopper doctor case,
|
||||
and two additional real UART/I2C MCP workflows. Original cohort costs and grades
|
||||
remain unchanged; these checks verify integration on the updated main only.
|
||||
|
||||
Use `measure.mjs --signal-selection baseline|focused|discovery|pages`, preserving
|
||||
runtime/source fingerprints and explicit provider JSON. Generate the exact task
|
||||
with `signal-model-prompt.mjs --artifact ID --selection baseline|focused`, run the
|
||||
isolated `agent-trial.py --mode direct --capture-tool-context`, and grade with
|
||||
`review-signal.mjs` and the independently produced oracle. Keep original failures,
|
||||
resources and raw observations private. For migration, existing optional annotation
|
||||
selection is sufficient for scoped reply reduction; no default/API change follows
|
||||
from this mixed whole-task result.
|
||||
@@ -0,0 +1,67 @@
|
||||
import importlib.util
|
||||
import struct
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
spec = importlib.util.spec_from_file_location('packet_oracle', Path(__file__).with_name('packet-oracle.py'))
|
||||
oracle = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(oracle)
|
||||
|
||||
|
||||
class PacketOracleTest(unittest.TestCase):
|
||||
def test_compression_pointer_preserves_question_cursor(self):
|
||||
message = b'\x03www\x07example\x03com\0' + b'\xc0\0' + b'\0\x01\0\x01'
|
||||
self.assertEqual(oracle.dns_name(message, 17), ('www.example.com', 19))
|
||||
|
||||
def test_compression_cycle_and_missing_pointer_byte_fail(self):
|
||||
for message in (b'\xc0\0', b'\xc0', b'\xc0\x02\xc0\0'):
|
||||
with self.subTest(message=message), self.assertRaises(ValueError):
|
||||
oracle.dns_name(message, 0)
|
||||
|
||||
def test_truncated_pcap_record_is_not_exhaustion(self):
|
||||
header = struct.pack('<IHHIIII', 0xa1b2c3d4, 2, 4, 0, 0, 65535, 1)
|
||||
with self.assertRaises(ValueError):
|
||||
list(oracle.packets(header + b'\0'))
|
||||
record = struct.pack('<IIII', 0, 0, 20, 20)
|
||||
with self.assertRaises(ValueError):
|
||||
list(oracle.packets(header + record + b'\0' * 19))
|
||||
|
||||
def test_missing_dhcp_server_id_stays_omitted(self):
|
||||
payload = b'\0' * 236 + b'\x63\x82\x53\x63\x35\x01\x01\xff'
|
||||
self.assertEqual(oracle.dhcp_options(payload), {53: b'\x01'})
|
||||
|
||||
def test_dhcp_duplicates_truncation_and_missing_end_fail(self):
|
||||
prefix = b'\0' * 236 + b'\x63\x82\x53\x63'
|
||||
for suffix in (b'\x35\x01\x01\x35\x01\x02\xff', b'\x36\x04\0', b'\x35\x01\x01'):
|
||||
with self.subTest(suffix=suffix), self.assertRaises(ValueError):
|
||||
oracle.dhcp_options(prefix + suffix)
|
||||
|
||||
def test_fragmented_selected_traffic_cannot_pass_header_oracle(self):
|
||||
ip = bytearray(20)
|
||||
ip[0], ip[9] = 0x45, 17
|
||||
struct.pack_into('!H', ip, 2, 20)
|
||||
struct.pack_into('!H', ip, 6, 0x2000)
|
||||
with self.assertRaises(ValueError):
|
||||
oracle.transport(b'\0' * 12 + b'\x08\0' + ip)
|
||||
|
||||
def test_declared_ip_length_and_tcp_options_cannot_be_truncated(self):
|
||||
ip = bytearray(40)
|
||||
ip[0], ip[9], ip[32] = 0x45, 6, 0xf0
|
||||
struct.pack_into('!H', ip, 2, 40)
|
||||
struct.pack_into('!HH', ip, 20, 12345, 5432)
|
||||
packet = b'\0' * 12 + b'\x08\0' + ip
|
||||
header = struct.pack('<IHHIIII', 0xa1b2c3d4, 2, 4, 0, 0, 65535, 1)
|
||||
record = struct.pack('<IIII', 0, 0, len(packet), len(packet))
|
||||
with self.assertRaisesRegex(ValueError, 'TCP header'):
|
||||
oracle.analyze(header + record + packet, 'postgres')
|
||||
struct.pack_into('!H', ip, 2, 60)
|
||||
with self.assertRaisesRegex(ValueError, 'truncated IPv4'):
|
||||
oracle.transport(b'\0' * 12 + b'\x08\0' + ip)
|
||||
|
||||
def test_unknown_link_protocol_does_not_prove_tcp_absence(self):
|
||||
with self.assertRaisesRegex(ValueError, 'unsupported Ethernet'):
|
||||
oracle.transport(b'\0' * 12 + b'\x86\xdd' + b'\0' * 40)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,48 @@
|
||||
"""Stored-byte semantics and fail-before-allocation admission, not providers."""
|
||||
|
||||
import base64
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
spec = importlib.util.spec_from_file_location('saz_oracle', Path(__file__).with_name('saz-oracle.py'))
|
||||
oracle = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(oracle)
|
||||
|
||||
|
||||
class SazOracleTests(unittest.TestCase):
|
||||
def test_duplicate_spelling_and_folding_are_source_facts(self):
|
||||
result = oracle.stored_http(b'HTTP/1.1 200 OK\r\nX-Case: first\r\nx-case:second\r\n continuation\r\n\r\n', False)
|
||||
self.assertEqual(result['headers'], [{'name': 'X-Case', 'value': ' first'},
|
||||
{'name': 'x-case', 'value': 'second\r\n continuation'}])
|
||||
self.assertEqual(result['body']['bytes'], 0)
|
||||
self.assertEqual(result['body']['text'], '')
|
||||
|
||||
def test_body_keeps_encoded_bytes_and_internal_separators(self):
|
||||
body = b'\x1f\x8b\xff\n\n\r\n\r\n'
|
||||
result = oracle.stored_http(b'HTTP/1.1 200 OK\r\nContent-Encoding: gzip\r\n\r\n' + body, False)
|
||||
self.assertEqual(base64.b64decode(result['body']['content_base64']), body)
|
||||
self.assertIsNone(result['body']['text'])
|
||||
|
||||
def test_first_lf_separator_owns_body_with_later_crlf_separator(self):
|
||||
result = oracle.stored_http(b'GET / HTTP/1.1\nHost: example.com\n\nbody\r\n\r\n', True)
|
||||
self.assertEqual(result['body']['text'], 'body\r\n\r\n')
|
||||
|
||||
def test_malformed_start_and_unowned_continuation_fail(self):
|
||||
for data in [b'garbage\r\n\r\n', b'HTTP/1.1 200 OK\r\n orphan\r\n\r\n']:
|
||||
with self.assertRaises(ValueError):
|
||||
oracle.stored_http(data, False)
|
||||
|
||||
def test_wrong_digest_cannot_allocate_zip_objects(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
path = Path(root)/'wrong.saz'
|
||||
path.write_bytes(b'X'*43515)
|
||||
with patch.object(oracle.zipfile, 'ZipFile', side_effect=AssertionError('Too late')):
|
||||
with self.assertRaisesRegex(ValueError, 'pinned SAZ corpus'):
|
||||
oracle.read_saz('xbox-clear_nomp.saz', path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,149 @@
|
||||
"""Distinct framing, identity and admission failures in the sample-bit oracle."""
|
||||
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import struct
|
||||
import tempfile
|
||||
import tracemalloc
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
import zipfile
|
||||
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
'signal_oracle', Path(__file__).with_name('signal-oracle.py'))
|
||||
oracle = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(oracle)
|
||||
|
||||
|
||||
class SignalOracleTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.root = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(self.root.cleanup)
|
||||
self.path = Path(self.root.name) / 'sample.sr'
|
||||
|
||||
def recording(self, data, unit, channels, chunk='logic-1', extra=0):
|
||||
metadata = '[global]\nsigrok version=0.3.0\n[device 1]\ncapturefile=logic-1\n'
|
||||
metadata += f'total probes={len(channels)}\nsamplerate=1 MHz\nunitsize={unit}\n'
|
||||
metadata += ''.join(f'probe{index+1}={name}\n' for index, name in enumerate(channels))
|
||||
with zipfile.ZipFile(self.path, 'w') as archive:
|
||||
archive.writestr('version', '2')
|
||||
archive.writestr('metadata', metadata)
|
||||
archive.writestr(chunk, data)
|
||||
for index in range(extra):
|
||||
archive.writestr(f'extra-{index}', '')
|
||||
|
||||
def test_uart_rearms_after_stop_sample_for_a_slightly_faster_sender(self):
|
||||
levels = [1] * 100
|
||||
for byte in [0x48, 0x65]:
|
||||
for bit in [0, *[(byte >> index) & 1 for index in range(8)], 1]:
|
||||
levels.extend([bit] * 17)
|
||||
levels.extend([1] * 100)
|
||||
data = b''.join(struct.pack('<H', (1-level) << 1) for level in levels)
|
||||
self.recording(data, 2, ['unused', 'MAX3232E DOUT1'])
|
||||
result = oracle.uart(self.path, True)
|
||||
self.assertEqual([row['byte'] for row in result['rows']], [0x48, 0x65])
|
||||
self.assertEqual(result['channels']['MAX3232E DOUT1'], 1)
|
||||
for row, start in zip(result['rows'], [100, 270]):
|
||||
self.assertEqual(row['first_data_sample'], start + 26)
|
||||
self.assertEqual(row['last_data_sample'], start + 147)
|
||||
|
||||
def i2c_levels(self, incomplete=False):
|
||||
states = [(1, 1), (1, 0)]
|
||||
for byte, ack in [(0xA5, 0), (0x75, 1)]:
|
||||
values = [(byte >> index) & 1 for index in reversed(range(8))] + [ack]
|
||||
if incomplete and byte == 0x75:
|
||||
values = values[:4]
|
||||
for bit in values:
|
||||
states.extend([(0, bit), (1, bit)])
|
||||
states.extend([(0, 0), (1, 0), (1, 1)])
|
||||
return bytes(clock | data << 1 for clock, data in states)
|
||||
|
||||
def test_i2c_stop_setup_is_distinct_from_another_data_byte(self):
|
||||
self.recording(self.i2c_levels(), 1, ['SCL', 'SDA'])
|
||||
result = oracle.i2c(self.path)
|
||||
self.assertEqual(len(result['reads']), 1)
|
||||
self.assertEqual([row['byte'] for row in result['reads'][0]['bytes']], [0xA5, 0x75])
|
||||
self.assertFalse(result['reads'][0]['bytes'][-1]['ack'])
|
||||
|
||||
def test_incomplete_i2c_byte_is_not_invented_at_stop(self):
|
||||
self.recording(self.i2c_levels(incomplete=True), 1, ['SCL', 'SDA'])
|
||||
with self.assertRaisesRegex(ValueError, 'Incomplete I2C byte'):
|
||||
oracle.i2c(self.path)
|
||||
|
||||
def test_channel_names_must_identify_one_stored_bit(self):
|
||||
self.recording(b'\x00', 1, ['SCL', 'SCL'])
|
||||
with self.assertRaisesRegex(ValueError, 'ambiguous'):
|
||||
oracle.read_edges(self.path, ['SCL'])
|
||||
|
||||
def test_missing_chunk_is_not_renumbered(self):
|
||||
self.recording(b'\x00', 1, ['SCL', 'SDA'], chunk='logic-1-2')
|
||||
with self.assertRaisesRegex(ValueError, 'chunk order'):
|
||||
oracle.read_edges(self.path, ['SCL', 'SDA'])
|
||||
|
||||
def test_partial_sample_word_is_rejected(self):
|
||||
self.recording(b'\x00', 2, ['unused', 'MAX3232E DOUT1'])
|
||||
with self.assertRaisesRegex(ValueError, 'incomplete digital samples'):
|
||||
oracle.read_edges(self.path, ['MAX3232E DOUT1'])
|
||||
|
||||
def test_directory_budget_precedes_zip_object_allocation(self):
|
||||
self.recording(b'\x00', 1, ['SCL', 'SDA'], extra=62)
|
||||
with patch.object(oracle.zipfile, 'ZipFile', side_effect=AssertionError('Too late')):
|
||||
with self.assertRaisesRegex(ValueError, 'excessive ZIP directory'):
|
||||
oracle.read_edges(self.path, ['SCL', 'SDA'])
|
||||
|
||||
def test_declared_expansion_is_rejected_before_decompression(self):
|
||||
self.recording(b'\x00', 1, ['SCL', 'SDA'])
|
||||
data = bytearray(self.path.read_bytes())
|
||||
directory = data.index(b'PK\x01\x02')
|
||||
struct.pack_into('<I', data, directory + 24, 32 * 1024 * 1024 + 1)
|
||||
self.path.write_bytes(data)
|
||||
with self.assertRaisesRegex(ValueError, 'Expanded SR input'):
|
||||
oracle.read_edges(self.path, ['SCL', 'SDA'])
|
||||
|
||||
def test_forged_member_count_cannot_allocate_extra_zip_objects(self):
|
||||
self.recording(b'\x00', 1, ['SCL', 'SDA'], extra=62)
|
||||
data = bytearray(self.path.read_bytes())
|
||||
end = data.rfind(b'PK\x05\x06')
|
||||
struct.pack_into('<2H', data, end + 8, 1, 1)
|
||||
self.path.write_bytes(data)
|
||||
with patch.object(oracle.zipfile, 'ZipFile', side_effect=AssertionError('Too late')):
|
||||
with self.assertRaisesRegex(ValueError, 'actual ZIP directory'):
|
||||
oracle.read_edges(self.path, ['SCL', 'SDA'])
|
||||
|
||||
def test_zip64_locator_cannot_override_the_classic_budget(self):
|
||||
self.recording(b'\x00', 1, ['SCL', 'SDA'])
|
||||
data = bytearray(self.path.read_bytes())
|
||||
end = data.rfind(b'PK\x05\x06')
|
||||
# Syntactically complete ZIP64 directory/locator before a classic EOCD.
|
||||
header = struct.unpack_from('<4s4H2IH', data, end)
|
||||
record = struct.pack('<4sQ2H2I4Q', b'PK\x06\x06', 44, 45, 45, 0, 0,
|
||||
header[4], header[4], 100000000, header[6])
|
||||
locator = struct.pack('<4sIQI', b'PK\x06\x07', 0, end, 1)
|
||||
data[end:end] = record + locator
|
||||
self.path.write_bytes(data)
|
||||
with patch.object(oracle.zipfile, 'ZipFile', side_effect=AssertionError('Too late')):
|
||||
with self.assertRaisesRegex(ValueError, 'ZIP64 directory'):
|
||||
oracle.read_edges(self.path, ['SCL', 'SDA'])
|
||||
|
||||
def test_forged_metadata_size_cannot_expand_past_its_output_budget(self):
|
||||
# Stream the malformed member so constructing the fixture is bounded.
|
||||
with zipfile.ZipFile(self.path, 'w', compression=zipfile.ZIP_DEFLATED) as archive:
|
||||
with archive.open('metadata', 'w') as member:
|
||||
for _ in range(128):
|
||||
member.write(b'X' * 65536)
|
||||
data = bytearray(self.path.read_bytes())
|
||||
directory = data.index(b'PK\x01\x02')
|
||||
struct.pack_into('<I', data, directory + 24, 8192)
|
||||
self.path.write_bytes(data)
|
||||
tracemalloc.start()
|
||||
try:
|
||||
with self.assertRaises(zipfile.BadZipFile):
|
||||
oracle.read_edges(self.path, ['SCL', 'SDA'])
|
||||
_, peak = tracemalloc.get_traced_memory()
|
||||
finally:
|
||||
tracemalloc.stop()
|
||||
self.assertLess(peak, 1024 * 1024, 'Metadata allocation followed forged ZIP expansion')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -2905,11 +2905,11 @@ pure-rand@8.4.2 | development | MIT
|
||||
Package: https://www.npmjs.com/package/pure-rand/v/8.4.2
|
||||
Archive: https://registry.npmjs.org/pure-rand/-/pure-rand-8.4.2.tgz
|
||||
Integrity: sha512-vvuOGgcuPJAirlHvuQw1TrOiw7ptaIXXmIbNuiNOY6lNGJJH49PQ1Kj4nd783nPdQhQdicgOjVI2yI/9BD6/Ng==
|
||||
qs@6.15.1 | development | BSD-3-Clause
|
||||
qs@6.16.0 | development | BSD-3-Clause
|
||||
Lockfile path: node_modules/qs
|
||||
Package: https://www.npmjs.com/package/qs/v/6.15.1
|
||||
Archive: https://registry.npmjs.org/qs/-/qs-6.15.1.tgz
|
||||
Integrity: sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg==
|
||||
Package: https://www.npmjs.com/package/qs/v/6.16.0
|
||||
Archive: https://registry.npmjs.org/qs/-/qs-6.16.0.tgz
|
||||
Integrity: sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==
|
||||
quick-format-unescaped@4.0.4 | runtime | MIT
|
||||
Lockfile path: node_modules/quick-format-unescaped
|
||||
Package: https://www.npmjs.com/package/quick-format-unescaped/v/4.0.4
|
||||
|
||||
@@ -26,6 +26,29 @@ its manifest. Release CI builds both, and `prepublishOnly` rejects a missing,
|
||||
stale, mismatched, or wrong-architecture artifact. A development tarball built
|
||||
without this lane reports Windows native controls as unavailable.
|
||||
|
||||
## Restore the artifact in a source checkout
|
||||
|
||||
The source tree omits `native/windows/build/` from Git. To run Windows
|
||||
provider-backed workflows from a checkout without the MinGW build lane, extract
|
||||
the two files from the published `rea-agents` tarball whose version exactly
|
||||
matches the checkout's `package.json` version. Do not use `latest` or copy files
|
||||
from another REA version; the loader verifies the manifest version, ABI,
|
||||
architecture, and addon digest before it grants authority.
|
||||
|
||||
From the checkout root, replace `<matching-version>` with the `version` in
|
||||
`package.json`:
|
||||
|
||||
```sh
|
||||
npm pack rea-agents@<matching-version>
|
||||
tar -xzf rea-agents-<matching-version>.tgz
|
||||
mkdir -p native/windows/build
|
||||
cp package/native/windows/build/manifest.json native/windows/build/
|
||||
cp package/native/windows/build/rea-windows-x64.node native/windows/build/
|
||||
```
|
||||
|
||||
This is a manual recovery step. REA does not fetch or install the artifact
|
||||
automatically. Alternatively, build it using the Linux/MinGW lane above.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Opaque Node objects carry a native type tag, resource kind, and closed state.
|
||||
|
||||
Generated
+7
-6
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rea-agents",
|
||||
"version": "6.4.0",
|
||||
"version": "6.5.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rea-agents",
|
||||
"version": "6.4.0",
|
||||
"version": "6.5.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/parser": "8.0.4",
|
||||
@@ -8408,13 +8408,14 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.15.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.1.tgz",
|
||||
"integrity": "sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg==",
|
||||
"version": "6.16.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz",
|
||||
"integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
"es-define-property": "^1.0.1",
|
||||
"side-channel": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
|
||||
+4
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "rea-agents",
|
||||
"mcpName": "io.github.morluto/rea",
|
||||
"version": "6.4.0",
|
||||
"version": "6.5.0",
|
||||
"description": "Reverse engineer anything from your terminal or agent with one CLI and MCP server.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -353,6 +353,9 @@
|
||||
"zod": "4.4.3"
|
||||
},
|
||||
"overrides": {
|
||||
"typed-rest-client": {
|
||||
"qs": "6.16.0"
|
||||
},
|
||||
"vitepress": {
|
||||
"vite": "6.4.4"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
export type NpmReleaseState =
|
||||
| { status: "absent" }
|
||||
| {
|
||||
status: "published";
|
||||
integrity: string;
|
||||
tag: "latest" | "next";
|
||||
taggedVersion: string | null;
|
||||
stableVersion: string | null;
|
||||
};
|
||||
export function readNpmRelease(
|
||||
version: string,
|
||||
request?: (url: string, init: RequestInit) => Promise<Response>,
|
||||
): Promise<NpmReleaseState>;
|
||||
export function requireMatchingNpmRelease(
|
||||
tarball: string,
|
||||
version: string,
|
||||
published: NpmReleaseState,
|
||||
): Promise<void>;
|
||||
export function stableUpdateVersion(
|
||||
version: string,
|
||||
published: NpmReleaseState,
|
||||
): string;
|
||||
export function waitForNpmRelease(
|
||||
version: string,
|
||||
lookup?: (version: string) => Promise<NpmReleaseState>,
|
||||
pause?: (milliseconds: number) => Promise<unknown>,
|
||||
): Promise<Extract<NpmReleaseState, { status: "published" }>>;
|
||||
@@ -0,0 +1,126 @@
|
||||
import { appendFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { setTimeout } from "node:timers/promises";
|
||||
import { z } from "zod";
|
||||
import { prerelease, valid } from "semver";
|
||||
import { releaseNpmTag } from "../release-npm-tag.mjs";
|
||||
import { verifyPublishedPackageIntegrity } from "./verified-package.mjs";
|
||||
|
||||
/** Parse one npm metadata snapshot; errors and malformed records are never absence. */
|
||||
export async function readNpmRelease(version, request = fetch) {
|
||||
const tag = releaseNpmTag(version);
|
||||
const response = await request("https://registry.npmjs.org/rea-agents", {
|
||||
headers: {
|
||||
Accept: "application/vnd.npm.install-v1+json",
|
||||
"Cache-Control": "no-cache",
|
||||
},
|
||||
signal: AbortSignal.timeout(30_000),
|
||||
});
|
||||
if (response.status === 404) return { status: "absent" };
|
||||
if (!response.ok)
|
||||
throw new Error(`npm registry lookup failed: HTTP ${response.status}`);
|
||||
const metadata = z
|
||||
.object({
|
||||
name: z.literal("rea-agents"),
|
||||
versions: z.record(z.string(), z.unknown()),
|
||||
"dist-tags": z.record(z.string(), z.string()),
|
||||
})
|
||||
.parse(await response.json());
|
||||
if (!Object.hasOwn(metadata.versions, version)) return { status: "absent" };
|
||||
const published = z
|
||||
.object({
|
||||
name: z.literal("rea-agents"),
|
||||
version: z.literal(version),
|
||||
dist: z.object({ integrity: z.string().min(1) }),
|
||||
})
|
||||
.parse(metadata.versions[version]);
|
||||
return {
|
||||
status: "published",
|
||||
integrity: published.dist.integrity,
|
||||
tag,
|
||||
taggedVersion: metadata["dist-tags"][tag] ?? null,
|
||||
stableVersion: metadata["dist-tags"].latest ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
/** REA update follows stable latest even when the candidate is published on next. */
|
||||
export function stableUpdateVersion(version, published) {
|
||||
if (published.status !== "published" || published.taggedVersion !== version)
|
||||
throw new Error(`npm does not select ${version} on its release channel`);
|
||||
const stable = published.stableVersion;
|
||||
if (
|
||||
typeof stable !== "string" ||
|
||||
valid(stable) !== stable ||
|
||||
prerelease(stable) !== null
|
||||
)
|
||||
throw new Error(
|
||||
"npm latest does not select a stable release for the update canary",
|
||||
);
|
||||
return stable;
|
||||
}
|
||||
|
||||
/** Validate content before accepting a previously published or newly visible version. */
|
||||
export async function requireMatchingNpmRelease(tarball, version, published) {
|
||||
if (published.status !== "published")
|
||||
throw new Error(`rea-agents@${version} is not published`);
|
||||
await verifyPublishedPackageIntegrity(tarball, published.integrity);
|
||||
if (published.taggedVersion !== version)
|
||||
throw new Error(
|
||||
`Expected npm ${published.tag} to select ${version}, observed ${published.taggedVersion ?? "missing"}; refusing to change an existing dist-tag`,
|
||||
);
|
||||
}
|
||||
|
||||
/** Retry only confirmed absence during the existing registry propagation window. */
|
||||
export async function waitForNpmRelease(
|
||||
version,
|
||||
lookup = readNpmRelease,
|
||||
pause = setTimeout,
|
||||
) {
|
||||
const attempts = 120;
|
||||
for (let attempt = 1; attempt <= attempts; attempt++) {
|
||||
const published = await lookup(version);
|
||||
if (published.status === "published") return published;
|
||||
if (attempt < attempts) await pause(15_000);
|
||||
}
|
||||
throw new Error(
|
||||
`rea-agents@${version} was not visible on npm after 120 attempts over 30 minutes`,
|
||||
);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const [operation, tarball, version, ...extra] = process.argv.slice(2);
|
||||
if (
|
||||
!["inspect", "verify"].includes(operation) ||
|
||||
tarball === undefined ||
|
||||
version === undefined ||
|
||||
extra.length
|
||||
)
|
||||
throw new Error(
|
||||
"Usage: node scripts/ci/npm-release.mjs inspect|verify <qualified-tarball> <version>",
|
||||
);
|
||||
const published =
|
||||
operation === "inspect"
|
||||
? await readNpmRelease(version)
|
||||
: await waitForNpmRelease(version);
|
||||
if (published.status === "published")
|
||||
await requireMatchingNpmRelease(tarball, version, published);
|
||||
if (operation === "inspect") {
|
||||
await appendFile(
|
||||
z.string().min(1).parse(process.env.GITHUB_OUTPUT),
|
||||
`published=${published.status === "published"}\n`,
|
||||
);
|
||||
} else if (process.env.GITHUB_STEP_SUMMARY !== undefined) {
|
||||
await appendFile(
|
||||
process.env.GITHUB_STEP_SUMMARY,
|
||||
`npm: rea-agents@${version} is published, matches the qualified tarball, and is selected by ${published.tag}.\n`,
|
||||
);
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify({ version, ...published })}\n`);
|
||||
}
|
||||
|
||||
if (
|
||||
process.argv[1] !== undefined &&
|
||||
resolve(process.argv[1]) === fileURLToPath(import.meta.url)
|
||||
)
|
||||
await main();
|
||||
+8
-2
@@ -10,11 +10,14 @@ const HOST_TEST_OWNERS = ["apple", "package", "sqlite"];
|
||||
// workflows' release, publication and self-hosted runner safeguards.
|
||||
const GUARDED_WORKFLOWS = new Set([
|
||||
".github/workflows/pr-title.yml",
|
||||
".github/workflows/pr-readiness.yml",
|
||||
".github/workflows/ci-full-pr.yml",
|
||||
".github/workflows/release.yml",
|
||||
".github/workflows/release-recovery.yml",
|
||||
".github/workflows/real-ghidra-windows.yml",
|
||||
".github/workflows/sqlite-runtime.yml",
|
||||
".github/workflows/ci-timings.yml",
|
||||
".github/workflows/mutation.yml",
|
||||
]);
|
||||
// Sources compiled by build-conformance-fixtures.mjs. The readiness journey
|
||||
// analyzes the built C fixture as well as its own applications.
|
||||
@@ -175,8 +178,11 @@ if (tier === "reused") {
|
||||
file.startsWith(".github/ISSUE_TEMPLATE/")
|
||||
) {
|
||||
selected.docs = true;
|
||||
// Authored documentation code also belongs to the static checkers.
|
||||
selected.code ||= /^docs\/.*\.(?:[cm]?[jt]s|[jt]sx)$/su.test(file);
|
||||
// Authored code and its Node package scopes belong to static checkers.
|
||||
selected.code ||=
|
||||
file.startsWith("docs/") &&
|
||||
(/\.(?:[cm]?[jt]s|[jt]sx)$/u.test(file) ||
|
||||
file.endsWith("/package.json"));
|
||||
selected.website ||= matchesAny(file, SCOPES.website);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
export interface ReadinessPullRequest {
|
||||
readonly number: number;
|
||||
readonly state: "open" | "closed";
|
||||
readonly draft: boolean;
|
||||
readonly body: string | null;
|
||||
readonly head: { readonly sha: string };
|
||||
readonly base: { readonly ref: string };
|
||||
}
|
||||
export interface ReadinessResult {
|
||||
readonly state: "success" | "failure" | "pending";
|
||||
readonly description: string;
|
||||
}
|
||||
export interface ReadinessGitHub {
|
||||
readonly rest: {
|
||||
readonly pulls: {
|
||||
get(input: {
|
||||
owner: string;
|
||||
repo: string;
|
||||
pull_number: number;
|
||||
}): Promise<{ data: ReadinessPullRequest }>;
|
||||
};
|
||||
readonly repos: {
|
||||
createCommitStatus(
|
||||
input: ReadinessResult & {
|
||||
owner: string;
|
||||
repo: string;
|
||||
sha: string;
|
||||
context: string;
|
||||
target_url: string;
|
||||
},
|
||||
): Promise<unknown>;
|
||||
readonly listPullRequestsAssociatedWithCommit: unknown;
|
||||
};
|
||||
};
|
||||
paginate(
|
||||
method: unknown,
|
||||
input: {
|
||||
owner: string;
|
||||
repo: string;
|
||||
commit_sha: string;
|
||||
per_page: number;
|
||||
},
|
||||
): Promise<
|
||||
readonly Pick<ReadinessPullRequest, "number" | "state" | "head">[]
|
||||
>;
|
||||
}
|
||||
export function evaluateReadiness(
|
||||
pull: Pick<ReadinessPullRequest, "body" | "draft">,
|
||||
template: string,
|
||||
): ReadinessResult;
|
||||
export function runReadinessCheck(input: {
|
||||
github: ReadinessGitHub;
|
||||
context: {
|
||||
repo: { owner: string; repo: string };
|
||||
payload: {
|
||||
pull_request?: { number: number };
|
||||
inputs?: { pull_request_number?: string };
|
||||
};
|
||||
serverUrl: string;
|
||||
runId: number;
|
||||
};
|
||||
core: { info(message: string): void; setFailed(message: string): void };
|
||||
}): Promise<ReadinessResult | undefined>;
|
||||
@@ -0,0 +1,173 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
const result = (state, description) => ({ state, description });
|
||||
|
||||
function readinessLines(markdown) {
|
||||
const lines = markdown.split(/\r?\n/u);
|
||||
const visible = [];
|
||||
let fence;
|
||||
let comment = false;
|
||||
for (const source of lines) {
|
||||
if (fence) {
|
||||
if (
|
||||
new RegExp(
|
||||
`^ {0,3}${fence.character}{${fence.length},}\\s*$`,
|
||||
"u",
|
||||
).test(source)
|
||||
)
|
||||
fence = undefined;
|
||||
continue;
|
||||
}
|
||||
const opening = !comment && /^ {0,3}(`{3,}|~{3,})/u.exec(source);
|
||||
if (opening) {
|
||||
fence = { character: opening[1][0], length: opening[1].length };
|
||||
continue;
|
||||
}
|
||||
let line = "";
|
||||
let offset = 0;
|
||||
while (offset < source.length) {
|
||||
const marker = comment ? "-->" : "<!--";
|
||||
const index = source.indexOf(marker, offset);
|
||||
if (!comment)
|
||||
line += source.slice(offset, index === -1 ? source.length : index);
|
||||
if (index === -1) break;
|
||||
offset = index + marker.length;
|
||||
comment = !comment;
|
||||
}
|
||||
visible.push(line);
|
||||
}
|
||||
const starts = visible.flatMap((line, index) =>
|
||||
/^## Author readiness\s*$/u.test(line) ? [index] : [],
|
||||
);
|
||||
if (starts.length !== 1) return [];
|
||||
const remaining = visible.slice(starts[0] + 1);
|
||||
const end = remaining.findIndex((line) => /^#{1,2}\s/u.test(line));
|
||||
return (end === -1 ? remaining : remaining.slice(0, end)).map((line) =>
|
||||
line.trimEnd(),
|
||||
);
|
||||
}
|
||||
|
||||
/** Check the initial declaration against the trusted repository template. */
|
||||
export function evaluateReadiness(pull, template) {
|
||||
if (pull.draft)
|
||||
return result(
|
||||
"pending",
|
||||
"Draft PR: complete Author readiness before requesting review.",
|
||||
);
|
||||
const expected = readinessLines(template).flatMap((line) => {
|
||||
const match = /^- \[ \] (.+)$/u.exec(line);
|
||||
return match ? [match[1]] : [];
|
||||
});
|
||||
if (expected.length !== 3)
|
||||
throw new Error(
|
||||
"Trusted PR template must contain three readiness declarations.",
|
||||
);
|
||||
const lines = readinessLines(pull.body ?? "");
|
||||
const owners = lines.filter((line) => line.startsWith("Human owner:"));
|
||||
if (
|
||||
owners.length !== 1 ||
|
||||
!/^Human owner: @[a-z\d](?:[a-z\d-]*[a-z\d])?$/iu.test(owners[0])
|
||||
)
|
||||
return result(
|
||||
"failure",
|
||||
"Fill Human owner with one @GitHub-handle in the Author readiness section.",
|
||||
);
|
||||
const declarations = lines.flatMap((line) => {
|
||||
const match = /^- \[([ xX])\] (.+)$/u.exec(line);
|
||||
return match
|
||||
? [{ checked: match[1].toLowerCase() === "x", text: match[2] }]
|
||||
: [];
|
||||
});
|
||||
if (
|
||||
expected.some((text) => {
|
||||
const matches = declarations.filter((item) => item.text === text);
|
||||
return matches.length !== 1 || !matches[0].checked;
|
||||
})
|
||||
)
|
||||
return result(
|
||||
"failure",
|
||||
"Complete all three Author readiness declarations from the current PR template.",
|
||||
);
|
||||
return result(
|
||||
"success",
|
||||
"Human owner and all three initial readiness declarations are filled.",
|
||||
);
|
||||
}
|
||||
|
||||
/** Publish readiness on the PR head without running contributor code. */
|
||||
export async function runReadinessCheck({ github, context, core }) {
|
||||
const number =
|
||||
context.payload.pull_request?.number ??
|
||||
Number(context.payload.inputs?.pull_request_number);
|
||||
if (!Number.isSafeInteger(number) || number <= 0)
|
||||
throw new Error("A positive pull request number is required.");
|
||||
const repository = context.repo;
|
||||
const getPull = async () =>
|
||||
(await github.rest.pulls.get({ ...repository, pull_number: number })).data;
|
||||
const pull = await getPull();
|
||||
if (pull.state !== "open" || !/^(?:main|release\/.+)$/u.test(pull.base.ref))
|
||||
return;
|
||||
const publish = (sha, verdict) =>
|
||||
github.rest.repos.createCommitStatus({
|
||||
...repository,
|
||||
sha,
|
||||
context: "PR readiness",
|
||||
...verdict,
|
||||
target_url: `${context.serverUrl}/${repository.owner}/${repository.repo}/actions/runs/${context.runId}`,
|
||||
});
|
||||
await publish(
|
||||
pull.head.sha,
|
||||
result("pending", "Checking the initial author readiness declaration."),
|
||||
);
|
||||
const template = await readFile(
|
||||
new URL("../../.github/pull_request_template.md", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
let verdict = evaluateReadiness(pull, template);
|
||||
if (verdict.state === "success") {
|
||||
const associated = await github.paginate(
|
||||
github.rest.repos.listPullRequestsAssociatedWithCommit,
|
||||
{ ...repository, commit_sha: pull.head.sha, per_page: 100 },
|
||||
);
|
||||
if (
|
||||
!associated.some(
|
||||
(other) =>
|
||||
other.number === number &&
|
||||
other.state === "open" &&
|
||||
other.head.sha === pull.head.sha,
|
||||
)
|
||||
)
|
||||
verdict = result(
|
||||
"pending",
|
||||
"GitHub has not confirmed this PR's head association; rerun PR readiness.",
|
||||
);
|
||||
else if (
|
||||
associated.some(
|
||||
(other) =>
|
||||
other.state === "open" &&
|
||||
other.number !== number &&
|
||||
other.head.sha === pull.head.sha,
|
||||
)
|
||||
)
|
||||
verdict = result(
|
||||
"failure",
|
||||
"Open PRs must have distinct head commits because GitHub shares commit statuses.",
|
||||
);
|
||||
}
|
||||
const latest = await getPull();
|
||||
if (latest.state !== "open") return;
|
||||
if (
|
||||
latest.head.sha !== pull.head.sha ||
|
||||
latest.body !== pull.body ||
|
||||
latest.draft !== pull.draft ||
|
||||
latest.base.ref !== pull.base.ref
|
||||
)
|
||||
verdict = result(
|
||||
"pending",
|
||||
"PR changed during the check; wait for the latest run or rerun PR readiness.",
|
||||
);
|
||||
await publish(latest.head.sha, verdict);
|
||||
core.info(verdict.description);
|
||||
if (verdict.state === "failure") core.setFailed(verdict.description);
|
||||
return verdict;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
export function selectRecoveryRelease(input: {
|
||||
repository: string;
|
||||
version: string;
|
||||
run: unknown;
|
||||
jobs: unknown;
|
||||
release: unknown;
|
||||
tagSha: string;
|
||||
}): {
|
||||
version: string;
|
||||
source_sha: string;
|
||||
run_id: number;
|
||||
run_attempt: number;
|
||||
};
|
||||
|
||||
export function verifyRecoveryPackage(input: {
|
||||
directory: string;
|
||||
sourceSha: string;
|
||||
runId: number;
|
||||
runAttempt: number;
|
||||
version: string;
|
||||
integrity: string;
|
||||
}): Promise<{
|
||||
version: string;
|
||||
sourceSha: string;
|
||||
runId: number;
|
||||
runAttempt: number;
|
||||
integrity: string;
|
||||
}>;
|
||||
@@ -0,0 +1,222 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { appendFile, readFile } from "node:fs/promises";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { promisify } from "node:util";
|
||||
import { valid } from "semver";
|
||||
import { z } from "zod";
|
||||
|
||||
import {
|
||||
validateVerifiedPackage,
|
||||
verifyPublishedPackageIntegrity,
|
||||
} from "./verified-package.mjs";
|
||||
|
||||
const execute = promisify(execFile);
|
||||
const sha = z.string().regex(/^[a-f0-9]{40}$/u);
|
||||
const positive = z.coerce
|
||||
.number()
|
||||
.int()
|
||||
.positive()
|
||||
.max(Number.MAX_SAFE_INTEGER);
|
||||
const versionSchema = z
|
||||
.string()
|
||||
.refine(
|
||||
(value) => valid(value) === value && !value.includes("+"),
|
||||
"Expected an exact release version without build metadata",
|
||||
);
|
||||
const repositorySchema = z.string().regex(/^[\w.-]+\/[\w.-]+$/u);
|
||||
|
||||
/** Require the original release's successful qualification and npm write. */
|
||||
export function selectRecoveryRelease({
|
||||
repository,
|
||||
version,
|
||||
run,
|
||||
jobs,
|
||||
release,
|
||||
tagSha,
|
||||
}) {
|
||||
repositorySchema.parse(repository);
|
||||
versionSchema.parse(version);
|
||||
sha.parse(tagSha);
|
||||
const original = z
|
||||
.object({
|
||||
id: positive,
|
||||
run_attempt: positive,
|
||||
path: z.literal(".github/workflows/release.yml"),
|
||||
event: z.literal("pull_request"),
|
||||
status: z.literal("completed"),
|
||||
repository: z.object({ full_name: z.literal(repository) }),
|
||||
head_repository: z.object({ full_name: z.literal(repository) }),
|
||||
})
|
||||
.parse(run);
|
||||
z.object({
|
||||
tag_name: z.literal(`rea-agents-${version}`),
|
||||
draft: z.literal(false),
|
||||
published_at: z.string().min(1),
|
||||
}).parse(release);
|
||||
const parsedJobs = z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
status: z.string(),
|
||||
conclusion: z.string().nullable(),
|
||||
steps: z
|
||||
.array(
|
||||
z.object({ name: z.string(), conclusion: z.string().nullable() }),
|
||||
)
|
||||
.default([]),
|
||||
}),
|
||||
)
|
||||
.parse(jobs);
|
||||
const requireJob = (name) => {
|
||||
const matches = parsedJobs.filter((job) => job.name === name);
|
||||
if (matches.length !== 1 || matches[0].status !== "completed")
|
||||
throw new Error(`Expected one completed original job: ${name}`);
|
||||
return matches[0];
|
||||
};
|
||||
for (const name of [
|
||||
"Release reviewed main merge",
|
||||
"Qualify exact release revision / CI required",
|
||||
])
|
||||
if (requireJob(name).conclusion !== "success")
|
||||
throw new Error(`Original release did not pass ${name}`);
|
||||
const publish = requireJob("Publish to npm");
|
||||
const writes = publish.steps.filter((step) => step.name === "Publish");
|
||||
const verified = publish.steps.filter(
|
||||
(step) => step.name === "Verify published npm bytes and dist-tag",
|
||||
);
|
||||
if (
|
||||
!(
|
||||
(writes.length === 1 && writes[0].conclusion === "success") ||
|
||||
(verified.length === 1 && verified[0].conclusion === "success")
|
||||
)
|
||||
)
|
||||
throw new Error(
|
||||
"Original npm publication did not succeed or verify existing bytes",
|
||||
);
|
||||
return {
|
||||
version,
|
||||
source_sha: tagSha,
|
||||
run_id: original.id,
|
||||
run_attempt: original.run_attempt,
|
||||
};
|
||||
}
|
||||
|
||||
/** Bind existing npm bytes to the original qualified archive, without rebuilding it. */
|
||||
export async function verifyRecoveryPackage({
|
||||
directory,
|
||||
sourceSha,
|
||||
runId,
|
||||
runAttempt,
|
||||
version,
|
||||
integrity,
|
||||
}) {
|
||||
const tarball = await validateVerifiedPackage({
|
||||
directory,
|
||||
sourceSha,
|
||||
runId,
|
||||
runAttempt,
|
||||
packageVersion: version,
|
||||
nodeVersion: process.version,
|
||||
});
|
||||
await verifyPublishedPackageIntegrity(tarball, integrity);
|
||||
return { version, sourceSha, runId, runAttempt, integrity };
|
||||
}
|
||||
|
||||
async function command(program, args, cwd) {
|
||||
return (
|
||||
await execute(program, args, { cwd, maxBuffer: 16 * 1024 * 1024 })
|
||||
).stdout.trim();
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const [operation, ...extra] = process.argv.slice(2);
|
||||
if (extra.length || !["resolve", "verify"].includes(operation))
|
||||
throw new Error(
|
||||
"Usage: node scripts/ci/release-recovery.mjs resolve|verify",
|
||||
);
|
||||
const version = versionSchema.parse(process.env.RECOVERY_VERSION);
|
||||
const runId = positive.parse(process.env.RECOVERY_RUN_ID);
|
||||
if (operation === "resolve") {
|
||||
if (process.env.GITHUB_REF !== "refs/heads/main")
|
||||
throw new Error("Run release recovery from main");
|
||||
const repository = repositorySchema.parse(process.env.GITHUB_REPOSITORY);
|
||||
const api = async (path) =>
|
||||
JSON.parse(await command("gh", ["api", `repos/${repository}/${path}`]));
|
||||
const run = await api(`actions/runs/${runId}`);
|
||||
const pages = z
|
||||
.array(z.object({ jobs: z.array(z.unknown()) }))
|
||||
.parse(
|
||||
JSON.parse(
|
||||
await command("gh", [
|
||||
"api",
|
||||
"--paginate",
|
||||
"--slurp",
|
||||
`repos/${repository}/actions/runs/${runId}/attempts/${positive.parse(run.run_attempt)}/jobs?per_page=100`,
|
||||
]),
|
||||
),
|
||||
);
|
||||
const release = await api(`releases/tags/rea-agents-${version}`);
|
||||
const tagSha = await command("git", [
|
||||
"rev-parse",
|
||||
"--verify",
|
||||
`refs/tags/rea-agents-${version}^{commit}`,
|
||||
]);
|
||||
const selection = selectRecoveryRelease({
|
||||
repository,
|
||||
version,
|
||||
run,
|
||||
jobs: pages.flatMap((page) => page.jobs),
|
||||
release,
|
||||
tagSha,
|
||||
});
|
||||
await appendFile(
|
||||
z.string().min(1).parse(process.env.GITHUB_OUTPUT),
|
||||
Object.entries(selection)
|
||||
.map(([key, value]) => `${key}=${value}\n`)
|
||||
.join(""),
|
||||
);
|
||||
process.stdout.write(`${JSON.stringify(selection)}\n`);
|
||||
return;
|
||||
}
|
||||
const sourceDirectory = z
|
||||
.string()
|
||||
.min(1)
|
||||
.parse(process.env.RECOVERY_SOURCE_DIRECTORY);
|
||||
const sourceSha = sha.parse(process.env.RECOVERY_SOURCE_SHA);
|
||||
if (
|
||||
(await command("git", ["rev-parse", "HEAD"], sourceDirectory)) !== sourceSha
|
||||
)
|
||||
throw new Error("Recovery checkout differs from the released source");
|
||||
z.object({ version: z.literal(version) }).parse(
|
||||
JSON.parse(await readFile(join(sourceDirectory, "package.json"), "utf8")),
|
||||
);
|
||||
const integrity = z
|
||||
.string()
|
||||
.parse(
|
||||
JSON.parse(
|
||||
await command("npm", [
|
||||
"view",
|
||||
`rea-agents@${version}`,
|
||||
"dist.integrity",
|
||||
"--json",
|
||||
"--registry=https://registry.npmjs.org",
|
||||
]),
|
||||
),
|
||||
);
|
||||
const result = await verifyRecoveryPackage({
|
||||
directory: z.string().min(1).parse(process.env.RECOVERY_ARTIFACT_DIRECTORY),
|
||||
sourceSha,
|
||||
runId,
|
||||
runAttempt: positive.parse(process.env.RECOVERY_RUN_ATTEMPT),
|
||||
version,
|
||||
integrity,
|
||||
});
|
||||
process.stdout.write(`${JSON.stringify(result)}\n`);
|
||||
}
|
||||
|
||||
if (
|
||||
process.argv[1] !== undefined &&
|
||||
resolve(process.argv[1]) === fileURLToPath(import.meta.url)
|
||||
)
|
||||
await main();
|
||||
@@ -3,6 +3,7 @@
|
||||
// every workflow.
|
||||
export const SCOPES = {
|
||||
reverse_tools: [
|
||||
".github/workflows/mutation.yml",
|
||||
"src/application/reverse/**",
|
||||
"src/application/binary/BinarySession.ts",
|
||||
"src/cutter/**",
|
||||
@@ -23,6 +24,7 @@ export const SCOPES = {
|
||||
"tests/composition/analysis-sessions/binarySession.test.ts",
|
||||
"tests/boundary/filesystem/directAnalysisSnapshotReplay.test.ts",
|
||||
"tests/boundary/filesystem/reverseToolsMutationConfig.test.ts",
|
||||
"tests/boundary/filesystem/mutationWorkflow.test.ts",
|
||||
"src/server/registerRizinDebugTools.ts",
|
||||
"tests/boundary/providers/CutterBridge*.test.ts",
|
||||
"tests/boundary/providers/cutterBridgeProducer.test.ts",
|
||||
@@ -88,6 +90,19 @@ export const SCOPES = {
|
||||
],
|
||||
// Four-host installed-package matrix and the Windows curated lane.
|
||||
package: [
|
||||
".github/actions/publish-mcp/**",
|
||||
".github/actions/prepare-release-package/**",
|
||||
".github/workflows/release-recovery.yml",
|
||||
"scripts/ci/release-recovery.mjs",
|
||||
"scripts/ci/verified-package.mjs",
|
||||
"scripts/ci/npm-release.*",
|
||||
"scripts/verify-release-artifact.mjs",
|
||||
"scripts/lib/release-package-canary.mjs",
|
||||
"scripts/verify-published-package.mjs",
|
||||
"tests/boundary/filesystem/releaseRecovery.test.ts",
|
||||
"tests/boundary/filesystem/mcpRegistryPublication.test.ts",
|
||||
"tests/boundary/filesystem/npmRelease.test.ts",
|
||||
"tests/boundary/process/releaseArtifactCanary.test.ts",
|
||||
"src/windows/**",
|
||||
"native/windows/**",
|
||||
"src/process/capture/FilesystemSnapshot.ts",
|
||||
@@ -123,6 +138,7 @@ export const SCOPES = {
|
||||
"src/domain/javascript/javascriptRuntimeStaticCandidates.ts",
|
||||
"tests/boundary/filesystem/webScriptManifestPaths.test.ts",
|
||||
"tests/boundary/process/ProcessEvidence.host.test.ts",
|
||||
"tests/boundary/process/windowsOutputCapture.test.ts",
|
||||
"tests/acceptance/webModuleCli.test.ts",
|
||||
"tests/acceptance/webSourceLocationCli.test.ts",
|
||||
"tests/boundary/cli/referenceSourceImportStatus.test.ts",
|
||||
|
||||
@@ -5,6 +5,7 @@ import { copyFile, readFile, writeFile } from "node:fs/promises";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { promisify } from "node:util";
|
||||
import { valid } from "semver";
|
||||
|
||||
const MANIFEST_NAME = "manifest.json";
|
||||
const TARBALL_NAME = "package.tgz";
|
||||
@@ -78,7 +79,7 @@ export async function retainVerifiedPackage({
|
||||
}
|
||||
|
||||
/** Validate a retained package against the current checkout and workflow attempt. */
|
||||
async function validateVerifiedPackage({
|
||||
export async function validateVerifiedPackage({
|
||||
directory,
|
||||
sourceSha,
|
||||
runId,
|
||||
@@ -155,6 +156,8 @@ function validateManifestShape(manifest) {
|
||||
])
|
||||
if (typeof manifest[key] !== "string" || manifest[key].length === 0)
|
||||
throw new Error(`Verified package manifest has an invalid ${key}`);
|
||||
if (valid(manifest.packageVersion) !== manifest.packageVersion)
|
||||
throw new Error("Verified package manifest has an invalid package version");
|
||||
if (
|
||||
typeof manifest.sha256 !== "string" ||
|
||||
!/^[a-f0-9]{64}$/u.test(manifest.sha256)
|
||||
@@ -173,6 +176,16 @@ async function sha256File(path) {
|
||||
return hash.digest("hex");
|
||||
}
|
||||
|
||||
/** Require the registry to serve the exact archive selected for publication. */
|
||||
export async function verifyPublishedPackageIntegrity(tarball, integrity) {
|
||||
const hash = createHash("sha512");
|
||||
for await (const chunk of createReadStream(tarball)) hash.update(chunk);
|
||||
if (integrity !== `sha512-${hash.digest("base64")}`)
|
||||
throw new Error(
|
||||
"Published npm integrity differs from the original qualified package",
|
||||
);
|
||||
}
|
||||
|
||||
async function validateFromCli(directory) {
|
||||
const sourceSha = process.env.GITHUB_SHA;
|
||||
const runId = parsePositiveInteger(
|
||||
@@ -202,10 +215,14 @@ async function validateFromCli(directory) {
|
||||
throw new Error(
|
||||
"GITHUB_OUTPUT is required to publish the validated tarball path",
|
||||
);
|
||||
await writeFile(process.env.GITHUB_OUTPUT, `tarball=${tarball}\n`, {
|
||||
encoding: "utf8",
|
||||
flag: "a",
|
||||
});
|
||||
await writeFile(
|
||||
process.env.GITHUB_OUTPUT,
|
||||
`tarball=${tarball}\nversion=${packageJson.version}\n`,
|
||||
{
|
||||
encoding: "utf8",
|
||||
flag: "a",
|
||||
},
|
||||
);
|
||||
process.stdout.write(`${tarball}\n`);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import { createHash } from "node:crypto";
|
||||
import {
|
||||
mkdir,
|
||||
readFile,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { mkdirSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { estimateTokenCount } from "tokenx";
|
||||
|
||||
const sourceRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const outputDirectory = resolve(
|
||||
process.env.REA_MCP_STARTUP_OUTPUT ?? join(sourceRoot, ".cache/mcp-startup-probe"),
|
||||
);
|
||||
const iterations = 5;
|
||||
const requestTimeoutMs = 180_000;
|
||||
const packageManifestPath = resolve(
|
||||
sourceRoot,
|
||||
".cache/verified-package/manifest.json",
|
||||
);
|
||||
const packageArchivePath = resolve(
|
||||
sourceRoot,
|
||||
".cache/verified-package/package.tgz",
|
||||
);
|
||||
const packageManifest = JSON.parse(await readFile(packageManifestPath, "utf8"));
|
||||
const packageArchive = await readFile(packageArchivePath);
|
||||
const packageSha256 = createHash("sha256").update(packageArchive).digest("hex");
|
||||
const packageLockSha256 = createHash("sha256")
|
||||
.update(await readFile(join(sourceRoot, "package-lock.json")))
|
||||
.digest("hex");
|
||||
assert.equal(packageSha256, packageManifest.sha256, "verified package digest mismatch");
|
||||
assert.equal(
|
||||
packageManifest.sourceSha,
|
||||
process.env.REA_MCP_STARTUP_QUALIFIED_SHA,
|
||||
"package must match the exact qualification source",
|
||||
);
|
||||
assert.equal(process.version, "v24.18.0", "probe must use pinned Node 24.18.0");
|
||||
assert.equal(process.platform, "win32");
|
||||
await mkdir(outputDirectory, { recursive: true });
|
||||
|
||||
const metricsPreloadPath = join(outputDirectory, "server-metrics-preload.cjs");
|
||||
await writeFile(
|
||||
metricsPreloadPath,
|
||||
`const fs = require("node:fs");\n` +
|
||||
`const started = process.hrtime.bigint();\n` +
|
||||
`const startedUsage = process.resourceUsage();\n` +
|
||||
`const metricsPath = process.env.REA_MCP_STARTUP_METRICS_PATH;\n` +
|
||||
`process.on("exit", () => {\n` +
|
||||
` if (metricsPath === undefined) return;\n` +
|
||||
` const ended = process.hrtime.bigint();\n` +
|
||||
` const usage = process.resourceUsage();\n` +
|
||||
` fs.writeFileSync(metricsPath, JSON.stringify({\n` +
|
||||
` startedAt: new Date(Date.now() - Number(ended - started) / 1e6).toISOString(),\n` +
|
||||
` processElapsedMs: Number(ended - started) / 1e6,\n` +
|
||||
` userCPUTimeDeltaMicros: usage.userCPUTime - startedUsage.userCPUTime,\n` +
|
||||
` systemCPUTimeDeltaMicros: usage.systemCPUTime - startedUsage.systemCPUTime,\n` +
|
||||
` resourceUsageMaxRssRaw: usage.maxRSS,\n` +
|
||||
` resourceUsageMaxRssUnit: "raw Node process.resourceUsage().maxRSS value; platform unit not converted",\n` +
|
||||
` exitRssBytes: process.memoryUsage().rss\n` +
|
||||
` }) + "\\n");\n` +
|
||||
`});\n`,
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const report = {
|
||||
schemaVersion: 1,
|
||||
host: {
|
||||
platform: process.platform,
|
||||
architecture: process.arch,
|
||||
nodeVersion: process.version,
|
||||
npmVersion: process.env.REA_MCP_STARTUP_NPM_VERSION ?? null,
|
||||
cpuCount: Number(process.env.NUMBER_OF_PROCESSORS ?? 0) || null,
|
||||
osRelease: await import("node:os").then(({ release }) => release()),
|
||||
},
|
||||
diagnosticSha: process.env.GITHUB_SHA,
|
||||
sourcePackageLockSha256: packageLockSha256,
|
||||
package: {
|
||||
version: packageManifest.packageVersion,
|
||||
sourceSha: packageManifest.sourceSha,
|
||||
qualifiedRunId: packageManifest.runId,
|
||||
nodeVersion: packageManifest.nodeVersion,
|
||||
sha256: packageSha256,
|
||||
},
|
||||
conditions: {
|
||||
sourceEntry: "checked-out scripts/rea.mjs and locally source-built dist; first process starts after npm ci, build and artifact restoration",
|
||||
packagedEntry: "fresh npm install of the exact verified-release-package/package.tgz into an isolated prefix",
|
||||
samplesPerEntry: iterations,
|
||||
firstSampleMeaning: "first fresh server process after build or install; runner OS/filesystem/AV cache is uncontrolled and must not be called cold",
|
||||
subsequentSamples: "four additional fresh Node server processes; runner page cache may remain warm",
|
||||
providerDiscovery: "USERPROFILE/HOME/APPDATA/LOCALAPPDATA isolated per sample; no target selected and no provider engine launched",
|
||||
requestTimeoutMs,
|
||||
processFamilyMemory: "unmeasured; only the server Node process resourceUsage is reported",
|
||||
tokenEstimate: "tokenx estimate over every actual JSON-RPC message sent and received, including initialize, both tools/list calls, notifications and full results; estimate is not model billing",
|
||||
mcpExchanges: "complete parsed MCP JSON-RPC message objects are retained per sample, with monotonic elapsed offsets",
|
||||
instrumentation: "a minimal --require preload records one server Node process resourceUsage row on normal process exit",
|
||||
},
|
||||
entries: [],
|
||||
exchangeTotals: [],
|
||||
};
|
||||
|
||||
const installPrefix = process.env.REA_MCP_STARTUP_INSTALL_PREFIX;
|
||||
assert.ok(installPrefix, "REA_MCP_STARTUP_INSTALL_PREFIX is required");
|
||||
const entryOptions = [
|
||||
{
|
||||
name: "source-tree",
|
||||
packageRoot: sourceRoot,
|
||||
entrypoint: join(sourceRoot, "scripts/rea.mjs"),
|
||||
},
|
||||
{
|
||||
name: "installed-package",
|
||||
packageRoot: resolve(installPrefix),
|
||||
entrypoint: resolve(
|
||||
installPrefix,
|
||||
"node_modules/rea-agents/scripts/rea.mjs",
|
||||
),
|
||||
},
|
||||
];
|
||||
const selectedName = process.argv[2];
|
||||
assert.ok(
|
||||
entryOptions.some(({ name }) => name === selectedName),
|
||||
"pass either source-tree or installed-package",
|
||||
);
|
||||
const previousReportPath = join(outputDirectory, "mcp-startup-report.json");
|
||||
if (selectedName === "installed-package") {
|
||||
try {
|
||||
const previousReport = JSON.parse(await readFile(previousReportPath, "utf8"));
|
||||
report.entries.push(...previousReport.entries);
|
||||
report.exchangeTotals.push(...(previousReport.exchangeTotals ?? []));
|
||||
report.totalEstimatedTokenCount = previousReport.totalEstimatedTokenCount ?? 0;
|
||||
} catch (cause) {
|
||||
if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT")
|
||||
throw cause;
|
||||
}
|
||||
}
|
||||
|
||||
for (const entry of entryOptions.filter(({ name }) => name === selectedName)) {
|
||||
assert.ok(entry.packageRoot, `${entry.name}: package root is required`);
|
||||
const entryReport = {
|
||||
name: entry.name,
|
||||
packageRoot: entry.packageRoot,
|
||||
serverEntrypoint: entry.entrypoint,
|
||||
samples: [],
|
||||
};
|
||||
report.entries.push(entryReport);
|
||||
|
||||
for (let iteration = 1; iteration <= iterations; iteration += 1) {
|
||||
const sampleStartedAt = new Date().toISOString();
|
||||
const sampleStarted = performance.now();
|
||||
const messageLog = [];
|
||||
const stderrChunks = [];
|
||||
const metricsPath = join(
|
||||
outputDirectory,
|
||||
`${entry.name}-${String(iteration).padStart(2, "0")}-server.json`,
|
||||
);
|
||||
const serverEnvironment = isolatedServerEnvironment(
|
||||
entry.name,
|
||||
iteration,
|
||||
metricsPreloadPath,
|
||||
metricsPath,
|
||||
);
|
||||
const transport = new StdioClientTransport({
|
||||
command: process.execPath,
|
||||
args: [entry.entrypoint, "mcp"],
|
||||
cwd: entry.packageRoot,
|
||||
env: serverEnvironment,
|
||||
stderr: "pipe",
|
||||
});
|
||||
transport.stderr?.on("data", (chunk) => stderrChunks.push(Buffer.from(chunk)));
|
||||
const elapsed = () => +(performance.now() - sampleStarted).toFixed(2);
|
||||
observeTransport(transport, messageLog, elapsed);
|
||||
const client = new Client({ name: "rea-1685-startup-probe", version: "1" });
|
||||
const sample = {
|
||||
iteration,
|
||||
firstProcessAfterBuildOrInstall: iteration === 1,
|
||||
startedAt: sampleStartedAt,
|
||||
launchElapsedMs: null,
|
||||
initializeElapsedMs: null,
|
||||
firstToolsListElapsedMs: null,
|
||||
firstToolsListDurationMs: null,
|
||||
warmToolsListElapsedMs: null,
|
||||
warmToolsListDurationMs: null,
|
||||
toolCount: null,
|
||||
firstToolsListResponseBytes: null,
|
||||
warmToolsListResponseBytes: null,
|
||||
firstToolsListWireRequests: 0,
|
||||
warmToolsListWireRequests: 0,
|
||||
serverVersion: null,
|
||||
closeRequestedElapsedMs: null,
|
||||
serverExitMetrics: null,
|
||||
serverExitMetricsError: null,
|
||||
stderr: "",
|
||||
stderrTruncated: false,
|
||||
stderrArtifact: null,
|
||||
stderrBytes: null,
|
||||
stderrSha256: null,
|
||||
messages: messageLog,
|
||||
error: null,
|
||||
completed: false,
|
||||
};
|
||||
entryReport.samples.push(sample);
|
||||
|
||||
try {
|
||||
const originalStart = transport.start.bind(transport);
|
||||
let startBegin;
|
||||
transport.start = async (...arguments_) => {
|
||||
startBegin = performance.now();
|
||||
await originalStart(...arguments_);
|
||||
sample.launchElapsedMs = +(performance.now() - startBegin).toFixed(2);
|
||||
};
|
||||
const connectBegin = performance.now();
|
||||
await client.connect(transport, { timeout: requestTimeoutMs });
|
||||
sample.initializeElapsedMs = +(performance.now() - connectBegin).toFixed(2);
|
||||
sample.serverVersion = client.getServerVersion() ?? null;
|
||||
|
||||
const priorToolListRequests = countToolListRequests(messageLog);
|
||||
const firstListBegin = performance.now();
|
||||
const firstList = await client.listTools(undefined, {
|
||||
timeout: requestTimeoutMs,
|
||||
});
|
||||
const firstListToolRequests = countToolListRequests(messageLog);
|
||||
sample.firstToolsListDurationMs = +(performance.now() - firstListBegin).toFixed(2);
|
||||
sample.firstToolsListElapsedMs = elapsed();
|
||||
sample.firstToolsListWireRequests =
|
||||
firstListToolRequests - priorToolListRequests;
|
||||
sample.toolCount = firstList.tools.length;
|
||||
sample.firstToolsListResponseBytes = Buffer.byteLength(
|
||||
JSON.stringify(firstList),
|
||||
);
|
||||
|
||||
const warmListBegin = performance.now();
|
||||
const warmList = await client.listTools(undefined, {
|
||||
timeout: requestTimeoutMs,
|
||||
cacheMode: "refresh",
|
||||
});
|
||||
sample.warmToolsListWireRequests =
|
||||
countToolListRequests(messageLog) - firstListToolRequests;
|
||||
sample.warmToolsListDurationMs = +(performance.now() - warmListBegin).toFixed(2);
|
||||
sample.warmToolsListElapsedMs = elapsed();
|
||||
sample.warmToolsListResponseBytes = Buffer.byteLength(
|
||||
JSON.stringify(warmList),
|
||||
);
|
||||
assert.equal(warmList.tools.length, firstList.tools.length);
|
||||
assert.ok(sample.firstToolsListWireRequests > 0, "first tools/list must reach the server");
|
||||
assert.ok(sample.warmToolsListWireRequests > 0, "warm tools/list must reach the server");
|
||||
sample.completed = true;
|
||||
} catch (cause) {
|
||||
sample.error = cause instanceof Error ? cause.stack ?? cause.message : String(cause);
|
||||
} finally {
|
||||
sample.closeRequestedElapsedMs = elapsed();
|
||||
try {
|
||||
await client.close();
|
||||
} catch (cause) {
|
||||
sample.error ??= `MCP client close failed: ${cause instanceof Error ? cause.message : String(cause)}`;
|
||||
}
|
||||
try {
|
||||
await transport.close();
|
||||
} catch (cause) {
|
||||
sample.error ??= `stdio transport close failed: ${cause instanceof Error ? cause.message : String(cause)}`;
|
||||
}
|
||||
const stderr = Buffer.concat(stderrChunks);
|
||||
const stderrPath = join(
|
||||
outputDirectory,
|
||||
`${entry.name}-${String(iteration).padStart(2, "0")}.stderr.log`,
|
||||
);
|
||||
await writeFile(stderrPath, stderr);
|
||||
sample.stderrArtifact = stderrPath;
|
||||
sample.stderrBytes = stderr.length;
|
||||
sample.stderrSha256 = createHash("sha256").update(stderr).digest("hex");
|
||||
sample.stderr = stderr.toString("utf8");
|
||||
if (stderr.length > 1_000_000) {
|
||||
sample.stderr = stderr.subarray(-1_000_000).toString("utf8");
|
||||
sample.stderrTruncated = true;
|
||||
}
|
||||
try {
|
||||
sample.serverExitMetrics = await readExitMetrics(metricsPath, 15_000);
|
||||
} catch (cause) {
|
||||
sample.serverExitMetricsError = cause instanceof Error ? cause.message : String(cause);
|
||||
}
|
||||
sample.totalElapsedMs = elapsed();
|
||||
sample.estimatedTokenCount = messageLog.reduce(
|
||||
(total, { json }) => total + estimateTokenCount(json),
|
||||
0,
|
||||
);
|
||||
sample.messageCount = messageLog.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
report.exchangeTotals = report.entries.flatMap(({ name, samples }) =>
|
||||
samples.map(({ iteration, messages, estimatedTokenCount, messageCount }) => ({
|
||||
entry: name,
|
||||
iteration,
|
||||
messageCount,
|
||||
estimatedTokenCount,
|
||||
transmittedUtf8Bytes: messages.reduce((total, { utf8Bytes }) => total + utf8Bytes, 0),
|
||||
})),
|
||||
);
|
||||
report.totalEstimatedTokenCount = report.exchangeTotals.reduce(
|
||||
(total, { estimatedTokenCount }) => total + estimatedTokenCount,
|
||||
0,
|
||||
);
|
||||
|
||||
const reportPath = join(outputDirectory, "mcp-startup-report.json");
|
||||
await writeFile(reportPath, `${JSON.stringify(report, null, 2)}\n`);
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
reportPath,
|
||||
diagnosticSha: report.diagnosticSha,
|
||||
runtimeQualifiedSha: report.package.sourceSha,
|
||||
packageSha256,
|
||||
nodeVersion: process.version,
|
||||
totalEstimatedTokenCount: report.totalEstimatedTokenCount,
|
||||
entries: report.entries.map(({ name, samples }) => ({
|
||||
name,
|
||||
samples: samples.map((sample) => ({
|
||||
iteration: sample.iteration,
|
||||
launchElapsedMs: sample.launchElapsedMs,
|
||||
initializeElapsedMs: sample.initializeElapsedMs,
|
||||
firstToolsListDurationMs: sample.firstToolsListDurationMs,
|
||||
warmToolsListDurationMs: sample.warmToolsListDurationMs,
|
||||
toolCount: sample.toolCount,
|
||||
serverMaxRssRaw: sample.serverExitMetrics?.resourceUsageMaxRssRaw ?? null,
|
||||
completed: sample.completed,
|
||||
error: sample.error,
|
||||
})),
|
||||
})),
|
||||
})}\n`);
|
||||
|
||||
if (
|
||||
report.entries.some(({ samples }) =>
|
||||
samples.some(({ completed, serverExitMetrics }) => !completed || serverExitMetrics === null),
|
||||
)
|
||||
)
|
||||
process.exitCode = 1;
|
||||
|
||||
function isolatedServerEnvironment(entryName, iteration, preloadPath, metricsPath) {
|
||||
const sampleRoot = join(
|
||||
tmpdir(),
|
||||
"rea-1685-mcp-startup",
|
||||
`${entryName}-${String(iteration).padStart(2, "0")}`,
|
||||
);
|
||||
const home = join(sampleRoot, "home");
|
||||
const appData = join(sampleRoot, "appdata");
|
||||
const localAppData = join(sampleRoot, "localappdata");
|
||||
const temp = join(sampleRoot, "temp");
|
||||
for (const path of [home, appData, localAppData, temp])
|
||||
requireMkdir(path);
|
||||
const environment = {};
|
||||
for (const key of [
|
||||
"PATH",
|
||||
"SystemRoot",
|
||||
"WINDIR",
|
||||
"ComSpec",
|
||||
"SystemDrive",
|
||||
"ProgramFiles",
|
||||
"ProgramW6432",
|
||||
]) {
|
||||
const value = process.env[key];
|
||||
if (value !== undefined) environment[key] = value;
|
||||
}
|
||||
Object.assign(environment, {
|
||||
USERPROFILE: home,
|
||||
HOME: home,
|
||||
APPDATA: appData,
|
||||
LOCALAPPDATA: localAppData,
|
||||
TEMP: temp,
|
||||
TMP: temp,
|
||||
NODE_OPTIONS: `--require=${preloadPath}`,
|
||||
REA_MCP_STARTUP_METRICS_PATH: metricsPath,
|
||||
});
|
||||
return environment;
|
||||
}
|
||||
|
||||
function requireMkdir(path) {
|
||||
mkdirSync(path, { recursive: true });
|
||||
}
|
||||
|
||||
function observeTransport(transport, messages, elapsed) {
|
||||
const originalSend = transport.send.bind(transport);
|
||||
transport.send = async (message, ...arguments_) => {
|
||||
recordMessage("client-to-server", message, messages, elapsed);
|
||||
return originalSend(message, ...arguments_);
|
||||
};
|
||||
|
||||
let messageHandler = transport.onmessage;
|
||||
Object.defineProperty(transport, "onmessage", {
|
||||
configurable: true,
|
||||
get: () => messageHandler,
|
||||
set: (handler) => {
|
||||
messageHandler =
|
||||
typeof handler === "function"
|
||||
? (message) => {
|
||||
recordMessage("server-to-client", message, messages, elapsed);
|
||||
return handler(message);
|
||||
}
|
||||
: handler;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function recordMessage(direction, message, messages, elapsed) {
|
||||
const json = JSON.stringify(message);
|
||||
messages.push({
|
||||
direction,
|
||||
method: typeof message?.method === "string" ? message.method : null,
|
||||
id: typeof message?.id === "string" || typeof message?.id === "number" ? message.id : null,
|
||||
elapsedMs: elapsed(),
|
||||
utf8Bytes: Buffer.byteLength(json),
|
||||
json,
|
||||
});
|
||||
}
|
||||
|
||||
function countToolListRequests(messages) {
|
||||
return messages.filter(
|
||||
(message) =>
|
||||
message.direction === "client-to-server" && message.method === "tools/list",
|
||||
).length;
|
||||
}
|
||||
|
||||
async function readExitMetrics(path, timeoutMs) {
|
||||
const deadline = performance.now() + timeoutMs;
|
||||
while (performance.now() < deadline) {
|
||||
try {
|
||||
return JSON.parse(await readFile(path, "utf8"));
|
||||
} catch (cause) {
|
||||
if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT")
|
||||
throw cause;
|
||||
await new Promise((resolvePromise) => setTimeout(resolvePromise, 100));
|
||||
}
|
||||
}
|
||||
throw new Error(`Server process did not write exit metrics within ${timeoutMs} ms`);
|
||||
}
|
||||
@@ -12,6 +12,20 @@ import { browserScenarioSchema } from "../../dist/domain/browserScenario.js";
|
||||
import { runScenarioCli } from "./browser-scenario-verifier.mjs";
|
||||
import { verifyScenarioPolicySetup } from "./browser-scenario-service-worker-setup-e2e.mjs";
|
||||
|
||||
const diagnosticError = (error) =>
|
||||
error instanceof Error
|
||||
? {
|
||||
name: error.name,
|
||||
message: error.message.slice(0, 1_000),
|
||||
reason: error.reason,
|
||||
stack: error.stack?.slice(0, 2_000),
|
||||
cause:
|
||||
error.cause instanceof Error
|
||||
? error.cause.stack?.slice(0, 3_000)
|
||||
: typeof error.cause,
|
||||
}
|
||||
: { kind: typeof error };
|
||||
|
||||
const startSite = async () => {
|
||||
let otherOrigin;
|
||||
const server = createServer((request, response) => {
|
||||
@@ -83,6 +97,7 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
|
||||
first.setOtherOrigin(second.origin);
|
||||
second.setOtherOrigin(first.origin);
|
||||
const observer = await chromium.connectOverCDP(endpoint);
|
||||
console.log("Service-worker fixture browser:", observer.version());
|
||||
let provider = createBrowserScenarioProvider(process.env);
|
||||
let session;
|
||||
let failure;
|
||||
@@ -129,14 +144,19 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
|
||||
true,
|
||||
);
|
||||
};
|
||||
const assertRejected = async (scenario) => {
|
||||
const assertRejected = async (scenario, expectedReason) => {
|
||||
const result = await provider.captureScenario(scenario);
|
||||
assert.equal(
|
||||
result.ok,
|
||||
false,
|
||||
"Worker-influenced capture unexpectedly succeeded",
|
||||
);
|
||||
assert.equal(result.error.reason, "target_not_allowed");
|
||||
assert.equal(result.error.reason, expectedReason);
|
||||
if (expectedReason === "service_worker_blocked")
|
||||
assert.match(
|
||||
result.error.userMessage,
|
||||
/environment\.service_workers to allow/,
|
||||
);
|
||||
assert.equal(
|
||||
result.error.partialObservation.capture.browser.cleanup,
|
||||
"disconnected-external",
|
||||
@@ -154,7 +174,42 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
|
||||
state: "visible",
|
||||
},
|
||||
]);
|
||||
const cleanCapture = (await runScenarioCli(clean)).normalized_result;
|
||||
let cleanCapture;
|
||||
try {
|
||||
cleanCapture = (await runScenarioCli(clean)).normalized_result;
|
||||
} catch (cause) {
|
||||
// Retain the original failure. One bounded replay navigates only this
|
||||
// verifier-owned target and exposes causes the CLI does not serialize.
|
||||
const state = await page
|
||||
.locator("#state")
|
||||
.evaluate(
|
||||
(element) => ({
|
||||
text: element.textContent?.slice(0, 100),
|
||||
blocked: element.getAttribute("data-blocked"),
|
||||
nativeRegister: navigator.serviceWorker.register
|
||||
.toString()
|
||||
.includes("[native code]"),
|
||||
}),
|
||||
undefined,
|
||||
{ timeout: 1_000 },
|
||||
)
|
||||
.catch((error) => ({ unavailable: String(error).slice(0, 500) }));
|
||||
console.error("Service-worker CLI failure state:", {
|
||||
url: page.url(),
|
||||
state,
|
||||
});
|
||||
const replay = await provider
|
||||
.captureScenario(clean, { signal: AbortSignal.timeout(5_000) })
|
||||
.then((result) =>
|
||||
result.ok ? { ok: true } : diagnosticError(result.error),
|
||||
)
|
||||
.catch(diagnosticError);
|
||||
console.error(
|
||||
"Service-worker diagnostic replay (original CLI failure retained):",
|
||||
replay,
|
||||
);
|
||||
throw cause;
|
||||
}
|
||||
assert.ok(cleanCapture.steps.every(({ status }) => status === "completed"));
|
||||
assert.equal(cleanCapture.browser.cleanup, "disconnected-external");
|
||||
await assertRestored();
|
||||
@@ -179,7 +234,7 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
|
||||
"worker",
|
||||
);
|
||||
await page.goto("about:blank");
|
||||
await assertRejected(scenarioFor(second.origin));
|
||||
await assertRejected(scenarioFor(second.origin), "service_worker_blocked");
|
||||
await page.goto("about:blank");
|
||||
await assertRejected(
|
||||
scenarioFor(first.origin, [
|
||||
@@ -190,6 +245,7 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
|
||||
wait_until: "load",
|
||||
},
|
||||
]),
|
||||
"service_worker_blocked",
|
||||
);
|
||||
await page.goto("about:blank");
|
||||
await assertRejected(
|
||||
@@ -201,9 +257,13 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
|
||||
},
|
||||
{ step_id: "loaded", action: "wait_for_timeout", duration_ms: 100 },
|
||||
]),
|
||||
"service_worker_blocked",
|
||||
);
|
||||
await page.goto("about:blank");
|
||||
await assertRejected(scenarioFor(`${first.origin}/frame`));
|
||||
await assertRejected(
|
||||
scenarioFor(`${first.origin}/frame`),
|
||||
"service_worker_blocked",
|
||||
);
|
||||
|
||||
const allowed = await provider.captureScenario(
|
||||
scenarioFor(second.origin, [], "allow"),
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
export interface GhidraVerifierTimeouts {
|
||||
readonly clientOptions: {
|
||||
readonly startupTimeoutMs: number;
|
||||
};
|
||||
readonly requestOptions: {
|
||||
readonly timeout: number;
|
||||
};
|
||||
}
|
||||
|
||||
/** Resolve one verifier-owned timeout policy before target I/O or allocation. */
|
||||
export function resolveGhidraVerifierTimeouts(
|
||||
environment: Readonly<Record<string, string | undefined>>,
|
||||
): GhidraVerifierTimeouts;
|
||||
|
||||
export interface GhidraVerifierMcpClient {
|
||||
connect(
|
||||
transport: unknown,
|
||||
options: GhidraVerifierTimeouts["requestOptions"],
|
||||
): Promise<void>;
|
||||
callTool(
|
||||
request: unknown,
|
||||
options: GhidraVerifierTimeouts["requestOptions"],
|
||||
): Promise<unknown>;
|
||||
}
|
||||
|
||||
/** Bind every verifier MCP operation to the same owned request budget. */
|
||||
export function createGhidraVerifierMcpOperations(
|
||||
client: GhidraVerifierMcpClient,
|
||||
requestOptions: GhidraVerifierTimeouts["requestOptions"],
|
||||
): {
|
||||
connect(transport: unknown): Promise<void>;
|
||||
callTool(request: unknown): Promise<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
import { parseConfig } from "../../dist/config/parseConfig.js";
|
||||
|
||||
const FILE_OFFSET_OPERATION_TIMEOUT_MS = 240_000;
|
||||
const MAX_TIMER_DELAY_MS = 2_147_483_647;
|
||||
|
||||
/** Resolve one verifier-owned timeout policy before target I/O or allocation. */
|
||||
export function resolveGhidraVerifierTimeouts(environment) {
|
||||
const configuration = parseConfig(environment);
|
||||
if (!configuration.ok) throw configuration.error;
|
||||
const startupTimeoutMs = configuration.value.ghidraStartupTimeoutMs;
|
||||
// A cold public query includes provider startup before its analysis request.
|
||||
// Preserve the operation budget after the caller-selected startup deadline.
|
||||
const publicRequestTimeoutMs =
|
||||
startupTimeoutMs + FILE_OFFSET_OPERATION_TIMEOUT_MS;
|
||||
if (publicRequestTimeoutMs > MAX_TIMER_DELAY_MS)
|
||||
throw new RangeError(
|
||||
"The Ghidra startup and verification operation budgets exceed the Node.js timer limit.",
|
||||
);
|
||||
return {
|
||||
clientOptions: { startupTimeoutMs },
|
||||
requestOptions: { timeout: publicRequestTimeoutMs },
|
||||
};
|
||||
}
|
||||
|
||||
/** Bind every verifier MCP operation to the same owned request budget. */
|
||||
export function createGhidraVerifierMcpOperations(client, requestOptions) {
|
||||
return {
|
||||
connect: (transport) => client.connect(transport, requestOptions),
|
||||
callTool: (request) => client.callTool(request, requestOptions),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
export interface GhidraFileOffsetVerification {
|
||||
readonly cli_mcp_parity: true;
|
||||
readonly explicit_and_numeric_offsets: true;
|
||||
readonly invalid_and_unmapped_offsets: true;
|
||||
readonly mapped_offset_without_procedure: true;
|
||||
readonly ambiguous_mappings: "verified" | "unavailable-single-section";
|
||||
readonly source_unchanged: true;
|
||||
readonly cleanup: "complete";
|
||||
}
|
||||
|
||||
/** Exercise file coordinates through public CLI/MCP using a source-owned PE fixture. */
|
||||
export function verifyGhidraFileOffsets(
|
||||
targetPath: string,
|
||||
entrypoint: string,
|
||||
procedure: string,
|
||||
): Promise<GhidraFileOffsetVerification>;
|
||||
@@ -14,6 +14,10 @@ import { promisify } from "node:util";
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { parseEvidence } from "../../dist/domain/evidence.js";
|
||||
import {
|
||||
createGhidraVerifierMcpOperations,
|
||||
resolveGhidraVerifierTimeouts,
|
||||
} from "./ghidra-verifier-timeouts.mjs";
|
||||
import {
|
||||
requireMcpOperationResult,
|
||||
requireMcpToolError,
|
||||
@@ -26,17 +30,22 @@ export async function verifyGhidraFileOffsets(
|
||||
entrypoint,
|
||||
procedure,
|
||||
) {
|
||||
const environment = {
|
||||
...process.env,
|
||||
REA_ANALYSIS_PROVIDER: "ghidra",
|
||||
REA_LOG_LEVEL: "silent",
|
||||
};
|
||||
const { requestOptions } = resolveGhidraVerifierTimeouts(environment);
|
||||
const timeoutMs = requestOptions.timeout;
|
||||
const original = await readFile(targetPath);
|
||||
const workspace = await mkdtemp(join(tmpdir(), "rea-file-offsets-"));
|
||||
const runtime = join(workspace, "runtime");
|
||||
await mkdir(runtime);
|
||||
const env = {
|
||||
...process.env,
|
||||
...environment,
|
||||
TEMP: runtime,
|
||||
TMP: runtime,
|
||||
TMPDIR: runtime,
|
||||
REA_ANALYSIS_PROVIDER: "ghidra",
|
||||
REA_LOG_LEVEL: "silent",
|
||||
};
|
||||
const client = new Client({ name: "rea-file-offsets", version: "1" });
|
||||
const transport = new StdioClientTransport({
|
||||
@@ -45,21 +54,19 @@ export async function verifyGhidraFileOffsets(
|
||||
env,
|
||||
stderr: "pipe",
|
||||
});
|
||||
const mcp = createGhidraVerifierMcpOperations(client, requestOptions);
|
||||
let connected = false;
|
||||
let complete = false;
|
||||
let primaryFailure;
|
||||
const call = async (name, arguments_ = {}) => {
|
||||
const result = await client.callTool(
|
||||
{ name, arguments: arguments_ },
|
||||
{ timeout: 240_000 },
|
||||
);
|
||||
const result = await mcp.callTool({ name, arguments: arguments_ });
|
||||
const projected = requireMcpOperationResult(result, name);
|
||||
return ["open_binary", "binary_session", "close_binary"].includes(name)
|
||||
? projected
|
||||
: (result.structuredContent ?? JSON.parse(mcpTextValue(result)));
|
||||
};
|
||||
try {
|
||||
await client.connect(transport);
|
||||
await mcp.connect(transport);
|
||||
connected = true;
|
||||
await call("open_binary", { path: targetPath, provider_id: "ghidra" });
|
||||
const session = await call("binary_session");
|
||||
@@ -90,12 +97,12 @@ export async function verifyGhidraFileOffsets(
|
||||
),
|
||||
);
|
||||
}
|
||||
const invalid = await client.callTool({
|
||||
const invalid = await mcp.callTool({
|
||||
name: "procedure_pseudo_code",
|
||||
arguments: { procedure: "file-offset:0x20000000000000" },
|
||||
});
|
||||
assert.equal(requireMcpToolError(invalid).code, "invalid_request");
|
||||
const unmapped = await client.callTool({
|
||||
const unmapped = await mcp.callTool({
|
||||
name: "procedure_pseudo_code",
|
||||
arguments: { procedure: "file-offset:0x100000" },
|
||||
});
|
||||
@@ -122,7 +129,7 @@ export async function verifyGhidraFileOffsets(
|
||||
assert.equal(headerOffset.normalized_result.file_offset, 0);
|
||||
for (const selector of ["file-offset:0x0", "0x0"]) {
|
||||
const missing = requireMcpToolError(
|
||||
await client.callTool({
|
||||
await mcp.callTool({
|
||||
name: "procedure_pseudo_code",
|
||||
arguments: { procedure: selector },
|
||||
}),
|
||||
@@ -147,7 +154,7 @@ export async function verifyGhidraFileOffsets(
|
||||
"ghidra",
|
||||
"--json",
|
||||
],
|
||||
{ env, timeout: 240_000, maxBuffer: 16 * 1024 * 1024 },
|
||||
{ env, timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024 },
|
||||
)
|
||||
).stdout,
|
||||
);
|
||||
@@ -164,7 +171,7 @@ export async function verifyGhidraFileOffsets(
|
||||
"ghidra",
|
||||
"--json",
|
||||
],
|
||||
{ env, timeout: 240_000, maxBuffer: 16 * 1024 * 1024 },
|
||||
{ env, timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024 },
|
||||
).then(
|
||||
() => {
|
||||
throw new Error(
|
||||
@@ -183,13 +190,10 @@ export async function verifyGhidraFileOffsets(
|
||||
const ambiguousPath = join(workspace, "ambiguous.exe");
|
||||
await writeFile(ambiguousPath, alias);
|
||||
await call("open_binary", { path: ambiguousPath, provider_id: "ghidra" });
|
||||
const ambiguous = await client.callTool(
|
||||
{
|
||||
name: "procedure_pseudo_code",
|
||||
arguments: { procedure: `file-offset:${coordinate}` },
|
||||
},
|
||||
{ timeout: 240_000 },
|
||||
);
|
||||
const ambiguous = await mcp.callTool({
|
||||
name: "procedure_pseudo_code",
|
||||
arguments: { procedure: `file-offset:${coordinate}` },
|
||||
});
|
||||
assert.ok(
|
||||
JSON.stringify(requireMcpToolError(ambiguous)).includes(
|
||||
"multiple loaded mappings",
|
||||
|
||||
@@ -98,9 +98,9 @@ export async function readReleaseHistory(run, base, target) {
|
||||
return { base: baseSha, target: targetSha, commits };
|
||||
}
|
||||
|
||||
// REA history maps Anthropic and Cursor's agent trailers to ordinary User actors.
|
||||
// GitHub maps these coding-agent trailers to ordinary User actors.
|
||||
// Keep those source identities in the inventory while excluding automation credit.
|
||||
const AGENT_ACCOUNTS = new Set(["claude", "cursoragent"]);
|
||||
const AGENT_ACCOUNTS = new Set(["claude", "cursoragent", "codex"]);
|
||||
// REA's maintainer requested external-contributor thanks without self-credit.
|
||||
const MAINTAINER_ACCOUNTS = new Set(["morluto"]);
|
||||
const human = (value) =>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { execFile } from "node:child_process";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
import { CATALOG_IDENTITY } from "../../dist/catalogIdentity.js";
|
||||
import { TOOL_CONTRACTS } from "../../dist/contracts/toolContracts.js";
|
||||
import {
|
||||
requireMcpLifecycleResult,
|
||||
sortVerifierNames,
|
||||
} from "./mcp-verifier-results.mjs";
|
||||
|
||||
const execute = promisify(execFile);
|
||||
|
||||
/** Install the selected archive or registry specifier before any protocol deadline. */
|
||||
export async function installCanaryPackage(specifier, workspace, environment) {
|
||||
const prefix = join(workspace, "installed");
|
||||
await execute(
|
||||
"npm",
|
||||
[
|
||||
"install",
|
||||
"--ignore-scripts",
|
||||
"--no-save",
|
||||
"--no-package-lock",
|
||||
"--no-audit",
|
||||
"--no-fund",
|
||||
"--prefix",
|
||||
prefix,
|
||||
specifier,
|
||||
],
|
||||
{ cwd: workspace, env: environment, maxBuffer: 16 * 1024 * 1024 },
|
||||
);
|
||||
return join(prefix, "node_modules", "rea-agents");
|
||||
}
|
||||
|
||||
/** Exercise the same installed CLI/MCP contract before and after publication. */
|
||||
export async function verifyInstalledCanaryPackage(
|
||||
packageRoot,
|
||||
version,
|
||||
workspace,
|
||||
environment,
|
||||
) {
|
||||
const installed = JSON.parse(
|
||||
await readFile(join(packageRoot, "package.json"), "utf8"),
|
||||
);
|
||||
if (installed.name !== "rea-agents" || installed.version !== version)
|
||||
throw new Error(
|
||||
`Installed package identity is ${installed.name}@${installed.version}, expected rea-agents@${version}`,
|
||||
);
|
||||
const launcher = join(packageRoot, "scripts", "rea.mjs");
|
||||
for (const option of ["--help", "--llms"])
|
||||
await execute(process.execPath, [launcher, option], {
|
||||
cwd: workspace,
|
||||
env: environment,
|
||||
maxBuffer: 16 * 1024 * 1024,
|
||||
});
|
||||
const transport = new StdioClientTransport({
|
||||
command: process.execPath,
|
||||
args: [launcher, "mcp"],
|
||||
cwd: workspace,
|
||||
env: environment,
|
||||
stderr: "pipe",
|
||||
});
|
||||
const client = new Client({ name: "release-package-canary", version: "1" });
|
||||
let stderr = "";
|
||||
transport.stderr?.on("data", (chunk) => {
|
||||
if (stderr.length < 16_384)
|
||||
stderr += chunk.toString("utf8").slice(0, 16_384 - stderr.length);
|
||||
});
|
||||
try {
|
||||
await client.connect(transport);
|
||||
const tools = await client.listTools();
|
||||
const toolNames = tools.tools.map(({ name }) => name);
|
||||
const canonicalToolNames = new Set(TOOL_CONTRACTS.map(({ name }) => name));
|
||||
const publishedToolNames = new Set(toolNames);
|
||||
const unknown = toolNames.filter((name) => !canonicalToolNames.has(name));
|
||||
const missing = [...canonicalToolNames].filter(
|
||||
(name) => !publishedToolNames.has(name),
|
||||
);
|
||||
if (
|
||||
toolNames.length === 0 ||
|
||||
publishedToolNames.size !== toolNames.length ||
|
||||
unknown.length ||
|
||||
missing.length
|
||||
)
|
||||
throw new Error(
|
||||
`Installed MCP exposed an invalid canonical tool catalog (${toolNames.length} tools, unknown: ${unknown.join(", ") || "none"}, missing: ${missing.join(", ") || "none"})`,
|
||||
);
|
||||
const status = requireMcpLifecycleResult(
|
||||
await client.callTool({ name: "binary_session", arguments: {} }),
|
||||
"binary_session",
|
||||
);
|
||||
const availability = sortVerifierNames(
|
||||
status.tool_availability.map(({ name }) => name),
|
||||
);
|
||||
if (
|
||||
JSON.stringify(availability) !==
|
||||
JSON.stringify(sortVerifierNames(canonicalToolNames))
|
||||
)
|
||||
throw new Error(
|
||||
"Installed binary_session omitted canonical tool availability",
|
||||
);
|
||||
return {
|
||||
mcpTools: toolNames.length,
|
||||
canonicalMcpTools: CATALOG_IDENTITY.counts.mcp_tools,
|
||||
};
|
||||
} catch (cause) {
|
||||
throw new Error(`Installed package MCP verification failed: ${stderr}`, {
|
||||
cause,
|
||||
});
|
||||
} finally {
|
||||
try {
|
||||
await client.close();
|
||||
} finally {
|
||||
await transport.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
import semver from "semver";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const version = process.argv[2];
|
||||
if (version === undefined || semver.valid(version) !== version) {
|
||||
console.error("Expected an exact SemVer version.");
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
process.stdout.write(semver.prerelease(version) === null ? "latest" : "next");
|
||||
export function releaseNpmTag(version) {
|
||||
if (version === undefined || semver.valid(version) !== version)
|
||||
throw new Error("Expected an exact SemVer version.");
|
||||
return semver.prerelease(version) === null ? "latest" : "next";
|
||||
}
|
||||
|
||||
if (
|
||||
process.argv[1] !== undefined &&
|
||||
resolve(process.argv[1]) === fileURLToPath(import.meta.url)
|
||||
)
|
||||
process.stdout.write(releaseNpmTag(process.argv[2]));
|
||||
+115
-4
@@ -1,6 +1,7 @@
|
||||
"""Exercise automatic route discovery and mistakes that break search metadata."""
|
||||
|
||||
import contextlib
|
||||
import errno
|
||||
import importlib.util
|
||||
import io
|
||||
import json
|
||||
@@ -9,13 +10,14 @@ import shutil
|
||||
import tempfile
|
||||
from threading import Thread
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
from http.server import ThreadingHTTPServer
|
||||
from urllib.error import HTTPError
|
||||
from urllib.request import urlopen
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import polib
|
||||
from website_i18n import Document, build_translations, checked_catalog, extract_catalogs, languages, reading_pages, read_runtime
|
||||
from website_i18n import Document, build_translations, checked_catalog, extract_catalogs, languages, prose_units, reading_pages, read_runtime
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
@@ -138,6 +140,106 @@ class WebsiteSearchChecks(unittest.TestCase):
|
||||
class WebsiteMaintenanceChecks(unittest.TestCase):
|
||||
"""Exercise contributor edits and the static preview through real consumers."""
|
||||
|
||||
def test_contributors_render_from_snapshot_and_reject_drift_without_rewriting(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
for name in ("public", "templates"):
|
||||
shutil.copytree(ROOT / "website" / name, root / "website" / name)
|
||||
page = root / "website/public/contributors/index.html"
|
||||
snapshot = root / "website/public/contributors/people.json"
|
||||
data = json.loads(snapshot.read_text())
|
||||
people = data["contributors"][:3]
|
||||
data["contributors"] = list(reversed(people))
|
||||
data["updated"] = "2026-10-15"
|
||||
snapshot.write_text(json.dumps(data))
|
||||
original = page.read_text()
|
||||
with self.assertRaisesRegex(ValueError, "Shared HTML is stale"):
|
||||
WEBSITE.sync_pages(root, check=True)
|
||||
self.assertEqual(page.read_text(), original)
|
||||
WEBSITE.sync_pages(root)
|
||||
source = page.read_text()
|
||||
doc = Document(source)
|
||||
cards = [node for node in doc.nodes if "data-contributor" in node.attrs]
|
||||
self.assertEqual([node.attrs["data-contributor"] for node in cards], sorted(
|
||||
(person["login"] for person in people), key=str.casefold,
|
||||
))
|
||||
links = [node.attrs["href"] for node in doc.nodes if node.attrs.get("class") == "contributor-card"]
|
||||
self.assertCountEqual(links, [person["html_url"] for person in people])
|
||||
self.assertIn('<time datetime="2026-10-15" translate="no">2026-10-15</time>', source)
|
||||
self.assertEqual(WEBSITE.sync_pages(root), [])
|
||||
translated_units = [unit[1] for unit in prose_units(source, "contributors/index.html")]
|
||||
for person in people:
|
||||
self.assertFalse(any(person["login"] in unit for unit in translated_units))
|
||||
|
||||
def test_contributor_refresh_collects_all_pages_and_preserves_snapshot_on_failure(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
snapshot = root / "website/public/contributors/people.json"
|
||||
snapshot.parent.mkdir(parents=True)
|
||||
original = (ROOT / "website/public/contributors/people.json").read_text()
|
||||
snapshot.write_text(original)
|
||||
people = json.loads(original)["contributors"][:3]
|
||||
response = WEBSITE.subprocess.CompletedProcess([], 0, stdout=json.dumps(people[:2]) + "\n" + json.dumps(people[2:]))
|
||||
with patch.object(WEBSITE.subprocess, "run", return_value=response) as api:
|
||||
WEBSITE.refresh_contributors(root)
|
||||
self.assertIn("--paginate", api.call_args.args[0])
|
||||
self.assertEqual(json.loads(snapshot.read_text())["contributors"], people)
|
||||
self.assertEqual(set(snapshot.parent.iterdir()), {snapshot})
|
||||
good = snapshot.read_text()
|
||||
for output in (json.dumps(people) + "\n[", json.dumps(people + people), "[]", '{"message":"API error"}'):
|
||||
with self.subTest(output=output), patch.object(WEBSITE.subprocess, "run", return_value=WEBSITE.subprocess.CompletedProcess([], 0, stdout=output)):
|
||||
with self.assertRaises(ValueError):
|
||||
WEBSITE.refresh_contributors(root)
|
||||
self.assertEqual(snapshot.read_text(), good)
|
||||
with patch.object(WEBSITE.subprocess, "run", side_effect=WEBSITE.subprocess.CalledProcessError(1, ["gh"])):
|
||||
with self.assertRaises(WEBSITE.subprocess.CalledProcessError):
|
||||
WEBSITE.refresh_contributors(root)
|
||||
self.assertEqual(snapshot.read_text(), good)
|
||||
|
||||
def test_contributor_refresh_preserves_snapshot_and_cleans_staging_on_save_failure(self):
|
||||
people = json.loads((ROOT / "website/public/contributors/people.json").read_text())["contributors"][:2]
|
||||
response = WEBSITE.subprocess.CompletedProcess([], 0, stdout=json.dumps(people))
|
||||
write_text = Path.write_text
|
||||
|
||||
def partial_write(path, text, *args, **kwargs):
|
||||
write_text(path, text[:20], *args, **kwargs)
|
||||
raise OSError(errno.ENOSPC, "injected partial write", str(path))
|
||||
|
||||
failures = (
|
||||
("partial write", patch.object(
|
||||
Path, "write_text", autospec=True, side_effect=partial_write,
|
||||
)),
|
||||
("replace", patch.object(
|
||||
Path, "replace", autospec=True,
|
||||
side_effect=PermissionError(errno.EACCES, "injected replace failure"),
|
||||
)),
|
||||
)
|
||||
for name, failure in failures:
|
||||
with self.subTest(failure=name), tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
snapshot = root / "website/public/contributors/people.json"
|
||||
snapshot.parent.mkdir(parents=True)
|
||||
snapshot.write_bytes(json.dumps({
|
||||
"repository": "morluto/rea", "updated": "2026-10-14", "contributors": people[:1],
|
||||
}).encode("utf-8"))
|
||||
before = snapshot.read_bytes()
|
||||
with patch.object(WEBSITE.subprocess, "run", return_value=response), failure as save:
|
||||
with self.assertRaises(OSError):
|
||||
WEBSITE.refresh_contributors(root)
|
||||
self.assertEqual(save.call_count, 1)
|
||||
self.assertEqual(snapshot.read_bytes(), before)
|
||||
self.assertEqual(set(snapshot.parent.iterdir()), {snapshot})
|
||||
|
||||
def test_contributor_snapshot_rejects_malformed_identity_and_unsafe_links(self):
|
||||
original = json.loads((ROOT / "website/public/contributors/people.json").read_text())
|
||||
for field, value in (("id", True), ("id", 0), ("login", ""), ("type", "unknown"),
|
||||
("html_url", "javascript:alert(1)"), ("html_url", "https://github.com.evil.test/person"),
|
||||
("avatar_url", "https://token@avatars.githubusercontent.com/u/1")):
|
||||
with self.subTest(field=field, value=value):
|
||||
data = {**original, "contributors": [{**original["contributors"][0], field: value}]}
|
||||
with self.assertRaises(ValueError):
|
||||
WEBSITE.checked_contributors(data)
|
||||
|
||||
def test_shared_edits_preserve_body_and_catch_drift_before_rewriting(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
@@ -314,12 +416,21 @@ class WebsiteTranslationChecks(unittest.TestCase):
|
||||
|
||||
def test_broken_placeholders_and_inline_markup_fail_before_replacing_preview(self):
|
||||
with self.translated_project() as root:
|
||||
page = root / "website/public/index.html"
|
||||
page.write_text(page.read_text().replace(
|
||||
"</main>",
|
||||
'<p>Translation test <a href="get-started/">read more</a>.</p></main>',
|
||||
))
|
||||
extract_catalogs(root)
|
||||
path = root / "website/locales/zh-CN/messages.po"
|
||||
catalog = polib.pofile(path)
|
||||
entry = catalog.find("Translation test {ph0}read more{ph1}.", msgctxt="page:index.html")
|
||||
self.assertIsNotNone(entry)
|
||||
entry.msgstr = "翻译测试:{ph0}继续阅读{ph1}。"
|
||||
catalog.save(path)
|
||||
site = root / "website/_site"
|
||||
build_translations(root, site)
|
||||
before = (site / "zh-CN/index.html").read_bytes()
|
||||
path = root / "website/locales/zh-CN/messages.po"
|
||||
catalog = polib.pofile(path)
|
||||
entry = catalog.find("Already know RE? {ph0}Skip to analysis guides →{ph1}", msgctxt="page:index.html")
|
||||
original = entry.msgstr
|
||||
for bad, reason in (("丢失链接", "changed placeholders"), ("{ph1}错误的链接{ph0}", "invalid inline markup")):
|
||||
with self.subTest(reason=reason):
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { execFile } from "node:child_process";
|
||||
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
@@ -7,20 +5,23 @@ import { delimiter, join } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
import { lt, rcompare } from "semver";
|
||||
import { lt, prerelease, rcompare, valid } from "semver";
|
||||
import { readNpmRelease, stableUpdateVersion } from "./ci/npm-release.mjs";
|
||||
|
||||
import { CATALOG_IDENTITY } from "../dist/catalogIdentity.js";
|
||||
import { TOOL_CONTRACTS } from "../dist/contracts/toolContracts.js";
|
||||
import {
|
||||
requireMcpLifecycleResult,
|
||||
sortVerifierNames,
|
||||
} from "./lib/mcp-verifier-results.mjs";
|
||||
installCanaryPackage,
|
||||
verifyInstalledCanaryPackage,
|
||||
} from "./lib/release-package-canary.mjs";
|
||||
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
|
||||
|
||||
const verifierRun = createVerifierRun();
|
||||
const execFileAsync = promisify(execFile);
|
||||
const version = process.argv[2];
|
||||
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(version ?? ""))
|
||||
if (
|
||||
typeof version !== "string" ||
|
||||
valid(version) !== version ||
|
||||
process.argv.length !== 3
|
||||
)
|
||||
throw new Error("Usage: node scripts/verify-published-package.mjs <version>");
|
||||
|
||||
const canaryRoot = await mkdtemp(join(tmpdir(), "rea-published-canary-"));
|
||||
@@ -29,88 +30,41 @@ const serverEnvironment = {
|
||||
npm_config_cache: join(canaryRoot, "npm-cache"),
|
||||
};
|
||||
delete serverEnvironment.HOPPER_TARGET_PATH;
|
||||
const transport = new StdioClientTransport({
|
||||
command: "npm",
|
||||
args: [
|
||||
"exec",
|
||||
"--yes",
|
||||
`--package=rea-agents@${version}`,
|
||||
"--",
|
||||
"rea",
|
||||
"mcp",
|
||||
],
|
||||
cwd: canaryRoot,
|
||||
env: serverEnvironment,
|
||||
stderr: "pipe",
|
||||
});
|
||||
const client = new Client({
|
||||
name: "published-package-canary",
|
||||
version: "1",
|
||||
});
|
||||
let stderr = "";
|
||||
transport.stderr?.on("data", (chunk) => {
|
||||
if (stderr.length < 16_384) stderr += chunk.toString("utf8");
|
||||
});
|
||||
|
||||
let publishedToolCount = 0;
|
||||
let surface;
|
||||
let update;
|
||||
|
||||
try {
|
||||
await client.connect(transport);
|
||||
const tools = await client.listTools();
|
||||
const toolNames = tools.tools.map(({ name }) => name);
|
||||
const canonicalToolNames = new Set(TOOL_CONTRACTS.map(({ name }) => name));
|
||||
const unknownToolNames = toolNames.filter(
|
||||
(name) => !canonicalToolNames.has(name),
|
||||
const publishedRoot = await installCanaryPackage(
|
||||
`rea-agents@${version}`,
|
||||
canaryRoot,
|
||||
serverEnvironment,
|
||||
);
|
||||
const publishedToolNames = new Set(toolNames);
|
||||
const missingToolNames = [...canonicalToolNames].filter(
|
||||
(name) => !publishedToolNames.has(name),
|
||||
surface = await verifyInstalledCanaryPackage(
|
||||
publishedRoot,
|
||||
version,
|
||||
canaryRoot,
|
||||
serverEnvironment,
|
||||
);
|
||||
publishedToolCount = toolNames.length;
|
||||
if (
|
||||
publishedToolCount === 0 ||
|
||||
publishedToolNames.size !== publishedToolCount ||
|
||||
unknownToolNames.length > 0 ||
|
||||
missingToolNames.length > 0
|
||||
)
|
||||
throw new Error(
|
||||
`Published MCP exposed an invalid canonical tool catalog (${String(publishedToolCount)} tools, unknown: ${unknownToolNames.join(", ") || "none"}, missing: ${missingToolNames.join(", ") || "none"})`,
|
||||
);
|
||||
const statusReply = await client.callTool({
|
||||
name: "binary_session",
|
||||
arguments: {},
|
||||
});
|
||||
const status = requireMcpLifecycleResult(statusReply, "binary_session");
|
||||
const availabilityNames = sortVerifierNames(
|
||||
status.tool_availability.map(({ name }) => name),
|
||||
);
|
||||
if (
|
||||
JSON.stringify(availabilityNames) !==
|
||||
JSON.stringify(sortVerifierNames(canonicalToolNames))
|
||||
)
|
||||
throw new Error(
|
||||
"Published binary_session omitted canonical tool availability",
|
||||
);
|
||||
update = await verifyPublishedUpdate({ version, canaryRoot });
|
||||
} catch (cause) {
|
||||
throw new Error(`Published package verification failed: ${stderr}`, {
|
||||
cause,
|
||||
update = await verifyPublishedUpdate({
|
||||
version,
|
||||
canaryRoot,
|
||||
updaterRoot: publishedRoot,
|
||||
});
|
||||
} finally {
|
||||
try {
|
||||
await client.close();
|
||||
await transport.close();
|
||||
} finally {
|
||||
await rm(canaryRoot, { recursive: true, force: true });
|
||||
}
|
||||
await rm(canaryRoot, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({ verifier_run: await completeVerifierRun(verifierRun), package: "rea-agents", version, mcpTools: publishedToolCount, canonicalMcpTools: CATALOG_IDENTITY.counts.mcp_tools, update })}\n`,
|
||||
`${JSON.stringify({ verifier_run: await completeVerifierRun(verifierRun), package: "rea-agents", version, ...surface, update })}\n`,
|
||||
);
|
||||
|
||||
async function verifyPublishedUpdate({ version: targetVersion, canaryRoot }) {
|
||||
async function verifyPublishedUpdate({
|
||||
version: targetVersion,
|
||||
canaryRoot,
|
||||
updaterRoot,
|
||||
}) {
|
||||
const updateVersion = stableUpdateVersion(
|
||||
targetVersion,
|
||||
await readNpmRelease(targetVersion),
|
||||
);
|
||||
const prefix = join(canaryRoot, "update-prefix");
|
||||
const home = join(canaryRoot, "update-home");
|
||||
const environment = {
|
||||
@@ -130,12 +84,12 @@ async function verifyPublishedUpdate({ version: targetVersion, canaryRoot }) {
|
||||
PI_PROFILE: undefined,
|
||||
XDG_CONFIG_HOME: join(home, ".config"),
|
||||
OPENCODE_CONFIG: join(home, ".config", "opencode", "opencode.json"),
|
||||
npm_config_cache: join(canaryRoot, "update-cache"),
|
||||
npm_config_cache: join(canaryRoot, "npm-cache"),
|
||||
npm_config_prefix: prefix,
|
||||
PATH: `${join(prefix, "bin")}${delimiter}${process.env.PATH ?? ""}`,
|
||||
};
|
||||
const previousVersion = await findPreviousPublishedVersion(
|
||||
targetVersion,
|
||||
updateVersion,
|
||||
canaryRoot,
|
||||
environment,
|
||||
);
|
||||
@@ -161,21 +115,6 @@ async function verifyPublishedUpdate({ version: targetVersion, canaryRoot }) {
|
||||
).stdout.trim();
|
||||
// Older releases may predate the update command. Exercise the new published
|
||||
// updater's production workflow against that real previous installation.
|
||||
const updaterPrefix = join(canaryRoot, "updater");
|
||||
await execFileAsync(
|
||||
"npm",
|
||||
[
|
||||
"install",
|
||||
"--ignore-scripts",
|
||||
"--no-save",
|
||||
"--no-package-lock",
|
||||
"--prefix",
|
||||
updaterPrefix,
|
||||
`rea-agents@${targetVersion}`,
|
||||
],
|
||||
{ cwd: canaryRoot, env: environment, maxBuffer: 16 * 1024 * 1024 },
|
||||
);
|
||||
const updaterRoot = join(updaterPrefix, "node_modules", "rea-agents");
|
||||
const harness = join(canaryRoot, "update.mjs");
|
||||
await writeFile(
|
||||
harness,
|
||||
@@ -196,20 +135,20 @@ if (result.status === "failed") process.exitCode = 1;
|
||||
if (
|
||||
result.status !== "updated" ||
|
||||
result.previousVersion !== previousVersion ||
|
||||
result.latestVersion !== targetVersion ||
|
||||
result.installedVersion !== targetVersion ||
|
||||
result.command.at(-1) !== `rea-agents@${targetVersion}`
|
||||
result.latestVersion !== updateVersion ||
|
||||
result.installedVersion !== updateVersion ||
|
||||
result.command.at(-1) !== `rea-agents@${updateVersion}`
|
||||
)
|
||||
throw new Error(
|
||||
`Published REA updater did not update ${previousVersion} to ${targetVersion}: ${stdout}`,
|
||||
`Published REA updater did not update ${previousVersion} to stable ${updateVersion}: ${stdout}`,
|
||||
);
|
||||
|
||||
const installed = JSON.parse(
|
||||
await readFile(join(npmRoot, "rea-agents", "package.json"), "utf8"),
|
||||
);
|
||||
if (installed.version !== targetVersion)
|
||||
if (installed.version !== updateVersion)
|
||||
throw new Error(
|
||||
`REA update installed ${installed.version}, expected ${targetVersion}`,
|
||||
`REA update installed ${installed.version}, expected stable ${updateVersion}`,
|
||||
);
|
||||
|
||||
const help = (
|
||||
@@ -241,7 +180,10 @@ async function findPreviousPublishedVersion(targetVersion, cwd, environment) {
|
||||
const previous = versions
|
||||
.filter(
|
||||
(candidate) =>
|
||||
typeof candidate === "string" && lt(candidate, targetVersion),
|
||||
typeof candidate === "string" &&
|
||||
valid(candidate) === candidate &&
|
||||
prerelease(candidate) === null &&
|
||||
lt(candidate, targetVersion),
|
||||
)
|
||||
.sort(rcompare)[0];
|
||||
if (previous === undefined)
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
} from "../dist/ghidra/GhidraSessionValues.js";
|
||||
import { parseBinaryTarget } from "../dist/application/BinaryTargetResolver.js";
|
||||
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
|
||||
import { resolveGhidraVerifierTimeouts } from "./lib/ghidra-verifier-timeouts.mjs";
|
||||
import { verifyGhidraCompactReferences } from "./lib/real-ghidra-compact-references.mjs";
|
||||
import { verifyGhidraFileOffsets } from "./lib/real-ghidra-file-offsets.mjs";
|
||||
import { verifyWindowsGhidraByteSearch } from "./lib/ghidra-windows-byte-search.mjs";
|
||||
@@ -47,6 +48,7 @@ if (
|
||||
)
|
||||
throw new Error("Windows Ghidra must not advertise database mutation");
|
||||
const installDir = process.env.GHIDRA_INSTALL_DIR;
|
||||
const { clientOptions } = resolveGhidraVerifierTimeouts(process.env);
|
||||
if (installDir === undefined || !isAbsolute(installDir))
|
||||
throw new Error(
|
||||
"Set GHIDRA_INSTALL_DIR to the absolute root of Ghidra 12.1.4.",
|
||||
@@ -116,6 +118,7 @@ const client = new GhidraClient({
|
||||
transport: "authenticated-loopback-tcp",
|
||||
providerVersion: SUPPORTED_GHIDRA_VERSION,
|
||||
profileDigest: profile.value.profile.digest,
|
||||
...clientOptions,
|
||||
});
|
||||
|
||||
let coordinates;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { valid } from "semver";
|
||||
import {
|
||||
installCanaryPackage,
|
||||
verifyInstalledCanaryPackage,
|
||||
} from "./lib/release-package-canary.mjs";
|
||||
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
|
||||
|
||||
const [tarball, version, ...extra] = process.argv.slice(2);
|
||||
if (
|
||||
tarball === undefined ||
|
||||
typeof version !== "string" ||
|
||||
valid(version) !== version ||
|
||||
extra.length
|
||||
)
|
||||
throw new Error(
|
||||
"Usage: node scripts/verify-release-artifact.mjs <qualified-tarball> <version>",
|
||||
);
|
||||
const source = resolve(tarball);
|
||||
const verifierRun = createVerifierRun();
|
||||
const workspace = await mkdtemp(join(tmpdir(), "rea-release-rehearsal-"));
|
||||
const environment = {
|
||||
...process.env,
|
||||
npm_config_cache: join(workspace, "npm-cache"),
|
||||
};
|
||||
delete environment.HOPPER_TARGET_PATH;
|
||||
let result;
|
||||
try {
|
||||
const packageRoot = await installCanaryPackage(
|
||||
source,
|
||||
workspace,
|
||||
environment,
|
||||
);
|
||||
result = await verifyInstalledCanaryPackage(
|
||||
packageRoot,
|
||||
version,
|
||||
workspace,
|
||||
environment,
|
||||
);
|
||||
} finally {
|
||||
await rm(workspace, { recursive: true, force: true });
|
||||
}
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({ verifier_run: await completeVerifierRun(verifierRun), package: "rea-agents", version, source, ...result })}\n`,
|
||||
);
|
||||
+90
-1
@@ -1,14 +1,17 @@
|
||||
"""Maintain shared HTML and run the static website's contributor commands."""
|
||||
|
||||
import argparse
|
||||
from datetime import date
|
||||
from functools import partial
|
||||
from html import escape
|
||||
from html.parser import HTMLParser
|
||||
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
|
||||
import json
|
||||
from pathlib import Path, PurePosixPath
|
||||
from string import Template
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from textwrap import indent
|
||||
from urllib.parse import quote, urlsplit
|
||||
|
||||
@@ -21,9 +24,89 @@ NAVIGATION = (
|
||||
("Blog", "blog/"),
|
||||
("Guides", "guides/"),
|
||||
("FAQ", "faq/"),
|
||||
("Contributors", "contributors/"),
|
||||
)
|
||||
|
||||
|
||||
def checked_contributors(data):
|
||||
"""Validate the public snapshot once, before rendering or replacing it."""
|
||||
if not isinstance(data, dict) or data.get("repository") != "morluto/rea":
|
||||
raise ValueError("Contributors must come from morluto/rea")
|
||||
if not isinstance(data.get("updated"), str):
|
||||
raise ValueError("Contributors need an ISO update date")
|
||||
date.fromisoformat(data["updated"])
|
||||
people = data.get("contributors")
|
||||
if not isinstance(people, list) or not people:
|
||||
raise ValueError("Contributors must be a nonempty list")
|
||||
ids, logins = set(), set()
|
||||
for person in people:
|
||||
if not isinstance(person, dict):
|
||||
raise ValueError("Invalid contributor record")
|
||||
identity, login = person.get("id"), person.get("login")
|
||||
if type(identity) is not int or identity <= 0 or identity in ids:
|
||||
raise ValueError("Contributor IDs must be unique positive integers")
|
||||
if not isinstance(login, str) or not login.strip() or login.casefold() in logins:
|
||||
raise ValueError("Contributor usernames must be nonempty and unique")
|
||||
if person.get("type") not in ("User", "Bot"):
|
||||
raise ValueError(f"Unknown contributor type: {login}")
|
||||
for key, host in (("html_url", "github.com"), ("avatar_url", "avatars.githubusercontent.com")):
|
||||
value = person.get(key)
|
||||
if not isinstance(value, str):
|
||||
raise ValueError(f"Missing {key}: {login}")
|
||||
url = urlsplit(value)
|
||||
if url.scheme != "https" or url.netloc != host or not url.path:
|
||||
raise ValueError(f"Invalid public {key}: {login}")
|
||||
ids.add(identity)
|
||||
logins.add(login.casefold())
|
||||
return data
|
||||
|
||||
|
||||
def contributor_block(root):
|
||||
"""Render equal-sized profile links from the checked GitHub snapshot."""
|
||||
path = root / "website/public/contributors/people.json"
|
||||
data = checked_contributors(json.loads(path.read_text(encoding="utf-8")))
|
||||
cards = []
|
||||
for person in sorted(data["contributors"], key=lambda item: item["login"].casefold()):
|
||||
login = escape(person["login"], quote=True)
|
||||
profile = escape(person["html_url"], quote=True)
|
||||
avatar = escape(person["avatar_url"], quote=True)
|
||||
cards.append(
|
||||
f' <li data-contributor="{login}"><a class="contributor-card" href="{profile}">\n'
|
||||
f' <img src="{avatar}" alt="" width="56" height="56" loading="lazy" decoding="async" referrerpolicy="no-referrer" />\n'
|
||||
f' <span dir="ltr">@{login}</span>\n'
|
||||
' </a></li>'
|
||||
)
|
||||
template = root / "website/templates/contributors.html.tmpl"
|
||||
return indent(Template(template.read_text(encoding="utf-8")).substitute(
|
||||
cards="\n".join(cards), updated=escape(data["updated"], quote=True),
|
||||
), " ")
|
||||
|
||||
|
||||
def refresh_contributors(root):
|
||||
"""Validate every GitHub page, then atomically replace the offline snapshot."""
|
||||
result = subprocess.run(
|
||||
["gh", "api", "--paginate", "repos/morluto/rea/contributors?per_page=100", "--jq",
|
||||
"[.[] | {login,id,type,avatar_url,html_url}]"],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
decoder, remaining, people = json.JSONDecoder(), result.stdout.strip(), []
|
||||
while remaining:
|
||||
page, end = decoder.raw_decode(remaining)
|
||||
if not isinstance(page, list):
|
||||
raise ValueError("GitHub returned an invalid contributors page")
|
||||
people.extend(page)
|
||||
remaining = remaining[end:].lstrip()
|
||||
data = checked_contributors({
|
||||
"repository": "morluto/rea", "updated": date.today().isoformat(), "contributors": people,
|
||||
})
|
||||
path = root / "website/public/contributors/people.json"
|
||||
with tempfile.TemporaryDirectory(dir=path.parent, prefix=f".{path.name}-") as directory:
|
||||
staged = Path(directory) / path.name
|
||||
staged.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
staged.replace(path)
|
||||
print(f"Refreshed {len(people)} contributors. Run sync, translations extract and check.")
|
||||
|
||||
|
||||
def authored_markdown(root):
|
||||
"""Discover website documentation while excluding local environments and vendors."""
|
||||
site = root / "website"
|
||||
@@ -117,10 +200,13 @@ def shared_blocks(root, path, source):
|
||||
values["language_picker"] = indent(selector, " ") if not metadata.noindex else ""
|
||||
values["alternates"] = alternates if not metadata.noindex else ""
|
||||
templates = root / "website/templates"
|
||||
return {
|
||||
blocks = {
|
||||
name: indent(Template((templates / f"{name}.html.tmpl").read_text(encoding="utf-8")).substitute(values), " ")
|
||||
for name in ("sharing", "theme", "header", "footer")
|
||||
}
|
||||
if route == "contributors/":
|
||||
blocks["contributors"] = contributor_block(root)
|
||||
return blocks
|
||||
|
||||
|
||||
def sync_pages(root, check=False):
|
||||
@@ -206,6 +292,7 @@ def main():
|
||||
sync = commands.add_parser("sync", help="Update shared HTML after editing templates or page metadata")
|
||||
sync.add_argument("--check", action="store_true", help="Report drift without rewriting pages")
|
||||
commands.add_parser("check", help="Check shared HTML, prepare assets, verify links and run regression tests")
|
||||
commands.add_parser("contributors", help="Refresh the public contributor snapshot using GitHub CLI")
|
||||
links = commands.add_parser("links", help="Audit external targets using gh and HTTP; separate from offline checks")
|
||||
links.add_argument("--report", help="Write the full external-link JSON report")
|
||||
create = commands.add_parser("new-page", help="Create a draft reading page")
|
||||
@@ -238,6 +325,8 @@ def main():
|
||||
new_page(root, args.route, args.title, args.description)
|
||||
elif args.command == "sync":
|
||||
sync_pages(root, check=args.check)
|
||||
elif args.command == "contributors":
|
||||
refresh_contributors(root)
|
||||
elif args.command == "check":
|
||||
sync_pages(root, check=True)
|
||||
for name in ("prepare-website.py", "verify-website.py", "test-website.py"):
|
||||
|
||||
+2
-2
@@ -8,13 +8,13 @@
|
||||
"url": "https://github.com/morluto/rea",
|
||||
"source": "github"
|
||||
},
|
||||
"version": "6.4.0",
|
||||
"version": "6.5.0",
|
||||
"packages": [
|
||||
{
|
||||
"registryType": "npm",
|
||||
"registryBaseUrl": "https://registry.npmjs.org",
|
||||
"identifier": "rea-agents",
|
||||
"version": "6.4.0",
|
||||
"version": "6.5.0",
|
||||
"runtimeHint": "npx",
|
||||
"transport": {
|
||||
"type": "stdio"
|
||||
|
||||
@@ -55,4 +55,12 @@ describe("parseAdbVersionOutput", () => {
|
||||
installedPath: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not accept arbitrary successful output as an adb version", () => {
|
||||
expect(
|
||||
parseAdbVersionOutput(
|
||||
"Android Debug Bridge version tomorrow\nVersion unknown\n",
|
||||
),
|
||||
).toMatchObject({ version: null });
|
||||
});
|
||||
});
|
||||
@@ -67,7 +67,9 @@ export interface AdbClientIdentity {
|
||||
* `Version ` the build version (no colon), and `Installed as` the binary path.
|
||||
*/
|
||||
export const parseAdbVersionOutput = (stdout: string): AdbClientIdentity => {
|
||||
const build = /^Version\s+(\S.*)$/mu.exec(stdout);
|
||||
const build = /^Version\s+(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)\s*$/mu.exec(
|
||||
stdout,
|
||||
);
|
||||
const installed = /^Installed as\s+(.+)$/mu.exec(stdout);
|
||||
return {
|
||||
version: build === null ? null : build[1]!.trim(),
|
||||
@@ -84,14 +86,34 @@ export const inspectAdbClient = async (
|
||||
signal?: AbortSignal,
|
||||
): Promise<AdbClientIdentity> => {
|
||||
try {
|
||||
const { stdout } = await execFileOutput(selection.binary, ["version"], {
|
||||
timeout: VERSION_TIMEOUT_MS,
|
||||
stopSignal: "SIGTERM",
|
||||
maxBuffer: VERSION_MAX_OUTPUT_BYTES,
|
||||
...(signal === undefined ? {} : { signal }),
|
||||
});
|
||||
return parseAdbVersionOutput(stdout);
|
||||
const { stdout, stderr } = await execFileOutput(
|
||||
selection.binary,
|
||||
["version"],
|
||||
{
|
||||
timeout: VERSION_TIMEOUT_MS,
|
||||
stopSignal: "SIGTERM",
|
||||
maxBuffer: VERSION_MAX_OUTPUT_BYTES,
|
||||
...(signal === undefined ? {} : { signal }),
|
||||
},
|
||||
);
|
||||
const identity = parseAdbVersionOutput(stdout);
|
||||
const hasRecognizedProtocolVersion =
|
||||
/^Android Debug Bridge version\s+\d+\.\d+\.\d+\s*$/mu.test(stdout);
|
||||
if (identity.version === null && !hasRecognizedProtocolVersion)
|
||||
throw new AdbConfigurationFailure(
|
||||
"version_unresolved",
|
||||
"The selected adb binary exited successfully but did not report a recognizable protocol or build version",
|
||||
{
|
||||
selected_binary: selection.binary,
|
||||
path_source: selection.pathSource,
|
||||
version_probe: "unrecognized_output",
|
||||
stdout,
|
||||
stderr,
|
||||
},
|
||||
);
|
||||
return identity;
|
||||
} catch (cause) {
|
||||
if (cause instanceof AdbConfigurationFailure) throw cause;
|
||||
const failure = execFileOutputFailure(cause);
|
||||
if (signal?.aborted || failure?.code === "ABORT_ERR")
|
||||
throw new AnalysisCancelledError("inspect_adb_client", { cause });
|
||||
|
||||
@@ -56,7 +56,9 @@ describe("parseAdbDevicesOutput", () => {
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("ADB daemon startup notices", () => {
|
||||
it("recognizes daemon startup notices instead of failing the listing", () => {
|
||||
const output = [
|
||||
"* daemon not running; starting now at tcp:5037",
|
||||
@@ -70,6 +72,67 @@ describe("parseAdbDevicesOutput", () => {
|
||||
expect(devices).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("recognizes daemon startup notices emitted on stderr", () => {
|
||||
const stdout = [
|
||||
"List of devices attached",
|
||||
"emulator-5554 device transport_id:1",
|
||||
"",
|
||||
].join("\n");
|
||||
const stderr = [
|
||||
"* daemon not running; starting now at tcp:5037",
|
||||
"* daemon started successfully",
|
||||
"",
|
||||
].join("\n");
|
||||
const { devices, daemonStarted, unparsedLines } = parseAdbDevicesOutput(
|
||||
stdout,
|
||||
stderr,
|
||||
);
|
||||
expect(daemonStarted).toBe(true);
|
||||
expect(unparsedLines).toEqual([]);
|
||||
expect(devices).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("recognizes the legacy daemon notice with its trailing marker and CRLF", () => {
|
||||
const { daemonStarted, unparsedLines } = parseAdbDevicesOutput(
|
||||
"List of devices attached\r\n",
|
||||
"* daemon started successfully *\r\n",
|
||||
);
|
||||
expect(daemonStarted).toBe(true);
|
||||
expect(unparsedLines).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not treat a daemon startup error containing the success phrase as success", () => {
|
||||
const { daemonStarted, unparsedLines } = parseAdbDevicesOutput(
|
||||
"List of devices attached\r\n",
|
||||
"* daemon not started successfully\r\n",
|
||||
);
|
||||
expect(daemonStarted).toBe(false);
|
||||
expect(unparsedLines).toEqual([]);
|
||||
});
|
||||
|
||||
it("ignores non-startup lines and device strings on stderr", () => {
|
||||
const stdout = [
|
||||
"List of devices attached",
|
||||
"emulator-5554 device transport_id:1",
|
||||
"",
|
||||
].join("\n");
|
||||
const stderr = [
|
||||
"adb: warning: some transport warning",
|
||||
"emulator-5556 device transport_id:2",
|
||||
"",
|
||||
].join("\n");
|
||||
const { devices, daemonStarted, unparsedLines } = parseAdbDevicesOutput(
|
||||
stdout,
|
||||
stderr,
|
||||
);
|
||||
expect(daemonStarted).toBe(false);
|
||||
expect(unparsedLines).toEqual([]);
|
||||
expect(devices).toHaveLength(1);
|
||||
expect(devices[0]?.serial).toBe("emulator-5554");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ADB device states", () => {
|
||||
it("keeps non-device states such as unauthorized and offline", () => {
|
||||
const output = [
|
||||
"List of devices attached",
|
||||
|
||||
@@ -30,6 +30,12 @@ export interface AdbDeviceEntry {
|
||||
|
||||
const DEVICE_LINE = /^(\S+)\s+(.*)$/u;
|
||||
|
||||
const normalizeAdbOutputLine = (rawLine: string): string => rawLine.trimEnd();
|
||||
|
||||
const isSuccessfulDaemonStartNotice = (line: string): boolean =>
|
||||
line === "* daemon started successfully" ||
|
||||
line === "* daemon started successfully *";
|
||||
|
||||
const metadataValue = (remainder: string, key: string): string | null => {
|
||||
const match = new RegExp(`(?:^|\\s)${key}:(\\S+)`, "u").exec(remainder);
|
||||
return match === null ? null : match[1]!;
|
||||
@@ -42,6 +48,7 @@ const metadataValue = (remainder: string, key: string): string | null => {
|
||||
*/
|
||||
export const parseAdbDevicesOutput = (
|
||||
stdout: string,
|
||||
stderr = "",
|
||||
): {
|
||||
devices: readonly AdbDeviceEntry[];
|
||||
unparsedLines: readonly string[];
|
||||
@@ -51,12 +58,13 @@ export const parseAdbDevicesOutput = (
|
||||
const unparsedLines: string[] = [];
|
||||
let daemonStarted = false;
|
||||
for (const rawLine of stdout.split(/\r?\n/u)) {
|
||||
const line = rawLine.trimEnd();
|
||||
if (line === "" || line.startsWith("List of devices attached")) continue;
|
||||
if (line.startsWith("* daemon")) {
|
||||
if (line.includes("started successfully")) daemonStarted = true;
|
||||
const line = normalizeAdbOutputLine(rawLine);
|
||||
if (isSuccessfulDaemonStartNotice(line)) {
|
||||
daemonStarted = true;
|
||||
continue;
|
||||
}
|
||||
if (line === "" || line.startsWith("List of devices attached")) continue;
|
||||
if (line.startsWith("* daemon")) continue;
|
||||
const match = DEVICE_LINE.exec(line);
|
||||
const state = ADB_DEVICE_STATES.find((candidate) => {
|
||||
const remainder = match?.[2];
|
||||
@@ -105,6 +113,15 @@ export const parseAdbDevicesOutput = (
|
||||
: "none",
|
||||
});
|
||||
}
|
||||
if (!daemonStarted && stderr !== "") {
|
||||
for (const rawLine of stderr.split(/\r?\n/u)) {
|
||||
const line = normalizeAdbOutputLine(rawLine);
|
||||
if (isSuccessfulDaemonStartNotice(line)) {
|
||||
daemonStarted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return { devices, unparsedLines, daemonStarted };
|
||||
};
|
||||
|
||||
|
||||
Loaded 100 of 638 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user