Skip to content

fix(artifacts): propose probes from the contents of inspected app bundles - #1969

Closed
thefolahan wants to merge 10 commits into
morluto:mainfrom
thefolahan:fix/inspect-artifact-bundle-probes
Closed

thefolahan wants to merge 10 commits into
morluto:mainfrom
thefolahan:fix/inspect-artifact-bundle-probes

Conversation

@thefolahan

@thefolahan thefolahan commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

inspect_artifact on a native macOS app bundle proposes analyze_javascript_application as its only next probe, even when the bundle contains no JavaScript at all. Directory probes now follow the member formats that the inventory actually observed. No issue is linked; I found this while running REA 6.4.0 on two of my own Swift apps and searched open and closed issues and PRs before opening this.

Problem and expected behavior

probesFor in src/domain/artifactInspection.ts chose probes from root_format alone, and "directory" shared the JavaScript branch with asar and javascript-bundle. Because inspect_artifact only admits app bundles as directories (a plain directory is refused with "open_binary accepts files and macOS app bundles"), every native .app was told to run the JavaScript analyzer and was never pointed at open_binary or inspect_plist.

Smallest trigger: any SwiftUI app bundle.

$ rea inspect-artifact Vigil.app --format json   # Contents/MacOS/Vigil and Contents/Helpers/vigil are universal Mach-O
next_probes: [analyze_javascript_application]

Expected: the probes match the bundle's members, so open_binary and inspect_plist, plus analyze_javascript_application only when the bundle holds an ASAR or bundled scripts (Electron).

Change and scope

For a directory root, probesFor now collects the artifact_format of every inventory occurrence and reuses the existing per format probes (renamed probesForFormat, unchanged otherwise) in a fixed order: ASAR and JavaScript, then Mach-O and ELF, then PE, then plist. Repeated operations are kept once, so open_binary keeps the general native rationale when a bundle holds both Mach-O and PE members. Non directory roots behave exactly as before.

Following review: classifyArtifactPath now names the same JavaScript source extensions the analyzer reads (.cts, .mts, .jsx, .ts, .tsx in addition to .cjs, .mjs, .js), so a bundle holding only TypeScript sources still gets the JavaScript probe; and directory probes ignore symlink occurrences, which the inventory and analyzers never follow.

Not included: no new probe operations, no schema change, and no change to hypotheses.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/domain/artifactInspection.ts, probe derivation after inventory.
  • CLI and MCP/tool-catalog contract: none; next_probes and unexplored_branches keep their schema, only their values for directory roots change.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: inventory occurrences for .cts, .mts, .jsx, .ts and .tsx paths now carry artifact_kind: javascript and artifact_format: javascript-bundle instead of resource and file, matching what the JavaScript analyzer already reads. No schema change.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/providers/native/artifactProvider.directoryProbes.test.ts runs inspect_artifact through the direct analysis workflow on a minimal native bundle (arm64 mach_header_64 plus Info.plist) and on an Electron style bundle (the same plus Contents/Resources/app.asar), on a bundle whose only scripts are TypeScript, and on a bundle whose only .js member is a symlink. Unexplored branches are checked to carry the same probes.
  • Base reproduction or other evidence: the first two tests fail on the base revision (it returns only analyze_javascript_application); the TypeScript test fails without the classifier change and the symlink test fails without the symlink filter. All four pass with this change.
  • User-visible CLI/MCP output: on real universal Swift bundles (Vigil.app and API Pilot.app, macOS 27.0.1), next_probes changes from ["analyze_javascript_application"] to ["open_binary", "inspect_plist"].
  • Remaining proof gaps: no real Electron app bundle was inspected; the Electron case is covered by the fixture only.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npx vitest run tests/boundary/providers/native/artifactProvider.directoryProbes.test.ts: 4 passed; each test fails when its corresponding fix is reverted.
  • npx vitest run over every test file whose path mentions artifact, javascript, inventory, electron, asar, bundle, comparison or evidence (251 files): 2852 passed, 4 failed, 41 skipped. The 4 failures are in tests/boundary/inspector/javascriptRuntimeObservation.test.ts and javascriptRuntimeTargetLocations.test.ts and fail identically on unmodified b777e5d in my environment, so they are unrelated to this change.
  • npm run check:fast: typecheck and lint passed.
  • npm run verify:test-discovery: discovered all test files exactly once.
  • oxfmt --check src tests: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS 27.0.1 on Apple silicon, Node 24.21.0; no native provider was needed or run, since inspect_artifact is provider neutral.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new process execution or file access; the change only reads inventory occurrences already in memory.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T18:44:20.474117Z aaede83 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41b633cd28

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/domain/artifactInspection.ts Resolved
Comment thread src/domain/artifactInspection.ts Resolved
…dles

inspect_artifact chose next probes from the root format alone, so every
app bundle directory was sent to analyze_javascript_application, including
native Swift bundles that contain no JavaScript. Directory probes now follow
the member formats the inventory observed: JavaScript for ASAR or bundled
scripts, open_binary for Mach-O, ELF or PE executables, managed inspection
for PE, and inspect_plist for property lists.
Path classification now names the same JavaScript source extensions the
analyzer reads (.cts, .mts, .jsx, .ts, .tsx), so a bundle holding only
TypeScript sources still proposes analyze_javascript_application. Directory
probes ignore symlink occurrences, whose path roles the inventory and the
analyzers never follow.
@thefolahan
thefolahan force-pushed the fix/inspect-artifact-bundle-probes branch from 41b633c to 7eece9b Compare October 11, 2026 21:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7eece9bc7e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/domain/artifactInspection.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

