Skip to content

fix: harden blueprint tooling flows#359

Open
ShiroKSH wants to merge 1 commit into
ton-org:masterfrom
ShiroKSH:agent/blueprint-pr
Open

fix: harden blueprint tooling flows#359
ShiroKSH wants to merge 1 commit into
ton-org:masterfrom
ShiroKSH:agent/blueprint-pr

Conversation

@ShiroKSH

@ShiroKSH ShiroKSH commented Jul 9, 2026

Copy link
Copy Markdown

Summary

  • Fix CLI argument forwarding and avoid shell interpolation when running tests and snapshots.
  • Select the correct Tact BOC, preserve recursive compilable paths, and handle legacy commands without a trailing newline.
  • Harden TonConnect transaction metadata/session storage and clean up network UI state on errors.
  • Make the package build work on Windows and align the example project dependencies and lockfile with Blueprint 0.45.0.

Validation

  • yarn tsc --noEmit --pretty false
  • yarn build
  • yarn test --runInBand --no-cache — 8 suites, 13 tests
  • yarn npm audit --environment production --no-deprecations
  • Example npm install --dry-run, yarn install --immutable, and yarn test --runInBand

Summary by CodeRabbit

  • New Features

    • Improved network and transaction handling for a smoother deployment and sending experience.
    • Contract/build discovery now handles nested paths more reliably.
  • Bug Fixes

    • Fixed timeout and snapshot/test argument handling for more consistent command behavior.
    • Better transaction link generation and explorer defaults.
    • Build artifacts and storage files are now created with safer, more reliable filesystem handling.
  • Documentation

    • Updated setup and configuration docs to match the latest option names and project structure.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request updates build orchestration, CLI argument handling, compiler artifact selection, recursive file discovery, network transaction behavior, session storage permissions, example dependencies, documentation, and related tests.

Changes

Build and project configuration

Layer / File(s) Summary
Build orchestration and artifact output
package.json, scripts/build.js, src/build.ts
The build script now invokes a platform-aware compiler and copies templates; artifact output creates missing parent directories recursively.
Project metadata and documentation
example/package.json, example/README.md, README.md, .gitignore
Example dependency versions, documented paths, the request timeout field name, and ignored temporary directories are updated.

CLI command execution

Layer / File(s) Summary
Compile string extraction
src/cli/convert.ts, src/cli/convert.spec.ts
Compile string extraction is moved into an exported helper and tested for commands without trailing newlines.
Structured CLI argument forwarding
src/cli/test.ts, src/cli/test.spec.ts, src/cli/snapshot.ts, src/cli/snapshot.spec.ts
Test and snapshot runners filter their own flags and invoke npm with structured argument arrays.

Compiler and file selection

Layer / File(s) Summary
Contract-specific Tact artifact selection
src/compile/tact/compile.tact.ts, src/compile/tact/compile.tact.spec.ts
Tact compilation selects the BOC matching the requested contract name and tests selection among multiple BOCs.
Nested compile path discovery
src/utils/selection.utils.ts, src/utils/selection.spec.ts
Compile names now preserve nested directory paths, with coverage for recursive discovery.

Network and storage behavior

Layer / File(s) Summary
Provider compatibility and transaction cleanup
src/network/createNetworkProvider.ts, src/utils/ton.utils.ts
Provider compatibility checks, explorer defaults, custom global ID handling, prompt cleanup, and network-prefix resolution are updated.
TonConnect transaction request
src/network/send/TonConnectProvider.ts
TonConnect requests now include chain selection and seconds-based expiration, while UI cleanup runs on success and failure.
Secure session file permissions
src/network/storage/FSStorage.ts, src/network/storage/FSStorage.spec.ts
Session directories and files receive explicit private permission modes, with filesystem tests covering the behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NetworkProvider
  participant TonConnectProvider
  participant TonConnectSDK
  NetworkProvider->>TonConnectProvider: select compatible network provider
  TonConnectProvider->>TonConnectSDK: send transaction with chain and expiry
  TonConnectSDK-->>TonConnectProvider: return transaction result or error
  TonConnectProvider-->>NetworkProvider: return after clearing UI prompt
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes changes and validation, but it omits the required Issue section and checklist items from the template. Add the Issue section with a closing issue number and complete the checklist entries for CHANGELOG, README, tests, test, and lint.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main theme of hardening Blueprint tooling flows.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ShiroKSH
ShiroKSH marked this pull request as ready for review July 9, 2026 21:27

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
src/compile/tact/compile.tact.ts (1)

