Commit Graph
4 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 81bf2041be chore(billing): remove the Stripe rail, which was never configured anywhere (#508)
STRIPE_SECRET_KEY and the seven other STRIPE_* vars appear zero times outside
src/ and zero times in .env.example, so isStripeReady() could only ever return
false. Three API routes, a checkout route, a tier grid and a "Manage
subscription" button were all gated on it and permanently unreachable.

Confirmed empty in production before touching the schema:

    select count(*) filter (where stripe_customer_id    is not null),
           count(*) filter (where stripe_subscription_id is not null),
           count(*) from users;
    →  0 | 0 | 7

So this removes no data and, more to the point, changes nothing a user sees:
every code path already fell through to the branch below it.

WHAT STAYS. Plans are real and untouched. They are granted through the
OrangeCat/Bitcoin rail (/api/orangecat/entitlement -> recordOcBillingGrant),
with the expiry cron reverting a lapsed pass to free. The pricing CTA cascade
loses only its unreachable middle step: free -> TBA -> [stripe] -> BTC ->
start-free.

WHAT WAS ACTIVELY WRONG. Because isStripeReady() was false, the one part of
Billing that DID render was a notice telling the reader to "add
STRIPE_SECRET_KEY and price IDs" — an environment variable shown to a person
who does not deploy the app and could not act on it. That is the same mistake
NotificationsPill's comment already calls out. Billing now states the plan and
links to /pricing.

Removed: lib/stripe.ts, api/stripe/{checkout,portal,webhook}, api/checkout/
[plan], getUserByStripeCustomerId, two user columns (migration 0063), two
entries from the user-client-view redaction lists, the api/stripe/webhook entry
in proxy.ts's public matcher, the stripe npm dependency, and the smoke/auth
probes for routes that no longer exist.

BillingSettings drops "use client" — with the handlers gone it holds no state,
no effect and no search-param read.

Two mentions deliberately KEPT because they are not the rail: the placeholder
prose describing what a user might build ("Simple dashboard, automated
reminders, Stripe payments…") and the demo project's stack string.

pnpm run verify green. 28 files, 519 deletions.


Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-05 17:04:53 +00:00
GandClaude Opus 5 caa0e41c3b chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

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

* style: format with prettier (1062 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

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

* chore: teach git blame to skip the reformat

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

* fix(lint): reattach two guards the reformat detached

Both effects were one-liners, so a trailing eslint-disable-line covered the
setState call:

  useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ...

prettier expanded the block. The comment stayed on the closing line while the
call moved above it, so the guard protected nothing and the rule its author had
deliberately silenced failed the build.

This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line
variant. Both come from the same fact: an eslint directive binds to a line
number, so reformatting can silently unbind it, which makes 'mechanical, no
behaviour change' false for any bulk reformat.

* chore(desktop): bump the runner version the reformat requires

desktop-release-drift enforces that anything built into Fleet Runner which
differs from the last released tag must carry a version ahead of that tag —
main read 0.8.15 and fleet-runner-v0.8.15 already shipped.

A whole-repo reformat changes bytes under desktop/, so the gate fires. The
alternative was adding desktop/ to .prettierignore, which would buy a quiet PR
by carving a permanent hole in the formatter's coverage — the precise shape of
silent drift this test was written to catch. Bumping is what the rule asks for
and costs one patch release whose only content is whitespace.

* chore: merge main and re-format

A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR
runs no checks at all while reporting nothing. Conflicts resolved to main,
which is correct because this branch changes formatting and nothing else.

* chore: leave desktop/ out of this reformat

desktop-release-drift is right to refuse this. Everything under desktop/ is
built into Fleet Runner, so changing it means shipping: bump the version AND add
a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed
Fleet Runner and wants to know what changed'. For a whitespace-only build the
honest answer is 'nothing', so that release should not exist — and I should not
write release notes claiming otherwise.

I had bumped to 0.8.16 to get the gate green. That was the wrong direction:
publishing a build to three OS runners to keep a formatting PR quiet. Reverted.

desktop/ is excluded in .prettierignore with the reasoning recorded there, to be
formatted alongside the next real runner change, where the bump and the notes are
true anyway.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 09:23:30 +00:00
0ffe305a62 fix(api): a second route shipped the user's credential hashes — and the gate that ends the class (#309)
* fix(api): a second route was shipping the user's credential hashes

POST /api/onboarding returned the whole users row — `{ ok: true, user }` —
so passwordHash and privateZonePinHash went to the browser on every
onboarding finish, exactly as GET /api/me did before #306. The client never
read that object; it checks `res.ok` and nothing else.

It survived the grep that found #306 only because it was nested one level
deeper (`json({ ok: true, user })`, not `json(user)`). That is the second
instance of one class, so this stops being something to grep for:

- scripts/test/no-raw-user-response.ts scans every route handler and server
  action, taints identifiers bound to a whole users row, and fails if one
  reaches a response call unprojected. Negative-tested against the real
  pre-fix source — it flags both branches — plus 13 fixtures covering the
  nested, shorthand and spread forms.

And the export had grown a second answer to the same question:

- src/lib/account-export.ts kept its own REDACTED_USER_FIELDS deny-list, so
  a secret column added later would be withheld by /api/me (allow-list) and
  shipped by /api/me/export (deny-list that never heard of it). Both now
  project through user-client-view.ts, which is exhaustive over the schema.
  The export additionally omits Stripe ids — a policy narrowing of the
  allow-list, not a second notion of what is secret.
- buildExportManifest generates its `excluded` lines from those same lists,
  so the document describing what was withheld cannot drift from what was,
  and the test asserts the linkage rather than a copy of the wording.

Verified: tsc clean, eslint 0 errors, 88/88 unit files, design-system ok.

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

* fix(ci): the deploy-ref fixtures inherited a handle to the real repo

The husky pre-push hook exports GIT_DIR — for a worktree push that is
.git/worktrees/<name>, the real repository. scripts/test/deploy-ref-gate.sh
runs from that hook, so every git call in the fixture suite inherited it.

An explicit GIT_DIR is not a search path, so GIT_CEILING_DIRECTORIES (guard 1)
did not constrain it, and the g() assertion (guard 2) could not see it either:
with GIT_DIR set and no work tree, `git -C <fixture> rev-parse --show-toplevel`
answers `<fixture>` — matching exactly, while objects and refs land in the real
repo. The suite this file was written to make safe was, from a hook, pointed
back at the thing it must never touch.

Guard 5 ($TMP must not be inside a repo) is what actually held the line, and it
held it by failing closed: with GIT_DIR set, an empty mktemp dir reads as a repo
root, so every push from a worktree died with "temp dir is inside a git repo" —
a true refusal with a misleading reason, and no way to push at all.

Now the ambient git environment is cleared first, from `git rev-parse
--local-env-vars` so it cannot fall behind a new variable. Test 9 re-runs the
whole suite with GIT_DIR pointing at a decoy repo and asserts both that it
passes and that the decoy is unchanged.

Verified to bite: with the unset removed, test 9 fails and the child run dies at
guard 5 exactly as the real push did.

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

* refactor(ci): one definition of an isolated git fixture

not-behind-gate.sh has the same inherited-GIT_DIR hole the previous commit
fixed in deploy-ref-gate.sh — and found it itself: run from the pre-push hook,
its own isolation probe reported "g() accepted a non-repo dir nested in a repo
— it would have mutated the ENCLOSING repo". Correct, and it was right.

Fixing it in place would have been the third copy of the same paragraph. The
copies are the hazard: both suites carry scars from 2026-08-15, each was
hardened against what its own incident taught it, and neither against the
other's — deploy-ref-gate knew $TMP must not sit inside a repo, not-behind-gate
knew a fixture must never write git config. A third suite would have copied
whichever file it sat next to.

So the four properties that must hold before a fixture touches git now live in
scripts/test/lib/git-fixture-env.sh, sourced by both. Each suite keeps its own
g() — the per-command assertion that the directory about to be mutated is the
fixture — because their fixture shapes genuinely differ.

Verified under the real hook environment (GIT_DIR=.git/worktrees/<name>):
deploy-ref-gate 9 passed, not-behind-gate 15 passed.

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

---------

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 09:41:51 +00:00
0c9f9dbc2a feat(data-controls): working account deletion, memory forget, consent toggle, data export (#131)
The P0 trust layer: (1) DELETE /api/me + deleteUserAccount() — one-transaction
purge that clears the 17 non-cascading user-FK tables in dependency order
before the users row cascades the rest; Danger-zone button wired to a
type-your-email confirm modal (was disabled; /privacy's deletion claim was
false). (2) /memory gains per-entity forget + guarded forget-everything
(graph + RAG index), PIN-gated. (3) user_preferences.memory_enabled gates
upsertKnowledgeBatch via memoryIndexingAllowed() — only explicit false
disables; toggle in Privacy → Data. (4) GET /api/me/export — 26 user-scoped
sections, redacted users row (no credential hashes / Stripe ids), manifest
states scope; export button in Privacy → Data.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-31 12:35:36 +02:00