Directory inspection now chooses probes from bundle members instead of treating every app bundle as JavaScript.

  • App bundle inspections suggest probes that match their contents.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Artifact inventory] --> B{Directory root?}
  B -->|No| C[Existing format probes]
  B -->|Yes| D[Check JavaScript file roles and ASAR members]
  B -->|Yes| E[Check native and plist directory ancestry]
  D --> F[Combine probes in fixed order]
  E --> F
  F --> G[Keep each operation once]
  G --> H[Next probes and unexplored branches]
Loading

Reviews (8) · Last reviewed commit: "Merge branch 'main' into fix/inspect-art..." · Reviewed by Greptile

Source-reviewed changes. Tests, builds and check reruns were skipped at maintainer request.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b7c7e1db2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/artifactInspection.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22ee275271

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/artifactInspection.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Probe selection used artifact-format labels while JavaScript acquisition used a broader relevant-file classification, excluding source-map-only bundles. Commit 22ee275 moves the acquisition classifier to the shared domain boundary and uses that same classification for directory probes, restricted to regular files as acquisition requires. The private duplicate classifier was removed; existing native/plist ordering and operation deduplication remain. A source-map-only bundle with sourcesContent now has public boundary regression coverage alongside the existing symlink and mixed-format cases.

Source and affected-consumer inspection, targeted formatting with two threads, and git diff --check completed. Regression coverage was authored; tests, builds, typechecks, lint, provider execution and CI reruns were skipped at the user’s request.

@morluto morluto added bug Something isn't working area: evidence Evidence, artifacts, and reconstruction area: domain Domain logic, errors, and pure functions P2: medium Medium priority issue labels Oct 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e283e621df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread

Probe eligibility now retains occurrence identity and walks its parent occurrences: direct filesystem paths may traverse directory ancestors, but a packed ASAR file cannot be reached as a local path by inspect_managed_artifact. The occurrence-aware rule is at the domain owner and leaves the archive probe available; shared JavaScript acquisition classification remains reused by the directory probe. The fix is live at e283e62. Source/consumer inspection and git diff --check passed; tests, builds, typechecks, lint, provider execution and CI reruns were skipped per instruction. No related cleanup remains.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e364692ab7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +112 to +113
"inspect_managed_artifact",
"open_binary",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Expect open_binary before the managed probe

After the metadata follow-up, fresh evidence is that the physicalCopy === true case now contains both the direct Mach-O at Contents/MacOS/Fixture and a direct PE. DIRECTORY_MEMBER_FORMATS visits Mach-O before PE (src/domain/artifactInspection.ts:311-312), and operation deduplication retains that first open_binary, so the actual sequence is analyze_javascript_application, open_binary, inspect_managed_artifact, inspect_plist; this assertion reverses the middle operations and deterministically fails that parameterized case.

Useful? React with 👍 / 👎.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread

The bundle component owner now treats JavaScript bundles as runtime evidence, and the native packed-PE fixture now contains a valid Mach-O plus Info.plist so its probes exercise the actual producer. Both fixes are live at e364692. Source inspection and git diff --check only; tests/checks/provider executions were not run.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e2ade30ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
await createPackageWithOptions(
source,
join(bundle, "Contents/Resources/app.asar"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Create Resources before writing the Electron ASAR

In this Electron-style case, writeTree creates Contents and Contents/MacOS but never Contents/Resources; createPackageWithOptions writes the archive file but does not recursively create its destination parent. On a fresh fixture this rejects with ENOENT before probeOperations runs, so create the Resources directory first as the packed-PE fixture below already does.

Useful? React with 👍 / 👎.

@morluto morluto closed this in 55dd21a Oct 14, 2026
morluto added a commit that referenced this pull request Oct 14, 2026
Normalize path facts once at the owning filesystem boundary, preserve caller spelling and unavailable inventory members, and retain typed read failures. Record exclusion entry kinds so only proven directories can establish descendant symlink targets; omitted legacy kinds stay unknown.

Reviewed fixes include #1969, #2642, #2759, and #2994.

Validation: 26 reference graph source tests passed; prior artifact checks passed 275 tests with one Windows-only skip. Updated compiled import workflows are included in final validation after regeneration.
@thefolahan

Copy link
Copy Markdown
Contributor Author

Hi @morluto, thank you for taking the fix from this PR into main in 55dd21a and ec27112. I am glad the probe selection work was useful.

A small request: when you fold a contributor's work into one of your commits, would you consider adding a co-author trailer? GitHub then credits the contributor on the commit, which means a lot to people contributing for the first time. For my work it would be:

Co-authored-by: Omisakin Joshua <[email protected]>

The same applies to #2877, whose core landed in 80de314. No need to rewrite history for the commits already on main, of course. This is only for future ones. Thank you again for the reviews and for maintaining REA.

@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

@thefolahan, thanks for catching that directory probes were being inferred from the bundle root alone. Probe suggestions now follow formats observed in the inventory, avoiding a JavaScript recommendation for native-only apps (main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions area: evidence Evidence, artifacts, and reconstruction bug Something isn't working P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants