Schema version 10: a component's `adds` are inputs added to its base, each
times a fact and optionally rounded down first, before the tariff applies.
Liechtenstein taxes a 4 % yield on wealth as income on one tariff
(SteG, LR 640.0, art. 5, art. 14 para. 2 l, art. 18 para. 1, art. 19).
Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC
Co-authored-by: Claude <noreply@anthropic.com>
Schema version 9, for Valais:
- a divisor's `scaledBy`: the canton and each commune move the tariff to
higher incomes by an index of their own (StG VS art. 32 para. 4, 178 para. 5)
- a component's `rebate`: a couple's 35 %, at least and at most an amount
(art. 32 para. 3a, 178 para. 3a)
- a component's `floor`: the minimum tax owed once it applies (art. 32 para. 6)
Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC
Co-authored-by: Claude <noreply@anthropic.com>
* fix(tax-model): a component on its own base applies only when that input is given
Without it, a canton whose wealth tariff is not recorded made every income
estimate there incomplete, though the reader entered no wealth.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC
* feat(tax-model): 0.9.0, a multiplier scaled by another fact
Schema version 8: a multiplier's scaledBy is a fact it is multiplied by
before it counts. Jura levies church tax on the cantonal tax rather than on
the basic tax: the church's rate times the canton's multiplier, which the
federal calculator applies (measured 2026-10-30, income and wealth).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC
---------
Co-authored-by: Claude <noreply@anthropic.com>
Schema version 7, for Solon's full Swiss tax bill:
- a component's `base` names the input its tariff applies to, so a wealth
tax sits beside the income tax in one model; the effective rate stays the
share of the model's base that the components reading it take;
- a `fixed` tariff is one amount whatever the base, as a tax per head.
An older evaluator refuses a model that needs 7 instead of ignoring it.
Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC
Co-authored-by: Claude <noreply@anthropic.com>
* docs: archive point-in-time records, drop broken guide symlinks
Status reports, progress trackers, audits, session summaries, completed
migration plans and the 2025 roadmap move to docs/archive/ (same relative
path), with a README saying they describe the day they were written.
.ai-guides/ held only symlinks into a docs/guides/ai/ that no longer
exists, tests/unit/docs/ held a stray copy of an old getting-started page,
and docs/operations/PORT_MANAGEMENT_README.md duplicated port-management.md;
all three are deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD
* docs: correct drifted paths, links and versions in current docs
Fix in place the reference docs agents use: point paths at where the code
lives now (src/stores/auth.ts, src/lib/supabase/*, scripts/dev/*,
docs/reference/api/CONVENTIONS.md, the squashed baseline migration),
rewrite the development, features, operations and API index pages to list
documents that exist, say plainly where something is gone (/api/metrics,
the CSP report route, .envrc in the repo, Loki's `migrate` script), and
correct the Next.js major. docs-truth findings: 468 -> 2 (both "Next 30/90
Days" headings in the legal overview, a checker false positive).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD
---------
Co-authored-by: Claude <noreply@anthropic.com>
searchkit now has its own repo, created from this folder by bitbaum/fleet's
package-repos workflow and tagged v0.2.2. OrangeCat installs that tag, the
same way the five other sites do, and the folder goes: one copy of the
package, changed through its own repo's pull requests, with its tests there.
Dependabot moves the tag forward here as everywhere else.
Same code; the search suites (find, palette, Discover) pass against the
tagged package.
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
Co-authored-by: Claude <noreply@anthropic.com>
searchkit's tests lived in orangecat's vitest tree, so the folder could not
stand alone. They now sit in packages/searchkit/test and run with Node's
own test runner against the built package (`npm test`), and orangecat's
verify runs them as `test:packages`. The dist check resolves TypeScript the
normal way instead of through orangecat's node_modules path.
This is what lets bitbaum/fleet's package-repos workflow create
bitbaum/searchkit from this folder with no hand edits.
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
Co-authored-by: Claude <noreply@anthropic.com>
Three findings from Loki's adoption:
- When no item had every typed word, relax dropped the LAST word, so
"jon smith" returned Jon Snow and lost John Smith. It now keeps the most
words any item has, whichever they are (subsets, up to 8 words).
- Adjacent words are also indexed joined, so "orangecat" finds "Orange
Cat". When the text wrote them apart, that pair now ranks as one typo:
"catto" had hit "Switch OrangeCat to Claude" exactly, above Cato. A
camelCase/handle pair is the word as written and is unchanged.
- typoCases splits names with the search's own tokenizer by default, so
"No-screen" no longer yields queries like "bo-screen".
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
Co-authored-by: Claude <noreply@anthropic.com>
* fix(searchkit): the typo budget is the written word's, not the spelling rule's
A site spelling rule (SearchSpec.normalize) can shorten a word before the
budget is decided: Heidi reads doubled letters as one, so a slip in "vill"
arrived as a three-letter word and got no typo at all. candidates() now
takes the written length; createSearch and expandQuery pass it. On Heidi's
9,700 one-slip cases, searches that found nothing fall from 1.5% to 0.4%
and success@3 rises from 0.967 to 0.972; success@1 moves 0.904 → 0.901,
because the shortened words now compete where they were unreachable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
* fix(searchkit): a field is covered only when every typed word landed in it
Substrata's golden test "gallium ch" put the company Chalco above the
gallium bottleneck: "ch" alone covered the one-word title "Chalco" while
"gallium" landed only in its description, and covering a field outranks
whole words. Covering now also requires every typed word in that field.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
* style(searchkit): prettier
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat(searchkit): 0.2 — site spelling rules, rerank, snippets
What the fleet survey said the other sites need before they can adopt it:
- SearchSpec.normalize: a site's own spelling rule on every word, both
sides (heidi's Swiss German: "ie" as "i", doubled letters as one);
ExpandOptions.normalize keeps a vocabulary in agreement.
- rerank(rows, spec, query): rank rows another engine found, unplaced rows
kept after in their original order. OrangeCat's rankFound now uses it.
- snippet(text, ranges): the window of a long text around its first
match, cut at words, "…" where cut, ranges re-based.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
* feat(searchkit): ship compiled dist so every fleet runner can load it
The fleet installs searchkit from git. Heidi's tests run on Node's own
type stripping, which refuses TypeScript inside node_modules, and
substrata's and solon's runners would each need their own transpile step.
Commit tsc's build in packages/searchkit/dist (as whenkit does) and point
the exports at it; source imports carry .ts so tsc rewrites them to .js.
A test rebuilds into a scratch directory and fails while dist/ is stale,
so a src change cannot reach the fleet unbuilt. OrangeCat no longer needs
to transpile the package.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
---------
Co-authored-by: Claude <noreply@anthropic.com>
- searchkit: a hit whose matched field is covered end to end by the typed
words ("lki" → "Loki") now ranks above a longer field that only starts
with it ("Loki — Capability Layer…"), typos and prefixes allowed.
- ⌘K: hits carry their typo count (null when only the database matched
them, e.g. a word past the snippet); "Jump to" leads when its best page
matched with no more typos, so Enter on "setings" opens Settings.
Found by testing the live site after #1322 deployed.
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
Co-authored-by: Claude <noreply@anthropic.com>
The SoundCloud failure, fixed and made shared. Postgres trigram similarity
cannot promise it (cqto/cato share 2 of 5 trigrams; kanye/kayne score 0.2)
and fuzzystrmatch counts a swap as two edits, so typos are now decided by
counting edits in a fleet package:
- packages/searchkit (@bitbaum/searchkit, zero deps, React optional):
folding (accents, ß, umlauts spelled out, camelCase, joined/split words),
bounded optimal-string-alignment distance, typo budget 0/1/2 at <4/4/8
letters (budget of the MEANT word when a short word matches nothing),
prefix-while-typing with typos, Algolia-order tie-break ranking, highlight
ranges, vocabulary corrections for any database, did-you-mean, generated
typo regression suites, and useSearchAsYouType/Highlight for React.
- Migration: search_public takes p_terms (corrections any of which make a
row a candidate); public_search_text feeds the vocabulary.
- /api/search + services/search/find.ts: vocabulary → corrections →
search_public → searchkit ranking, behind ⌘K and Discover alike;
Discover offers "Did you mean …?".
- The palette's own lists (pages, things, create) rank with searchkit too,
and page matches come before the actions, so Enter on "setings" opens
Settings.
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
Co-authored-by: Claude <noreply@anthropic.com>
* feat(deck): presentations as data — @bitbaum/deckkit, and a deck in every investor room
George: "generate a beautiful presentation, remember the tools and package
them — people should generate whatever presentation they want and change it."
Built from first principles and from a study of evig's hand-written decks
(public/presentations/*): good design language, but only a developer could
edit them, the engine was copied into every deck and drifted, the PDF was a
raster, numbers were typed, nothing linked to one slide.
packages/deckkit (@bitbaum/deckkit 0.1.0, workspace package):
- A deck is data: 9 layouts (cover, statement, points, numbers, chart,
compare, columns, image, closing), stable slide ids, notes, sources.
- normalizeDeck: anything stored → a deck that renders; https-only links;
enforced LIMITS keep slides short.
- generateDeck: drafts the investor arc from a source — nothing invented;
bindDeck fills `bind: facts | pace | roadmap` slides from live data.
- /react: Slide (one frame, identical at any size via container units) and
DeckPresenter (keys, swipe, #3 deep links, notes on S, print to PDF).
- styles.css: evig's design language as --dk-* tokens, dark + light.
- README: the writing rules (claim titles, one accent, no fabrication).
OrangeCat:
- project_rooms.deck (migration, expand-only).
- /projects/<id>/room/deck: generate a first draft, edit every slide
(layout, words, figures, order), theme + accent, present with notes.
- /room/<token>/deck: the reader's presenter, live-bound; counts as a deck
open by the one rule (countsAsOpen). "Open the deck" goes there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(deckkit): linear text scans, not backtracking patterns, over slide text
CodeQL js/polynomial-redos flagged the sentence splitter and the
"Lead: rest" parser: user text through /[^.!?]+[.!?]+(?=\s|$)/ runs in
polynomial time on a crafted string. Replaced with plain linear scans
(sentences, squash, an indexOf for the lead, a loop for trailing
punctuation); a test feeds 50k-character hostile strings and requires
under 500ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(copy): public pages give a real mailbox and stop claiming what is not true
- FAQ, /status, /security, privacy, terms and the OpenAPI spec named
hello@, support@, security@ and integrations@orangecat.ch; cato@ is the
only mailbox on the domain. One CONTACT_EMAIL in brand.ts now.
- /company/careers listed four full-time jobs with salaries, health cover
and unlimited PTO that do not exist; it now lists the real ways in.
/company/about drops the invented "passionate team".
- Footer said "All rights reserved" and the OpenAPI spec "Proprietary";
the code is MIT.
- /technology hand-typed "Next.js 15" (app is on 16); reads STACK now.
- /docs claimed BTCPay; Lightning runs on NWC + LNURL.
- /security claimed encryption at rest "provided by Supabase" (self-hosted,
no encrypted volume on the box) and a bug-bounty channel; both cut.
- bitbaum.com (does not resolve) -> bitbaum.orangecat.ch; partners
"Talk to the studio" went to the donation page, now the hire page, and
drops "clients". Solon's /api/v1/decisions index 404s -> /proposals.
- README: 15 entity types (was 13), Next.js 16.
- Guard: public-copy-claims.test.ts fails on a role address, a literal
mailto, or a hand-typed framework version (mutation-checked).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(copy): SDK is MIT, no dead address in emails or security docs, no partner course that does not exist
The guard now also scans packages/, supabase/templates, legal/, content/,
docs/security and the root README/SECURITY/package.json for dead role
addresses and a non-MIT licence claim.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(copy): verified-client link opens mail, not the backing page; cut unmeasured security and member claims
- /docs/sign-in-with-orangecat: "ask for a verified client" and "Questions,
or a verified client" linked ROUTES.SUPPORT (the Bitcoin backing page);
both now mailto CONTACT_EMAIL.
- docs/security/README.md: cut the security score, "0 Critical, 0 High",
the passed pentest, the review cadence and nine links to files that do
not exist; it is now an index of the documents that do.
- audit-report.md: cut the "coming soon" bug bounty and the unverified
"platform messaging" report channel.
- Reset email templates: cut "10,000+ Bitcoin innovators" and
"bank-grade security".
- Guard: public-copy-claims now fails on a question/contact link to
ROUTES.SUPPORT and on "N+ members/users" or "bug bounty" in prose
outside the app (both mutation-checked).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(changelog): move this PR's entries under 2026-10-07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017cqEJ2nWRCs2CA6GP6BmoZ
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A city with its own charter, founded by agreement with the state that
hosts it, or proposed before that agreement. Place-bound, like a town.
OrangeCat's label defaults gain its row; groups.label is free text, so no
migration. Asked for by Solon's Places design (P0).
Co-authored-by: Cursor <cursoragent@cursor.com>
First piece of Solon's Places design (P0). @bitbaum/tax-model knows no
country: levels, metric keys and currencies come from the model and the
facts it is given. It does no I/O and reads no clock, so an estimate can
run in the browser without the income leaving the device.
- evaluate(): per component, total, effective rate, currency, and the
facts that were missing (incomplete, never guessed)
- taxingLevels(): which levels actually take tax (a city quarter does
not; the city does)
- modelProblems() / tariffProblem(): validation for config and importers
Tests use a made-up country, plus a pin that it reproduces today's
estimateIncomeTax on the Zürich table exactly. No app code imports it
yet; Solon vendors it next.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(map): "What you can do" — every capability in plain words, from one source
A newcomer had no page that said what this place does. The registry knew
fifteen types by noun; the landing page carried a second, hand-written list
that had drifted from it; the create hub offered a grid of nouns. None of
them said "sell something", "raise money for a goal", "lend a friend 500".
- Every entity type in the registry now carries `plain` copy (verb, what,
example, three steps) and declares the intent it serves. `INTENTS` in
src/config/intents.ts is the grouping: earn, fund, borrow, together,
money, cat.
- src/config/capability-map.ts derives the map from the registry plus five
non-entity capabilities (receive, send, request, civic split, the Cat).
One shape whatever backs a card.
- /what-you-can-do renders it, public, with the door on top: a plain GET
form that hands one sentence to the Cat (`/dashboard/cat?q=`), which
already auto-sends it into an empty conversation.
- Reachable from the sidebar (signed in or not), the footer, the create hub
("Not sure which one?") and How it works, whose hand-written
SUPER_APP_CATEGORIES grid is deleted in favour of <CapabilityMap compact />.
- __tests__/unit/config/capability-map.test.ts fails when a registry type is
missing from the map, an intent heading is empty, verbs collide, steps are
not three, or copy uses a banned word (donate, tip, crypto, campaign…).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EsT2PtLuBKwgaaBU5pheG8
* feat(nav): fold fifteen entity sections into "My things"; the door on Home
The sidebar carried fifteen kinds of thing behind four chevrons (Create ·
Fund · Coordinate · Finance). Nobody reads a list like that; they want to
know what they have and what they can do.
- /dashboard/things: one list of everything the person made or joined,
grouped by the intent the registry declares (earn, fund, borrow,
together, money, cat), each row with its status badge and a link into
where its owner works on it. `listMyThings` in src/domain/things reads
every registry type through the registry — table, owner column, title
column — plus organisations joined but not created.
- The registry gains `detailPath` (and `detailKeyColumn` for slug-keyed
organisations) so a cross-entity list never guesses `${basePath}/${id}`.
Declared after apiEndpoint, where audit-routes' parser expects the fixed
fields to stay adjacent.
- Sidebar main: Cat · Home · My things · Money · Messages · What you can do.
The People destinations (People, Set up for someone, Your civic split,
Collaborate) get their own folded section; Timeline and Explore move to
More. The phone tab bar is unchanged and still agrees with the sidebar.
- navigation-generator.ts and its test are deleted: nothing renders entity
sections any more, and its ENTITY_GROUPS was a second grouping beside the
intents on the map.
- Home opens with the door — one sentence to the Cat — above the sections.
- __tests__/unit/config/my-things.test.ts: every type with a dashboard
detail page declares detailPath, every detailPath resolves to a route
file, the primary sidebar lists My things and the map and stays at six
lines, and no entity list is linked one by one any more.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EsT2PtLuBKwgaaBU5pheG8
* feat(groups): organisations are collective kinds, with a place and a legal status
One list of what kinds of collective exist, shared by OrangeCat, Loki and
Solon: @bitbaum/collective-kinds, a workspace package at
packages/collective-kinds (kinds · place · legal status; data and pure
functions only). OrangeCat's group labels, Solon's governance profiles and
Solon's audiences each restated their own version of this list; copies
drift, imports cannot.
- src/config/group-labels.ts is now keyed by the package's ids and holds
only what OrangeCat adds per kind (icon, visibility defaults, features,
governance preset). Name and description come from the kind. `nonprofit`
is retired for `association` — what the world calls it — and the
migration renames the rows.
- Three new kinds a group can be: collective, town, local fund. A town or
a local fund cannot be created without a place; the Zod schema asks the
package (`kindOf(label).needsPlace`, `placeProblem`) and points at the
first missing field.
- groups gain where they belong (country_code, region, locality, with
generated lower(btrim()) keys — the civic split's rule) and what they
legally are (informal | registered | tax_exempt with the evidence each
requires; `legalProblem` refuses a status without it, and a kind that
cannot be tax-exempt cannot claim to be). Migration
20260928120000_groups_are_collective_kinds_with_a_place.sql.
- Create form gets "Where it belongs"; templates gain a Local fund
(Witikon first) and Association replaces Non-Profit Foundation.
- The Cat prompt derives the label list from the package instead of
spelling it; the glance line is dropped to stay inside the prompt budget.
- pnpm-workspace.yaml now declares the package (package.json "workspaces"
is npm-only and pnpm ignored it); next.config transpiles it.
- Tests: __tests__/unit/packages/collective-kinds.test.ts (the package),
__tests__/unit/config/group-labels-are-kinds.test.ts (labels == kinds,
retired word gone, templates valid, place rule enforced, place key ==
civic split key).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EsT2PtLuBKwgaaBU5pheG8
---------
Co-authored-by: Claude <noreply@anthropic.com>
* refactor(lib): one sanitizeApiKey and one escapeHtml, with tests
Two helpers that touch security-relevant material had drifted into copies:
- sanitizeApiKey existed five times (transcribe route, groq, openai-compat,
openrouter, health probes). It stands between a pasted credential and an
Authorization header, so it now has one definition in src/lib/api-key.ts
and a test. health-probes wanted the "did anything get stripped?" answer,
which is sanitizeApiKeyChecked over the same regex rather than a sixth one.
- escapeHtml existed four times across the email templates — the injection
guard between a user-supplied name and an inbox. It is now exported once
from templates/layout.ts, which all three callers already import.
No behaviour change: the regex and the replacement chain are byte-identical
to what every copy did.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor(utils): one home for the display formatters that had drifted
Four helper names were declared in three or four files each. Consolidated,
with every call site printing byte-for-byte what it printed before — pinned
by __tests__/unit/lib/display-formatters.test.ts.
- formatDate x4 -> src/utils/dates.ts, which already owned one of them.
The three copies were three DIFFERENT formats, so the module gained the
two it was missing rather than flattening them: formatDateLong ("July 22,
2026") for article datelines, and formatIsoDay for 'YYYY-MM-DD' strings.
formatIsoDay keeps the changelog's deliberate property of never building a
Date: a calendar date has no timezone, and `new Date('2026-07-22')` is UTC
midnight, which renders the day before west of Greenwich and renders it
differently on the server than in the browser.
- formatTimestamp x3 (identical) -> formatDateTimeOrDash in utils/locale.ts,
next to the formatDateTime it wrapped. The two row components took it as a
prop from their parent; they import it instead, so the prop is gone.
- formatCountdown x3 -> src/utils/countdown.ts. These were not one helper
that drifted but three formats sharing a name — 45 seconds read as "45s",
"1m" or "0:45" depending on which file you imported from. They keep their
three behaviours under names that say what they print.
- readJson + errorMessage x3 in the browser payment clients -> the
unwrapApiResponse that src/lib/api/client-response.ts already exports, and
whose docblock warns about exactly these hand-rolled copies drifting.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* fix(slug): slugify transliterates, so a non-ASCII name is not deleted
`slugify()` filtered to ASCII, which does not mean "strip accents" — it means
"delete every letter that is not ASCII". `Café Genève` became `caf-genve`,
`Grüße` became `gre`, and a Cyrillic or Japanese name produced the EMPTY
STRING. Under a unique constraint an empty slug means the second such record
cannot be saved at all, and the first one is addressed by a slug that
identifies nobody — walked live on 2026-09-11, `Марина` became
/profiles/someone and @someone.
That was already known and already fixed, but in domain/profileClaims only:
it kept its own `transliterate` and wrapped the broken slugify with it. Group
creation, the Cat's organization handler and the entity create form all still
went through the unwrapped path. So the transliteration moves into
`slugify()` itself — German digraphs first (ß has no decomposition and would
otherwise vanish), then NFKD plus a combining-mark strip for everything that
decomposes, then a Cyrillic table for the script that does not. claimSlugFor
keeps only what is specific to a claim: the person-<random> fallback.
Also in this commit, same concern:
- groups' `generateSlug` was `(name) => slugify(name)` — an alias, deleted;
its one caller calls slugify, with a 'group' fallback so an unslugabble
name cannot become the empty slug that ensureUniqueSlug would then extend.
- slugify with randomSuffix no longer returns a slug starting with a dash
when the base is empty.
- scripts/cli/create-entity.ts deleted: a dead twin of create-entity.js,
which is what `pnpm run create-entity` actually runs, carrying a third
generateSlug. knip already listed it as unused.
- formatAmount: the real implementation inside <CurrencyDisplay> moves to
services/currency/formatting.ts as formatAmountSuffixed. Output is
unchanged — it is deliberately not formatCurrency(), which prefixes BTC
with ₿ where every card in the app suffixes the ticker.
Tests: __tests__/unit/lib/slugify.test.ts covers the accented, German and
Cyrillic cases plus the ASCII behaviour that must not have moved.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor: say the repeated blocks once — chat types, footer, Esplora readers
Three places where the same thing was written out two to five times.
- The Cat's tool-call vocabulary (ToolCallResultRef, ToolCallEvent,
PrefillProposal) was defined twice: once by the pipeline that emits it and
once by the panel that renders it, 55 lines of discriminated union that had
to agree with nothing making them. The panel now re-exports the service's
types. Type-only, so nothing enters the bundle. The two copies had already
drifted: the service carries `handle?` on a result ref (the citation handle
the UI needs to link the right source) and types `entityType` as the entity
union rather than `string`.
- <Footer> wrote out the same seventeen-line link column five times, and only
two of the five carried the external-link branch — so which columns could
hold an external link was an accident of which had been copied last. One
<FooterColumn>. Renders identically: only `ecosystem` has external items
today.
- The Bitcoin service listed mempool.space and blockstream.info with
byte-identical processBalance and processTransactions, 60 lines each. They
both serve the Esplora API, so there is one reader for each now — one place
for the satoshi arithmetic instead of one place to fix it and another to
leave wrong.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor(timeline): the feed envelope is written once, not fourteen times
Six feed functions across four files each spelled out the same three things
by hand: the page window, the success envelope, and — twice per function,
once for "no rows" and once for the catch — the empty envelope. Twenty
copies of the same twenty-line object literal, which is why userFeeds.ts was
the most-duplicated file in the repo (9 clones, 184 duplicated lines).
The cost was not the lines. A field added to TimelineFeedResponse had to be
remembered in all twenty places, and the ones that forgot it still compiled;
`hasNext` was computed from `offset + limit` in fourteen separate
expressions, any one of which could be edited alone.
queries/feed-shape.ts now owns pageWindow(), feedResponse() and emptyFeed().
What differs between the feeds — which rows they fetch, and the RPC or view
they fetch them from — stays in each file, which is the part that was ever
worth reading.
Two behaviours that looked accidental were kept deliberately and documented
rather than "tidied":
- emptyFeed echoes the requested limit WITHOUT clamping it to MAX_PAGE_SIZE.
There are no rows for it to bound, and three call sites did exactly this.
- emptyFeed with no pagination reports page 1: the early returns that never
read their arguments (no session, follows nobody) did that, and the numbers
are what the UI paginates on.
userFeeds.ts 407 -> 281 lines, profileFeeds 87 -> 54, projectFeeds 122 -> 89,
communityFeeds 94 -> 61, plus 95 shared. Existing timeline tests pass
unchanged (62 files, 601 tests).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor: extract the preludes that PUT/DELETE and five seed scripts repeated
Five more places where the same block was written out twice or five times.
- entityCrudHandler's PUT and DELETE each carried the same thirty lines:
authenticate, load the row, run the ownership check. Now
authorizeEntityMutation(), taking the verb and the optional per-entity
access check. A change to the 401, the not-found copy or the ownership rule
could previously land on update and not on delete — and delete is the half
where getting it wrong is permanent.
- /api/projects/[id]/favorite: POST and DELETE both throttled the write,
loaded the project and looked up the existing favourite. One helper in
lib/api/projectFavorites.ts. It is called rateLimitedFavoriteContext for a
reason, spelled out in its docblock: api-route-guards.test.ts reads route
SOURCES for evidence of a write quota, and a helper called loadX would have
hidden that evidence behind an import — the gate goes quiet while the
protection is still there, which is the shape of a gate that later goes
quiet when it is not.
- messaging/api-helpers.server.ts declared ActorRow, GroupMembershipRow and
GroupActorRow twice, 27 lines apart-but-identical. TypeScript merges
identical interfaces, so it compiled and nobody noticed.
- The group-activity and re-engagement email templates each wired their
config into emailLayout + emailPlainText by hand. One renderEmail() in
layout.ts.
- Five owner-gated operational scripts opened with the same thirty lines:
load .env.local, read the service-role key, refuse without
ORANGECAT_OWNER_SEED=1, build an admin client. These run against the LIVE
database with a key that bypasses RLS, so that gate is the only thing
between a stray `npx tsx` and production — not a check to keep in five
versions. scripts/lib/owner-gate.ts owns it; the client it returns carries
its own supabaseUrl so the two scripts that print which database they are
about to write to still can.
Also: webhook signature verification stays duplicated between the app and
packages/sdk, because the SDK ships to customers and cannot import from src/,
and the app should not take a build dependency on a customer-facing package.
What is new is that the copy can no longer drift silently:
__tests__/unit/services/webhook-signature-parity.test.ts drives BOTH through
the same vectors — replay, forged body, bumped timestamp, wrong secret,
truncated and non-hex signatures, multi-signature rotation — and fails if
they ever disagree. Both files now say so at the top.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* test(slug): the assertions that pinned the limitation the fix removes
#1051 landed NFKD for slugify while this branch was in flight, and its tests
pinned what NFKD alone cannot do: `slugify('Марина') === ''`, and an article
titled in Cyrillic slugging to the literal word "article". Both were true,
both were documented as "callers transliterate first" — and this branch moves
that transliteration into slugify, so neither is true any more.
Updated rather than deleted, because the cases are the interesting ones: they
now assert 'marina' and 'shcherbakov', plus the sharp s that NFKD deletes
('Straße' → 'strasse', not 'strae'). The fallback assertion survives where it
still applies — a title with no letters at all.
The two slug test files are merged into the one that came with #1051; keeping
a second file for the same function would have been the thing this branch is
about.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
The sibling product was renamed on 2026-09-14. Every reference follows:
service and route paths (src/services/loki, /api/integrations/loki),
env keys (LOKI_*), the build-intent audience and timeline source ('loki'),
ecosystem config, docs, tests, and 13 file names.
Tool labels keep "Loki" capitalised: the old name had an internal capital
and passed the "looks like a name" shape test for free; a one-word name
needs listing, so softLower now carries a small PROPER_NOUNS set.
Box and data were moved ahead of this: LOKI_* keys sit beside the old ones
in the app env, the OAuth client is `loki` with the new callback host, and
timeline/metadata rows carrying the old name were rewritten.
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Phase 2 of 2 for the GET-by-id thread. 94e99909 landed the server side
(GET /api/v1/<entity>/[id] across all 9 public entities with full
auth/scope/sandbox awareness); this commit exposes the matching SDK
method so customers can `client.<resource>.get(id)` directly.
EntityResource gains `.get(id, options?)`:
- Calls GET `${path}/${encodeURIComponent(id)}`
- On 404 the HttpClient surfaces OrangeCatError with code='not_found'
— same envelope server-side for "doesn't exist" and "exists but not
visible" so probers can't distinguish (docs/api/CONVENTIONS.md §6)
- Returns the Response shape matching `.create()` + `.list()`
Available on all 9 resources: products, services, projects, causes,
events, loans, investments, assets, wishlists.
README updated to show the full triple — create + list + get — per
resource, replacing the "Read endpoints land later" placeholder.
Version bump 0.3.0 → 0.4.0 (minor, additive). Build clean
(dist/client.{js,d.ts} re-emitted; the .get signature shows up in
the .d.ts).
App suite still: 54 suites · 701 tests · 0 failures. tsc + eslint clean.
GET-by-id thread now complete (server + SDK + OpenAPI + README). The
deploy checklist step 5 — repack tarball into FleetCrown's vendor — is
now versioned at 0.4.0 instead of 0.3.0; the doc continues to read
"$VERSION" so no doc update needed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7dfdab2f shipped the server-side signing util but the receive side
lived only in src/services/. Customers consuming @orangecat/sdk could
not verify deliveries without hand-porting the algorithm — which is
exactly the kind of "every customer rolls their own crypto" footgun
the SDK exists to avoid.
This commit ports the verify-only path to packages/sdk/src/webhooks.ts
(no signing — server-only), re-exports it from index.ts, and bumps
0.2.0 → 0.3.0 (minor: additive). Build emits dist/webhooks.{js,d.ts}
alongside the existing client surface; npm install + one import is
now enough to verify any X-OrangeCat-Signature header.
Implementation notes preserved from the server-side util:
- timing-safe hex comparison (no `===` on signatures)
- tolerance window default 300s
- multi-value v1= accepted (future key rotation needs no code change)
- parsed reasons (malformed_header / unknown_scheme /
timestamp_outside_tolerance / signature_mismatch) for logs only,
never branch user-facing behaviour on them
The SDK and server-side functions diverged ONLY at the API surface
(SDK accepts Node 18 http header arrays, collapses to first element).
The hashing rules are byte-for-byte identical so they verify each
other's outputs.
App suite still: 46 suites · 604 tests · 0 failures.
SDK tsc + build clean (dist/webhooks.js + .d.ts emitted, index re-export verified).
Next: FleetCrown vendor tarball repack at vendor/orangecat-sdk-0.3.0.tgz
(separate FleetCrown-side commit; OrangeCat does not vendor its own SDK).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Integrations can now reconcile state, not just create. FleetCrown can
ask "what subscriptions have I already mirrored?" before re-syncing,
and any consumer can paginate through what its bound actor owns.
Server (entityListHandler):
- Replaces session-only getAuthenticatedUserId() with resolveRequestAuth()
so the same handler accepts both Supabase cookies and X-OrangeCat-Key.
- Integration-key auth: the key is bound to one actor at mint time, so
THAT actor is the implicit (and only) scope. The `?user_id=` query
param is ignored — a key can't peek at someone else's profile.
- Session auth: unchanged. Existing ?user_id= behaviour preserved.
- Commerce-helper path (products/services/causes listEntitiesPage) is
bypassed for integration auth — we want the bound actor's rows
including drafts, not the public-only list.
v1 route re-exports now expose `{ POST, GET }` for all 9 entities. The
discovery endpoint advertises `methods: ['POST', 'GET']`. registerV1Routes
adds the GET operation to the OpenAPI spec with ListQuery (limit/offset/
category) + paginated ListResponse + the auth-relevant error responses.
SDK 0.2.0:
- Each resource gains `.list(params?)` returning the array directly
(envelope unwrapped by the shared HTTP layer).
- ListParams: { limit?, offset?, category? }. Bounds (max 100) enforced
server-side; the SDK doesn't pre-validate.
- Versioning per the SDK's own README: minor bump (new method, no
breaking changes).
- New tarball packed and committed to fleetcrown/vendor/ in the next
commit so FleetCrown can consume the .list() method.
Smoke-tested end-to-end against local dev:
- GET /api/v1/products → HTTP 200 (3 rows)
- GET /api/v1/services → HTTP 200
- SDK products.list({ limit: 3 }) → 3 rows, types intact
- Discovery → methods: POST,GET
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Step 3 of the platform-ification. The SDK is the first integration
artefact FleetCrown (and the rest) will install. Lives at
packages/sdk/ as an npm workspace member of the orangecat repo —
single source of truth, one CI pipeline, lock-step PRs when schemas
change.
Package layout (packages/sdk/):
- package.json — ESM-only, "type": "module", clean "exports" map,
declares Node ≥18, sideEffects: false for tree-shaking, marked
public so it can be published to npm later (UNLICENSED for now).
- tsconfig.json (type-check) + tsconfig.build.json (emit to dist/).
- src/errors.ts — OrangeCatError + OrangeCatErrorCode enum mirroring
CONVENTIONS.md §3. `.isRetryable` for SDK retry logic and consumer
branches.
- src/http.ts — fetch transport. Built-in: 20s timeout (matches
FleetCrown's useFetch), exp backoff retry (3 attempts) on network /
5xx / 429 honouring Retry-After, auto-generated Idempotency-Key on
mutating requests (forward-compatible — server dedup planned),
bearer + X-OrangeCat-Key headers, User-Agent identifying the SDK,
AbortSignal composition.
- src/types.ts — request/response types for the 9 v1 entity creates.
Hand-written for v0.1 (OpenAPI codegen is a follow-up). Each response
type intersects Record<string, unknown> so additive server fields
don't break consumers.
- src/client.ts — OrangeCatClient with resource namespaces
(client.products.create(…), .services.create(…), etc.) +
client.discovery() for startup-time version sanity check.
- src/index.ts — public exports.
- README.md — quickstart, auth, error handling, reliability features,
versioning policy.
OrangeCat root package.json gains `"workspaces": ["packages/*"]`.
`npm install` symlinks @orangecat/sdk into node_modules.
Contract reality check while building the SDK exposed two drifts from
the conventions doc — fixed both:
- Server returns `error: { code, message, details }` (nested object),
not `error: string + code` (flat) as the doc claimed. Fixed
src/lib/openapi/responses.ts to describe the real shape and updated
CONVENTIONS.md §3 with the actual wire format + the SDK's
case-normalisation (server sends UPPERCASE, SDK matches lowercase).
- This is what end-to-end SDK testing is FOR. The doc is the
aspirational contract; the server is the running reality; the SDK
is what proves they match.
Smoke test (against local /api/v1):
- DISCOVERY OK: v1 - 9 entities, /api/v1/openapi.json
- AUTH ERROR (expected): unauthorized / HTTP 401 - Unauthorized
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>