Files
causius/lib/fleet.test.ts
CatoandClaude Opus 5.5 40a5c4b05d Matters, the fleet design system and a technical narrative (#10)
* Matters: encrypted, agentic legal workspace behind OrangeCat sign-in

A matter is sealed per matter (AES-256-GCM data key under CAUSIUS_MASTER_KEY).
The agent works it with tools (search, read, deadlines, tasks, drafts,
approvals); every personal detail is swapped for a placeholder before a model
sees it, and the person's account name is always one of them. The database in
the clear holds no name, message, deadline or document.

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

* Fleet design system, a technical narrative, one account across the fleet, domain checks

- @bitbaum/design-tokens replaces the bespoke paper-and-ink theme; Solon's
  grammar (kicker, headline-caps, btn-frame) for every page, pinned dark.
- New Platform, Security and Ecosystem pages; the home page rebuilt around what
  works today (lib/capabilities.ts is the one place a status is decided).
- Sign-in and sign-up routes hand straight to OrangeCat; the account menu and
  the ecosystem page link the rest of the fleet, read from the fleet map.
- The agent can check domain names with the registries over RDAP.
- The i18n parity test reads ICU properly (select branches, apostrophes).

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

* Provision matters on the host: database, OrangeCat client, runtime env

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 12:23:14 -07:00

86 lines
3.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { pillarsFromMap, presenceFromMap } from "./fleet";
const entry = (over: Record<string, unknown> = {}) => ({
slug: "causius",
name: "Causius",
what: "Understand and answer legal letters",
identity: { problem: "Letters nobody can read", solution: null, mission: " ", vision: 7 },
urls: { live: "https://causius.orangecat.ch", repo: null, orangecat: null, solon: null },
roadmap: [{ title: "Read a letter", status: "in progress", progress: 60, targetDate: null, milestones: [] }],
changelog: [{ date: "2026-10-10", done: "Causius reads a letter." }],
...over,
});
describe("presenceFromMap", () => {
it("is absent, not invented, when the map is unreadable or has no entry", () => {
for (const map of [null, "down", {}, { projects: [] }, { projects: [entry({ slug: "solon" })] }]) {
const p = presenceFromMap(map);
expect(p.development).toBeNull();
expect(p.orangecatUrl).toBeNull();
expect(p.solonUrl).toBeNull();
expect(p.identity.problem).toBeNull();
}
});
it("reads identity, treating blank or mistyped fields as missing", () => {
const p = presenceFromMap({ projects: [entry()] });
expect(p.identity).toEqual({
problem: "Letters nobody can read",
solution: null,
mission: null,
vision: null,
});
expect(p.development?.roadmap).toHaveLength(1);
expect(p.development?.changelog[0].date).toBe("2026-10-10");
});
it("links to OrangeCat and Solon only when the map reports an https profile", () => {
const none = presenceFromMap({ projects: [entry()] });
expect([none.orangecatUrl, none.solonUrl]).toEqual([null, null]);
const both = presenceFromMap({
projects: [
entry({
urls: {
orangecat: "https://orangecat.ch/projects/causius",
solon: "https://solon.orangecat.ch/orgs/causius",
},
}),
],
});
expect(both.orangecatUrl).toBe("https://orangecat.ch/projects/causius");
expect(both.solonUrl).toBe("https://solon.orangecat.ch/orgs/causius");
const hostile = presenceFromMap({
projects: [entry({ urls: { orangecat: "javascript:alert(1)", solon: "http://plain.example" } })],
});
expect([hostile.orangecatUrl, hostile.solonUrl]).toEqual([null, null]);
});
});
describe("pillarsFromMap", () => {
it("joins each pillar to its project, and drops what it cannot vouch for", () => {
const pillars = pillarsFromMap({
pillars: [
{ slug: "orangecat", layer: "economic", role: "Move value." },
{ slug: "loki", layer: "execution", role: "Get the work done." },
{ slug: "ghost", layer: "governance", role: "Not on the map." },
{ slug: "solon", layer: "governance", role: "" },
],
projects: [
entry({ slug: "orangecat", name: "OrangeCat", urls: { live: "https://orangecat.ch" } }),
entry({ slug: "loki", name: "Loki", what: null, urls: { live: "javascript:alert(1)" } }),
entry({ slug: "solon", name: "Solon" }),
],
});
expect(pillars.map((p) => p.slug)).toEqual(["orangecat", "loki"]);
expect(pillars[0]).toMatchObject({ name: "OrangeCat", role: "Move value.", url: "https://orangecat.ch" });
expect(pillars[1].url).toBeNull();
});
it("is empty when the map is unreadable", () => {
for (const map of [null, "down", {}, { pillars: "x" }]) expect(pillarsFromMap(map)).toEqual([]);
});
});