Repository navigation
refactor(providers)!: key Ghidra and Hopper analysis profiles on the producer identity instead of hand-bumped markers - #11320
Conversation
…tead of hand-bumped markers Ghidra snapshot validity depended on 53 hand-maintained "-vN" semantic markers in the analysis profile; a behaviour fix that forgot to bump its marker left old snapshots admissible (#3664). #10562 added a digest of the bridge sources, but TypeScript projection changes still needed a bump and the REA release was not committed. - src/filesystem/ProducerIdentity.ts owns the producer identity: the REA release plus a framed SHA-256 of a producer's packaged scripts, read once per process. - Ghidra profiles commit `producer` in place of `bridge_sources_sha256` and the constant revision markers (shared semantics block, load-image, entry seed, PDB, jump-table, DOL import, MIPS ISA-mode markers) are removed. - Runtime-selected values keep their meaning without a revision suffix (language_selection, annotation_policy, relocation/no-return/launch policy, MIPS/PowerPC/PSP lanes, MIPS ABI basis). Bridge wire policy ids shared with the Java scripts (ilp32-prototype-v1, o32-soft-float-prototype-v1) are unchanged. BREAKING CHANGE: Ghidra Evidence `analysis_profile.parameters` replace the semantic marker keys and `bridge_sources_sha256` with `producer` ({rea_version, sources_sha256}), and selection values lose their "-vN" suffix (for example `language_selection: "provider-pinned"`). Ghidra Evidence IDs and profile digests change, and analysis snapshots saved by earlier builds are refused at open. Migration: open the target without the old snapshot and save a fresh one; consumers reading the removed marker keys should read `producer` instead.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The reviewed changes appear safe to merge, with no new blocking issue found. SummaryReplaces hand-maintained cache markers with producer identities.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
Release["REA release"] --> Identity["Producer identity"]
Scripts["Packaged bridge scripts"] --> Identity
Identity --> Profile["Ghidra or Hopper profile digest"]
Profile --> Match{"Saved digest matches?"}
Match -->|No| Refuse["Refuse snapshot"]
Match -->|Yes| Reuse["Allow matching results"]
Release --> Kuna["Kuna export key and manifest"]
Reviews (8) · Last reviewed commit: "fix(artifacts): import the moved file so..." · Reviewed by Greptile |
…ysis profiles (#11324) Hopper analysis profiles committed the launcher digest and one hand-bumped marker (function_dossier_coverage "...-v1"), but neither the REA release nor bridge/hopper_bridge.py. A snapshot saved before a bridge or REA change replayed results the current bridge would not produce. HopperBridgeSources owns the packaged bridge script URL (used to launch it) and hopperProducerIdentity() on the shared ProducerIdentity owner; the profile commits `producer` in place of the marker. BREAKING CHANGE: Hopper Evidence `analysis_profile.parameters` replace `function_dossier_coverage` with `producer` ({rea_version, sources_sha256}). Hopper profile digests and Evidence IDs change, and analysis snapshots saved by earlier builds are refused at open. Migration: open the target without the old snapshot and save a fresh one.
…r and use the shared temp directory
…he producer identity (#11353)
…aded verifier scripts/verify-ghidra-bridge-sources.mjs loads GhidraBridgeSources.ts with Node type stripping, which does not resolve .js specifiers to .ts sources. The producer identity import made every verifier run fail with ERR_MODULE_NOT_FOUND; the identity now lives in GhidraProducerIdentity.ts.
…y-cache-key # Conflicts: # src/hopper/HopperProvider.ts
|
@greptileai review |
# Conflicts: # src/artifacts/MachOSliceArtifactReader.ts
|
@greptileai review — latest head b57bccf (main merged; import-path conflict in MachOSliceArtifactReader resolved to main's src/domain/apple/machoLoadCommandReader). local-gate.sh 11320 passed on this head. |
# Conflicts: # tests/boundary/providers/kuna/kunaProjectCache.test.ts
|
@greptileai review — latest head aa1741b (main merged; the Kuna cache test conflict resolved by keeping this PR's layouts 1, 2, 3 and "release" and main's shared phaseGate harness, which made the local deferred helper unused). local-gate.sh passed on aa1741b. |
# Conflicts: # src/artifacts/ArtifactHash.ts # src/artifacts/DotnetBundleArtifactReader.ts # src/artifacts/NodeSeaArtifactReader.ts # src/artifacts/PyInstallerArtifactReader.ts # src/artifacts/deno/DenoVirtualFs.ts # src/artifacts/extraction/ArtifactExtraction.ts # src/artifacts/pyinstaller/PyInstallerPyzStore.ts # src/resources/StableRootArtifact.ts
…ir resources owner after merging main
Main's morluto#11320 dropped revision markers from profile-only values, and this lane's code writes language_selection configured and provider-pinned, processor_labels not-applied and arm_float_prototype dwarf-default-stdcall-softfp. The guides still showed -v1 on each. Lane ids such as elf32-exec-le-eabi5-armv7-m-pinned-v1 keep their suffix, because the code still emits it.
Summary
Ghidra analysis profiles commit one producer identity (the REA release plus a digest of the packaged bridge scripts) instead of 53 hand-bumped
-vNsemantic markers. A behaviour change in REA now invalidates earlier snapshots without anyone remembering to bump a marker. Refs #3664, refs #10510.Carries #11324 (collapsed into this branch): Hopper analysis profiles commit the same producer identity for
bridge/hopper_bridge.pyin place of theirfunction_dossier_coveragemarker. Before this, Hopper profiles had no bridge or REA input at all.Problem and expected behavior
Snapshot and Evidence validity for Ghidra depended on hand-maintained marker strings such as
instruction_references: "exact-address-incoming-without-synthetic-entry-v3". #3664 was a forgotten bump: old snapshots replayed results the new code would no longer produce. #10562 addedbridge_sources_sha256, which covers Java bridge edits, but TypeScript projection changes still needed a bump (for example #8831 changed only TypeScript and bumpedinstruction_references), and the REA release was not part of the profile at all.Expected: a snapshot replays only under the same producer. A new REA release or an edited bridge script refuses it, with no marker to maintain.
Change and scope
src/filesystem/ProducerIdentity.ts:ProducerIdentity = {rea_version, sources_sha256},packagedSourcesDigest(directory, names)(name-sorted, each source framed by name and byte length; a missing source throws), andpackagedProducerIdentity(...)(computed once per process). It is generic so the other providers with hand-typed bridge identities (Hopper, JADX) can migrate in follow-up PRs.src/ghidra/GhidraBridgeSources.tsexportsghidraProducerIdentity()built on it; the private digest copy is removed.GhidraAnalysisProfile.tscommitsproducerin place ofbridge_sources_sha256and removes every constant revision marker: the 19-entry shared semantics block,load_image_evidence,entry_seed,pdb_observations,jump_table_evidence, plusdol_import(DOL) andinstruction_context_evidence(MIPS).language_selection(provider-pinned/configured/caller-supplied),annotation_policy,import_modefor existing projects, relocation, no-return and launch policy, Windows ARM PE import, MIPS/PowerPC/PSP lanes,mips_abi_basis,selected_project_relationship_coverage.ilp32-prototype-v1,o32-soft-float-prototype-v1), which are wire values, not cache markers.NATIVE_AOT_PROFILE_CONTRACT_REVISIONandnative_aot_metadata.contract_revisionare deleted from the Ghidra PE profile, whichproduceralready covers. Kuna's hand-bumpedCACHE_LAYOUTis replaced byproducer: { rea_version }(releaseProducerIdentity()) in the export cache key and manifest. Entries written by another REA release, or in the oldlayoutformat, are rebuilt and retired through the existing owned-cache cleanup.src/hopper/HopperBridgeSources.tsowns the packaged bridge URL (the provider launches from it) andhopperProducerIdentity(). The Hopper profile commitsproducerin place offunction_dossier_coverage.ContentCachedesign from the audit (bounds/freshness).Accepted limitation: between releases (a development checkout), a TypeScript-only change does not change
rea_version, so a snapshot saved by an earlier dev build of the same version can still replay. Released builds are always covered. Digesting the compiled TypeScript was left out to keep the change small.Contract and boundary impact
ProducerIdentity(foundation) -> Ghidra analysis profile -> snapshot binding and Evidenceanalysis_profile. Superseded: the private bridge digest and all constant Ghidra markers.analysis_profile.parametersis an open JSON object.Expected effects:
Evidence and regression coverage
tests/boundary/filesystem/producerIdentity.test.ts: editing a producer script changes the digest without a marker; name/length framing; order independence; a missing source throws; the REA release is committed.GhidraSnapshotCache.test.ts: the 19-row "outdated marker" table is replaced by snapshots from an edited bridge script, another REA release, and no producer identity. Each is refused withEvidenceIntegrityErrorand makes no provider call.GhidraProvider.behavior.test.ts: the historical PDB-marker case becomes "Evidence from an earlier producer is retained but not replayed".producer.scripts/lib/ghidra-reference-snapshot-e2e.mjs(verify:ghidra) built its legacy snapshot by removingfunction_references. It now uses an earlierproducer, like the value-scope verifier.producerIdentity.test.tsusescreateTestTempDirectory.hopperAnalysisProfile.test.ts"commits the REA release and packaged bridge script it runs".scripts/verify-real-ghidra-*.mjs) were updated for the renamed values but not run. No Ghidra installation was used.For evidence-bearing changes:
Validation performed
npm run check:fast: passed (typecheck, lint, architecture guards across 2812 files)npx oxfmt --check .: passednpm run docs:check: passed(refactor(providers): key Kuna exports and the Native AOT profile on the producer identity #11353)
npm run check:fast: passed;npm run test:focused -- tests/boundary/providers/kuna/kunaProjectCache.test.ts src/ghidra/GhidraProvider.behavior.test.ts: 348 passed; producerIdentity, GhidraRawProfileDigest, GhidraSnapshotCache, hopperAnalysisProfile and seven Kuna boundary tests: 11 files, 121 passed;npm run docs:check: passed(fix(hopper)!: commit the REA release and bridge script in Hopper analysis profiles #11324)
npm run test:focused -- tests/boundary/providers/hopper/hopperAnalysisProfile.test.ts src/hopper/HopperAnalysisProfile.test.ts src/hopper/HopperProvider.test.ts tests/boundary/providers/hopper/hopperRelativeLauncher.test.ts tests/boundary/providers/hopper/hopperClient.protocol.test.ts: 79 passedAfter review fixes:
npm run check:fastpassed;npm run test:focused -- tests/boundary/filesystem/producerIdentity.test.ts: 5 passed;node --check scripts/lib/ghidra-reference-snapshot-e2e.mjs: ok (not run against real Ghidra)npm run test:focused --the 14 changed or affected test files (producer identity, Ghidra bridge sources, raw profile digest, snapshot cache, DOL/language/MIPS/PowerPC/RISC-V profiles, provider behavior, session values, PSP extension, Ghidra evidence and inventory MCP): 14 files, 609 tests passedGate refusal fix (d870a1b):
scripts/verify-ghidra-bridge-sources.mjsloadssrc/ghidra/GhidraBridgeSources.tsdirectly with Node type stripping, which does not resolve.jsspecifiers. TheProducerIdentityimport made every verifier run fail withERR_MODULE_NOT_FOUND(tests/boundary/filesystem/ghidraBridgeSources.test.ts, 10 cases). The source table is import-free again, andghidraProducerIdentitymoved tosrc/ghidra/GhidraProducerIdentity.ts. The other two modules the scripts load directly (GhidraJavaProperties.ts,GhidraReleasePolicy.ts) have only type imports.Merged current main. Resolved a
HopperProvider.tsconflict: main's launcher verification options are kept, together with this PR'sHOPPER_BRIDGE_SCRIPT_URL.npm run check:fast: passed.npm run test:focused --with the 7 Ghidra producer/bridge test files and 30 Hopper test files: 578 passed, 6 skipped.briefs/local-gate.sh 11320after the push: passed (60 affected test files, 1386 passed).Compatibility, safety, and release
BREAKING CHANGE:Ghidra Evidenceanalysis_profile.parametersreplace the marker keys andbridge_sources_sha256withproducer({rea_version, sources_sha256}), and selection values drop their-vNsuffix (e.g.language_selection: "provider-pinned"). Ghidra Evidence IDs and profile digests change, and analysis snapshots saved by earlier builds are refused at open (evidence_integrity_mismatch). Migration: open the target without the old snapshot and save a fresh one. Readers of the removed marker keys should compareproducer. Keeping the old markers alongside would bring back the hand-bump this PR removes.BREAKING CHANGE:(fix(hopper)!: commit the REA release and bridge script in Hopper analysis profiles #11324) Hopper Evidenceanalysis_profile.parametersreplacefunction_dossier_coveragewithproducer. Hopper profile digests and Evidence IDs change, and Hopper snapshots saved by earlier builds are refused at open. Migration: open the target without the old snapshot and save a fresh one.Author readiness
Human owner:
Before merge
type(scope): outcome.