19-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

BOC selection logic is sound.

The two-tier matching (name-based first, single-BOC fallback second) correctly handles both the new contract-specific selection and backward compatibility with older Tact compiler output. The uniqueness enforcement and clear error message on ambiguity are good.

One observation: the fallback path (bocs.length === 1 when no name match exists) will silently select the only BOC regardless of the name argument. This is intentional for backward compat, but consider adding a test case for this fallback path and the error path (multiple BOCs, no name match) to lock in the behavior.

🧪 Suggested additional test cases
it('falls back to the only BOC when no name match exists', () => {
    const cell = beginCell().storeUint(0, 1).endCell();
    const files = new Map([['contract.code.boc', cell.toBoc()]]);

    expect(findTactBoc(files, 'Nonexistent').hash()).toEqual(cell.hash());
});

it('throws when multiple BOCs exist and none match the name', () => {
    const a = beginCell().storeUint(0, 1).endCell();
    const b = beginCell().storeUint(1, 1).endCell();
    const files = new Map([
        ['A_Foo.code.boc', a.toBoc()],
        ['B_Bar.code.boc', b.toBoc()],
    ]);

    expect(() => findTactBoc(files, 'Baz')).toThrow(
        "Could not find unique BOC for Tact contract 'Baz'",
    );
});

Also applies to: 106-106

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/compile/tact/compile.tact.ts` around lines 19 - 28, Add tests for
findTactBoc to lock in the current selection behavior: cover the fallback path
where bocs.length === 1 returns the only .code.boc even when the contract name
does not match, and cover the error path where multiple BOCs exist and none
match the requested name. Use the findTactBoc helper in
src/compile/tact/compile.tact.ts as the target for these cases and assert both
the returned Cell hash and the existing unique-error message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/compile/tact/compile.tact.ts`:
- Around line 19-28: Add tests for findTactBoc to lock in the current selection
behavior: cover the fallback path where bocs.length === 1 returns the only
.code.boc even when the contract name does not match, and cover the error path
where multiple BOCs exist and none match the requested name. Use the findTactBoc
helper in src/compile/tact/compile.tact.ts as the target for these cases and
assert both the returned Cell hash and the existing unique-error message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 605e4552-3595-4572-8ac6-30d42a0ed962

📥 Commits

Reviewing files that changed from the base of the PR and between 5da9654 and c98a959.

⛔ Files ignored due to path filters (1)
  • example/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (22)
  • .gitignore
  • README.md
  • example/README.md
  • example/package.json
  • package.json
  • scripts/build.js
  • src/build.ts
  • src/cli/convert.spec.ts
  • src/cli/convert.ts
  • src/cli/snapshot.spec.ts
  • src/cli/snapshot.ts
  • src/cli/test.spec.ts
  • src/cli/test.ts
  • src/compile/tact/compile.tact.spec.ts
  • src/compile/tact/compile.tact.ts
  • src/network/createNetworkProvider.ts
  • src/network/send/TonConnectProvider.ts
  • src/network/storage/FSStorage.spec.ts
  • src/network/storage/FSStorage.ts
  • src/utils/selection.spec.ts
  • src/utils/selection.utils.ts
  • src/utils/ton.utils.ts

@Danil42Russia

Copy link
Copy Markdown
Contributor

Hi!
Thank you for your contribution. However, at the moment, Blueprint is marked as deprecated in favour of Acton. The same applies to Tact, which has been deprecated in favour of Tolk.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants