mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo-client.git
synced 2026-09-21 16:52:02 -07:00
- Add three boundary unit tests to memo-like (tip == max, spendable == dust, tip == spendable) closing mutation survivors. - Refresh mutate4javascript and acceptance-mutation manifests from normal tool runs. - Add written architectural review report for like-tip-memo. By architect.
4.3 KiB
4.3 KiB
Architectural Review Summary — like-tip-memo
Task and commits reviewed
- Task:
like-tip-memo - Processed the refactorer handoff
merge_and_process refactorer 6b7a7e2b86and fast-forward merged theswarmforge-refactorerbranch ending at6b7a7e2b86intoswarmforge-architect, which carried:eb9aa29— specifier: addedspecs/like-tip-memo.feature(10 scenarios) anddev-docs/psf-memo-db-changes.mddd0535d— coder: implemented the Memo like action (0x6d04) with optional author tip, the like/tip page controller, heart-icon + modal UI, and acceptance handlers6b7a7e2b86— refactorer: reduced CRAP in the like/tip slice, consolidated rejection assertions, and added hex/like/property tests
Architectural findings and fixes applied
Reviewed UI/Core separation, dependency rule, information hiding/encapsulation, and local code quality.
- UI/Core separation (good). Core behavior is cleanly split from UI:
src/services/memo-like.js(extendsMemoAction) owns compose/validate/broadcast of the like OP_RETURN and optional tip, speaking only to an injected wallet.src/services/like-tip-page.js(extendsPageController) owns the modal page behavior (open/close/setTip/submit and error classification).- React (
like-button.js,like-tip-modal.js,post-feed-item.js) is a thin shell over the testable services. Core is testable with no UI/IO.
- Dependency rule (good). UI components depend inward on services;
LikeTipPage→MemoLike→MemoAction. Wallet/network I/O stays behind the injected minimal-slp-wallet adapter. No low-level module reaches toward IO. - Information hiding / encapsulation (good). Txid hex encoding, tip validation
(integer, dust floor, hard max, spendable balance), and the
0x6d04wire prefix are encapsulated.hexToByteswas extracted tosrc/services/hex.jsand is shared withmemo-reply.js— a good cross-slice DRY consolidation. - Local code quality (good). Small, single-responsibility modules; CRAP for every like/tip function is at or below 6 with 100% coverage.
- Boundary test gap closed (architect fix). Added three boundary unit tests to
test/unit/memo-like.test.js:- a tip at exactly the hard maximum is accepted,
- a wallet with exactly the dust-limit balance can make a pure like,
- a tip at exactly the spendable balance is accepted.
These kill the previously-surviving
> -> >=/< -> <=boundary mutants and pin down the inclusive max/balance semantics.
Verification results
- Unit (
node --test): 133/133 pass (including the 3 added boundary tests). - Property (
node --test test/property/*.test.js): 18/18 pass. - Acceptance (normal):
memo-new,post-memo,set-name,reply-memo, andlike-tip-memo(10 scenarios) generated suites all pass. - Mutation (
mutate4javascript src/services/memo-like.js --mutate-all): 25 killed, 0 uncovered, 7 survived — all documented equivalents:validate/validateTip{ok:true}returns are ignored bylike()(dead return value),likedefaulttipSats = 0(callers always pass the parsed tip),_requireTipAddress/_buildTipOutputboundary mutations ontipSats ≤ 1/authorAddress.length > 1are unreachable because such tips are below the dust floor and rejected earlier.
- DRY (
dry4javascript src/services/memo-like.js like-tip-page.js hex.js): no duplicate candidates. - Gherkin acceptance mutation (soft) on
like-tip-memo.feature: 16 executed, 4 killed, 12 survived, 0 errors. Every survivor is an expected soft survival: a mutated example value still yields the same asserted outcome (a still-invalid tip, a still-below-dust tip, or a tip/balance pair that still trips the same check). - CRAP: all like/tip functions ≤ 6.0 (max
_validateTipAmount6.0), 100% coverage.
Suite status
Unit + property + acceptance all pass; source-level mutation kills all meaningful mutants with survivors documented as equivalents; DRY clean; CRAP within threshold.
Handoffs sent
git_handoff→ coder, refactorer (priority00, tasklike-tip-memo), to review the architect commit (three boundary tests + tool-refreshed manifests; no source logic change).- No handoff to the specifier: the architect produced no functional feature commit.
By architect.