Skip to content

Fix the silent frontend regression, wire peer-lost, and lock the contract with tests - #5

Open
XxHugheadxX wants to merge 4 commits into
mainfrom
fix/f0-heridas
Open

XxHugheadxX wants to merge 4 commits into
mainfrom
fix/f0-heridas

Conversation

@XxHugheadxX

Copy link
Copy Markdown
Contributor

Phase 0 of the restructure plan: close the open wounds before building anything new. Four independent commits, each reviewable on its own.

Why

An audit of main turned up two live regressions and one piece of debt the team's own rules already forbade.

af42c9d reduced MerchantDetailModal to { merchant, onClose } while DiscoverScreen kept passing onConnect, onSave and connecting. React does not warn about extra props, so Connect P2P and Save promo silently disappeared. saveToWallet() is the only writer of wallet.loyaltyCards and its only caller was that dropped prop, so the wallet could never leave zero. The store handlers were never removed — only the props that reach them.

Separately, app.store.js wired peer-found and status but never peer-lost, so a beacon that walked out of range stayed in the visible list. This is the gap already written down in FRONTEND_INTEGRATION.md; the CLI TUI handled it correctly all along.

What changed

Commit Change
e1e916c Reconnects the two actions to the merchant sheet, in the current styling. No visual redesign.
7d0d8dd Adds the peer-lost handler and teardown(), which stops the beacon and the scan. network.stop() was added to the contract for this and had no caller, leaving the swarm open for the life of the app.
eb2237b Six tests over the nine frozen contract names. backend/mock.js gains an optional timings object so the suite does not wait out a timeline paced for a human watching --fake.
ce155af Removes frontend/package-lock.json (260 KB) and blocks npm/yarn lockfiles.

Verification

  • Tests: 10/10 passing, 31/31 asserts (was 4 tests, all DataManager).
  • Lint clean. Warnings went 4 → 3; the three that remain are pre-existing require-await on async stop() / update().
  • --fake verified end to end: the TUI receives status, renders the beacon with its promo and hours, and peer-lost clears it.
  • Mock defaults unchanged, measured directly: status 1s, peer-found 4s, peer-lost 19s, visitor every 5s. stop() now also clears the pending connect timer, which previously leaked.

Deliberately not in this PR

pear.stage.ignore is untouched. It was on the Phase 0 list, but 45 of its entries hang off pear-runtime — they are build tooling (bare-build-*, bare-pack, bare-cov) excluded on purpose in 491bee2. Validating a change needs pear stage --dry-run against the real link. Rewriting it blind would risk the bundle and OTA, which is the part that currently works.

The Spanish identifiers in app.store.js:461 ('local-propio', propio: true) are left alone. They date to efafde2 and belong to whoever owns frontend/src — flagging, not fixing, per the folder-ownership rule. AGENTS.md requires English in code, so this is worth a follow-up by that owner.

Review note

This is the first PR under the rule the restructure plan proposes: no self-merges. PR #1 shipped 98 files with zero reviewers, which is how the regression above reached main unnoticed. Please have someone who owns frontend/src look at e1e916c and 7d0d8dd.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V9zUvsS38fU1M1hT9yFK6j

XxHugheadxX and others added 4 commits September 4, 2026 15:12
af42c9d reduced MerchantDetailModal to { merchant, onClose } while
DiscoverScreen kept passing onConnect, onSave and connecting. React does
not warn about extra props, so the two actions silently disappeared.

saveToWallet() is the only writer of wallet.loyaltyCards and its only
caller was that dropped prop, so the wallet could never leave zero. The
store handlers were untouched -- this only reconnects them, in the
current 8-bit styling.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The store wired peer-found and status but never peer-lost, so a beacon
that went out of range stayed in the visible list -- the gap called out
in FRONTEND_INTEGRATION.md. The CLI TUI already handled it correctly.

Also adds teardown(), which stops the beacon and the scan. network.stop()
was added to the contract for this and had no caller, leaving the swarm
open for the life of the app.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
FRONTEND_INTEGRATION.md freezes nine names that two consumers depend on.
A rename already shipped once without either consumer noticing, and
nothing failed. These six tests fail loudly instead.

backend/mock.js takes an optional timings object so the suite does not
wait out a timeline paced for a human watching --fake. Defaults are
unchanged and verified: status 1s, peer-found 4s, peer-lost 19s,
visitor every 5s. stop() now also clears the pending connect timer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AGENTS.md and the team plan both mandate pnpm: pear stage walks
node_modules and depends on .npmrc node-linker=hoisted, so an npm install
here is the documented cause of "works in dev, missing in the binary".

frontend/package-lock.json (260 KB) was exactly the artifact the plan
warned about. Removed, and package-lock.json / yarn.lock are now ignored
so the next stray install cannot commit one.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant