Clean up code found in the audit

- Replace every em-dash in src and server/src with a colon, comma or hyphen
- Give every relative import its file extension (.jsx imports of .tsx fixed)
- Delete old-historyMock.ts, unused exports, unused CSS utilities, the
  unused @ alias and the fallback option nothing passed
- One copy each of initials, capitalize, byName and the server's marks()
- Move the organization, chapter and event hooks from src/data to src/lib
- Schema sync always throws on a mismatch (strict was never turned off)
- Replace the placeholder README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:02:03 -05:00
parent 4066e9ec61
commit 5274e09571
75 changed files with 282 additions and 688 deletions

View file

@ -24,7 +24,7 @@
import { Hono } from "hono";
import { asBool, loadBlocks, loadFeaturedCards, paragraphs } from "../shape.js";
import { asBool, loadBlocks, marks, loadFeaturedCards, paragraphs } from "../shape.js";
import { readFeeds } from "../feeds.js";
const blog = new Hono();
@ -33,7 +33,6 @@ const CACHE = "public, max-age=60, stale-while-revalidate=300";
const json = (c, body) => c.json(body, 200, { "Cache-Control": CACHE });
const marks = (n) => Array(n).fill("?").join(",");
const PAGE_ID = "community";

View file

@ -1,5 +1,5 @@
/* ═══════════════════════════════════════════════════════════════
CONTENT ROUTES — read-only, mounted under /api
CONTENT ROUTES: read-only, mounted under /api
GET /events list + the event scopes
GET /events/:id one event, full body, people
@ -12,7 +12,7 @@
Organizations are one table, so they're one endpoint. A region
and a chapter differ by a handful of fields, which arrive under
`details` rather than as separate routes — that's what lets a
`details` rather than as separate routes, that's what lets a
list component be written once and pointed at any kind.
The lists leave out unlisted records (is_listed = 0); the
@ -32,7 +32,7 @@
every event.
An event's hosts are a list, in billing order, and each one is
either an organization or a person — `kind` says which, and
either an organization or a person, `kind` says which, and
`org_kind` is there for the three organization routes. The
first is the one the colour and logo fell back to, which is why
order is data and not a display choice.
@ -56,6 +56,7 @@ import {
asBool,
loadBlocks,
loadLinks,
marks,
paragraphs,
shapeSeries,
splitLinks,
@ -72,7 +73,6 @@ const json = (c, body) => c.json(body, 200, { "Cache-Control": CACHE });
const ORG_KINDS = ["national", "region", "chapter", "partner"];
const marks = (n) => Array(n).fill("?").join(",");
/* ── Loaders ───────────────────────────────────────────────── */
@ -83,7 +83,7 @@ const marks = (n) => Array(n).fill("?").join(",");
Unpublished hosts are dropped here rather than in the view: the
admin reads the same view and needs to see them. An event whose
only host is unpublished comes back with an empty list, which is
the right answer — there is nobody to name and nowhere to link. */
the right answer, there is nobody to name and nowhere to link. */
function loadHosts(db, ids) {
const byEvent = new Map();
if (ids.length === 0) return byEvent;
@ -230,8 +230,8 @@ function shapeTeam(row, links, cardBlocks) {
};
}
/* awards.org_id is nullable — an award can predate any decision
about which organization owns it — so `org` genuinely can be
/* awards.org_id is nullable, an award can predate any decision
about which organization owns it, so `org` genuinely can be
null, and is also null when the awarding org is unpublished. */
function shapeAward(row) {
return {
@ -372,7 +372,7 @@ function attachLeadership(db, orgs) {
/* Every team this organization has, including ones with nobody
currently filed under them. `leadership` already carries team_id
and team_name, so the page can group people without this — but
and team_name, so the page can group people without this, but
grouping alone would make an empty team invisible rather than
listed, which is the wrong answer for a team that exists. */
function attachTeams(db, orgs) {

View file

@ -1,5 +1,5 @@
/* ═══════════════════════════════════════════════════════════════
FEEDBACK ROUTE — the only public write on the site
FEEDBACK ROUTE: the only public write on the site
Everything hostile that will ever reach this service arrives
here, so the defences live here rather than being sprinkled
@ -30,7 +30,7 @@ const LIMITS = {
const MIN_MESSAGE = 10;
// Must match FEEDBACK_TYPES in src/pages/sections/FeedbackForm.jsx.
// Anything else falls back to 'general' rather than being rejected —
// Anything else falls back to 'general' rather than being rejected,
// a renamed option shouldn't lose someone's submission.
const TYPES = ["broken", "confusing", "outdated", "request", "praise", "other"];

View file

@ -1,5 +1,5 @@
/* ═══════════════════════════════════════════════════════════════
HISTORY ROUTE — read-only, mounted under /api
HISTORY ROUTE: read-only, mounted under /api
GET /history every published timeline entry
@ -17,7 +17,7 @@
queries doesn't grow with the number of entries.
· precision that outruns the date. An entry can hold '2012' with
precision 'day' — the admin doesn't stop you. Trusting that
precision 'day', the admin doesn't stop you. Trusting that
pair would put the entry in a month node built from a month
that isn't there, so precision is capped at what the string
actually carries.
@ -31,6 +31,7 @@
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
import { marks } from "../shape.js";
const history = new Hono();
@ -38,7 +39,6 @@ const CACHE = "public, max-age=60, stale-while-revalidate=300";
const json = (c, body) => c.json(body, 200, { "Cache-Control": CACHE });
const marks = (n) => Array(n).fill("?").join(",");
/* 'YYYY' → year, 'YYYY-MM' → month, 'YYYY-MM-DD' → day. */
function precisionOfString(date) {
@ -115,7 +115,7 @@ history.get("/history", (c) => {
)
.all();
// How many entries exist but can't be placed. Worth knowing about —
// How many entries exist but can't be placed. Worth knowing about,
// an entry nobody gave a date to is invisible, and silence is how it
// stays that way.
const undated = db
@ -153,7 +153,7 @@ function loadRosters(db, rows) {
const teamIds = [...new Set(teamEntries.map((row) => row.ref_id))];
// v_org_leadership already decides who counts as current and
// public — affiliation still open, marked public, person
// public, affiliation still open, marked public, person
// published. Restating those conditions here is how they drift.
const members = db
.prepare(

View file

@ -1,12 +1,12 @@
/* ═══════════════════════════════════════════════════════════════
PEOPLE ROUTES — read-only, mounted under /api
PEOPLE ROUTES: read-only, mounted under /api
GET /teams/:id/people current public members of a team
GET /people?ids=a,b,c named people, any order
GET /people/:id one person's page
The team route reads v_org_leadership, which already decides who
counts as current and public — affiliation still open, marked
counts as current and public, affiliation still open, marked
public, person published. Restating those conditions here is how
they drift apart.
@ -21,7 +21,7 @@
import { Hono } from "hono";
import { asBool, loadBlocks, loadLinks, paragraphs, splitLinks } from "../shape.js";
import { asBool, loadBlocks, loadLinks, marks, paragraphs, splitLinks } from "../shape.js";
const people = new Hono();
@ -29,7 +29,6 @@ const CACHE = "public, max-age=60, stale-while-revalidate=300";
const json = (c, body) => c.json(body, 200, { "Cache-Control": CACHE });
const marks = (n) => Array(n).fill("?").join(",");
/* How many slugs one request may name. Keeps the URL sane. */
const MAX_IDS = 50;
@ -55,7 +54,7 @@ function shapePerson(row) {
}
/* people.bio is one run of prose with blank lines between
paragraphs — unrelated to shape.js's paragraphs(), which turns
paragraphs, unrelated to shape.js's paragraphs(), which turns
content_block rows into text. */
function splitParagraphs(text) {
if (!text) return null;
@ -144,7 +143,7 @@ people.get("/people", (c) => {
the same visibility rules its own page applies: a role needs a
public affiliation and a published organization, an event must
be published, an award must be published and the citation
public. A hidden team drops its name rather than the role —
public. A hidden team drops its name rather than the role,
the seat is still real, it just has no page to link to.
Roles are current and past. v_org_leadership only knows