Repository navigation
fix(web): route refused writes to their fix, keep edits on retry, calibrate cost previews - #91
Merged
Merged
Conversation
|
Warning Review limit reachedNext included review available in 39 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (45)
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 |
…ibrate cost previews D-007: decode Drive's refusal texts (budget, balance, key, gate, ...) and open the renew, top-up-key or top-up sheet; never show a refused write as sent. D-008: key the retry cache by content, pin an edited retry to the superseded attempt's nonce, remember superseded attempts and tombstone a landed one. D-011/D-012: recalibrate cost.ts from live moutai charges with first-write surcharges; check Drive's admission requirement before signing. D-042: typed unusable-key errors and an expiry timer. D-048: Follow through the write flow. D-049: body limits with a live counter. D-045: copy. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PastaPastaPasta
force-pushed
the
fix/web-write-refusals
branch
from
September 27, 2026 20:57
c8bd8b8 to
a1d6ae1
Compare
This was referenced Sep 27, 2026
fix(web): store a new browser key before registering it, and finish interrupted renewals (D-016)
#94
Merged
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.
What this fixes
This PR fixes web write-flow defects from the QA ledger: D-007, D-008, D-011, D-012, D-042, D-045, D-048, D-049.
D-007: a refused write was shown as "Sent, not yet visible"
Cause. When Platform refuses a transition at the broadcast check (CheckTx), evo-sdk 4.2.0-beta.4 throws a
WasmSdkErrorof kindGeneric, withcode: -1and the messageFailed to broadcast: Protocol error: <Drive's #[error] text>. I captured this live on moutai.consensusCodeOfneeded a numeric code, so every such refusal fell through to the "unclassified → poll → Unconfirmed" path.Fix.
asConsensusRefusalnow decodes Drive's refusal texts (rs-dpp 4.2.0-beta.4#[error]strings) into codes and figures: remaining, balance and required.ConsensusRefusalgainsisBalance,unpaid,figures, andcharged/feeCharged. A refusal at broadcast charges nothing and is not added to the ledger. A verdict from a block is charged, unless Drive leaves it unpaid.writeFailureinlib/view/write-errors.tsmaps each refusal to its fix:"Sent, not yet visible" is only ever said for a write that really may still land.
useWriteGuard().failed(e)opens that sheet and refreshes the balance and limits. Every composer and ConfirmDialog uses it.WriterBusyErrorand the newBusyWriteErrorget plain sentences.BusyWriteErrorcovers the budget gate turning the broadcast away: "may not have been sent".D-008: a retry after an edit lost the edit
contentKey), because sealing is randomised.SupersededWriteError. A tombstone makes every later retry of that intent answer the same way and sign nothing;createNumberedremembers the number the last attempt signed (24h). A retry therefore finishes that number instead of allocating the next and posting a second issue or PR.D-011: previews under-estimated
lib/sdk/cost.tsis recalibrated from about 60 live moutai measurements (listed in the header). It adds first-write surcharges:HEADROOMis 1.06.limit: 1proved read or count per subtree (lib/repo/first-write.ts), only once the viewer turns to a write: typing, pointing at Star or Follow, or a confirm opening.key:renewestimate now usesKEY_RENEW_CREDITS.D-012: the pre-check had no headroom
CostPreview.admit.affordability()compares againstadmit, so the case QA saw (0.0009 DASH left, 100.2M required) is stopped before signing.sumPreviewsadmits each write after the earlier ones have spent theirs.D-042: key expiry
KeyUnusableError(expired | disabled | missing | level) replaces the raw "no usable AUTHENTICATION key" error and opens Renew with the right reason.D-048: Follow
Follow now shows its price, runs the write guard, and confirms in ConfirmDialog. Unfollow confirms its refund.
D-049: body limits
Issue, comment, PR and review bodies are checked against the contract's
schemaDefslimits (5,120 bytes and characters for a body; 1,024 bytes and 256 characters for a title). A live byte counter shows the count, and over-long input is blocked. Private repos keep their sealed limit.D-045: copy
/logindescribes the real options.Also
repo-settings-sectionsguards now useadmit.auth-context.tsx.Tests
pnpm test: 1,891 pass, 10 skipped):lib/view/write-errors.test.ts: decoding the real SDK strings; nonce text never read as a refusal; routing to each sheet; charged vs not.lib/sdk/write-engine.test.ts:lib/repo/numbered-retry.test.ts: after Superseded, every retry of a numbered write returns to the same number (never posts a second issue or PR); a permanent refusal frees the number.lib/sdk/cost.test.ts: 42 measured charges (the upper-bound and +30% bounds) and 15 measured admission requirements.lib/view/funds.test.ts:admit-based affordability and the expiry timer.lib/view/text-limits.test.ts: limits read from the contract file.e2e/write-refusals.spec.ts;E2E_WRITE=1, withE2E_REFUSAL_IDENTITYset to a funded identity of your own):dash-forge-qa/evidence/impl/fix-web-write-refusals/{before,after}/.Not in this PR
banFailedAddress: false): "Try again" now recovers after a full outage, both for a failed read and for a failed first connect.🤖 Generated with Claude Code