feat: seed the batch capacity and duration from depth/amount query params - #10
Merged
Cafe137 merged 1 commit intoSep 11, 2026
Merged
Conversation
…rams Hosts that let the user choose a size and lifespan before opening the widget had no way to hand those over: the batch screen always opened on depth 19 (+ reserved slots) and 7 days, so what the user picked in the host and what the widget offered never matched (snaha/swarm-id#632). `depth` preselects the capacity when it is one of the offered depths, and `amount` (PLUR per chunk) preselects the duration as the whole days it funds at the current storage price, clamped to the input's 1–365. Both are defaults only: the user can still change them, and the `batch` message keeps carrying the depth and amount that were actually bought. NumberInput now follows a value its parent changes on its own — the seeded duration arrives once the price is known, after the input has mounted, and without this it kept showing 7 while the swap was priced for the seeded days. A change that originated in the input already matches, so typing is untouched. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w
Collaborator
|
Thanks @agazso! I will have a quick look and deploy it by tomorrow noon. |
Cafe137
approved these changes
Sep 11, 2026
agazso
added a commit
to snaha/swarm-id
that referenced
this pull request
Sep 11, 2026
The popup URL carried only the batch owner, so the widget opened on its own defaults (depth 21, 7 days) whatever the form said, and a user who chose ~90 MB for 3 days met 111 MB / 7 days in the popup and a 2.2 GB / 7-day drive afterwards (#632). The widget reads no size or lifespan parameter today; ethersphere/multichain-widget#10 adds `depth` and `amount` as defaults it opens on, and this passes them — the form's depth, and the per-chunk amount that funds its lifespan at the current price. Until that deploys the extra params are ignored, so nothing changes for users before it. The mock settles on the same two values, so `mockDepth` goes. The method screen's explainer now says the form's choice is the popup's starting point rather than an estimate the popup ignores. Part of #632 — the issue closes once the widget deployment carries the fix. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w
agazso
added a commit
to snaha/swarm-id
that referenced
this pull request
Sep 11, 2026
…and lifespan (#721) * fix(ui): hand the form's size and lifespan to the widget as its defaults The popup URL carried only the batch owner, so the widget opened on its own defaults (depth 21, 7 days) whatever the form said, and a user who chose ~90 MB for 3 days met 111 MB / 7 days in the popup and a 2.2 GB / 7-day drive afterwards (#632). The widget reads no size or lifespan parameter today; ethersphere/multichain-widget#10 adds `depth` and `amount` as defaults it opens on, and this passes them — the form's depth, and the per-chunk amount that funds its lifespan at the current price. Until that deploys the extra params are ignored, so nothing changes for users before it. The mock settles on the same two values, so `mockDepth` goes. The method screen's explainer now says the form's choice is the popup's starting point rather than an estimate the popup ignores. Part of #632 — the issue closes once the widget deployment carries the fix. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w * fix(ui): label a drive with what one device can write to it Every size — the Add drive and Resize dropdowns, the drive card — was bee-js's effective volume for a whole batch written by a single writer. A device writes into one of PARTITION_COUNT interleaved lanes and reports "Storage full" when a bucket of that lane fills, so the used % sat on the lane's scale beside a label on the batch's: ~2x too big from depth 22 up, ~6x at 20 and ~16x at 19 (#566). `driveEffectiveBytes(depth)` is bee-js's figure one depth smaller — a lane has half the slots of every bucket, and the table is indexed by slots per bucket — from the encrypted, no-erasure-coding table, which is how the lib writes chunks; the one-argument call we made fell through to a table with medium erasure coding baked in. The reserved slot the lane also gives up is not modelled: little from depth 22 up, ~1.5x at 20 and ~6x at 19, and the exact lane capacity can be priced later if that matters. The widget popup gets `reserved-slots=1`: it implements that as a depth shift on the label it shows, so one halving is the closest it comes to our labels. With 2 it said 111 MB for a batch we now label 650 MB. Closes #566 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w * fix(lib): stop offering depth 19, a drive of ~1 MB With drive sizes labelled by what one device can write (#566), depth 19 shows as 6 MB and honestly holds about 1 MB: its partition lane has three slots per bucket, and with chunks placed uniformly some bucket fills after a few hundred of them. Not worth its purchase, so the usable floor moves from a lane of 2 chunks to one of 4 — depth 20, ~66 MB — the same way #538 dropped 17 and 18. MIN_USABLE_PARTITION_CAPACITY is exported so the test says why. An existing depth-19 drive keeps working and can still grow, the way a 17 or 18 could; it is only no longer offered. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w * fix(ui): hedge the widget explainer until the deployed popup reads the form Review follow-ups on #721: the deployed swarmbucks bundle still seeds the popup from 19 + reserved-slots and 7 days, so the copy no longer promises the form's values as the popup's defaults. Also note the lifespan clamp beside the depth one, the power-of-two assumption behind LANE_DEPTH_SHIFT, cite #728 for the depth-20 overstatement, and update the depth-19-era figures in the test prose. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
agazso
added a commit
to snaha/swarm-id
that referenced
this pull request
Sep 11, 2026
…URL (#730) * fix(ui): open the widget on fund.bzz.limo and name its host from the URL fund.bzz.limo now serves the build with the window.opener fix and the depth/amount defaults (ethersphere/multichain-widget#10), so the popup opens there. The host is named only in WIDGET_BASE_URL; the method label, the explainer and both "Continue to" buttons derive it through WIDGET_HOST, so the copy cannot drift from the URL again. With the deployed popup reading the form's values, the explainer says so plainly. Closes #612 Closes #632 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w * fix(ui): name the widget host nowhere but WIDGET_BASE_URL Review follow-ups on #730: the e2e suites match the derived button label by shape, the allowed-origin list takes the base origin by construction, the dev page and the cancel error derive the host through WIDGET_HOST, the unit test imports the origin instead of mirroring it, and every comment, rules file and doc says "the widget" rather than a host that moves. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hosts that let the user choose a drive size and lifespan before opening the widget have no way to hand those over: the batch screen always opens on depth 19 (+
reserved-slots) and 7 days, so the host's choice and the widget's never match (snaha/swarm-id#632).Two optional query params, both documented in the README:
depth=21preselects the capacity, when it is one of the offered depths (after thereserved-slotsshift). Anything else is ignored.amount=<PLUR per chunk>preselects the duration: converted to whole days at the current storage price, clamped to the input's 1–365.Both are defaults only — the user can still change them in the widget, and the
batchmessage keeps carrying the depth and amount actually bought.NumberInputnow follows a value its parent changes on its own: the seeded duration arrives once the price is known, after the input has mounted, and without this it kept showing 7 while the swap was priced for the seeded days. A change that originated in the input already matches, so typing is untouched.Verified on the vite dev build against Gnosis:
depth=22&amount=4502615040(3 days at the current price) opens on 682.21 MB / 3 days, typing into the days input still works, anddepth=30&amount=abcfalls back to 111.18 MB / 7 days.🤖 Generated with Claude Code
https://claude.ai/code/session_01DLLFWxrn3PjMtT4DiucK2w