Skip to content

docs: add spark-regtest skill - #1403

Open
jvsena42 wants to merge 9 commits into
masterfrom
docs/spark-regtest-skill
Open

jvsena42 wants to merge 9 commits into
masterfrom
docs/spark-regtest-skill

Conversation

@jvsena42

@jvsena42 jvsena42 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Twin: synonymdev/bitkit-android#2008

Related: synonymdev/bitkit-android#1814

Description

  • Adds the spark-regtest agent skill at .agents/skills/spark-regtest/SKILL.md (docs: update docs and agent skills for the Blocktank sunset and Spark bitkit-android#1814, Part B). It covers only what a reader can't get from the docs: which Spark regtest to use (Lightspark's hosted one or bitkit-docker's local ./spark), that neither shares a chain with Blocktank's staging regtest, funding, the build gating for the local stack, and mining with ./spark. For details it points at bitkit-docker/docs/spark-regtest.md and bitkit-android's scripts/spark-regtest-fund.py.
  • Adds .claude/skills as a symlink to .agents/skills, the same pattern as .claude/commands, and mentions it in AGENTS.md.

Out of Scope

  • bitkit-docker docs/spark-regtest.md says iOS can take the two local Spark settings as SIMCTL_CHILD_ launch variables. The app reads them from Info.plist build settings, so that doesn't work. The skill says so, but the doc itself is unchanged here.
  • The other #1814 Part B docs and skills.
  • A Synonym-hosted Spark regtest: Host a Spark regtest network in the staging deployment bitkit-docker#42.

Design

N/A — no UI changes.

Preview

N/A

QA Notes

Setup

N/A — documentation only.

Journeys

N/A — no user-visible behaviour change.

Manual Tests

N/A

Automated Checks

N/A

Evidence

  • I checked each claim against master at be55060:

    • Env.localSparkSettings, Env.sharesLocalSparkChain, SparkManager.readsSavingsChain and Info.plist;
    • bitkit-e2e-tests main: scripts/build-ios-sim.sh and README.md;
    • bitkit-docker main: spark and docs/spark-regtest.md.
  • The Android twin had an independent review. Its findings that apply to iOS are fixed here:

    • claims on the hosted regtest after 3 confirmations, and on the local stack after 1 block;
    • Lightning wording on the hosted regtest;
    • the pinned BITKIT_DOCKER_REVISION in E2E;
    • no mainnet key content.
  • Round 2 (e2d7e1d), from ovi-reviewer's comments and an independent review:

    • the local recipe passes this checkout as IOS_ROOT;
    • uninstall or Reset To Default for a simulator that already chose an Electrum server;
    • the worktree paths, where ./spark runs, the simctl install step and the Instant claim;
    • hosted step 5 covers a payment between two devices;
    • the skill names the argument each ./spark funding command takes, ported from the Android review.
  • Proof for the IOS_ROOT fix: with the script's real IOS_ROOT default and stubs, from a worktree named bitkit-ios-wt, the old recipe resolved IOS_ROOT to bitkit-ios and the new one to bitkit-ios-wt.

Gaps

  • I did not run the skill's steps end to end on a simulator for this PR.

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: Not exposed)
  • Implementation: Claude Opus 5.5 (reasoning: Not exposed)
  • Review: Claude Opus 5.5 (reasoning: Not exposed)
  • Review rounds: 2

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42 jvsena42 self-assigned this Nov 24, 2026
@jvsena42
jvsena42 requested review from a team, ovitrif and piotr-iohk and removed request for a team November 24, 2026 12:45

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

No findings. Adds a spark-regtest agent skill under .agents/skills/ with a .claude/skills compatibility symlink, and points AGENTS.md at it. Reviewed 9321951, light tier (docs only), static: nothing to build.

What I checked, and 2 candidates I ruled out

