Taskmaster reroll: haggle to a real Whop checkout, then coach #209

Open
time wants to merge 2 commits from claude/taskmaster-haggle-checkout-f57aux into main
pull from: claude/taskmaster-haggle-checkout-f57aux
2 Commits
Author SHA1 Message Date
Claude a06682f40a Taskmaster: a checkout per deal, a seat holder the app can find, a return that closes the deal
ci / test (pull_request) Successful in 46s
heartbeat / tick (pull_request_review) Successful in 9s
The reviewer objected that three paths the finish line depends on look broken. The review reached me cut off
partway through its first point ("Checkout re…"), so rather than guess at points two and three I ran each DONE
line against Whop's real semantics instead of the test doubles. Three paths failed, and they are the three fixed
here; the probes are now tests, so each one fails if the old behaviour comes back.

**A reused variant was sending the first deal's metadata.** `checkout()` returned the stored configuration whole
for any later deal that landed on the same price, so ann's configuration — with ann's deal, thread and member in
its metadata — was handed to bob. Bob's payment would have routed to a deal that was already paid: the webhook
answers `already`, bob's own deal never closes, his thread never leaves haggle mode. The card asks for variant
reuse, and reuse is what the *variant* is for, so the plan is still made once per price and named by `plan_id`
thereafter; the configuration on top of it is per deal, because its metadata is the whole routing mechanism.
`writing()` now runs before the store is read too, so a known variant is not a way around the live guard.

**A seat holder could never be found.** `whoIs` asked Whop what the member holds, and a seat holder holds nothing
— the pack is the lead's membership — so coach mode for a pack only ever worked for the buyer who bought it. The
flow test hid this behind a fake whose `membershipsFor` answered every user with every membership; it now answers
the way Whop does. `packIndex` (seats.js) remembers which pack a username was seated on and the server reads each
pack it names straight from Whop, so the index says where to look and Whop's metadata still says whether the seat
is there: a stale pointer costs one read and grants nothing, which a test asserts. The other half of the same
break: memberships answer to a Whop user id and seat lists are written in usernames, so a thread now carries both
names and `whoIs` uses the right one for each question.

**Back from checkout, the deal never closed.** The card allows a membership check on return as the other road a
confirmed payment arrives by, and the mode did switch — but nothing called `paid()`, so the deal stayed agreed,
was never logged, and showed no share card. Worse, `/api/walkaway` then logged a paid deal as a *walkaway*: a
closed sale recorded as a lost one, in the log the card calls the price discovery. `/api/return` now closes and
logs it, once, on a membership whose metadata either names this deal or names none; a membership from an earlier
deal does not close this one.

Two Whop writes that could take a member's turn down with them, while I was in there: a seat holder's usage write
refused by the live guard (which is every day of card #66) 500'd a coaching turn the member had paid for, and now
reports `usage_noted: false` instead; a refused checkout 500'd the accept turn and lost the thread's own record of
it, and now costs the quote card its button rather than the deal, with `/api/agree` minting it once Whop will
take it. And the seats routes were open to anyone holding a membership id — a paying org's staff list, readable
and writable by any caller — so they now take a thread, the same identity every other route runs on, and answer
403 to anyone but the buyer.

Nothing created on Whop, nothing bought: the live guard is intact and stronger, and the suite (83 tests, up from
75) still runs against an injected `fetch` with simulated signed webhooks. Since the reviewer's diff ran out
inside `dealdesk.test.js`, the README's layout now maps every test file to what it covers, so the half of the
suite that falls past a diff budget can at least be read about.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018M6pq5GUaS75LDV7WDaddA

Closes #66
2026-10-20 16:08:54 +00:00
Claude a1ea50f816 Taskmaster reroll: haggle to a real Whop checkout, then coach
ci / test (pull_request) Successful in 47s
heartbeat / tick (pull_request_review) Successful in 12s
`taskmaster/`: the factory's Whop coaching app rebuilt so the money is real. The old
version switched to coaching when the member typed "Paid $X via ..." and its webhook
handler only logged invoices.

The character haggles; the deal desk decides. The character never sets a price: it calls
one tool, quote(tier, price, reason), and dealdesk.js answers accept, counter or refuse.
Four rules — the opening is the list price and the desk never quotes above it or walks a
price back up; a quote under the floor is countered at the floor whatever reason came with
it; a step down needs one of four reasons the member gave (scope, urgency, commitment,
pay_now), each worth a slice of the anchor and each spendable once; three rounds, the
opening included. Two refusals are about honesty and spend no round: a reason that reaches
for the member's profile, following, employer, means or country, and invented scarcity or
a fake deadline.

The app decides the mode, never the model. One sheet, two prompts, and the server picks
from whether Whop says the member has paid — a valid membership on prod_EZ7UkE4pkW04U or a
place on a valid pack's seat list. Typing "Paid" changes nothing and a test proves it.

Also: the sealed quote card the model can't edit, the share card, the deal log (openings,
counters, final price, rounds, reasons, outcome, fee and net; never a word the member
wrote, validated so prose can't get in), seat packs in membership metadata with
rate-limited swaps and a buyer view of seats and usage but no chats, the signed payment
webhook, the three experiments bucketed by user, and the Venice voice with one tool, a
per-member limit and no uncensored default.

Nothing created on Whop, as the card requires: the Whop client refuses every write unless
constructed with live: true, and the 75 tests run against an injected fetch with simulated
signed webhooks.

What is missing, and why:

- teahub.xyz is blocked by this container's network policy, so teahubxyz/dealdesk and its
  SKILL.md could not be read. The rules are implemented in taskmaster/src/dealdesk.js
  behind the same seam (openDeal / quote / agree / walkaway), so swapping the import in is
  a one-file change. Someone with network access to Teahub should reconcile the two.
- docs.whop.com is blocked too, so four things stay unconfirmed and each is one line to
  correct: daily billing for the daily and checkins tiers (checkout() refuses to create a
  renewal tier until it is passed dailyBilling: "confirmed", so nothing is built on the
  assumption), the field that keeps an inline plan off the product's public page (HIDDEN in
  whop.js), the webhook's header names and whether the signed string is the body alone or a
  timestamp joined to it (both shapes verify; the names are constants), and how Whop's iOS
  rules treat a one-off checkout, which would change what these tiers may be priced at on a
  phone.
- Where the code lives was the operator's call. It is a top-level taskmaster/ here, beside
  havre/, since GitHub access for this session is scoped to teahubxyz/time alone. Moving it
  to teahubxyz/taskmaster or a shared Whop-apps repo is a directory move; nothing outside
  taskmaster/ depends on it but the one test hook.
- No workflow change is needed: CI's `python3 .github/time/test_time.py` step now runs the
  suite, as it already does for havre/.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014KUi5SZq4GBkdHQ2TdhZ3r

Closes #66
2026-10-20 14:15:26 +00:00