feat(explorer): import source artifacts from a dropped project folder - #1229
feat(explorer): import source artifacts from a dropped project folder#12291IxI1 wants to merge 2 commits into
Conversation
Registering ABIs one by one is tedious for multi-contract projects: each
file needs a manual pick plus a hand-copied code hash. Let the ABI
catalog accept a whole acton build/ directory instead - drag-and-drop it
anywhere onto the table (or use the new "Import build folder" button)
and every contract registers in one go.
The import pairs build/abi/<Name>.json (raw compiler ABI) with
build/<Name>.json ({code_boc64, hash}) by basename, falling back to the
ABI's contract_name; when same-named artifacts exist in several places,
the one next to the abi/ directory wins, and genuinely different hashes
all attach to the ABI. cache/ (stale versions), logs/, sessions/ and
hidden directories are skipped, hashes are normalized (hex or base64),
duplicates collapse, and ABIs with no matching code artifact surface as
warnings in the result toast. Files that already carry inline
code_hashes (exported extended ABIs) register as-is.
Also drop the top: -4px offset that pushed the "environment" badge
above the vertical center of its row.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The source catalog's manual form wants one very specific JSON per
contract, and nothing on the page says which file that is. Let the page
take the whole project instead: drag-and-drop the project root (or use
the new "Import project folder" button) and every source artifact found
anywhere in the tree - typically build/sources/<Name>.source.json -
registers in one batch. If none are found, the error explains how to
generate them (acton build --output-sources build/sources).
Artifact detection is shape-based and accepts both the current
{code_hash, verified, bundle} artifact and the legacy bundles-array
emitted by CLIs predating fcb3a1a (feat(verifier): single bundle for
one code hash); the manual form now takes the legacy shape too, since
it shares the parser. Registrations dedupe by code hash.
The ABI catalog's drop importer generalizes to buildImport.ts to host
the shared directory walker and the new source plan; its behavior is
unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for acton-staging canceled.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92d7263dc8
ℹ️ 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".
| if (seenCodeHashes.has(registration.codeHash)) { | ||
| continue | ||
| } | ||
| seenCodeHashes.add(registration.codeHash) |
There was a problem hiding this comment.
Preserve distinct artifacts that share a code hash
When a dropped folder contains multiple source artifacts for the same compiled code hash but different source_bundle_hash values, this check silently imports only the first. The environment registry intentionally stores artifacts by source artifact ID and supports multiple revisions for one code hash (crates/acton-studio/src/contract_registry.rs:549-583), so deduplication should use the bundle/artifact ID rather than registration.codeHash; otherwise the “Register every source artifact” flow loses valid revisions.
Useful? React with 👍 / 👎.
|
Folded into #1228 as a second commit — one PR for both importers. |
What
The verified-sources catalog (
/sources) now accepts a whole acton project folder: drag-and-drop the project root anywhere onto the table (or click the new Import project folder button) and every source artifact found in the tree registers in one batch. The existing one-file manual form is unchanged.Why
The manual form wants one very specific JSON per contract, and nothing on the page tells you which file that is — you have to know about
build/sources/<Name>.source.jsonand cherry-pick them one by one. Dropping the project root removes the guesswork entirely; when a project has no generated artifacts yet, the error message says exactly what to run (acton build --output-sources build/sources).How
buildImport.ts, which now hosts the shared directory walker (recursivewebkitGetAsEntry,cache//logs//sessions//node_modules//hidden dirs skipped) plus the newbuildSourceImportPlan.{code_hash, verified, bundle}and the legacybundlesarray emitted by CLIs predating fcb3a1a (feat(verifier): single bundle for one code hash). The manual form shares the parser, so it now takes legacy artifacts too.registerSourcesbatch; the toast lists the registered entrypoints.Testing
tests/buildImport.test.ts): project-tree discovery, legacybundlesshape, code-hash dedupe, skipped dirs, no-artifacts hint.build/<Name>.jsonhashes; the real artifacts were generated by a pre-fcb3a1a1d CLI, so the legacy path is exercised with production data.bun fmt/bun lint/tsc --noEmit/ fullbun test(169 tests) clean.🤖 Generated with Claude Code