Claims checked against code on master (be55060)

  • Local settings are read only when isDebug && isLocalE2EBackend && network == .regtest (Env.localSparkSettings, Env.swift:112); isE2E is E2E_BUILD or launch env E2E=true in DEBUG; E2E_BACKEND defaults to local.
  • SPARK_LOCAL_CONFIG_B64 / SPARK_LOCAL_CHAIN_URL go through infoPlistValue, not configValue, so a SIMCTL_CHILD_ launch variable cannot set them. The skill's correction of bitkit-docker/docs/spark-regtest.md holds.
  • Env.sharesLocalSparkChain requires http://<host>:23090/api and tcp://<host>:60001 for both node and hardware Electrum, which is what SparkManager.readsSavingsChain gates Transfer to Spending on.
  • bitkit-e2e-tests scripts/build-ios-sim.sh maps BACKEND=local to E2E_BACKEND=local, sets E2E_BUILD, and forwards both Spark settings as build settings.
  • bitkit-docker ./spark: config --base64, mine, pay, send exist; chain API on 127.0.0.1:23090/api; its docs give the v3-package reason for ./spark mine and the 1-block claim.
  • The Android script path and the BREEZ_API_KEY note resolve.

Ruled out

  • SPARK_CHAIN_SERVICE_URL not mentioned: journeys/README.md:223 says setting it lifts the Transfer Unavailable sheet on regtest. That knob changes what Spark reads (Env.sparkChainServiceUrl), not Savings' chain, and the skill's step (fund Spark's deposit address directly) works with or without it, so omitting an alternative is not a wrong instruction.
  • Claim timing differs from the Android twin ("unless an Instant transfer claims it early"): wording, not a wrong step.

CI: SwiftFormat and validate green; unit and integration runs still pending, and none of them reads these files.

Merge confidence: 5/5, a docs change no test applies to, its references checked against the code.

Reviewer model: claude-opus-5-5
Reasoning effort: Unknown (the reviewing session's run metadata does not report an effort setting)

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: full PR diff against its merge base, at 9321951.

No new actionable code findings.

No actionable code findings. All claims, symbols (Env.localSparkSettings, Env.sharesLocalSparkChain, SparkManager.readsSavingsChain), Info.plist build settings (SPARK_LOCAL_CONFIG_B64, SPARK_LOCAL_CHAIN_URL, E2E_BACKEND, E2E_NETWORK, BREEZ_API_KEY), UI navigation path, and symlink resolution (.claude/skills -> ../.agents/skills, CLAUDE.md -> AGENTS.md) match the pinned source, and git diff --check passes cleanly. Cross-repo references and intentional platform differences align with twin synonymdev/bitkit-android#2008 at 4a7d080 (scripts/spark-regtest-fund.py, no iOS ESPLORA_URL, 3-confirmation direct deposits on hosted regtest, and simulator loopback + Env.sharesLocalSparkChain enabling Transfer to Spending and Savings-paid exit fees on local ./spark), bitkit-docker (spark, docs/spark-regtest.md), and bitkit-e2e-tests (scripts/build-ios-sim.sh, README.md, BITKIT_DOCKER_REVISION). Reconciled the prior review; there are no open review threads.

Limitation: The skill's build, funding, and mining commands were verified statically against source and scripts rather than executed end to end against a simulator or Docker stack.

Device testing: not performed in this review; no device testing is required because this is a documentation-only change with no runtime or UI impact.

Reviewer model: gemini-4-neon
Reasoning effort: high

@jvsena42
jvsena42 enabled auto-merge (squash) November 24, 2026 13:15
@jvsena42
jvsena42 disabled auto-merge November 24, 2026 13:20
@jvsena42
jvsena42 enabled auto-merge November 24, 2026 13:20

@ovi-reviewer ovi-reviewer 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.

Verdict: ✅ Approve

Findings:

  • LOW .agents/skills/spark-regtest/SKILL.md:38 — The hosted guide stops at funding. Add how to create a Spending invoice on the receiving dev build and pay it from the funded build. Feature scope
  • LOW .agents/skills/spark-regtest/SKILL.md:51 — The build script can select another checkout. Pass the original iOS checkout path as IOS_ROOT. Build script
  • LOW .agents/skills/spark-regtest/SKILL.md:57 — A saved Electrum server can leave Savings off the fixture chain. Document Reset To Default for reused simulators. Electrum selection

QA for 9321951:

Check: Skill discovery and build recipe ✅ Both symlinks resolve and the shell block parses.

git diff --check passed. Replaying the commands with Xcode and Docker stubbed confirmed that IOS_ROOT selects the intended worktree.

Device testing was skipped because the diff changes documentation and agent skill discovery only. The full review from be55060 to 9321951 covered the build flags, chain selection, and funding references. The hosted and local wallet flows were checked against source and prior reports. Static QA and earlier hosted payment evidence.

Twin synonymdev/bitkit-android#2008 matches the Spark backend guidance and shares the missing hosted payment step. iOS enables Transfer to Spending and Savings-paid exit fees when the local Spark and Electrum endpoints match the fixture.


Reviewed by gpt-6.2-sol-high

Comment thread .agents/skills/spark-regtest/SKILL.md Resolved
Comment thread .agents/skills/spark-regtest/SKILL.md Resolved
Comment thread .agents/skills/spark-regtest/SKILL.md Resolved

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

utAck

@jvsena42
jvsena42 marked this pull request as draft November 24, 2026 14:44
auto-merge was automatically disabled November 24, 2026 14:44

Pull request was converted to draft

jvsena42 and others added 5 commits November 24, 2026 11:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review November 24, 2026 14:50
@jvsena42
jvsena42 enabled auto-merge November 24, 2026 14:50
@jvsena42
jvsena42 requested a review from ovitrif November 24, 2026 14:50

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: changes since 9321951, including affected code paths and prior findings, at e2d7e1d. Baseline: QA review.

No new actionable code findings.

No new actionable code findings in the follow-up. The skill updates match the pinned app and the scripts they name: IOS_ROOT is captured before cd and overrides build-ios-sim.sh's default of the bitkit-ios checkout beside bitkit-e2e-tests; xcrun simctl install runs from that repo against aut/Bitkit.app; ./spark send takes an address then sats and ./spark pay takes an invoice then optional sats; Receive › Spending exposes the Spending bolt11; and a stored Electrum server is what getCurrentServer prefers, with Reset To Default reconnecting to this build's default. The three review threads are resolved, and those steps are still in the skill: hosted payment, IOS_ROOT, and saved Electrum. The Electrum bullet now says to uninstall the app or use Settings › Advanced › Electrum Server › Reset To Default.

git diff --check passed. A stub replay of the recipe from a sibling worktree kept IOS_ROOT on that worktree and left the install path at bitkit-e2e-tests/aut/Bitkit.app. The real Xcode build, simctl, and Docker stack were not run. Commands were checked against bitkit-e2e-tests ecfc4c1 and bitkit-docker ad995c1. Compared only the shared spark-regtest skill with synonymdev/bitkit-android#2008 at 4dce3c3: the hosted payment, Instant caveat, funding arguments, and Electrum reset match; iOS passes IOS_ROOT and installs with simctl, and keeps Transfer to Spending available when the local Spark and Electrum URLs match the fixture.

Device testing: not performed in this review. This documentation-only change has no user-visible app behavior to exercise on a device.

Suggested additional test cases

  • iOS, from a worktree that sits next to bitkit-docker and bitkit-e2e-tests, with ./spark up already finished and one simulator booted. Run the skill's local recipe, including on a simulator whose app already saved a non-fixture Electrum server. The installed build should be that worktree, and Savings should use tcp://127.0.0.1:60001 after uninstalling the app or after Settings › Advanced › Electrum Server › Reset To Default.

Reviewer model: grok-4.7
Reasoning effort: xhigh

@jvsena42
jvsena42 marked this pull request as draft November 24, 2026 17:11
auto-merge was automatically disabled November 24, 2026 17:11

Pull request was converted to draft

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review November 24, 2026 17:12
@jvsena42
jvsena42 enabled auto-merge November 24, 2026 17:12
@jvsena42
jvsena42 requested a review from piotr-iohk November 24, 2026 17:12

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: changes since e2d7e1d, including affected code paths and prior findings, at 39466ad. Baseline: QA review. Coverage of the earlier skill edits, the .claude/skills compatibility symlink and the AGENTS.md pointer is inherited from that review; only the skill file changed since then.

No new actionable code findings.

No new actionable code findings in the follow-up. The only change captures spark config --base64 in CFG before the build and chains the build and xcrun simctl install with &&. That guard does what the new bullet says. A pure assignment returns the status of its command substitution: run in bash, a missing spark path gave status 127 and a failing command gave 1, and the build was skipped both times. In bitkit-docker, config exits 1 when spark-regtest/data/spark-config.json is missing, and it runs cd "$(dirname "$0")", so it works from bitkit-e2e-tests. build-ios-sim.sh forwards SPARK_LOCAL_CONFIG_B64 whenever it is set, even to an empty string, so the old inline form really would have built with an empty config.

Parity: the Android twin synonymdev/bitkit-android#2008 at 9f9197b uses the same CFG=… && guard and explanation before its Gradle build. Only that contract was compared.

Prior review threads: all three ovi-reviewer threads are marked resolved, and the steps they asked for are still in the skill at this head: hosted two-device payment, IOS_ROOT and saved Electrum reset.

This PR changes documentation and agent skills only, so no runtime check is needed. Device testing was not performed in this review, and the recipe was not run end to end.

Reviewer model: claude-opus-5-5
Reasoning effort: high

@ovi-reviewer ovi-reviewer 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.

Verdict: ✅ Approve

Posted as a comment: not every planned case passed.

Findings:

  • LOW .agents/skills/spark-regtest/SKILL.md:60 — If spark up fails and a config file from an earlier run survives, the recipe still builds and installs against a fixture that failed to start. Add spark up and the directory change to the existing && chain. Fixture startup, config lookup

QA for 39466ad:

Check: Local Spark build recipe ✅ The recipe selects the intended iOS worktree, stops on missing config, and skips install if the build fails.

git diff --check and Bash syntax validation passed. A replay ran the Spark helper and E2E build script with Docker, Xcode, and simulator commands stubbed. It also reproduced the retained-config failure above. Chaining startup stopped that replay before the build.

Reviewed 9321951..39466ad and verified all three prior fixes. Receive › Spending copies the Lightning invoice for the hosted payment, IOS_ROOT preserves the original worktree, and Reset To Default reconnects to the fixture Electrum server. Earlier hosted payment evidence, QA review at 39466ad

The suggested end-to-end simulator smoke check was skipped because the delta changes only the agent guide. The shell replay checked checkout selection and failure handling. Source inspection confirmed the Electrum reset path.

Twin synonymdev/bitkit-android#2008 at 9f9197b matches the hosted payment steps, funding arguments, and config capture. Android requires Connect To Host after electrum reset. iOS reconnects on reset and enables Transfer to Spending when the local Spark and Electrum endpoints match.


Reviewed by gpt-6.2-sol-high

Comment thread .agents/skills/spark-regtest/SKILL.md Resolved

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the updated Spark regtest guide at 39466ad3. I verified with stub commands that a missing config stops the build and install. The open recipe thread covers the remaining edge case: when startup fails but an old config exists, the recipe can still install the app. The required Run Tests job currently fails in the profile UI test while locating ProfilePubkyCopiedToast. This PR changes documentation and skill discovery.

Nonblocking wording suggestion: replace “ask the user” with “Ask the developer to set SPARK_REGTEST_MNEMONIC locally, or use the web faucet. Keep the mnemonic out of chat.”

@jvsena42
jvsena42 marked this pull request as draft November 25, 2026 08:34
auto-merge was automatically disabled November 25, 2026 08:34

Pull request was converted to draft

jvsena42 and others added 2 commits November 25, 2026 05:34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42

Copy link
Copy Markdown
Member Author

@piotr-iohk Applied your mnemonic wording suggestion from bitkit-android#2008 here in 3401126.

@jvsena42
jvsena42 marked this pull request as ready for review November 25, 2026 08:35
@jvsena42
jvsena42 enabled auto-merge November 25, 2026 08:35
@jvsena42
jvsena42 requested a review from piotr-iohk November 25, 2026 08:35
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The documentation changes appear safe to merge.

Summary

Adds the spark-regtest skill for hosted and local Spark testing.

  • A shared skill guides iOS developers through Spark regtest setup.

Reviewer model: gpt-6.1-sol
Reasoning effort: Unknown
Metadata note: The supplied session metadata names the model but provides no reasoning-effort setting.

Reviews (1) · Last reviewed commit: "docs: keep the spark faucet mnemonic out..." · Reviewed by Greptile

@ovi-reviewer ovi-reviewer 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.

Verdict: ✅ Approve

Findings: None. The remaining startup-failure finding is fixed: a failed spark up now stops the recipe before it can read a retained config or build the app. The faucet wording keeps the mnemonic local.

QA for 3401126:

Check: Local recipe stops on failures and preserves the intended checkout ✅ A shell replay in Bash and Zsh confirmed the failure chain and checkout selection.

Replayed the exact recipe with fixture, build and install commands stubbed. Failed startup with a retained config, a missing E2E directory, failed config retrieval and a failed build each stopped subsequent steps. Install failure returned a nonzero status. The success path passed the original worktree as IOS_ROOT, forwarded both local Spark settings with BACKEND=local, and installed aut/Bitkit.app from the E2E repository. Shell syntax checks and git diff --check passed.

Reviewed 39466ad..3401126 and the remaining startup thread. Unchanged hosted payment and Electrum guidance retain the coverage in the previous review.

No app build, live Docker fixture or simulator smoke check was run: the PR lists no device cases and changes documentation only. The shell replay checks the recipe's control flow, not wallet behavior.

Twin synonymdev/bitkit-android#2008 at 6e84867 matches the startup guard and mnemonic wording. The documented platform differences in chain selection and device setup remain unchanged.


Reviewed by gpt-6.1-sol-high

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: changes since 39466ad, including affected code paths and prior findings, at 3401126. Baseline: QA review. Coverage of the earlier spark-regtest skill edits, the .claude/skills compatibility symlink and the AGENTS.md pointer is inherited from that baseline; only the two new commits to .agents/skills/spark-regtest/SKILL.md were re-assessed.

No new actionable code findings.

No new actionable code findings in the follow-up.

  • Local recipe chaining (a2bf63e): spark up, IOS_ROOT="$PWD" and the cd are now part of the && chain. Checked against bitkit-docker spark at ad995c1: up exits with the spark-ready container's status (non-zero on compose failure or readiness timeout), while config only checks that spark-regtest/data/spark-config.json exists. That file persists until spark reset, so the new bullet's explanation is accurate. A local stub replay of the exact recipe showed that a failing spark up stops before config lookup, build and install (exit 1), and that the success path passes the original checkout as IOS_ROOT. This was a shell replay with stubs only, not a Docker/Xcode run.
  • Faucet mnemonic wording (3401126): the new text keeps the secret local or points to the web faucet. It is consistent with the SPARK_REGTEST_MNEMONIC usage in the bitkit-android scripts/spark-regtest-fund.py header.

Prior concerns: the recipe startup-failure thread, which was the remaining open edge case at the baseline, is marked resolved, and the fix is verified in the pinned source as described above. The other three review threads were already resolved at the baseline.

Parity: bitkit-android#2008 at 6e84867 has the same spark up && … spark config --base64 && chain, the same explanatory bullet and the same mnemonic wording. This was a comparison only, not a review of that PR.

Device testing: not performed in this review. The PR changes only agent documentation and skill discovery; no app code changed. At this head the Run Tests and Run Integration Tests checks were still pending.

Reviewer model: claude-opus-5-5
Reasoning effort: high

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.

4 participants