Skip to content

OPS-197: import prelaunch bootstrap JSON during cluster creation - #47

Closed
huangminghuang wants to merge 22 commits into
masterfrom
feature/ops-197-prelaunch-bootstrap
Closed

OPS-197: import prelaunch bootstrap JSON during cluster creation#47
huangminghuang wants to merge 22 commits into
masterfrom
feature/ops-197-prelaunch-bootstrap

Conversation

@huangminghuang

@huangminghuang huangminghuang commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add optional Ethereum and Solana prelaunch bootstrap JSON inputs to cluster creation, persist their absolute paths as provenance, and validate and convert them before phase execution
  • merge configured, synthetic, and controlled credits into one deterministic cluster-owned dclaim plan with compact report inputs, file-backed batch transport, and exactly one global importdone
  • reuse the shared pipeline from emissions soak with independent per-chain synthetic fallback and collision-aware controlled claimant expectations
  • add the flow-with-bootstrap-data fixture flow and forward exact post--- flow arguments through the canonical runner; its README documents the required runner + heartbeat-monitor pair
  • merge current master daemon start-script support while preserving the completed dclaim bootstrap sequence before those scripts are composed

Safety

  • strict Zod validation reports chain, absolute file, row, and field context; malformed inputs preserve their originating errors
  • configured-file balance accumulation rejects a converted value above the Antelope asset maximum with its source file, row, field, address, converted amount, and maximum before phase composition
  • merged credits enforce address width, positive amounts, valid positive-safe-integer batch sizes, and the Antelope asset maximum
  • additive dclaim writes use Step-owned single-attempt runOnce / invokeOnce / invokeViaFileOnce submission; an ambiguous finality outcome is accepted only when the exact transaction is present in a canonical irreversible block and paginated reconciliation confirms the expected contract state
  • reconciliation scans the complete bounded unmapped id window through next_key, and the global finalization Step issues importdone exactly once
  • large payloads use isolated owner-only temporary transaction files, remove their containing directory after use, and never enter Step report inputs

Validation

  • current pushed head: b2900941
  • Remote E2E Flow Tests #31730711106 — passed for wire-tools-ts b290094124c9abfb4a657fa45c98ef501272eb38; full Release platform build, artifact verification, pooled flows, and aggregate results completed successfully
  • local cluster-tool validation passed: TypeScript build, complete Jest project (132 suites / 1,173 tests), repository lint, and git diff --check

Jira: OPS-197

Change-Id: I3893e9cc8026ad7cdf574fc6cdf8e917cd7e6ef5
@huangminghuang
huangminghuang marked this pull request as ready for review July 29, 2026 18:14
@huangminghuang
huangminghuang requested a review from a team July 29, 2026 18:14

@jglanz jglanz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You need to repo sync and have claude take a pass with rules,STYLE.md and lint enabled from the wire-platform root.

Plus there's a note about using the changes I made to David's PR #25 (not landed), but you will see the pattern.

There are many rules being ignored - I was reviewing manally and saw the scope.

* Retry connection-level failures. Disable for additive actions whose
* delivery is ambiguous after a reset. Default `true`.
*/
retryTransport?: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove, nothing is regarded as ambiguous any longer, this goes agiinst the phase/steps model

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec868e23. Removed retryTransport from ClioRunOptions. ClioRunner.run keeps the normal transport policy, while the explicit runOnce primitive performs one subprocess attempt; the dclaim orchestration Step owns that choice and reconciliation instead of passing ambiguity/retry flags through the client.

* Absolute Ethereum prelaunch balance-dump path used during `create`, or
* `null` when no Ethereum dclaim bootstrap input was supplied. Persisted as
* provenance; reload paths never reread the source file.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checkout PR #25 - while its a work in progress, it introduces enclosed interfaces for Cluster{Ethereum,Solana}Config leafs & types

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec868e23 following the enclosed chain-config pattern from PR #25. Added ClusterConfigEthereumSchema / ClusterConfigEthereum and ClusterConfigSolanaSchema / ClusterConfigSolana, moved the persisted fields to ethereum.bootstrapJsonFile and solana.bootstrapJsonFile, and added matching nested caller options. The resolver, CLI mapping, consumers, fixtures, and schema default/validation tests were updated; the existing CLI flag names remain unchanged.

