fix: harden blueprint tooling flows#359
Conversation
📝 WalkthroughWalkthroughThe 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. ChangesBuild and project configuration
CLI command execution
Compiler and file selection
Network and storage 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
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/compile/tact/compile.tact.ts (1)
19-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winBOC 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 === 1when no name match exists) will silently select the only BOC regardless of thenameargument. 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
⛔ Files ignored due to path filters (1)
example/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (22)
.gitignoreREADME.mdexample/README.mdexample/package.jsonpackage.jsonscripts/build.jssrc/build.tssrc/cli/convert.spec.tssrc/cli/convert.tssrc/cli/snapshot.spec.tssrc/cli/snapshot.tssrc/cli/test.spec.tssrc/cli/test.tssrc/compile/tact/compile.tact.spec.tssrc/compile/tact/compile.tact.tssrc/network/createNetworkProvider.tssrc/network/send/TonConnectProvider.tssrc/network/storage/FSStorage.spec.tssrc/network/storage/FSStorage.tssrc/utils/selection.spec.tssrc/utils/selection.utils.tssrc/utils/ton.utils.ts
|
Hi! |
Summary
Validation
yarn tsc --noEmit --pretty falseyarn buildyarn test --runInBand --no-cache— 8 suites, 13 testsyarn npm audit --environment production --no-deprecationsnpm install --dry-run,yarn install --immutable, andyarn test --runInBandSummary by CodeRabbit
New Features
Bug Fixes
Documentation