Skip to content

feat(explorer): import source artifacts from a dropped project folder - #1229

Closed
1IxI1 wants to merge 2 commits into
ton-blockchain:masterfrom
1IxI1:source-project-import
Closed

feat(explorer): import source artifacts from a dropped project folder#1229
1IxI1 wants to merge 2 commits into
ton-blockchain:masterfrom
1IxI1:source-project-import

Conversation

@1IxI1

@1IxI1 1IxI1 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Builds on #1228 (the ABI build-dir import) — the first commit here is that PR; review only the last commit until it merges.

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.json and 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

  • The ABI catalog's drop importer from feat(explorer): drag-and-drop ABI and source import from acton build/project folders #1228 generalizes into buildImport.ts, which now hosts the shared directory walker (recursive webkitGetAsEntry, cache//logs//sessions//node_modules//hidden dirs skipped) plus the new buildSourceImportPlan.
  • Artifact detection is shape-based, not name-based, and accepts both artifact shapes: the current {code_hash, verified, bundle} and the legacy bundles array 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.
  • Registrations dedupe by code hash and go through one registerSources batch; the toast lists the registered entrypoints.

Testing

  • 5 new unit tests (tests/buildImport.test.ts): project-tree discovery, legacy bundles shape, code-hash dedupe, skipped dirs, no-artifacts hint.
  • Verified against a real 5-contract acton project root: both plans (ABI + sources) find all 5 contracts, source code hashes byte-match the build/<Name>.json hashes; the real artifacts were generated by a pre-fcb3a1a1d CLI, so the legacy path is exercised with production data.
  • Browser end-to-end (vite dev + CDP): picked the real project directory through the "Import project folder" input — all 5 sources appeared in the table with correct entrypoints, code hashes, and compiler versions; the ABI page still works after the refactor.
  • bun fmt / bun lint / tsc --noEmit / full bun test (169 tests) clean.

🤖 Generated with Claude Code

1IxI1 and others added 2 commits August 15, 2026 16:04
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>
@1IxI1
1IxI1 requested a review from i582 as a code owner August 15, 2026 13:49
@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploy Preview for acton-staging canceled.

Name Link
🔨 Latest commit 92d7263
🔍 Latest deploy log https://app.netlify.com/projects/acton-staging/deploys/6a806e898b3e7a0008a8d375

@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: 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".

Comment on lines +224 to +227
if (seenCodeHashes.has(registration.codeHash)) {
continue
}
seenCodeHashes.add(registration.codeHash)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@1IxI1

1IxI1 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #1228 as a second commit — one PR for both importers.

@1IxI1 1IxI1 closed this Aug 15, 2026
@1IxI1
1IxI1 deleted the source-project-import branch August 15, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant