Commit Graph
18 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 ef96be9b91 feat(projects): invite anyone into a project by email, account or not (#872)
Inviting a collaborator required them to already have a Loki account.
The members route answered "No Loki account uses that email. Ask them to
register first." — a dead end with no way to ask. The only other invite
path creates a LOCAL-PASSWORD account and adds it to the inviter's whole
org: broader than one project, and a second identity path beside
OrangeCat, which fleet STACK.md says our own products must not grow.

Now any email works:

- Has an account: added at once, as before.
- No account: a one-time invite is created, emailed when mail is
  configured, and ALWAYS returned as a link to copy — an email that was
  sent is not an email that was received. They open it, sign in with
  OrangeCat (creating that account on the way), and join exactly this
  project with exactly the role chosen. No Loki password anywhere.

The link is bound to the invited email. A token is a bearer secret that
gets forwarded; on its own it would let whoever holds the link in. The
wrong account is told which address it was for, masked (ge•••@gmail.com)
because the link may be in the wrong hands.

Only a sha-256 of the token is stored, so a leaked backup cannot be
replayed as working links. Acceptance spends the invite and grants the
membership in one transaction guarded on accepted_at/revoked_at IS NULL,
so a double click or two tabs grants once. Re-inviting the same email
revokes the old link rather than leaving two live ones.

"emailed" is only reported when mail is configured AND the send
succeeded: sendEmail returns quietly when mail is off, so trusting the
call alone would have claimed an email nobody sent.

The panel moved from a collapsed "Editors" disclosure inside the
Feedback tab to the top of the project's Settings tab — where every other
product keeps "people with access", and where George looked for it. It
now offers Editor or Viewer, lists pending invites, and lets the owner
withdraw one. Editors do not see pending invitees' emails.

The accept API lives under /api/invitations/project/ so it inherits the
existing public-route exclusion instead of widening the proxy allow-list.

Migration 0080 is hand-written, like 0073-0079: drizzle/meta's snapshot
stops at 0072, so `drizzle-kit generate` diffs against a stale picture —
it believes beacon_sessions still exists and calendar_busy does not, and
would have emitted a DROP and a duplicate CREATE alongside this table.

Tests: 14 checks on the acceptance rule, proved by mutation — removing
the email binding turns the suite red. tsc clean, lint 0 errors,
check:design ok, format ok, test:unit 260/260, test:home 130/130.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 02:34:14 -07:00
CatoandClaude Opus 5 0464358605 fix(orangecat): the wall went silent, and every link on it pointed at a login (#839)
* fix(orangecat): the wall went silent, and every link on it pointed at a login

Three failures on one seam, each invisible from inside Loki because the
symptom is on somebody else's page.

THE WALL STOPPED. OrangeCat rotated this account's refresh token at
2026-09-17 07:42:44 and issued a replacement that is still valid and was
never used; Loki kept presenting the one that rotation REVOKED at that
instant. Every refresh since answered 400, getOrangeCatLink returned null,
and every promote was skipped as "feature unavailable" — across every
project, for four days. The last entry to reach any OrangeCat wall was
posted eight minutes before that access token expired. The only trace was
66 console.warn lines on the box.

Verified by hashing the stored token and finding its row in OrangeCat's
oauth_refresh_tokens: revoked_at = 2026-09-17 07:42:44.

Three rules follow, none of them a repair: one refresh at a time per
account (the backfill cron fires up to 50 promotes at once, so a burst was
guaranteed to look like a broken link); a spent refresh token is never
written back (`?? account.refresh_token` reads as defensive and stores a
credential that can only ever fail); and a dead link raises an alert,
because re-linking needs a human click and nobody clicks what nobody sees.

EVERY LINK POINTED AT A LOGIN. Wall entries carried a hardcoded
`${LOKI_PUBLIC_ORIGIN}/projects` — the private dashboard. A stranger
following "via Loki" from Heidi's OrangeCat page got a sign-in form; the
owner got all 36 projects instead of the one the entry was about. Twelve
such links on that page alone. The right page has existed the whole time:
/fleet/<slug>, now derived exactly as the register derives it.

THAT PAGE WAS UNREADABLE ON A PHONE. Measured at 390px: 737px of roadmap
content in a 390px column, clipped by .ui-public-surface's own
overflow-x:hidden — 47% of every milestone line unreachable, no scrollbar,
no ellipsis. Cause: unbreakable GitHub URLs in prose. Fixed on the
ui-public-* prose tokens in globals.css, so it holds for every public page.
Also on that page: three of six "changelog" entries were internal dispatch
bookkeeping (two announcing a FAILED dispatch, stored truncated mid-word),
a `Source: <url>` provenance pointer rendered as an untickable milestone,
"0% recorded progress" under every item, and a raw ISO timestamp.

NO GATE COULD HAVE CAUGHT IT. audit-covers-every-page skipped every route
containing "[", so /fleet/[slug] — the template behind all 36 public
profiles — had never been measured at any width. Dynamic routes now take
the same decision as static ones: a concrete sample (/fleet/heidi,
/u/cato, one essay) or a line in NOT_MEASURED saying what it would take.
The overflow detector could not have seen it either — it reads
documentElement.scrollWidth, which the clip holds at the viewport width —
so there is a new one asking the reader's question: can I get to the rest
of this sentence? A listed route that 404s now fails, because a rotted
sample looks exactly like a covered route.

Two gates lied and are fixed with it: the audit's list parser ended an
array at the first "]" in a comment, and alert-registry read
`grant_type: "refresh_token"` as an unregistered alert type.

AND THE FEED IS NOW A CHOICE. Publishing did two things under one press:
it created the public page and enrolled the project in a live feed of
everything its agents did, with no switch — "stop telling everyone what my
agents are doing" cost you the funding page. user_projects.orangecat_autopost
separates them, three-state like auto_ship (null = nobody has chosen, and
an unanswered question is not consent). Reversible either way, without
touching the page. Already-published projects are backfilled to true:
introducing consent must not silently stop a feed someone relies on.

Left on, it is the strongest thing a public project page can carry —
dated evidence of work, which is the half of a transparency claim that
better copy cannot manufacture.

/fleet/[slug] also now reads CONSENT rather than ownership (it resolved any
slug in the owner's map, which the catalogue beside it has never done), and
a slug with no public profile gets an invitation instead of a dead end.

verify: tsc, lint (0 errors, 2 pre-existing warnings), test:unit 231/231.
The page itself is measured against prod after deploy — it cannot be
measured before.

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

* fix(smoke): the pre-push gate blocked a push over another app's dev server

`/api/health` answering with a `"commit"` field was the whole identity test,
and every app in the fleet serves that route from the same template. On
2026-09-22 a Heidi dev server held :3000 first; Loki's 48-route auth smoke ran
against it, reported 23 routes returning 404, and failed the push — a verdict
about somebody else's app, delivered as a verdict about this one.

A name cannot be mistaken for another name: health now says which app answered,
and the hook asks for "loki" instead of for a shape. Additive to the payload,
so the deploy assertion, the uptime sweep and check-deploy-ref are unaffected.

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

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 07:04:07 -07:00
CatoandClaude Opus 5 cdff69e3c2 test(audit): make the page list earn it, instead of asking it to (#818)
responsive-audit.mjs opens with the argument this enforces — "a rule enforced
on the pages that happened to be reachable is a rule with holes exactly where
nobody looked, so the list has to earn it". It could not earn it alone,
because nothing ever compared the list to the app. Twenty-four static page
routes were in neither list.

Comparing them found four that matter:

  /my-feedback  the REPORTER's view — the one feedback surface whose reader
                may be a stranger on someone else's site, and one AGENTS.md
                already records as having been forgotten ("the three-line
                clamp shipped to the operator inbox never reached it").
  /license      public, 200, and already missed once: the MIT relicense fixed
                LICENSE, README and Terms and left this page telling readers
                they "may not" host or repackage (loki#802).
  /privacy      the other two pages a stranger is entitled to read, neither
  /terms        of them ever measured.

Plus /unlock, /releases, /setup and the two /docs guides. All twenty new
checks pass, so the gap was not hiding broken layouts here — but it was
hiding /feedback's, which clipped its own stats mid-word on a phone until
#813, and it would hide the next one.

The rest are excluded BY NAME WITH A REASON in NOT_MEASURED: retired redirect
stubs that render nothing (/agents, /atlas, /duet, /digests, /decisions,
/history, /blog), an action rather than a page (/sign-out), and flows that
need state a headless run cannot mint — a claim token, a verification token,
a connected Fleet Runner.

scripts/test/audit-covers-every-page.ts then fails when a page.tsx is in
neither, so adding a page becomes a decision about whether it is measured
rather than a silent omission. It also fails on an exclusion whose page no
longer exists — a stale reason is one nobody re-examines — and refuses a route
listed in both.

It asserts its own parse first. If the regex that reads those lists ever stops
matching, every other check would pass vacuously, which is precisely the
failure this file exists to prevent.

Mutation, both ways: removing /my-feedback from the audit fails it, and
excluding a route with no page fails it.

verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings),
check:design (11), check:desktop, test:home 130/130. test:unit 226/228 —
activity-time-zone-stable and telegram-allowlist need a live local server and
fail identically on pristine origin/main.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 14:09:32 -07:00
CatoandClaude Opus 5 1f40a7c0d5 fix(ui): five scroll strips that hid their own scrollbar and never said so (#813)
Started from a real report: the buttons on /feedback look thrown together on a
phone. They do, and the page had never been measured — /feedback and /robots
were reachable from the sidebar and audited by NEITHER list in
responsive-audit.mjs. The paragraph above that list argues exactly this: "a
rule enforced on the pages that happened to be reachable is a rule with holes
exactly where nobody looked — so the list has to earn it." Both are in it now.

WHAT THE PHONE ACTUALLY SHOWED

  /feedback at 390px ended mid-word — "32 Shipped 18 in…" — with the third
  stat entirely off-screen. `.ui-stat-row` below sm is a flex strip with
  `overflow-x-auto` AND `[scrollbar-width:none]`: no scrollbar, no fade, and
  nothing whatever to say the row continues. A clipped word does not read as
  "swipe me", it reads as a broken layout.

  The repo already had the answer — `ui-scroll-fade-right`, which masks the
  right edge below sm and nulls itself at sm. Four more strips were missing it:

    ui-stat-row         Feedback, Goals, Memory, Money, Habits
    ui-filter-chip-row  EventsGrid — the other FOUR call sites already had it
    ui-inbox-projects   Control's inbox
    ui-activity-tabs    the Activity tab row
    ui-term-key-lane    the phone key deck

  ui-filter-chip-row settles the question of whether this was a decision: the
  same class carries the fade at four of its five call sites.

A COMMENT THAT DESCRIBED A LAYOUT THAT DOES NOT EXIST

  StatRow's doc said the row is "two columns below sm" and that the odd card
  spans via `:last-child:nth-child(odd)`. No such rule has ever existed in
  globals.css — the layout was replaced by the scroll strip and the
  description was left behind. That is worse than no comment: it sends the
  next reader hunting for a rule to adjust that is not there. Rewritten to
  describe what the CSS does.

THE RATCHET

  scripts/test/scroll-strips-have-an-affordance.ts fails on any strip that
  scrolls horizontally AND hides its scrollbar AND offers no fade — reading
  both the JSX and the ui-* class bodies, since .ui-stat-row hides its
  scrollbar inside globals.css and its className reads innocent.

  Its first cut reported the file it had just fixed, because it matched the
  class name in the explanatory PROSE above the component. It reads className
  attributes only now. A detector that cannot tell code from commentary
  invents work.

  Mutation: removing any one fade fails the suite.

verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings),
check:design (11), check:desktop, test:home 130/130. test:unit 223/225 —
activity-time-zone-stable and telegram-allowlist need a live local server and
fail identically on pristine origin/main.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 11:52:27 -07:00
CatoandClaude Opus 5 04cedba195 Loki's public face belongs to the tenants who agreed to be on it (#798)
* fix(setup): the documented local setup produced a broken app

Followed README.md and .env.example exactly on a clean checkout and got an
app that renders but cannot read a session. Three separate gaps, each on the
documented path:

- AUTH_TRUST_HOST was undocumented. src/auth.ts gates trustHost on it, and
  scripts/hetzner/gen-env.sh writes it on the box — but .env.example, the
  README's "minimum local .env.local", docker-compose.yml and loki-app.sh all
  omitted it. Unset, Auth.js answers EVERY /api/auth/session with 500
  UntrustedHost. Verified: 500 before, 200 after, nothing else changed.
  The auth.ts comment claimed the local production server set it; it did not.

- The compose db image has no pgvector. knowledge-embeddings.ts declares
  vector(384), so `drizzle-kit push` dies on the first table with
  `type "vector" does not exist` and leaves an EMPTY database — which reads
  like a broken checkout rather than a missing extension. Switched to
  pgvector/pgvector:pg17 and added an initdb script that creates it before
  the migrate service runs.

- drizzle.config.ts never loaded .env.local, though a dozen scripts under
  scripts/db and scripts/test do. `pnpm run db:push` therefore threw
  "DATABASE_URL is required" at someone who had just set DATABASE_URL where
  the README told them to. An exported variable still wins, so CI and the box
  are unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* fix(projects): the empty state named a button that does not exist

A new account with no projects is told to "Register your first project with
'New project' above". There is no "New project" control on the page — the
button reads "Add", and the dialog it opens is titled "Add Project". The
component file is called NewProjectButton.tsx, which is most likely where the
copy came from.

Found by signing up as a new user and following the onboarding instruction
literally: the first thing the product asks you to do names a control you
cannot find. Now says "Add", matching what is rendered.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* feat(fleet): a project reaches Loki's public catalogue only by consent

/fleet is unauthenticated and speaks for the PRODUCT, not for a user. It
resolved a single account — getSelfImprovementTarget(), "whoever owns the
oldest entity named loki" — and published every project that account had.
Two things were wrong with that in a multi-tenant product:

  1. No decision was ever recorded. A project was on a public page because it
     existed. Every other public surface here already goes through
     getPublicProjects (the landing hero, /u/[username]); /fleet was the only
     one reading the unfiltered query.
  2. WHICH account got published was a side effect of the self-improvement
     loop's notion of "which product am I improving". Reseed that entity and
     the next-oldest match's whole project list becomes Loki's front page.

So consent is now a stored property of the project:

- user_projects.listed_publicly, DEFAULT FALSE. The default is the point —
  signing up must never enrol a tenant in the product's shop window.
- getPubliclyListedProjects() reads consent instead of ownership, across all
  accounts, which is also what makes the page meaningful with more than one
  user. /fleet no longer selects by owner at all.
- A per-project toggle on the project workspace, beside the existing
  "Publish to OrangeCat" opt-in and reversible from the same control.
- 0075 backfills the account publishing the catalogue today, so the live page
  is unchanged for it while everyone else starts at false.

Also: FleetRegisterNote told EVERY account "19 sites are hosted on the box
with no project here" — apps.conf describes one box and is a file in this
repo, so a brand-new user was being told about sites they do not own. It now
renders only for the account that operates that box.

A user's own profile (/u/[username]) is deliberately untouched: that page is
the user speaking about themselves, and it was already scoped.

scripts/test/public-catalogue-consent.ts pins all of it — swapping the query
back is a one-word change, and a comment cannot hold that line.

Verified against a real database: consent false -> absent from /fleet,
true -> present, toggled both ways through the UI.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* feat(public): what a signed-out visitor sees is a decision, not an accident

Answers "whose projects does a stranger see on Loki?" — with three tiers
instead of three different hardcoded owner lookups.

THE PROBLEM. Loki is multi-tenant and the founder is tenant #1, but every
public surface resolved an owner and published whatever that account held:

  - the landing hero  → getHeroFleetSnapshot(getDefaultUser())
  - /fleet            → getSelfImprovementTarget()  (fixed in the last commit)
  - the /projects note→ nothing at all

Three answers to one question is three chances to be wrong, and the landing
was the worst of them: it never consulted consent at all. Verified locally —
a project with listed_publicly = false was rendering in the hero console.
It also ordered by a hardcoded FLAGSHIPS = ["loki", "orangecat"], the ad-hoc
version of "featured", which could only ever name the founder's own projects.
The same list sat in /u/[username], where it reordered EVERY tenant's profile
by two names they will never have.

THE MODEL. src/db/queries/public-visibility.ts is now the one place that says
what a signed-out visitor may see:

  1. AGGREGATE  — fleet-wide counts. Identify nobody, need no consent, and
                  grow honestly as Loki gains users.
  2. CATALOGUE  — /fleet: projects whose OWNER opted in (listed_publicly).
  3. SHOWCASE   — landing hero: the catalogue narrowed to what the OPERATOR
                  featured (featured_at). Curated space cannot be first-come.

Two gates because they answer to different people: consent is the tenant's
and may be withdrawn; featuring is the operator's editorial act. The showcase
predicate is BUILT ON the catalogue predicate, so revoking consent drops a
project off the homepage immediately even while it is still featured —
verified all three ways against a real database.

This is the doctrine site_feedback.featured_at already had ("raw visitor text
NEVER auto-publishes"). Projects now work the way feedback already did.

Featuring is authorized by isSiteOperator (users.is_default — the account made
at /setup, so it means "runs this instance" for self-hosters too) and lives on
its own query rather than riding patchProject, because it is the one project
field a tenant must not set for themselves. It also refuses to feature a
project whose owner has not consented.

UI: two separate controls on the project workspace, deliberately not merged —
"List publicly" (owner) and "Feature" (operator, shown only to them, and
explaining itself when consent is missing).

ALSO, from auditing the public pages at 320/390/768/1440:

- /fleet had 19 sub-44px tap targets — every one the site address that is the
  whole point of the row, and the only sub-44px targets left on any public
  route. .ui-public-fleet-site was missing from the touch floor AND was an
  inline box, where min-height does nothing. Both fixed; now zero.
- The responsive auditor EXCLUDED public routes, deferring to `smoke` "which
  already covers them" — smoke asserts HTTP status, which says nothing about a
  layout. So the pages a stranger sees first were the only ones with no
  responsive coverage. They are in the auditor now and need no session, so a
  session is required only when authenticated pages are requested.

No horizontal overflow at any width, before or after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* fix(fleet): a phone spent a screenful on filters before the catalogue

Measured at 390x844: the first project row sat at y=1020px. Four facet rows
(Where / Kind / For / Missing) took 366px of that, so you scrolled past more
than a screen of controls before seeing any of the thing they control — on a
page whose entire job is to show a catalogue.

The rows now live in a <details> that is collapsed below md and forced open
from md up, so desktop is unchanged and the phone leads with content:
first row y=1020 -> 699. The summary carries a count of active facets,
because a filter you cannot see is one you forget you set — and then an empty
result reads as a broken page rather than a narrowed one.

<details> rather than state, because this page deliberately ships no
JavaScript ("the address bar is the state") and a filter panel that needed a
bundle to open would be the one thing on it that did.

One trap worth recording: hiding the closed panel has to be EXPLICIT. The UA
sheet hides a closed <details>'s children with display:none, but author styles
outrank the UA sheet and .ui-fleet-facet-row is `@apply flex` — so the first
version rendered a toggle that changed nothing, with the element correctly
reporting open=false while all four rows stayed visible. Verified both states
at both widths after the fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* feat(public): credit the builder, ask before publishing, stop renting the box

Four things, all following from the same rule: Loki is multi-tenant, so its
public face belongs to the tenants who agreed to be on it.

1. ATTRIBUTION. A showcased project now carries a byline — @handle linked to
   /u/[handle], display name when there is no handle, and NOTHING when there is
   neither, because a stand-in label is a name we would be inventing for
   somebody. Showing a tenant's work unattributed reads as "our projects",
   which is untrue and is the opposite of why a showcase exists; being credited
   and linked is also most of what a tenant gets back for consenting. Joined in
   the query rather than fetched per row.

2. LOKI ASKS. Consent was reachable only from a toggle nobody knew about, and a
   control nobody finds collects exactly one answer. The empty catalogue that
   follows is what gets "fixed" by widening the query again — the bug 0075
   removed. So the project workspace now invites the owner once, and
   listing_prompt_dismissed_at takes no for an answer: per project (declining
   for a client build says nothing about the open-source one beside it) and in
   the database (a refusal that resets on a new device is a product that nags).
   The rule lives in src/lib/listing-invitation.ts, pure and unit-tested. The
   bar is repo + active, deliberately NOT a live URL: /fleet's own facets list
   "Being built" beside "Live", so requiring a deployment would ask only the
   projects that least need the exposure.

3. THE BOX IS NOT THE FLEET. apps.conf describes ONE box and is a file in this
   repo, and unmatched entries MINTED rows — so a Loki with one consented
   project still published 19 sites belonging to someone the viewer has never
   heard of. buildFleetRegister now takes includeUnlinkedSites, true only for
   the operator, for whom those rows are the entire point (the register read
   sideways is a to-do list). A hosted app still ENRICHES a project that
   exists, so a consented project keeps its real address either way; only row
   creation is gated, because only row creation publishes something nobody
   asked to publish. Verified: operator sees 20 projects / 19 sites, the public
   sees 1 / 0.

4. THE COPY. "This is the studio's whole catalogue" was true when one account
   was the whole fleet. It now says what the page is: projects their owners
   chose to show.

Also, from re-auditing: .ui-public-fleet-name (the row's PRIMARY link) measured
21px tall on a phone. It had been invisible to every previous audit because
while the page listed hosted sites alone, nothing in a row was a link at all —
the fix in 3 is what made a real project row render and the gap appear. Same
cause as .ui-public-fleet-site last time: the coarse-pointer floor sets
min-height, which does nothing to an inline box.

Every public page: zero horizontal overflow and zero sub-44px targets at
320/390/768/1440.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* fix(home): the hero console had an empty third column

Making the hero tenant-agnostic dropped "runs this week", because the old one
counted getRecentOrchestrationRuns(userId) — one account's week, which is not a
number a visitor should be shown. But the console's metric row is grid-cols-3,
so removing it left a visibly empty third of the panel. Caught by looking at
the rendered page rather than the diff.

Restored fleet-wide, counted the same way as the other two: it is the metric
that answers "is anything actually happening here", and an aggregate across
every tenant identifies nobody, so it needs no consent and grows with the
product instead of describing one account.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* fix(footer): the studio's sites were labelled as Loki's fleet

Every public page's footer lists 14 sites generated from apps.conf under
"Part of the fleet — 14 more sites". apps.conf describes ONE box, the
studio's, and several of those sites belong to clients — so on a multi-tenant
Loki the label told every visitor that one account's client work was what Loki
is. Same error as the /fleet lede, and the same fix: say whose they are.

"Built by the studio" now, and the link beside it points at the tenants'
catalogue by its real name rather than calling it "the whole register".

Deliberately a COPY change and nothing more. The links themselves stay, all
14 of them: they are real work, several had no inbound link from anywhere
before this block existed, and the cross-linking is the entire reason it is
here. Removing them would trade a genuine asset to fix a sentence. Only the
claim was wrong.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* fix(home): the hero console looked broken with nothing featured

0076 deliberately does not backfill a feature stamp — featuring is an
editorial act nobody has performed yet — so the live hero will really render
with zero project rows until someone features something. I had asserted that
was fine without looking at it. It was not.

The bar carries mb-4 + border-b and the metrics carry mt-4 + border-t, so with
no rows between them the panel drew TWO horizontal lines with 32px of nothing
in between: the shape of content that failed to load, on the first screen of
the product.

The metrics now sit flush under the bar's own border in that state, which is a
panel with nothing to list rather than a panel that broke. Verified in both
states: with rows the divider is back and the flush class is absent.

Not fixed by falling back to showing consented-but-unfeatured projects, which
was the tempting option: the invitation asks permission for the public fleet
page specifically, so putting those projects in the hero would take more than
the owner agreed to.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

* fix(fleet): an empty catalogue told visitors to clear filters they never set

With nothing listed, /fleet rendered "Nothing matches that. Clear the filters →"
— to a visitor who had set no filters, offering a link that changes nothing.
That is the FIRST thing a freshly self-hosted Loki ever says on that page, and
it reads as a fault rather than an empty shelf.

Two states now, told apart by `rows` (the whole catalogue, before the query)
rather than `result.rows` (after it):

  nothing listed at all → says so, and says why: owners choose which of their
                          projects appear, and nothing is published without
                          them saying so. Links to what Loki does.
  filtered away        → unchanged: "Nothing matches that" + clear the filters.

Found by putting the local database into the state a new install starts in,
rather than only the state mine happened to be in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-20 06:30:17 -07:00
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
5e4192e4d1 fix(control): stop offering back the prompts nobody reuses, and the clamp that never clamped (#482)
Found by using /control in a browser as a user, on a phone-width window,
start to finish: pick a project, type a prompt, send it, follow the outcome.

1. "PASTE FROM HISTORY" WAS SHOWING THE OPPOSITE OF WHAT IT PROMISES

The card offered back conversational asides — "you do it. open in browser and
do it" — as reusable work. Not a rendering bug: those really were dispatches.
The selection was wrong.

Measured on prod, 30 days: 1859 distinct custom prompts, of which 1823 (98%)
were sent exactly ONCE. The query ordered by recency, so it surfaced the three
most recent one-offs — by definition the prompts least likely to be wanted
again — while the genuinely reused ones sat unoffered: "continue" 115×, a
git-diff review prompt 63×, "go ahead" 14×, "keep going" 8×.

Requiring two uses cuts the pool from 1859 to 36 and leaves exactly what the
feature is named for. Nothing is lost: Activity keeps every dispatch with a
re-run control. One-offs just stop competing for space on the card.

2. THE CLAMP I SHIPPED IN #479 WAS INERT, AND I COULD NOT SEE IT

`block ... line-clamp-2` computes to `display: block; -webkit-line-clamp: 2`.
`-webkit-line-clamp` does nothing without `display: -webkit-box`, and
Tailwind's `block` utility overrode it. It LOOKED fixed because an unclamped
box just wraps — which reads fine until the sentence is long.

Checked live in the browser: a 460-character next_step grew that box from 48px
to 96px and pushed the composer, the thing you act with, off the bottom of the
viewport. So my "it renders fully now" was measuring the ABSENCE of a clamp.

Dropping `block` makes it work; three lines, not two, so a typical next_step
(~256 chars) still reads in full and a pathological one is bounded and
reachable (clicking loads the whole text into the composer).

THE GATE: responsive-audit now flags a line-clamp that is declared but not
enforced. It cannot test `display === "-webkit-box"` — Chrome reported
`flow-root` for a clamp working correctly — so it tests BEHAVIOUR: an element
declaring N lines that renders more than N. Run against live prod it says:

  "Suggested next (profile)…"[ui-link-subtle-button.block.line-clamp-2]
  declared 2 lines, renders 4 (display:block)

naming the offending class. That is this exact bug, caught in shipped code.

3. A FAILURE MESSAGE THAT NAMED THE WRONG AGENT

A real dispatch returned: "launched claude (pty) + injected, but the agent
isn't generating yet … Retry, or switch the project agent away from grok if
this repeats." One sentence naming the agent that ran and, as advice, one that
did not — a literal left over from when grok was the default. `agent` was in
scope; the auth branch above it interpolates it correctly.

Gated in failure-message-pairing: a failure message that NAMES an agent must
interpolate ${agent}. Stated that way rather than "no agent ids", because the
auth message legitimately says `~/.claude/.credentials.json` and `claude
setup-token` — a real path and a real command — and already names the right
agent. The check joins `+` continuations so a message split across two lines is
judged whole; per-line it got that one wrong.

Mutation-proven: restoring the "grok" literal → 20 passed, 1 failed, naming the
line. Restored → 21/21.

pnpm run verify passes.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 12:20:44 +00:00
60dac488b1 fix(control): a sentence you can read, and the check that noticed it (#479)
/control's "Suggested next" line carried `truncate` — one line, ellipsis. On
prod that rendered "Suggested next (profile): Conduct a 1-month baseline m…":
594 of its 644 pixels hidden at 390px, 432 at 1440. The remainder existed
only in the `title` tooltip, and a phone has no hover.

It is the card's one actionable sentence, and clicking it loads the text into
the composer — so the sentence IS the decision, and a tenth of a sentence is
not one. OutcomeStreak.tsx, in this same directory, documents having already
fixed this exact mistake for its glyph row. /activity has always clamped the
same "what's next" content to two lines (ActivityEventRow). This makes the
three agree: line-clamp-2.

Same class in the composer's status line, worse: it shared a row with four
icons and Send, leaving it 72px — measured at 0% shown at 320px and 14% at
390px. Shorter copy cannot fix that; no sentence fits 72px. It needed the
width, so below `sm` it wraps onto a row of its own (order-last w-full) and
from `sm` up it stays exactly as it was.

THE GATE, and why it is not a lint rule.

responsive-audit already looks for clipped text, and deliberately EXEMPTS
`text-overflow: ellipsis` as "a deliberate design choice". That exemption is
right for what it was written for — a project name in a narrow rail, a
filename, an id — and 76 files under src/components truncate exactly that way.
A rule banning `truncate`, or `truncate` beside a `title`, would fire on ~42
legitimate sites and be turned off within a week.

The distinction is prose, which a static rule cannot judge but a real viewport
can measure. So the check lives where the viewports are: flag an ellipsis only
when the text READS as a sentence (>=60 chars, >=8 spaces — an id has neither)
AND under half of it is visible (a chip losing its tail is fine; a line showing
its first eight words is not).

Proven by mutation, in one environment, with only the classNames differing:
  - with `truncate`  -> 2 findings ("40% shown, -552px", "22% shown, -402px")
  - with the fix     -> silent at 320 / 390 / 768 / 1440
and it flags none of the 76 legitimate truncations.

Verified against prod before the fix (2 findings at 320 and at 390, silent at
768/1440 where the line fits) and against a local server after it.

npm run verify passes.

Separately observed and NOT addressed here: /control logs a React #418
hydration mismatch at every viewport.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 10:30:47 +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
GandClaude Opus 5 0d0e91657b feat(crew): assign work to humans, and pay them in bitcoin (#391)
* feat(crew): assign work to humans, not just agents

FleetCrown dispatches intents to agents. Some work is not an agent's to
do — calling twelve suppliers on the company's behalf, signing something,
walking into a room. That half of the fleet had nowhere to live, so it
lived in the operator's head. This adds it as a surface: /crew, the
humans in the loop and the work handed to them.

Three laws, each because the alternative is worse:

  A person is not a queue. `assigned` only ever means you ASKED. The
  answer is theirs — accept, decline, or deliver — and OPERATOR_MOVES
  cannot reach `accepted` or `declined`, so FleetCrown can never record
  consent nobody gave. Declining is a first-class button on the share
  page, not small print: an ask you cannot refuse is an order.

  Nothing reaches a human by accident. An assignment is born a DRAFT,
  and a draft has told nobody anything. Handing it over mints the share
  link, and that is the only act in the feature that reaches a person —
  which is what makes it safe to let Loki propose one (propose_human_task
  writes a draft, exactly as propose_action does).

  Money is OrangeCat's. A task states its fee so both sides see the
  terms; a paid one mirrors to OrangeCat as a service and keeps the
  pointer. FleetCrown decides WHO does the work; OrangeCat settles what
  it costs. That seam is the missing link between the two products.

The roster is not a new table. A crew member is a person already in the
operator's book (`entities`, type person) carrying `crew:member`, so
enrolling someone you know adds no row, un-enrolling keeps every note and
assignment, and the book can never disagree with the roster. The actor
kernel gains a DELEGATE capability opposite MARKET: a robot physically
cannot join the crew, and a person still cannot be listed, booked or
sold — assertAttrAllowed enforces both directions.

The assignee never signs in. They open a link and answer; the token is
their credential, looked up with revoked links excluded, and it can only
ever answer for its own assignment. Revoking an unanswered ask pulls it
back to draft, because a board that says "asked" over a dead link lies
to you every morning.

Verified against real Postgres, not just types: the whole query layer end
to end (enrol → draft → hand over → accept → deliver → accept the work →
revoke → re-share), and the public surface over HTTP — page renders,
accept succeeds, a replayed accept is 409, an invented action is
rejected, unknown tokens 404, and /api/crew plus /crew stay gated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YKERdritcwNRuPW72zv8c3

* feat(crew): pay in bitcoin, to the person who did the work

Three corrections, all of them about the same thing: a fee is a promise to
a human, and every part of it has to be true.

BTC is now an assignable currency. The list is exactly the enum OrangeCat's
services API accepts (USD, EUR, CHF, GBP, BTC) — a currency FleetCrown
offers but OrangeCat rejects is a fee that cannot be mirrored.

fee_amount becomes NUMERIC(20,8), not real. float4 carries ~7 significant
digits, so it cannot represent a satoshi: 0.00050001 BTC would have been
silently rounded on the way to disk, and the amount someone is owed is the
last field in this system allowed to drift. Verified against Postgres —
that exact figure now round-trips to the last satoshi. Two-decimal
formatting had the same bug on screen, printing "BTC 0.00" for 50,000
sats, on the page where a person decides whether to say yes.

And the payment goes to THEM. `publishTaskToOrangeCat` creates a service
under the studio's integration key, so paying that listing pays the
studio — the SDK's actor_id is documented as ignored for integration keys,
and OrangeCat has no endpoint that creates an actor, because a profile
carries a wallet and a wallet belongs to whoever holds its keys. So the
roles are split honestly: the listing is the record of the engagement, and
`crew:orangecat_profile` — their own OrangeCat page, Lightning wallet and
all — is the destination. It rides on the task as `assigneePayUrl`, gives
the operator a "Pay Jana BTC 0.0005" button, and tells the assignee where
the money lands before they accept. A paid assignment with no destination
on file says so out loud on both sides rather than looking complete.

Profile links are stored canonical (a handle and a pasted URL are one
wallet, not two) and anything that is not a profile is refused rather than
half-saved.

The migration is regenerated rather than stacked: 0060 was never applied
anywhere, so the column is born numeric instead of being altered later.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YKERdritcwNRuPW72zv8c3

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-26 18:46:03 +00:00
84a0edd70d fix(mobile): a dialog you cannot close, on pages nothing could test (#287)
* fix(deploy): a marker that can lie is worse than no marker

Two flaws in #279, found before its deploy ran.

1. The stamp preferred GITHUB_SHA over the checked-out commit. deploy.yml's
   workflow_run path checks out `workflow_run.head_sha`, which is not always the
   run's GITHUB_SHA, so the marker could name a commit that was never compiled.
   Since the deploy compares the live marker against the shipped ref, a lying
   marker manufactures a false alarm. Git HEAD is literally what was built, so
   it now comes first; GITHUB_SHA is the last resort for checkouts with no .git.

2. A mismatch rolled the box back. The realistic cause of a mismatch is a second
   deploy landing behind this one — and reverting to app.prev would discard the
   NEWER build, turning a benign race into exactly the incident the check exists
   to catch. It now reports loudly and leaves the running build alone. What was
   missing before was never the ability to revert; it was ever being TOLD that
   the box serves something else. That, plus /api/health, is the fix.

Both are pinned by tests, including one asserting the mismatch path does not
call rollback_box.

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

* fix(mobile): a dialog you cannot close, on pages nothing could test

Testing prod in a real phone viewport turned up two defects and the reason
neither was ever going to be caught.

THE OVERLAYS

The mobile navigation sheet — the only route to half the app on a phone —
ignored Escape and let the page keep scrolling behind it. Checking the other
overlays found the same thing twice more: the floating Loki assistant could be
opened with a key (`?`) and not closed with one, and the sessions drawer and
command palette both cover the app while the page scrolls underneath.

The cause is structural. `useEscapeToClose` was a private helper inside
modal.tsx, so the behaviour was reachable only by using <Modal>/<Drawer>; every
hand-rolled overlay started from zero and had to remember. Some did. Three did
not — and CommandPalette already carries a comment about fixing "the user's
'Escape doesn't close' complaint", so this is the class's third appearance, not
its first.

The hook moves to hooks/use-escape-to-close.ts, and scripts/test/overlay-contract.ts
enforces the rule: anything claiming role="dialog" handles Escape, and the
overlays that cover the app lock what is behind them. Fixing the fourth instance
by hand would have cost more than that file.

THE BLIND HALF

/people, /money, /habits, /events, /goals and /memory sit behind the PIN, so the
prod smoke skipped them, the UI dogfood's flows failed as "skipped", and the
responsive audit's page list never included them. Three checks, one hole, in the
same place — and it read as coverage: 97 green probes, 84 green viewport checks.

The PIN was never the boundary. The unlock is an HMAC under AUTH_SECRET, and
anything holding AUTH_SECRET can already mint a session as any user — which is
exactly what print-session-token.ts does. So the format moves to a request-free
module and the tooling mints its own unlock. Nothing new is granted; the tests
just stop pretending a third of the product does not exist. The PIN keeps
guarding what it was built to guard: a person at a keyboard.

The smoke now proves the gate before walking through it — a session without the
unlock must be refused — so bypassing it adds an assertion instead of removing
one. 97 probes to 129, all green against production.

VERIFIED IN PROD

- 129/129 authenticated probes, including the private zone for the first time
- 84 viewport checks across 320/390/768/1440, no horizontal overflow, now
  including the six private pages
- new audit:mobile drives a touch Chromium: every page's last element is
  reachable above the floating nav at max scroll, and the menu sheet closes on
  the close button, a backdrop tap, and Escape

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-15 10:29:20 +00:00
48aef7e1df fix(a11y): the touch floor is a constraint, not something you remember to add (#271)
Five passes fixed 60-odd controls one at a time and a scan still found 54 more.
That is the tell that the fix was never the control. It was the predicate.

The floor was opt-in: a button got 44px because someone typed `ui-tap` on it.
So correctness depended on memory, every new button started non-compliant, and
the audit could only catch the ones it happened to RENDER — a control inside a
closed modal or an empty state is invisible to it and ships undersized.

"Needs a 44px target" is not "someone added a class". It is "this is a
control", and the markup already says that. So the default is inverted: every
button/summary/select/textarea/role=button/role=switch/role=tab/a[href]/input
gets the floor on coarse pointers, and exemption is the thing you type.

Three details that make it hold:

  · Element selectors (0,0,1) on purpose. Every existing ui-* rule outranks
    them, so the named lists still own their controls and this only reaches the
    bespoke ones that never had a class.

  · Inline links exempt themselves, for free. min-height is inert on a
    non-replaced inline box, so an <a> in a sentence is untouched while an <a>
    laid out as a row gets the floor — exactly WCAG 2.5.8's inline exception,
    with no list to maintain.

  · Icon-only controls need the width too, or height alone leaves a 44x24
    sliver. `:has(> svg:only-child)` is CSS for what a human means by "icon
    button".

THE PART THAT TOOK TWO TRIES

The floor lived at the end of @layer components, reasoning that a later rule in
the same layer would otherwise win. True, and not enough: Tailwind's utilities
are their own layer, and @layer utilities beats @layer components outright. So
`className="ui-btn-secondary min-h-9"` silently undercut the floor. Thirteen
controls do exactly that, and the audit caught one only because /loki happens
to render it at 768px.

It is unlayered now, which beats every layer. Not a trick — the accurate
statement of what this is. A tap minimum is a CONSTRAINT, and a layout utility
must not be able to argue with it. Overriding it deliberately still works
(`!min-h-*`), so the escape hatch is loud instead of accidental. Desktop is
untouched: the media query still gates everything, so a mouse keeps its
compact 32px buttons.

The one opt-out is shape. A switch reads as a switch because it is a small
pill; `.ui-tap-overlay` keeps the 28x16 box and grows the hit area instead —
verified still 28x16 with a 44x44 ::after under the new default.

VERIFIED AGAINST PRODUCTION, BEFORE PUSHING

Not a local build: same DOM, same data, one variable changed. /control's "Show
details" measured 20px minutes earlier and is clean under the rule — which is
also the proof the injection took effect rather than quietly doing nothing,
the failure mode that cost a full production run last time.

AUDIT_EXTRA_CSS makes that a flag rather than a one-off, because both
alternatives were bad. Shipping first is what this audit exists to prevent. A
local build measures a different database — and on the day this was written it
silently measured a DIFFERENT APP, because another process already held the
port and `next dev` had exited with EADDRINUSE into a log nobody read.

THE AUDIT WAS MEASURING FIFTEEN PAGES AND REPORTING TWENTY

Five of the twenty routes are `redirect()` stubs: /agents and /atlas (retired,
→ /control and /projects), /digests, /decisions and /history (→ /activity). So
four pages were measured twice under names they no longer own, and a quarter of
the claimed coverage did not exist. Nothing surfaced it, because a redirect
renders a real page and passes.

Two of them did worse than lie: the redirect raced the measurement, so one run
hung on /history and another reported /decisions destroyed. The route moved
between runs, which is a race, not a layout fault — it settles and measures
once more now, because a gate that cries wolf is a gate someone learns to
ignore.

Stale entries removed, and a route that lands somewhere else now SAYS so, so
the next retirement is a line of output instead of silent double-counting.
CLAUDE.md's route table claimed /agents and /atlas were live pages; corrected
there too, since that table is what teaches the next agent which routes exist.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 11:21:03 +00:00
04ee93ef9f fix(audit): elementFromPoint is viewport-only — resolve the hit area from geometry (#268)
My previous commit replaced the box measurement with a hit test: probe a 44px
cross around each control and ask `document.elementFromPoint` what is there.
It is the obviously-right idea and it is wrong, which cost a full production
run to find out.

`elementFromPoint` only sees the VIEWPORT. Every control below the fold
returned null, null counted as "not reachable", and the report filled up with
44px, 46px, 55px and 65px "offenders" — three whole pages of items that were
never undersized. A measurement that depends on scroll position is not a
measurement.

Replaced with geometry, which is what the two real techniques actually change:
  • a wrapping <label> (or one pointing here with `for`) IS the hit area
  • an absolutely-positioned ::after/::before overlay extends it
Both resolved by reading boxes, so the answer does not move when the page
scrolls.

Verified before pushing this time, against production: /control, /system and
/today are clean at 320 and 390 — which also confirms the two fixes that
prompted the whole detour work, the bulk-select checkbox's label wrapper and
the scheduled-job switch's overlay.

That left exactly one offender across those pages: the sidebar `v0.8.9` link
at 15px, visible only at 768+ where the rail appears. I had twice argued it
was fine as non-tappable chrome. It is a link to /releases, so it is tappable
by definition — `ui-tap`, and `block` becomes `flex` so the floor applies.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 02:07:38 +00:00
de9b5a69b7 fix(a11y): measure the hit area, not the box — and clear the tail it exposed (#264)
Two of my own fixes from the last commit were reported as still-broken, and
both times the AUDIT was wrong, in opposite directions. That is a measurement
problem, so fix the measurement.

MEASURE WHAT THE FINGER HITS.
The check read `getBoundingClientRect().height`. That is not the hit area:
  - the bulk-select checkbox is 14px of input inside a 60px <label>
  - the scheduled-job switch is a 16x28 pill with an ::after overlay
    extending its hit area to 44px
  - anything given room by padding on a wrapper
The box measurement called all three failures. It now HIT-TESTS: probe the
four points of a 44px cross centred on the control and ask the document what
is actually there. That measures the real property rather than one of several
techniques for achieving it, and it catches the opposite error too — a
nominally tall control that something else is covering.

WCAG 2.5.8's INLINE EXCEPTION, encoded.
"Unlock the private zone" sits inside a sentence: "<link> to see this
project's milestones." I put `ui-tap` on it last commit and the audit still
reported 18px — correctly, because `ui-tap` sets no display and min-height
does nothing to an inline box. The right answer is not to force it: a 44px
link would wreck the paragraph, and the surrounding text is what makes it
findable. The spec exempts exactly this case. The audit now skips links whose
computed display is `inline` AND that sit in flowing text (parent has
materially more text than the link) — a link that is a flex item has been
blockified and is not this. The three pointless `ui-tap`s are reverted.

Also skips opacity:0 / pointer-events:none, which is how a closed mega-menu
panel was reporting eleven undersized links you cannot click at all.

THE TAIL, now that the cap is 12 and the class is printed.
Named classes to the floor: ui-public-primary-action, ui-control-live-select,
ui-control-live-input, ui-btn-nextbest, ui-link-subtle-button, ui-link-muted.
Raw-class controls to `ui-tap` / `ui-tap-icon`: the footer's fleet-site cards,
the prompt-library toggle, the recent-activity disclosure, OutcomeStreak, the
habit goal-link icon, and both RunnerStatusBanner dismiss buttons.

NOT INCLUDED, deliberately: FleetFeedbackStrip, FleetWidgetCoverageStrip and
the rest of AttentionBar. A concurrent session is mid-rewrite in those files —
264 changed lines in one, another untracked entirely. My one-line class
additions there are backed out rather than swept into this commit; only my own
hunk of AttentionBar is staged. Their controls get the floor when their work
lands.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 01:39:34 +00:00
f6d38fbeb6 fix(a11y): every remaining undersized target, and the clipped-text finding was noise (#259)
Made findable by teaching the audit to print the CLASS of each offender. Every
finding had been a truncated label you had to reverse-hunt back to a component;
now the report says what to edit. Cap raised 6 → 12 per page, because a capped
list looks like a short list.

THE CLIPPED-TEXT FINDING WAS WRONG — all of it.
"Clipped text up to -1014px" across half the app was `-webkit-line-clamp`
doing exactly its job. line-clamp is the VERTICAL ellipsis and is just as
deliberate as the horizontal one the audit already excluded; it sets overflow
hidden and leaves scrollHeight > clientHeight, which is the signal the check
was reading. Excluded now, and the clipped-text section goes from ~40 findings
to ZERO. Nothing was ever clipped. An unreadable section hides the real
clipping underneath it, so this is a fix, not a suppression.

TOUCH TARGETS — the rest of them.
Named classes joined the floor: ui-public-link (20 instances, the marketing
footer), ui-public-nav-toggle, ui-app-footer-cell, ui-loki-suggest-chip,
ui-loki-tool-btn, ui-loki-send-btn, ui-control-fleet-chip.

Thirteen raw-Tailwind controls got `ui-tap` — Layer-4 violations every one, so
this pays down the design-system debt that made them invisible: /today project
links, /control sort chips and rail rows, the bare search inputs on /control
/prompts /settings, "source" and "availability history" on /system, the
"Unlock the private zone" links, ControlDispatchButton's default.

TWO CONTROLS COULD NOT SIMPLY GROW, and needed different answers:
- The bulk-select CHECKBOX (14px) is a native control; scaling it up stops it
  reading as a checkbox. Wrapped in a `<label class="ui-checkbox-hit">` so the
  LABEL carries the hit area — which is what the finger lands on anyway, and
  what the audit now measures.
- The scheduled-job SWITCH (16x28) is a control whose SHAPE is its meaning.
  New `ui-tap-overlay`: an ::after child extends the hit area to 44px while the
  pill keeps its size (the WCAG target-offset technique). Documented as
  use-sparingly — the overlay reaches ~14px past the control on each side and
  will eat a neighbour's clicks in a dense row.

Not lifted: nothing. The inline links that WCAG 2.5.5 exempts (links inside a
sentence) are not what these were — they are standalone links in cards, lists
and footers, and they are all standalone-sized now.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 22:22:22 +00:00
0b6cfe72bc fix(a11y,avatar): nobody's profile photo has ever loaded; finish the touch floor (#255)
* test(audit): name the rejected request and the hydration mismatch

The first full run reported "400 responses on /settings and /thoughts" and
that was the whole finding — because a 4xx only ever reached the log as the
browser's generic "Failed to load resource" console line, truncated to 120
chars, two per page. A request your own app made and your own server rejected
is a real bug, and it is not actionable without the path.

4xx is now tracked separately from 5xx, same-origin only (a third party's 4xx
is their problem) and skipping 404 (favicons are noise, not findings). Still a
warning, not a failure: an authenticated audit can legitimately probe a route
the fixture user cannot reach.

Hydration mismatches get their own line rather than competing for one of two
truncated console strings. They are never cosmetic — the server sent markup
the browser disagreed with, which means something rendered from state the
server could not have (a clock, a locale, a random id) and the user saw the
wrong content before React repaired it. That is exactly the /today greeting
bug, which sat in the log as an unnamed console error for a whole audit run.

Matches BOTH shapes: production ships minified errors where #418 is the entire
message, dev builds print prose. Matching one form means the check works in
precisely the environment you are not auditing.

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

* fix(a11y,avatar): nobody's profile photo has ever loaded; finish the touch floor

Found by re-running the audit against production after the pointer-type floor
deployed. Three things, all of which the instrument could only report once it
was taught to say what it saw.

AVATARS: every remote profile photo 400s.
`/_next/image?url=https://avatars.githubusercontent.com/…` → 400 "url parameter
is not allowed". There are no `images.remotePatterns` in next.config at all, so
the optimizer rejects every host — and `Avatar` has an onError fallback to
initials, so the failure renders as a tidy initials circle that looks
deliberate. Users sign in with GitHub, Google, X or OrangeCat; not one of them
has ever seen their own picture, and nothing surfaced it.

Fixed with `unoptimized` rather than an allowlist, matching the decision
already made for essay images in thoughts/[slug] (`unoptimized={src.startsWith
("http")}`). The host set is not ours to enumerate — it grows every time an
identity provider is added, and the breakage is invisible by construction.
These are 32-72px images the optimizer would save nothing on.

TOUCH FLOOR: the offenders the first pass deliberately left.
The theme toggle was the single most common finding in the whole audit — it
sits in the top bar of all 20 authenticated routes, so one missing class name
was 20 pages of report. Its `h-9` is a fixed 36px; min-height still wins,
because min-height constrains the used height whatever `height` asked for.

Also added: the command-palette search, the public marketing nav (its own
namespace, but not its own fingers), `ui-input`, `ui-btn-overlay` and
`ui-locked-banner`. Those last three measured 42px — a near-miss is still a
miss, and "nearly" is not a category the finger recognises.

AUDIT: stop reporting a false positive.
It flagged 13px radio buttons on /control/new-from-scratch. Those radios sit
inside `<label class="ui-card-shell p-3">` — the whole card is the hit area,
comfortably over 44px. The audit measured the control; the finger hits the
label. It now measures the label's box for form controls that have one (a
wrapping `<label>` or a `label[for]`). A report with false positives is a
report people stop reading, which is the failure mode that kills a gate.

Production run after this deploys should be quiet on all four counts.

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

---------

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 21:14:41 +00:00
a041b8be11 fix(a11y): touch floor keys on pointer type, not viewport width (#236)
Found by the audit from the previous commit, across 80 checks:

  all pages @320,390  sessions / theme / push  = 36px
  all pages @768      Expand sidebar=28px  Settings=32px  Sign out=32px

Two causes:

1. The top-bar buttons were a raw inline Tailwind string —
   `inline-flex h-9 w-9 ... rounded-full ...` — repeated across the shell.
   A Layer-4 violation (JSX re-rolling a visual pattern instead of using a
   ui-* class) AND 36px, under the stated 44px minimum. Extracted to
   `.ui-topbar-btn`.

2. `.ui-btn-icon` carried `min-h-11 min-w-11 sm:min-h-0 sm:min-w-0`, so the
   44px floor was dropped at 640px. WIDTH IS THE WRONG PREDICATE: a tablet
   is a touch device, and at 768px it inherited desktop sizing — which is
   exactly where the audit found 28-32px targets. A finger is the same size
   whatever the screen is.

So the floor is now `@media (pointer: coarse)`, applied to ui-btn-icon,
ui-topbar-btn and ui-loki-toolbar-btn together. Desktop keeps its compact
chrome untouched; anything driven by a finger gets 44px.

Also extends the audit itself: all 20 authenticated routes (was 5), plus
clipped-text, buried-under-fixed-chrome, broken-image, console-error and
5xx detection. That widening is what surfaced a React #418 hydration error
on /today at every viewport and 400s on /settings and /thoughts — reported,
not fixed here.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 16:12:27 +00:00
f300e16166 test(responsive): put an actual check behind the "works at 320px+" rule (#234)
* fix(loki): reclaim the 400px of dead width and 398px of dead height

Measured in the live DOM rather than eyeballed:

  ui-loki-main   1072px wide, content 672px  → 400px unused (37%)
  answer bottom  y=356, composer top y=754   → 398px of dead vertical

Two causes, both in the layout primitives:

1. `.ui-loki-stage` was `max-w-2xl` — a flat 672px cap. That is a sane
   reading measure on a laptop and a waste on a 1680px display, on a
   surface that routinely renders lists of projects and goals wanting the
   room. Now steps up: 2xl → lg:3xl → xl:4xl, so line length stays sane
   where the screen is small and the desktop stops being 37% empty.

2. The transcript is `flex-1` (correct — it must own the scroll) while
   its messages stacked from the TOP, so a short answer left the composer
   marooned at the bottom of the pane. An `mt-auto` inner column pushes a
   short transcript down to meet the composer, and is inert once content
   overflows, so long conversations scroll exactly as before.

HONEST LIMIT ON THIS CHANGE: I could not verify it across real viewports.
`resize_window` does not take effect under this window manager
(outerWidth stayed 1680 after resizing to 375px), and the repo's own
headless responsive audit needs a session token that requires the
database, which is firewalled from this sandbox. So the breakpoints above
are reasoned from the CSS and verified at ONE width. The `lg:`/`xl:` steps
only add width on large screens and cannot affect small ones, and
`mt-auto` degrades to today's behaviour the moment content overflows —
both chosen to be safe under exactly that uncertainty, but neither is
proven at 320/375/768 the way it should be.

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

* test(responsive): put an actual check behind the "works at 320px+" rule

CLAUDE.md has stated the rule for months and nothing enforced it on
AUTHENTICATED pages. Every existing check runs either unauthenticated
(smoke) or at a single desktop width (dogfood), so the rule was a promise
and a layout regression on the pages the operator actually uses could
ship green.

It surfaced concretely one commit ago: a Loki layout change shipped
verified at exactly ONE width, because `resize_window` in the interactive
browser does not take effect under a tiling window manager (outerWidth
stayed 1680 after resizing to 375), and the repo's headless tooling needs
a session token that needs a database firewalled to the box. Reasoning
about breakpoints from CSS is not verification.

  scripts/test/responsive-audit.mjs   real viewports (320/390/768/1440) in
                                      headless chromium, authenticated.
                                      FAILS on horizontal overflow and
                                      names the offending element; REPORTS
                                      touch targets under 44px; writes a
                                      screenshot per page/viewport.
  scripts/db-tunnel.sh                SSH tunnel to the box's Postgres,
                                      printing the URL to use through it.

Two decisions worth the words:

- The audit takes AUDIT_DATABASE_URL explicitly instead of reusing
  print-session-token.ts, which resolves a DIRECT box connection from
  .env.hetzner.local — precisely what is unreachable from a sandbox or a
  CI runner. Explicit is what makes this runnable somewhere other than
  the founder's laptop.
- Touch targets warn rather than fail. The 44px rule has legitimate
  exceptions (inline text links), and failing on it would bury the
  overflow signal that actually breaks a phone.

FIRST RUN, 20 checks across 5 pages x 4 viewports:
  ✓ no horizontal overflow anywhere — the 320px rule holds, and the Loki
    layout change from #231 is now actually verified rather than reasoned
  ⚠ touch targets under 44px on every mobile/tablet width, incl. genuinely
    bad ones: /today project links at 16px, /control links at 26px and a
    20px input; global chrome (sessions drawer, theme, push) at 36px;
    sidebar Expand/Settings/Sign out at 28-32px on tablet.

Those warnings are left unfixed here on purpose — this commit is the
instrument, and fixing what it found in the same change would make it
impossible to tell which one this proves.

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

---------

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 15:39:30 +00:00