* Resend after finality observation failure. Disable for additive or
* irreversible actions and reconcile their state instead. Default `true`.
*/
retryFinality?: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove as well - Phase/Step system must be aware of all this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec868e23. Removed retryFinality and retryTransport from WireClient.InvocationOptions. The client now exposes explicit one-attempt primitives (invokeOnce / invokeViaFileOnce); the dclaim Phase/Step owns their use and performs exact-transaction plus expected-state reconciliation after a finality error.

}

/** One pre-batching credit set contributed for one native chain. */
export interface DistributionClaimBootstrapCreditSet {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

zod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec868e23. Replaced the hand-written bootstrap output interfaces with Zod schemas and z.infer types in DistributionClaimBootstrapOutput.ts. Core, contribution, per-chain result, and final result values are parsed at their merge/finalization boundaries.

/** Steps for `sysio.dclaim` (distribution claims) actions. */
export namespace DclaimContractSteps {
/** Compact per-chain totals copied into every batch's report input. */
export interface ImportSeedChainSummary {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

zod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec868e23. Added ImportSeedChainSummarySchema and now derive ImportSeedChainSummary with z.infer. The nested batch-input schema composes it, so sources, counts, and atomic totals are validated at the orchestration boundary.

* Compact input for one `importseed` Step. The bulk payload remains in
* `ctx.outputs` and is selected by chain plus batch index at run time.
*/
export interface ImportSeedBatchInput extends StepInput {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

zod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec868e23. Replaced the hand-written batch Step input interface with ImportSeedBatchInputSchema and z.infer, including kind, chain, batch index, credit count, and summary validation. The planner parses the input before creating the Step.

Change-Id: I31acf510362ea8e24c09d6ae531acaad7f87c73c
…launch-bootstrap

Change-Id: Ib00584cfe7c21727708655917f9f20b0eea4edab

# Conflicts:
#	packages/cluster-tool/src/orchestration/ClusterBuildDefaults.ts
Change-Id: Id060bb94b2703b1b9c2a4fc1d55f273248131617
Change-Id: Id8282ddbdfd66aadaf7f7dd5dfe0731041df0f09
@huangminghuang
huangminghuang requested a review from jglanz July 30, 2026 16:26
@huangminghuang

Copy link
Copy Markdown
Contributor Author

Addressed the review in follow-up commits ec868e23, fc079ab9, and 6ae46f7c. I synced current master and performed the root-level repo/rules/STYLE/lint compliance pass directly (Claude was not invoked), including independent rule/style gate reviews and validation against live sibling links. pnpm run lint passes, and pnpm test passes with 204 suites / 1,337 Jest tests plus 3 script tests. The full Release platform E2E run repo-synced the platform, applied exact wire-tools-ts head 6ae46f7c, and passed all 13 flows: https://github.com/Wire-Network/wire-platform-build-system/actions/runs/30554471282. I replied separately on each inline thread with the corresponding change.

Change-Id: I562ff1ab5777e373655758263729de9a144957bd

@jglanz jglanz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see any tests OR test data/fixtures (unit tests); also please run a fresh flow suite. I'd suggest delaying this work till wednesday as there is a very large changeset coming that this will need to be rebased on to as well

@jglanz jglanz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are quite a few potential conflicts with a PR stack that I'm wrapping up myself (time critical cluster build related); this thursday, please fetch & rebase on to master and resolve any gaps.

Additionally, this requires a new flow-with-bootstrap-data to be created.

Change-Id: I3893e9cc8026ad7cdf574fc6cdf8e917cd7e6ef5
Change-Id: I31acf510362ea8e24c09d6ae531acaad7f87c73c
Change-Id: Id060bb94b2703b1b9c2a4fc1d55f273248131617
Change-Id: Id8282ddbdfd66aadaf7f7dd5dfe0731041df0f09
Change-Id: I562ff1ab5777e373655758263729de9a144957bd
…launch-bootstrap

Change-Id: Iad24f69894715f19b62de073ba2fa44564eecf67
Change-Id: Ic88cd60d2cd842517c7d0a36b6504554a57ddcf6
Change-Id: Ic58f8611e8e4af1cfdf563934985cfcb30165753
Change-Id: Ifc6b594277d707b1e3067e05c8831ff95f91462c
…rap' into feature/ops-197-prelaunch-bootstrap

Change-Id: I24f9fdbc63b2866935c2276360b62343d4d10bb1

# Conflicts:
#	README.md
#	eslint.config.mjs
#	packages/cluster-tool/README.md
#	packages/cluster-tool/src/clients/wire/WireClient.ts
#	packages/cluster-tool/src/clients/wire/clio/ClioRunner.ts
#	packages/cluster-tool/src/config/ClusterBuildOptions.ts
#	packages/cluster-tool/src/config/ClusterConfigProvider.ts
#	packages/cluster-tool/src/orchestration/ClusterBuildDefaults.ts
#	packages/cluster-tool/src/orchestration/outputs/DistributionClaimBootstrapOutput.ts
#	packages/cluster-tool/src/tools/wire/WireDclaimSeedTool.ts
#	packages/cluster-tool/tests/cli/ClusterBuildOptionsArgs.test.ts
#	packages/cluster-tool/tests/clients/wire/WireClient.test.ts
#	packages/cluster-tool/tests/flow/contexts/SwapScenarioContext.test.ts
#	packages/cluster-tool/tests/orchestration/ClusterBuildDefaultsDclaim.test.ts
#	packages/cluster-tool/tests/tools/wire/WireDclaimSeedTool.test.ts
#	packages/cluster-tool/tests/tools/wire/WireOperatorProvisioningTool.test.ts
#	packages/cluster-tool/tests/tools/wire/WireReserveTool.test.ts
@huangminghuang
huangminghuang requested a review from jglanz August 12, 2026 14:37
…launch-bootstrap

Change-Id: Ib2c01776d26db0f9b66aef6856d25ddca5b05ed9

# Conflicts:
#	packages/cluster-tool/src/orchestration/ClusterBuildDefaults.ts
Change-Id: Ib340584720c1c03be7207b6e107f62d6d80f9a01
Change-Id: I446a2d569e18d02f645c48d592e318fde9b27c81
Change-Id: I037b9099281f20af94cac02f59bb9d9502f06798
…launch-bootstrap

Change-Id: I2edee3e63b26f338370ee3030907eb28dd0af3a3
Change-Id: I1979ce4da5d3a45304025cbef77def739b0bb4bb

@jglanz jglanz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I stopped reviewing at FlowScenario as the approach as mentioned in the comments is not adherent to the design pattern the system is built on

Comment on lines +20 to +34
/**
* Normalize the process arguments pnpm appends to a flow package script.
* `run-flow.mjs` intentionally reinserts a pnpm delimiter; pnpm passes that
* literal token through to `node`, while yargs would otherwise treat it as the
* end of options and ignore every forwarded flow flag.
*
* @param args - Process arguments following the flow entrypoint.
* @returns A fresh array with at most one leading delimiter removed.
*/
export function normalizeFlowCLIArguments(
args: readonly string[]
): string[] {
return args[0] === "--" ? args.slice(1) : [...args]
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove

options,
this.scenario.createContext?.bind(this.scenario)
this.scenario.createContext?.bind(this.scenario),
this.scenario.prepareDistributionClaimBootstrap?.bind(this.scenario)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bad design, FlowScenario shouldn't have any such member

Comment on lines +45 to +58
/**
* Optionally prepare additive distribution-claim credits after configured
* files are validated and converted but before batching and bootstrap phase
* composition.
*
* @param cluster - Resolved cluster and flow context.
* @param core - Configured-file credits already prepared by the harness.
* @returns Additive flow credit sets.
*/
prepareDistributionClaimBootstrap?(
cluster: ClusterBuild<C>,
core: DistributionClaimBootstrapCore
): Promise<DistributionClaimBootstrapContribution>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

back-to-the-drawing board

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