Commit Graph
91 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 6ce6ff7832 feat(places): keep place photographs in R2, not Postgres (#605)
place_photo_bytes held 4,234 Wikimedia Commons thumbnails (1.7 GB of a 4.3 GB
database), copied into every nightly backup until the off-site store filled
(2026-11-16). Photographs are files: they belong in object storage.

- photo-keep-r2.ts: an S3/R2 keep, and a layered keep (R2 first; a photograph
  found only in Postgres is copied to R2 on first read; new ones go to R2).
- The place-photo and og routes use placePhotoKeep(): R2 when the four
  PHOTOS_S3_* settings exist, Postgres exactly as before otherwise.
- scripts/places-photos-to-r2.ts (places:photos:to-r2): one-off resumable copy.
- Same S3 client as evig (@aws-sdk/client-s3).

Expand first: the table stays until R2 is verified serving; dropping it is a
later change (a drop in the same deploy blocks later deploys).

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 00:30:03 +01:00
CatoandClaude Opus 5.5 5f27700b14 feat(places): a new country pack takes its country over from the world pack; generated data refreshed monthly (#577)
* fix(law): a recut keeps the mark of a text read by OCR

The weekly recut wrote every cantonal version it examined back with the plain
importer version, so a text read from a scan by OCR (`…+ocr`) lost the mark
that says how it was read, and an older version so marked was examined again
at the head of every run. Any version carrying this reader's version with a
mark (+archive, +ocr, or both) is now current, and a version brought up to
date keeps every mark it had.

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

* feat(places): a pack of its own takes a country over from the world pack

Adding a pack is how a country gets places in depth, and the path had never
run: a new pack's root resolved to the world pack's row, which kept its pack
and path; the new pack's places hung under world/...; and a world file still
stating the country would set the root's level back and give it a parent.

- A pack may `yield` (the world pack does): it holds a place only until a
  pack of the place's own names it.
- Then the place moves: same row (its figures and records stay), new pack and
  path, the new path canonical in place_paths and the old one redirecting, and
  the parents other sources stated for it superseded.
- What the world pack held under a moved place that the batch does not restate
  ends that day; restated later, it moves and is current again.
- A batch of a yielding pack leaves alone a place another pack holds and every
  place it states under one, so a world file not yet regenerated, the
  countries' or the subdivisions', cannot take a country back.
- An integration test adds Quuxland, a made-up country the world pack holds
  first, and checks all of it, rerun-safe on one database.

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

* feat(data): one command refreshes every generated dataset, and a monthly workflow opens the PR

The world's profiles, its countries, every country's subdivisions, the world
list's photographs and the law plan were refreshed only when someone ran three
to five commands on a laptop, in an order nobody wrote down; all were last
read on 2026-11-10.

- `pnpm run data:refresh [--only a,b] [--list]` (scripts/data-refresh.ts)
  runs the generators in the order they build on each other. One that fails
  keeps its old files and is reported; the rest still run. A new generator is
  one entry.
- .github/workflows/data-refresh.yml runs it on the 4th of each month (or on
  dispatch, for some), and opens a pull request when anything changed, as
  bitbaum/substrata's recheck-data.yml does; the sweep merges it on green CI
  and the deploy's places-data job imports it.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 09:27:44 +01:00
CatoandClaude Opus 5.5 266a4d5b68 perf: the World Bank fetched from a runner; statistics in one query; imports and deploys skip what did not change (#576)
* perf(places): place pages kept for an hour; the run log indexed and bounded; a place's country by its ISO code

- A place's country (its profile, budget, photograph and share card) is its
  own ISO 3166-1 code, else its pack's root, else a world nation's slug, never
  the last slug segment: the Djibouti Region (world/djibouti/djibouti), the
  City of San Marino and the US state of Georgia showed a country's page.
- /places/[...slug] is ISR for an hour with nothing built ahead, instead of
  force-dynamic: its queries run about once an hour per place and language.
- place_import_runs gets indexes on (source_key, started_at) and (status,
  finished_at); sourceRuns is one DISTINCT ON query, read once per call and
  passed to the worker.
- Runs a stopped process left `running` are closed as failed after two worker
  budgets, so they are reported once and backed off.
- The worker starts on a day with nothing due as well, for the daily rebuild
  of the ancestors view.
- verify runs places:world-countries --check, now comparing the countries the
  file holds rather than CLDR's names; geography:world writes its registry as
  Prettier formats it. The engineering audit's claim that both were checked is
  corrected.

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

* feat(places): a source a publisher refuses to the box is fetched daily from a runner

The World Bank's API answers the box HTTP 403 (2026-11-10), and its source is
the only one for eight statistics in about 210 countries: none had ever loaded
in production, and the box's queue failed it and alerted every cycle.

- A source may say `fetchFrom: "runner"`. The box's worker leaves it out of
  its queue; `pnpm run places:queue --from runner` drains it, with the same
  cadence, retries and run log.
- places-load-cloud.yml runs that daily (and on dispatch with kind=queue),
  through its SSH tunnel to the production database, copying the snapshots
  back to the box as it already did for hand-dispatched loads.
- The World Bank's source is the one runner source; a test fails if another
  side gets it.

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

* refactor(statistics): a governance indicator is five lines; shared scopes and sentence()

- statistic-templates.ts holds sentence() (moved from the budgets' metrics),
  the scope of general government at every level and the scope of a
  perception score, and wgiMetric({ key, code, name }).
- The six Worldwide Governance Indicators are written with wgiMetric: 204
  lines become 66, and the generated metrics were checked identical to the
  hand-written ones, word for word in every language.
- Government consumption and tax revenue share one scope sentence instead of
  two copies.

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

* perf(statistics): every statistic in one query; a new statistic adds no queries

- loadSeriesFor(db, config, keys, locale, { latestOnly }) reads any number of
  metrics in one facts query and names their places once. latestOnly keeps
  each place's latest value within the metric's plausible band, as a chart's
  screening leaves it.
- /statistics: 4 queries instead of 136 (34 statistics x loadSeries +
  placeLabels); 104-131 ms instead of 325-548 ms on a database holding the
  live OECD, Eurostat and World Bank figures. Checked identical to the old
  per-metric query for all 34 statistics (2,403 series), and latest-only
  identical to the screened full series.
- The dimension, event, compare and saved-view pages load their metrics in
  one call each.
- placeLabels groups names and codes once instead of filtering every row per
  place, and builds one Intl.DisplayNames for the list.
- facts gets a partial index on (metric_key, jurisdiction_id, valid_from DESC)
  for current, unvaried figures.

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

* perf(ci): a deploy that touched no Places data clones, installs and reads nothing

places-data.yml ran after every deploy: a full clone and pnpm install on the
memory-tight box, a runner install, and 798 image requests through the live
site, though most deploys change no Places data and no photograph.

- A first job diffs the deployed commit against the one this workflow last
  loaded successfully (a failed load is retried by the next deploy; a
  dispatch, perhaps a dry run, does not count). The import runs when Places
  data, its config, adapters or importer changed; the photo warm-up when
  photos.json or the photo code changed. A dispatch runs both.
- The box fetches the deployed commit at depth 1 instead of cloning the
  repository's history.

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

* perf(places): an old /places/<slug> link is redirected after a two-query lookup

It ran the full place-page load (about 17 queries) only to learn whether the
world pack holds the place. Links no longer point there (#572); the redirect
stays for old ones.

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

* perf(law): a register import reads only its own register, and stops when nothing changed

About 34 register imports run every week. Each made one query per law
authority (311, one after another) and read every current act, title, number
and page in the law database, however small its register; and
missingFromSource counted every act sharing the identity scheme, so it was
wrong for every publisher_ref register.

- A retrieval whose acts, as read, are those the register last applied is
  recorded as applied and `unchanged` and goes no further. The recorded
  importer version carries a hash of the rows read, so the same bytes read by
  a changed reader are applied again.
- The authorities the retrieval names are resolved to places in one query.
- Known acts are read for the identities the retrieval lists, a thousand at
  a time, with their titles, numbers and pages for those acts only.
- missingFromSource counts only the identities this register itself stated.

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

* fix(law): the weekly sync waits for a heavy load; verify reads a sample, a second apart

- law-sync.yml took /tmp/solon-law-load.lock while a heavy load dispatched by
  hand (law-text.yml) takes /tmp/solon-law-load-heavy.lock, so the two never
  excluded each other, the pairing that ran the box out of memory on
  2026-11-08. The sync now takes the heavy lock, and after two hours' wait
  leaves that week's sync be, saying so.
- `law:text verify` read its sample size from --limit, which the workflow
  passes every source (1,500 by default): a dispatch read 1,500 publisher
  pages back to back. It reads --sample (30 by default) and pauses a second
  between reads.

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

* fix(law): an act held in two languages is listed once, titled in the reader's language

recentChanges joined every current title to every current version, so an act
held in German and French appeared up to four times in a place's recent
changes (with repeated React keys), and a constitution's title on the
profile card came out in whichever language the database returned first.

- actTitleSql (src/lib/law/act-title.ts): an act's current title in the
  reader's language, else its first other language, as one value.
- recentChanges takes the reader's language and keeps one row an act, its
  latest current version; the profile's constitution lookup uses the same
  title rule.
- An integration test holds one act in two languages.

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

* refactor(generators): one polite Wikidata client; scratch scripts removed

world-profiles, places-photos and law-plan each carried their own SPARQL
helper: world-profiles retried any error four times (a 400 included), law-plan
did not retry at all, and each sent its own user agent. They use the shared
client (src/lib/wikidata/query.ts), which waits as long as the server asks on
a 429 or 503 and fails at once on anything else. law-plan now checks that
Constitute's index answered before reading it. scripts/_ws.ts and _ws2.ts,
committed scratch files, are deleted.

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

* refactor(statistics): one rule a unit, so a statistic in a new unit is a line in units.ts

What a unit means was decided in six places: the chart scale (present.ts),
the label (shared.ts), the brief's value text and points (brief.ts), the
profile figure's format (place-figures.tsx), the axis panel's percent sign
and the divisor a published percentage is stored with (sources.ts). A
statistic in a count or a currency would have been shown with no unit, or
scaled wrong, in some of them.

src/lib/config/places/units.ts holds, per unit, its scale and decimals,
whether publishers print it in per cent, whether it is a percentage, and the
key of its words under Statistics.units; every site reads it. A test fails
when a unit's words are missing in a language. Nothing shown changes.

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

* perf(law): a place's page counts its own authorities' acts, not the whole register's

loadPlaceLaw ran loadLawCoverage, three aggregates over every act and version
in the law database, to show the counts of a handful of authorities: the
place's chain and the parts of its nearest. loadLawCoverage takes an optional
list of authorities and counts only theirs; a place's page passes the ones it
shows. Checked against a database of 9,119 acts in 14 authorities: the counts
of all 132 shown authorities are the same as before. The pages that show the
whole register still count it all.

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

* fix: findings of an adversarial review of this stack

- Place pages are rendered on every visit again: ISR made Next keep every
  rendered URL on the server's disk (a few thousand places in five languages,
  and any made-up path besides, with no bound), and kept a not-found path as
  not found for an hour. A view's cost is cut where it is spent instead.
- A failed source retried by a once-a-day queue (the runner's) waited a full
  24 hours from the failed run's start, so the next day's run, starting a few
  minutes earlier, missed it: retries allow two hours' slack.
- Abandoned runs are closed after eight hours, longer than any import runs
  from the box or a runner (a workflow job stops at six), instead of after
  two worker budgets.
- One concurrency group for every cloud load, so the daily queue and a fetch
  dispatched by hand never write the same source at once.
- The saved-axis page scores, as the index does, on each place's latest
  plausible value; loadSeriesFor dedupes its keys.
- places-data runs the import weekly whatever changed, for a file applied
  while some of its places were not held (`+partial`) or one whose import
  failed.
- An unchanged register import still reports what the register no longer
  lists.
- The shared Wikidata client retries 500, 502 and 504 too, as world-profiles
  did; a bad query still fails at once.
- The weekly law sync waits 45 minutes for the heavy lock, not two hours.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 09:11:31 +01:00
CatoandClaude Opus 5.5 b261787c2d fix(person-seat): decide on fresh person tags; one key is one seat in every encoding (#574)
* fix(membership): one key cannot hold a second seat under its uncompressed address

verifyMessage named only the addresses of the serialization the header
chose. The header's compression flag is not signed, so the holder of a key
seated under its compressed address could lower the header by 4 and claim
the uncompressed P2PKH address with the same r||s. keyAddresses now always
holds every standard address of the recovered point: P2PKH of the
uncompressed key, and P2PKH, P2WPKH and P2SH-P2WPKH of the compressed key.
Validity stays tied to the claimed address and the header.

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

* fix(person-seat): decide on fresh person tags; a stored tag is only a cache

After an OrangeCat identity is handed over its tag changes, so the tag
Solon stored at admission was wrong both ways: the former holder was
refused (and the operator told the two were once linked), and the new
holder could take a second seat.

- personTagsFor asks OrangeCat for many accounts in one request (chunked
  at 100); personTagFor uses it.
- No OrangeCat client configured is now "could not ask", not "cannot be
  told apart", so add-member refuses instead of seating unchecked and the
  backfill exits 1.
- seatHeldByPerson asks for the candidate and every non-retired human seat
  at once, decides on those answers only, and rewrites stored tags that
  changed (null for one OrangeCat now leaves out). planPersonTags never
  writes one tag to two seats; a clash between existing seats is reported
  instead of thrown, and add-member prints it.
- backfill-person-tags asks once per organization per 100 seats, has a
  --refresh mode, and its dry run finds clashes between untagged seats.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:37:28 +01:00
CatoandClaude 53d8edc79d perf(places): an import skips what it already applied; the ancestors view is rebuilt only when a place moved (#571)
- A retrieval whose bytes the source last applied, read by the same importer,
  is recorded as an applied run marked unchanged and goes no further. The
  importer version now carries a hash of the source's options and packs
  (applied.ts, importerVersion), so a changed option reads the same bytes
  again; the repo-file importer uses the same string.
- Adapters say how retrievals compare: independentRetrievals (World Bank,
  OECD, Eurostat: one part each) against their own address; any other
  against the source's latest reading, so an earlier edition re-applies;
  publishesFiles (boundaries) always read again. The snapshot is kept either
  way.
- place_ancestors is rebuilt only when places or part_of relations changed
  (a non-concurrent refresh locks it against page reads), and once a day by
  the queue worker for relations whose validity starts or ends later.
- Facts are compared only for the metrics a batch states, and superseded and
  inserted a thousand rows a statement instead of one.

Measured locally on a fresh database: an unchanged file now takes about a
second (process start); the 4,759 subdivisions import in 7 s (was 10).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 07:29:47 +01:00
CatoandClaude 3cb4b06b80 feat(places): the places inside every country, from Wikidata's ISO 3166-2 codes (#570)
- scripts/places-world-subdivisions.ts writes data/places/world/subdivisions.json:
  every item with an ISO 3166-2 code (P300, statement neither ended nor
  deprecated, item not dissolved) in every country no pack holds, named in
  five languages, with its item number. 4,759 places in 194 countries.
- Each sits under its nearest coded ancestor by P131+ (a department in its
  region), else under its country (src/lib/places/nesting.ts, pure, tested):
  two equally near ancestors that do not lie in each other (Brcko District)
  mean the place lies in both, so it sits under what they share. The world
  pack gains three tiers below a country.
- Neutral by the world list's rule: an item that is itself a world entry, and
  the codes in SUBDIVISIONS_WITH_OWN_PAGE (Taiwan, Abkhazia, Transnistria,
  Kosovo), keep their own pages and are not listed inside a claimant.
- The world-subdivisions source imports it after the deploy, like every file
  under data/places. Ten seconds locally.
- The importer inserts identifiers, names, relations and instruments a
  thousand rows a statement: five thousand places passed Postgres's 65,535
  parameters in one.
- One Wikidata helper (src/lib/wikidata/query.ts) for scripts.
- A banner photo fills a tile at full width, not enlarged from 960 into a
  blur; a place's line no longer names the world.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 07:16:16 +01:00
CatoandClaude 1b5e007b23 feat(membership): one person, one human seat per organization (#565)
A person on OrangeCat can hold several identities, each its own account
with its own actor id. A seat goes to an account, so one person could hold
several seats in the same organization, one per identity.

Solon now asks OrangeCat for a person tag per account (orangecat ADR-0014
D7): two accounts carry the same tag exactly when one person holds both.
The tag is keyed per client and per scope, and Solon's scope is the
organization, so it says nothing about who the person is or about their
seats elsewhere.

- members.person_tag, and a unique index on (organization, person_tag) for
  human seats that are not retired. A suspended seat still counts: a
  suspension is not dodged by being seated under another identity.
- seatHeldByPerson is what an admission asks before giving a seat. Three
  answers: may be seated (with the tag to store), already seated (naming
  the seat), or OrangeCat could not be asked, which is not a 'no' and not
  a licence to seat either.
- The founding seat and an organization's founder are tagged as created.
  No clash is possible there (nobody else is on the human roster), so the
  seat never waits on another service; a missed tag is picked up by
  scripts/backfill-person-tags.ts.
- scripts/add-member.ts checks before seating an --oc-actor, and refuses
  when it cannot ask unless --skip-person-check is passed.
- 0034 also carries a snapshot correction: 0033 added
  legal_provisions.heading_path by hand without recording it.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:39:10 +01:00
Cato dc7d4bb6ec law text: order-aware verify for PDF acts; keep the text before a PDF act's first article (#561)
- verify reads PDF versions too (any authority): the text layer is read again, cut the way the
  reader cuts it (repeated header/footer lines, page numbers, split words), and compared in
  order. A scanned PDF is reported as not compared. A short title block at the start is
  reported as such, never as word for word.
- parseCantonalProvisions keeps what comes before the first article when it is more than a
  title (enacting formula, legal basis), not only when the first heading is a later number.

Claude-Session: https://claude.ai/code/session_019MDtmt65Ai8jku68kDmxUU
2026-11-11 22:26:56 +01:00
Cato 933d8a7f78 law text: chapter headings held on the provisions under them; verify compares in order (#558)
- Provision.headingPath (jsonb heading_path, migration 0033, additive): tit1/tit2/tit3 of a
  gesetze.li page are attached to the articles under them, shown above the first one, and
  counted by law:text verify. A heading is still not a provision.
- verify: a gazette masthead table is page furniture (FURNITURE_TABLES), footnote marks and
  inline tags (CO<sub>2</sub>) are read as the reader reads them.
- verify: a sequence score (Myers diff over words) and the longest missing run next to the
  bag score; an act is word-for-word only when every page word is held in the page's order.

Fixtures: Kundmachung 2022308000, AIFMV and Waffengesetz excerpts.

Claude-Session: https://claude.ai/code/session_019MDtmt65Ai8jku68kDmxUU
2026-11-11 20:22:37 +01:00
Cato 9b874277fe Gaps: a proposal on a topic and on a coverage line, and a registry of responsible offices checked by statistics:verify (#549)
A proposal is Solon's own statement of what collecting a measure would take, signed as such. An office is an institution's own channel (a page, a general e-mail or telephone, a postal address), never a person; each e-mail or telephone must be among the words its cited page is expected to hold, and statistics:verify reads the page again. A coverage line names its office, which must belong to the same place. Statistics Denmark is the first office, read from its contact page; the crime-by-background topic carries a proposal drawn from its own purposes, cautions and companions.
2026-11-11 17:58:32 +01:00
CatoandClaude d874861492 feat(snapshots): source snapshots are kept gzipped on disk (#535)
The snapshot store held 17 GB on 2026-11-11, on a disk every site on the
box shares and that had reached 89%. Almost all of it is law text and
register pages: XML, HTML and JSON.

- FileSnapshotStore writes <sha256>.gz and hands back the same bytes; the
  key is unchanged, and a snapshot written before this is still read
- snapshots:compress converts the existing files one at a time: compressed
  aside, read back and checked against the sha256 in its name, renamed, and
  only then is the plain copy removed. A file whose bytes do not match its
  name is left alone and reported
- snapshots-compress.yml runs it on the box at lowest priority; it refuses
  to write unless the live app's release receipt is on code that reads a
  compressed snapshot. Dry run by default
- geometry files are served to browsers as they are and are not touched


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-11 13:32:54 +01:00
CatoandClaude bb6fbffa2c feat(places): one page shape for every place, photographs for every subdivision, served by Solon (#532)
- The page: a hero with where the place sits, its kind, name, status line,
  headline facts and one main action (its constitution, else its law); below,
  the law and what a resident can do beside the place at a glance, which no
  longer repeats the hero. The same shape with or without a photograph.
- The places inside a place are photo tiles, the world index's tile, when most
  have a photograph. The world index opens on the Earth from Apollo 17 and is
  grouped by kind of place.
- Photographs for 9,296 places: places:photos --all reads every ISO 3166-2
  subdivision, Swiss commune, US state and county Wikidata holds; a Swiss
  canton's FSO number reaches its ISO code through a config crosswalk. Iran,
  Tanzania, Appenzell Ausserrhoden and Jura chosen by hand.
- Solon serves the photographs itself (/api/place-photo, place_photo_bytes):
  each Commons thumbnail read once, politely, kept across deploys. About one in
  sixteen tiles came up black when the image optimiser hit Wikimedia's limits.
  The places-data workflow reads the world list's photographs after a deploy.
- /credits pages through the place photographs.
- Fixed: the chat's "Thought for {time}" label threw a formatting error in
  every language.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 21:55:46 +01:00
CatoandClaude 8c27ece452 feat(places): every place opens on its photograph, and shares with it (#531)
- places:photos finds any place on Wikidata by its world entry or by an
  identifier whose scheme names a Wikidata property (ISO 3166-1/-2, FSO
  municipality, US FIPS), and chooses one free photograph from Commons:
  the original of its Wikivoyage banner, its image, aerial or night view,
  else a panorama as a strip. A person can replace any choice in one line.
- A full-screen hero on country, territory and subdivision pages: name,
  kind, capital, population, area, and the photo's author and licence.
- A share card for every place (/api/og/place) with its photograph.
- /credits lists every place photograph; the world index is a wall of
  photographs.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 21:12:42 +01:00
CatoandClaude 09b0a02928 feat(world,law): every place's profile, places beyond the UN on the map, more constitutions (#530)
- Kinds of place, by what each does (src/lib/config/world/kinds.ts): UN
  member (un.org's list, with admission), observer, self-governing, territory,
  proclaimed (one stated rule: Wikidata micronation, not dissolved, at least
  30 Wikipedias: Sealand, Liberland, Molossia, ...), special jurisdiction
  (Próspera), project (seasteading). They join the world list with pages,
  law authorities (keyed by slug) and places in the law plan.
- `pnpm run world:profiles` writes every place's facts from Wikidata (CC0)
  and the UN's list: data/world/profiles.json for pages, a small extras.json
  for the map. Area: the preferred figure, else the smallest (Taiwan's
  governed area, not its claim).
- A profile card on every country, territory, self-governing and proclaimed
  place page: its kind in a neutral sentence, capital, population, area,
  languages, currency, government, heads of state and government, UN
  admission or founding, website, the way into its constitution and law,
  and where the facts come from. Wikidata descriptions only for special
  jurisdictions and projects (they can judge: "Scheinstaat").
- The map: "All places" or "Beyond the UN", shading and dots, and a list by
  kind under the switch.
- Constitutions: the owner decided a law's text is never held back for want
  of a recorded copyright provision (LicenseRef-official-law; the country's
  own provision is cited where recorded). The copy reader follows indexes of
  editions (only from a short page, only to the same document), reads a
  constitution split into subpages whole, reads Markdown, cuts more article
  forms (Art. 1º, Article premier, Roman numerals, § only without articles,
  第一条, المادة/الفصل), and stops at a second printing. Liberland's
  constitution from its own repository.
- docs/design/2026-11-world-of-jurisdictions.md; roadmap, changelog.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 20:41:45 +01:00
CatoandClaude 68759b9847 feat(law): a plan for every country's law, and Russia's and Ukraine's constitutions (#529)
- A law authority for every country of the world list: listed ones keep
  their key; any other is its alpha-2 code, or alpha-3 where a canton holds
  the two letters (fra, geo, bel).
- The plan as data (data/law/plan.json, src/lib/law/plan): per country,
  the constitution in force by Constitute's index, candidate copies from
  Wikidata, the source chosen by an unambiguous rule or by a person with a
  reason, the provision of its own law that puts official texts outside
  copyright, the national readers. `pnpm run law:plan seed` re-reads the
  sources and keeps every person's decision; `pnpm run law:plan status`
  counts progress from the database and derives each country's next step.
- One reader for any country's constitution (law:text plan-constitutions):
  a Wikisource page through the REST API or any document copy (PDF/HTML),
  cut into articles for many languages, stored as status `copy` with who
  keeps it and the day read. Refused: no copyright basis recorded, too few
  articles, or a copy naming no year since the last recorded amendment. A
  copy attaches to the constitution a register already lists; a country
  whose constitution is held from its publisher is left alone. Waits as
  long as a 429 asks.
- Russia's Constitution (ru.wikisource, as amended in 2020: 137 articles
  and the five inserted) and Ukraine's (the Constitutional Court's copy,
  with the 2016 and 2019 amendments; uk.wikisource's was refused as older),
  with their routes: Russia Art. 134-136; Ukraine Art. 93, 154-157 and the
  people's referendum (Art. 72, 74). Licences: Russia Civil Code Art.
  1259(6), Ukraine Law No. 2811-IX Art. 8(1)(3).
- The act page says whose copy a text is. Law sync runs Russia's register
  and the plan's constitutions weekly.
- statistics sync test writes the metric it names, instead of relying on
  another file having done so first.
- docs/design/2026-11-law-of-every-country.md; roadmap, changelog.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 20:11:43 +01:00
CatoandClaude Opus 5.5 2829402aa0 feat(law,amend,contested): propose in Russian, Russia's register and routes, a pseudonym per proposal (#528)
* feat(contested,amend): a South Ossetian reader can propose a change in Russian

- Amend pages (write a change, support it, the official route) translated
  into Russian, French and Italian; AMEND_LOCALES now holds every language.
- "Propose terms" on a contested place led to the primary organization's
  form ("you are not a member of OrangeCat"). It now opens each side's law
  to pick the article, where amendments are filed and supported.
- The claimant's quotes, published only in English, read in the reader's
  language from the config catalog; their labels too. The coverage test
  holds them to every language.
- Roadmap: a scenario side (as a subject of the Russian Federation), "my
  life under each", Georgia's budget.

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

* feat(law,amend): Russia's register, its official routes, and a pseudonym per proposal

- Pseudonyms: a signed-in person is named in the public amendment record by
  anon:<HMAC(key, proposal, account)>, never actor:<id>, so their proposals
  cannot be linked to each other or to them. Rows written earlier keep their
  name and are recognised as the same person. The filing rate limit moves
  into the process, so no lasting list of who filed is kept to count it.
  SOLON_PSEUDONYM_SECRET (falls back to the session secret).
- Russia: one reader over the official publication portal's JSON API
  (PRAVO_GOV_RU), one entry per authority: federal Constitution, laws on its
  amendment, federal constitutional and federal laws (8,012 acts), and North
  Ossetia–Alania's constitutional laws and laws (1,095). The portal's
  robots.txt disallows /File, where the scanned texts are, so the register
  only. Laws are not objects of copyright (Civil Code Art. 1259(6)).
- Routes: federal bills (Constitution Art. 104, citizens hold no initiative)
  and the Russian Public Initiative, federal and regional bars, each from the
  page opened; in Russian. An act page shows its official routes whether or
  not Solon holds its text.
- Authorities may carry their own names per language (North Ossetia–Alania).
- docs/research/2026-11-russia-sources.md; roadmap and changelog.

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

* test(law): count only this file's acts in the South Ossetian dry-run check

Another integration file registers the Parliament's acts at the same time,
so counting every parliamentrso act raced it (CI: expected 8 to be 5).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 19:34:05 +01:00
CatoandClaude Opus 5.5 d3cd864ca5 feat(i18n,money): every page in the reader's language and one currency (#527)
* feat: one currency and one language for the reader; codes read from their Word files

Money: every amount on the budget and comparison pages is in the currency
the reader picks (?in=, CHF by default), converted at the budget year's
average rate, and the page says from what and whose rate. Rates are data
(data/money/rates.json, pnpm run money:rates): Eurostat's annual euro rates
for 151 currencies and, for the rouble after 2021, the Bank of Russia's
official rate averaged over the year. src/lib/money imports nothing from
Solon, ready to become the fleet's package. Eurostat budgets are now also
read in million euro beside the shares of GDP (generated from the same
taxonomies); a budget knows its GDP, so both show.

Language: a law in another language reads in the reader's, as a machine
translation labelled as one with the authentic text a click away. The
translations are a cache keyed by the sha256 of the words (text_translations,
migration 0030), each answer checked before it is kept (one per passage,
every number kept, no passage ballooned); titles in lists use it too, and
pnpm run law:translate fills titles ahead of readers. Places are named in
the reader's language when the data has the name (Tskhinval, not город
Цхинвал), their own names still listed.

Texts: a South Ossetian code printed as a page linking Word files is read
from the file worded as its text (never the contents file), with
word-extractor; --stubs reads again the acts held only as such a page.

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

* feat(i18n,money): every page in the reader's language and one currency

- Money defaults to US dollars; the reader's choice is remembered site-wide
  in a cookie (/api/preferences/currency) and used by budgets, contested
  places and the structures comparison, which now adds the reader's
  equivalent beside an amount quoted in its own currency.
- Configured words (statistics scales, tax forms, budget lines and their
  COFOG/ESA labels, source attributions, publishers) get their other
  languages from one catalog, data/i18n/config.json, keyed by the English.
  localized() and cite() read it; a test fails while any text a translated
  page shows lacks a language; pnpm run i18n:config reports gaps.
- Citations rewritten in English instead of mixed Russian/English; source
  lists show the localized attribution; budget document captions read in
  the reader's language with the original quoted below.
- The voting method lab and South Ossetia's legislative route translated.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 17:28:03 +01:00
CatoandClaude a25b15a4a5 feat: one currency and one language for the reader; codes read from their Word files (#526)
Money: every amount on the budget and comparison pages is in the currency
the reader picks (?in=, CHF by default), converted at the budget year's
average rate, and the page says from what and whose rate. Rates are data
(data/money/rates.json, pnpm run money:rates): Eurostat's annual euro rates
for 151 currencies and, for the rouble after 2021, the Bank of Russia's
official rate averaged over the year. src/lib/money imports nothing from
Solon, ready to become the fleet's package. Eurostat budgets are now also
read in million euro beside the shares of GDP (generated from the same
taxonomies); a budget knows its GDP, so both show.

Language: a law in another language reads in the reader's, as a machine
translation labelled as one with the authentic text a click away. The
translations are a cache keyed by the sha256 of the words (text_translations,
migration 0030), each answer checked before it is kept (one per passage,
every number kept, no passage ballooned); titles in lists use it too, and
pnpm run law:translate fills titles ahead of readers. Places are named in
the reader's language when the data has the name (Tskhinval, not город
Цхинвал), their own names still listed.

Texts: a South Ossetian code printed as a page linking Word files is read
from the file worded as its text (never the contents file), with
word-extractor; --stubs reads again the acts held only as such a page.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 15:34:48 +01:00
CatoandClaude 32e7f6cb28 feat(budgets): public budgets as a product, on one model for every place (#525)
Budgets become their own section, /budgets and /budgets/<place>, built so
that every page and analysis works for any place and any source:

- Taxonomies are the single source (src/lib/config/budgets): COFOG for
  what money is spent on (80 codes, Eurostat's labels), ESA 2010 for where
  it comes from. They generate the budget.<scope>.<side>.<code> metrics and
  the per-country Eurostat sources; scope (general government or a state
  budget) is part of every key.
- Eurostat's government finance for 30 countries from 1995, through a new
  eurostat_json adapter (a JSON-stat reader that knows no country): spending
  by function and group, revenue by kind, the balance, in shares of GDP.
  Every division is also a statistic with its map and ranking. Reuse is
  authorised with acknowledgement (LicenseRef-eurostat-reuse).
- Budget laws are documents held to their stated totals: South Ossetia's
  2023 outturn (revenue line by line) and 2023 allocations by section, each
  line placed on the classifications, the placement explained.
- src/lib/budgets: one Budget shape for both inputs; pure analysis
  (breakdown with what the parts leave over, allowing for rounding; a total
  given with no breakdown; self-reliance; history; which year to show).
- Pages: key figures, who pays, spending by function opened into groups,
  revenue by kind, the years, sources down to the publisher's own lines,
  "propose a change to this budget"; a budget card on a country's page.
- The contested places' budget section now uses these components; their
  ledger, the quote component and rowsOf were made shared rather than kept
  as copies, and SITE_URL lives in site-config.

Design: docs/design/2026-11-budgets.md.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 15:04:10 +01:00
CatoandClaude 7fc644dbb1 feat(places): contested law, one place's two sets of law side by side (#520)
Every place the world list marks as claimed (South Ossetia, Abkhazia,
Transnistria, Northern Cyprus, Somaliland, Kosovo) gets a comparison page at
/places/contested/<slug>: the same questions for every place, each side's own
words quoted in their language beside a translation, with the page and the day
read; a side with nothing read shows the gap. South Ossetia and Georgia are
compared from their constitutions on four questions (territory, citizenship,
moving and leaving, defence). /places/contested lists them all.

- Config: src/lib/config/places/contested.ts (topics in five languages, the
  contest, the quotes); schema and checks in src/lib/places/contested.ts;
  the pure view in src/lib/places/contest-view.ts.
- Every page of a claimed place says who claims it and links the comparison,
  which also restores the line the South Ossetia pack page lost when the world
  slug began redirecting to the pack.
- statistics:verify re-reads every quoted page weekly.
- Design: docs/design/2026-11-contested-law.md (why, as a system: rule sets
  competing for the same people, results per side, terms proposed with support
  counted per electorate; the plan for shared-area and layered disputes).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 14:02:51 +01:00
CatoandClaude 2dd925e9f4 refactor(brand): the owl comes from @bitbaum/design-tokens/marks (#509)
Solon's mark now lives where the fleet's marks live (design-tokens 1.6.1,
`marks/solon.mjs`), the same data OrangeCat's tiles draw. mark.ts reads it
from the package, the icons and exports are written from it with the
package's own helpers (so Solon's icon has the fleet's proportions), and
brand/solon-mark.svg is gone. The test fails if an icon drifts from the
package or a drawing of its own reappears.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 12:21:35 +01:00
Cato 39ddbf253f South Ossetia: text reader for the President's decrees (and the Parliament's, held back) (#500)
* South Ossetia: text reader (L1) for the Parliament's acts and the President's decrees

A node page or post cut into preamble, chapters and articles, dated by the
Parliament's own date field or the decree's closing lines, numbered from the
header or closing lines when it prints one (act_number, <year>/<number>).
Commands law:text parliamentrso-text|presidentruo-text, paced by the site's
crawl-delay and a second respectively; verify reads only the act's body on a
Drupal page. Fixtures from the live pages, unit and database tests.

* South Ossetia: text reader (L1): the President's decrees stored, the Parliament's refused until its terms are found

A node page or post cut into preamble, chapters and articles, dated by the
Parliament's date field or a decree's closing lines, numbered <year>/<number>
(act_number) when the act prints one. law:text presidentruo-text and
parliamentrso-text, --act to read chosen ids, paced by the site's crawl-delay
and a second. The Parliament's texts are refused while its config says no
terms admit them. verify reads only the act's body on a Drupal page.
2026-11-10 11:32:50 +01:00
Cato ddd4212400 Commune tax surcharges: the latest decision stays in force until the next one; a changed adapter re-imports its files (#496)
The surcharges were imported and attached (Vaduz takes a tax on 2025-06-01) but each ran from
1 January to 1 January of its tax year, so from 1 January 2026 no commune had one: coverage "0 of 11",
Vaduz "no tax of its own". The councils decide the next year's in the autumn.

csv_facts gets an opt-in inForceUntilNext: the latest year of each place's figure has no end date, and
the importer supersedes it with a closed period when the next year arrives. The Liechtenstein
surcharge source sets it.

places:import-files skipped a file whose bytes were unchanged, so an adapter change reached production
only when somebody edited the data. It now also compares the adapter version the importer records
with the current one; csv_facts is version 3.

Claude-Session: https://claude.ai/code/session_019MDtmt65Ai8jku68kDmxUU
2026-11-10 11:28:22 +01:00
CatoandClaude Opus 5.5 7dcbdc2787 Places, statistics, navigation and a new mark: the globe, every country a place, methods, gaps, research with AI, a header that fits, the owl (#458)
* feat(places): a globe that names the world, and zooms where you point

geo-kit 0.4.0 labels; countries, subdivisions (Natural Earth 1:10m) and
every place of 1,000+ people (GeoNames, CC BY 4.0) loaded a country at a
time; blue sea, land on the page surface, light and dark; credit line
names the sources and how to steer.

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

* feat(statistics): how the rankings are made; one country registry

Nine indexes of freedom and governance described the same way, with
quoted licence terms, what is unread, the same critical questions per
kind, and checked AI explanation from what was read. Country codes for
the law globe, statistics map and OECD sources come from one registry
generated from Natural Earth; a test ties every named country to it.

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

* fix(places): calm labels on geo-kit 0.5.0, towns actually drawn, land never drawn as sea

Quiet type hierarchy with room per style; zoom buttons kept clear;
subdivisions and states painted on their own layers; GeoNames towns were
loaded but never added to the labels (a patch had not applied), and the
loaders no longer drop a fetch when the view changes.

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

* feat(places): every country a place; governance scores for all

A world pack of 235 countries generated from the registry, World Bank
indicators for each and OECD tax series for its 38 members, staggered so
no publisher sees a burst; six World Bank governance scores (CC BY 4.0)
on a governance dimension; a rate fixed by law is no longer flagged for
staying put; the importer names itself and paces the OECD.

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

* feat(statistics): deep research with AI over Solon's data and law

A model with read-only tools (catalog, series, dimensions, methods, law,
and the web where configured) gathers numbered sources; the report is
written from them alone and checked: numbers, citations, paragraphs,
verdict words. Failing reports are dropped; sources stay listed.

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

* fix(places): the world pack has one root, so countries are world/<name>

235 nations in one pack each claimed the root path; Andorra became
'world'. A root place (the Earth) now holds them, as other packs hold
their subdivisions.

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

* test(places): the world pack's data has one root

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

* docs(roadmap): second-level subdivisions need a licence read per country

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

* feat(statistics): code compulsory old-age provision for CH and US

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

* fix(places): the OECD answers a plain request, not Node's default

Its gateway returned 500 for accept-language: * and 200 for a plain
language and a data type (found by trying headers one at a time; the
earlier rate-limit explanation was wrong). The importer now sends
accept and accept-language; the 6 s OECD pacing and the five-minute
stagger are gone.

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

* feat(statistics): what is measured, and where it is not

A registry and pages for the places where statistical offices collect and
publish different things: per topic and breakdown, what each office's own
pages say (checked weekly), the law that frames it, where a gap lies, what
must accompany a new measure, the objections with safeguards, who decides.
First topic: crime by a person's background, nine places; descriptive, no
characterisation of offices or people.

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

* feat(site): a header that fits, Find over everything, an engineering audit

Four panels of four or five links (Law, Places, Data, Governance) instead
of 27, a Find palette over pages, statistics, places and laws (Ctrl/Cmd+K
or /), the phone menu as folds. Six import cycles fixed and gated in
verify; docs/design/2026-11-engineering-audit.md records what was measured,
the one-source map and the debt in order.

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

* feat(brand): the owl, and one drawing behind every place the mark appears

Solon's mark is now Athens' little owl (the bird on the coins of Solon's
city) with the fleet's rotorelief rings for eyes: the Cat's sibling, where
the old balance was a line icon from no family.

brand/solon-mark.svg is the only drawing. `pnpm run brand` writes the
mark data (header, footer, share card), the favicon, the app icons and
the deck/press exports from it; a test fails when a copy drifts. The
candidates it was chosen over are in brand/concepts with the reasons.

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

* docs(brand): where the marks should live next, and why a copy remains

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

* test(e2e): follow the curated header and the folded phone menu

The phone menu folds the site by section (only the current one opens), so
the test opens Platform before it looks for Security. The Governance
panel no longer carries the ideas page (the footer does); the panel test
follows Decisions instead.

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

* refactor(law): name an authority by its place, in the reader's language

Law authorities hand-wrote 80 English names ("Confederation", "Zürich")
for places Places already names in every language. Pages now read the
place's own name (loadAuthorityNames, once per request); a country with no
place yet is named by Intl, the cantons together and the European Union
from messages, and two places of one name get their level ("Zürich
(Gemeinde)"). The config's field is now `label`: English, for logs, the
API, llms.txt and prompts only.

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

* feat(brand): one statement of what Solon is, on the card, in search and on the phone

The share card, the meta description and the app manifest each carried
their own line about Solon, and all three still described governance
alone. They now read the home page's hero (Home.hero), in the reader's
language: the card is per locale, set in Inter from the design-tokens
package (Cyrillic included, nothing fetched), with the owl, and sizes its
headline so every language fits on two lines. Meta.description is gone.

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

* fix(brand): the owl favicon is linked, and iOS gets its own icon

The layout's explicit `icons` replaced Next's file convention, so the
generated icon.svg was never linked and only favicon.ico was. Without it,
Next links favicon.ico, icon.svg and apple-icon.png (180, full bleed,
written by `pnpm run brand -- --png` like the others).

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

* Test: the world pack's own root is not a reserved path segment

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 11:11:37 +01:00
Cato 8e7fc9cada South Ossetia: register of acts (L0) from the Parliament's listings and the President's API (#487)
Authority `rso` (place Wikidata Q23427, topLevel: no ISO code, and `so` is
Solothurn's). Two format readers, config-driven: a Drupal taxonomy listing
(Parliament, honours the 90 s crawl-delay) and the WordPress REST API
(President, 1,849 acts with decrees, documents and treaties under one id).
Fixtures from the live pages, unit tests and a database integration test;
commands `law:text parliamentrso|presidentruo` and the two workflows' lists.
Licence entry for the President's site quoting its reuse page.

Claude-Session: https://claude.ai/code/session_019MDtmuWnz7uS87NvSiDSDs
2026-11-10 10:49:12 +01:00
CatoandClaude 7c80eda2a1 law:text verify: decode § and quotation entities; show the raw markup where a long missing run begins (#475)
After the annex fix a sample of 30 Liechtenstein acts held 91.4% of their pages' words (from 66%);
some of what remained was the checker's own: &sect; read as 'sect'. The three lowest pages need
their markup read.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 07:59:52 +01:00
CatoandClaude b857d08d56 Liechtenstein: keep the text outside the articles (promulgations, annexes, lists); recut-lilex; verify leaves footnotes out (#474)
The accuracy check showed 29 of 30 sampled acts below 97% of their pages' words. The cutter
ended each article at the next heading and dropped what sat under a heading of its own: one
annex held 3,225 words of a partner-state list that was not stored.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 07:49:47 +01:00
CatoandClaude 4cb99e3a06 law:text verify: show the long runs of page text the provisions lack, and the page's div classes (#471)
The first sample of 30 Liechtenstein acts held 60% of their pages' words on average; the
lowest were far below, and a number alone does not say which block was not kept.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 07:32:07 +01:00
CatoandClaude 519ad8f389 law:text verify: one line an act and the totals last, since the workflow shows only the end of the output (#470)
Claude-Session: https://claude.ai/code/session_019MDtmsWmge2YFXGRyA2au4

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 07:25:03 +01:00
CatoandClaude b34c4339f4 law:text verify: read a sample of held acts again and say how much of each page the stored text holds (#469)
So 'loaded' can be told from 'correct': a cut-short provision or a skipped article shows
as page words held nowhere.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 07:05:43 +01:00
CatoandClaude 83093c5dbf feat(statistics): screen charts for sense, and explain pages with checked AI (#456)
Figures outside a metric's plausible band are left out and listed; misleading
comparisons carry a warning. Each page's figures become numbered facts; an AI
explanation is written from them only and dropped unless every number and
citation is in them.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-09 11:17:33 +01:00
CatoandClaude Sonnet 5.5 c50c65fffa Statistics: law, practice and outcome as layers, data-integrity plumbing, and the freedom framework (#452)
* feat(statistics): the law beside the numbers — series, law links, timelines, axes, saved views

Implements the roadmap section {#stats} (docs/design/2026-11-freedom-laws-statistics.md):

- Series as facts: a `statistic` block on metrics (definition, publisher,
  series code); World Bank (WDI API) and OECD (SDMX) adapters; five series
  for CH, LI, EE and US, read monthly; a publisher's 5xx is retried twice.
- An append-only `statistic_records` log for law links, events and
  enforcement, written from a curated, source-checked list by
  `statistics:sync` and the daily places cron; three links checked against
  Fedlex and Riigi Teataja.
- /statistics (ranked bars, axes with reader or group weights),
  /statistics/<metric> (line chart, a timeline of linked acts' versions over
  the same years, the law, enforcement, sources), /statistics/view/<sha256>;
  on @bitbaum/chartkit; five languages.
- Saved views under the sha256 of their spec; a proposal that links one
  carries it as evidence (proposal_evidence), attached in the same
  transaction.
- Roadmap and changelog updated; what remains is listed with its reason.

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

* feat(statistics): law event pages, clickable timelines, maps, scatter, parallel coordinates, reader-built axes

- Events: what changed (wording before/after), how it came about, votes with
  party breakdowns, who initiated/sponsored/recommended/opposed, claims and
  critiques kept apart from what happened, each line with the page it was read
  on; five loaded (Estonia 2023, US TCJA 2017, two Swiss firearms ballots,
  Kennesaw 1982). /statistics/event/<slug>, /statistics/events; timeline marks
  open them; the numbers around an event (line cut at the change, peers apart,
  a before/at/after table).
- Numbers that mean the same everywhere: central-government-only series
  retired for all-levels OECD series; a per-statistic scope sentence; central
  share of tax as a decentralisation proxy; SDMX series told apart by `match`.
- A world map per statistic on geo-kit, /statistics/compare scatter, parallel
  coordinates per axis, a reader-built axis kept in the link, saved axes.
- Fetch: four retries with backoff and a pause between a source's requests.
- Tests, roadmap, changelog and design note updated.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-09 09:40:57 +01:00
CatoandClaude Sonnet 5.5 568fc14323 Statistics beside the law: series, law events, timelines, maps, axes and saved views (#441)
* feat(statistics): the law beside the numbers — series, law links, timelines, axes, saved views

Implements the roadmap section {#stats} (docs/design/2026-11-freedom-laws-statistics.md):

- Series as facts: a `statistic` block on metrics (definition, publisher,
  series code); World Bank (WDI API) and OECD (SDMX) adapters; five series
  for CH, LI, EE and US, read monthly; a publisher's 5xx is retried twice.
- An append-only `statistic_records` log for law links, events and
  enforcement, written from a curated, source-checked list by
  `statistics:sync` and the daily places cron; three links checked against
  Fedlex and Riigi Teataja.
- /statistics (ranked bars, axes with reader or group weights),
  /statistics/<metric> (line chart, a timeline of linked acts' versions over
  the same years, the law, enforcement, sources), /statistics/view/<sha256>;
  on @bitbaum/chartkit; five languages.
- Saved views under the sha256 of their spec; a proposal that links one
  carries it as evidence (proposal_evidence), attached in the same
  transaction.
- Roadmap and changelog updated; what remains is listed with its reason.

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

* feat(statistics): law event pages, clickable timelines, maps, scatter, parallel coordinates, reader-built axes

- Events: what changed (wording before/after), how it came about, votes with
  party breakdowns, who initiated/sponsored/recommended/opposed, claims and
  critiques kept apart from what happened, each line with the page it was read
  on; five loaded (Estonia 2023, US TCJA 2017, two Swiss firearms ballots,
  Kennesaw 1982). /statistics/event/<slug>, /statistics/events; timeline marks
  open them; the numbers around an event (line cut at the change, peers apart,
  a before/at/after table).
- Numbers that mean the same everywhere: central-government-only series
  retired for all-levels OECD series; a per-statistic scope sentence; central
  share of tax as a decentralisation proxy; SDMX series told apart by `match`.
- A world map per statistic on geo-kit, /statistics/compare scatter, parallel
  coordinates per axis, a reader-built axis kept in the link, saved axes.
- Fetch: four retries with backoff and a pause between a source's requests.
- Tests, roadmap, changelog and design note updated.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-09 09:15:42 +01:00
CatoandClaude Sonnet 5.5 55ddd4d486 Law: the United Kingdom's Public General Acts and Statutory Instruments from legislation.gov.uk (#440)
* Law: the United Kingdom's Public General Acts and Statutory Instruments from legislation.gov.uk

Authority uk (GB), Open Government Licence v3.0, a feed-and-CLML reader with the
EU reader's shape (safe to rerun, --limit, paced, failure reasons, stop after 20
refusals), CLI source ukleg and recut-ukleg, workflow inputs.

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

* Law (UK): the last feed page is the first that is not full; an act with nothing commenced is not out of force; path kinds in the report

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

* Law (UK): say what a text-less item looks like, why feed entries were left out, and show the first words of a few cuts in a dry run

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

* Law (UK): an item the site holds only as a PDF is not a failure; samples of the cut in a dry run's report

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

* Law (UK): subsection numbers in brackets, as the site prints them

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

* Docs: ROADMAP law-uk (verified live by dry run) and its follow-ups, CHANGELOG entry

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 15:33:03 +01:00
CatoandClaude Sonnet 5.5 290dd04585 Austria's federal law: the authority and a reader for the RIS's consolidated acts (#437)
* Austria's federal law: the authority, and a reader for the RIS's consolidated acts

The authority at (ISO AT, Natural Earth 040), under the European Union as one of its
members, with its aliases and the notice the RIS's CC BY 4.0 terms ask for. A reader
for the consolidated federal acts in force (ris): the register from the OGD-RIS API's
Bundesrecht query (application BrKons), each act once by its Gesetzesnummer with its
Kurztitel and kind, and each act's whole consolidated text from the RIS's page, cut
into its sections, articles and annexes under the RIS's own markers (§ 4, Art. 2 § 4,
Anlage 1), dated by the latest day a section took effect. Safe to stop and rerun, with
a limit, paced, with failure reasons and a stop after 20 refusals in a row; a text is
read again only when the RIS changed the act after it was read.

Tested on real excerpts of the API's documents and of the whole-act page, and on
hand-written approximations where none could be had (marked as such). Not yet
verified against the live API.

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

* ris: the types the live register holds, and a way to read chosen acts

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

* ris: count the register's types by first word, and know more of them

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

* ris: say in the log what the cut made of each page

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

* Austria's federal law: roadmap and changelog

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 15:01:52 +01:00
CatoandClaude d1b06d5c9f Cut 'Article N – Title' headings into articles; re-cut held municipal PDFs (#439)
A commune's regulation whose headings put a dash between the number and the
title (Neuchâtel) was stored as one block. The cutter accepts the dash, and
recut-municipal cuts the held PDFs again from their snapshots.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 14:59:04 +01:00
CatoandClaude Sonnet 5.5 e7a4348495 Law: Germany's federal acts from Gesetze im Internet (#436)
* Law: Germany's federal acts from Gesetze im Internet (reader, register, tests)

Authority `de`, scheme `gii_abbr`, licence LicenseRef-de-official-work (§ 5 UrhG),
globe feature 276. The reader takes gii-toc.xml as the register and each act's
xml.zip as text, cut into paragraphs, articles and annexes; versions are dated by
the day read and stored only when the text changed. CLI source `gii`, workflow
input `acts`, a weekly law-sync step. Fixtures are hand-written approximations
(the portal could not be reached from the sandbox).

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

* Law (Germany): drop the portal's trailing "*)" from titles; dry run shows a glance at each cut

The first live dry run (60 of 6,143 acts, no failures) showed titles ending in the
portal's note mark. The report now also names titles with no kind, acts whose
cut text still holds markup, and unknown abbreviations.

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

* Law (Germany): kinds from the live titles, the act's own note kept, roadmap and changelog

The live dry run showed Abgabenordnung and Gewerbeordnung read as regulations
(a "-ordnung" is a statute or an ordinance, so it is now `other`), the old
spelling Erlaß unmatched, and the BGB's first norm (a note on its title) cut
under an unstable number: it is `vorspann` now.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 14:33:12 +01:00
CatoandClaude Opus 5.5 e06fabb429 Law loads one at a time; EU acts before 2004 cut into articles (#433)
* Law loads one at a time; EU acts before 2004 cut into articles

The first EU production load ran out of memory (exit 137) while New
Hampshire's batch was loading on the same box: law-text runs did not wait
for each other. Both law workflows now take one lock on the box (flock on
/tmp/solon-law-load.lock) before they start, so a second load waits for
the first; the lock goes with the SSH session, so a timed-out run frees it.
GitHub's own concurrency groups would cancel all but one waiting run.

The same load stored most 1995 regulations as one provision: acts published
before EUR-Lex marked anything are plain paragraphs with no class or anchor,
the article numbers each alone in a paragraph. They are now cut on those
paragraphs ("Article 3", "ANNEX II") under the anchors newer acts carry,
with what precedes the first article as the preamble.

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

* EU law: cut the acts already held again, from their snapshots

The 1995 acts already stored as one provision are not fetched again (they
are held). The recut that re-cuts cantonal acts from the bytes they were
read from now takes any reader (source, reader version, cutter), and
`law:text recut-eurlex` re-cuts the EU acts held with the new cutter,
replacing a version's provisions only when it finds more. The EUR-Lex
reader's version goes to law-text-eurlex-2 so every act read before is
re-cut once; a version read from an Internet Archive copy keeps its
"+archive" mark.

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

* Format the EU recut test

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 12:30:40 +01:00
CatoandClaude bfc1385637 European Union law: the layer above its members, and a reader for EUR-Lex (#429)
The European Union is an authority whose law applies in each of its 27
member states (`members` in LAW_AUTHORITIES), the layer above a member's own
law: Estonia's and Luxembourg's place pages, trail, Markdown front matter and
questions include it, the way a canton's include the Confederation. The atlas
draws no shape for it; its law is reached from each member Solon holds.

A reader for the EU's regulations and directives in force (`eurlex`): the
register from Cellar's SPARQL endpoint a year at a time (CELEX number, English
title, entry into force), each act's English text from EUR-Lex HTML, the
latest consolidated version that has begun or else the act as published,
dated by the day the publisher states, cut into preamble, articles and annexes
under EUR-Lex's anchors. Read through the shared polite reader (Internet
Archive fallback), safe to stop and rerun with a limit; a dry run reads and
cuts texts and stores nothing. Reuse under Commission Decision 2011/833/EU,
with its notice on the act page. law-text.yml gains the source and a `year`
input; law-sync.yml reads it weekly.

Neither publisher's host answered the sandbox: the reader is tested against
excerpts in the publishers' shapes, not captures.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 11:11:14 +01:00
CatoandClaude e1476751bf Places: the United States, Wyoming's counties and the 2026 federal income tax (#426)
The pack `united_states` holds nation, state and county. The nation, all
fifty states and the District of Columbia come by state FIPS code from the
Census Bureau's state list (state.txt), each with its ISO 3166-2 code (US-WY),
which is how the law registry keys a state; Wyoming's 23 counties come by
five-digit FIPS code with the names of the Bureau's 2020 county list. The
script scripts/places-us-census.ts writes the batches, so another state's
counties are a rerun with its postal code: data, not code. New identifier
schemes: iso_3166_2, us_state_fips, us_county_fips. New licence:
LicenseRef-us-federal-work (17 U.S.C. § 105).

Boundaries: the same script cuts Wyoming's counties out of us-atlas's
TopoJSON (Census cartographic boundary file, 2017 edition) into a fixture
batch with its geometry, so opening the United States on the atlas draws
them.

Tax: the federal tax for 2026 from Rev. Proc. 2025-32, read on irs.gov:
§ 4.01 Tables 1 (joint) and 3 (single), and § 4.14(1), standard deduction
32,200 and 16,100. The model reads adjusted gross income, so each tariff is
its table moved up by the standard deduction, stating the table's tax at each
step; valid for 2026 only. Wyoming's own income tax is recorded as zero:
W.S. 39-12-101 keeps the field to the state, which levies none (Title 39,
chapter 12, read on wyoleg.gov; LSO, Wyoming Statutory Tax Structure, June
2025: 0 %). A state whose tariff is not recorded leaves the estimate
incomplete.

Switzerland's typo test now holds the order among Swiss places: Vermont and
the United States ("Vereinigte Staaten") now stand before Bern for "vern".

Checked in a production build: Laramie County's page with its chain,
FIPS code and source; Wyoming's with its ISO code and both sources; the
atlas drawing the 23 counties at $7,670 for an example $75,000 (single:
5,800 + 22 % of 8,500), on a desktop and a phone.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 10:40:21 +01:00
CatoandClaude 4e8b2955ec New Hampshire's statutes: a reader for the RSA from the General Court (#424)
Adds the authority us-nh (US-NH, on the globe as states:33, with aliases)
and a reader for the Revised Statutes Annotated as gc.nh.gov publishes
them: the table of titles, each title's chapters as acts ("RSA 39",
publisher_ref gcnh:<chapter>, the merged page as official_url), and each
chapter's merged page cut into sections with heading, text and source
note. Anchors follow the publisher's own section pages (sec_39-3,
sec_5-6-a). Repealed sections stay as the site marks them; a chapter
repealed whole is one provision and is marked out of force.

Paced 11 seconds apart, safe to stop and rerun, and read from the
Internet Archive's dated copy when the site refuses, trying the former
www.gencourt.state.nh.us address when the archive has nothing under the
new one. A firewall's "Web Page Blocked" page now counts as a refusal
for every publisher.

CLI source gcnh, and the law-text workflow's choice. The warrant-article
route (RSA 39:3) waits for a New Hampshire town authority.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-08 10:01:58 +01:00
CatoandClaude cbfcc99dfa Estonia: read acts without sections, say why a load fails, stop when refused (#408)
The first production load stored 4,195 of 9,958 texts and reported 5,763
failures, but the workflow keeps only its last 80 lines, so all but 30
reasons were lost. The same code against the live gazette locally failed
4 of 400: two regulations laid out without sections and two acts that
give two sections one id. The rest of production's failures were
something the log could not show, most likely the publisher refusing the
box after a few thousand requests.

- An act without sections (a regulation of a preamble, points, parts and
  tables) is read as its preamble and its text, in order; the gazette's
  link targets are left out of every text
- Two sections with one id are both kept: the second as `para1-2`
- A failure says the database's own reason, not the statement; the report
  counts failures by reason and stops after 20 refusals in a row, saying
  which; acts are paced at 1.5 s; the command prints 5 sample failures so
  the counts survive the workflow's 80 lines


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-07 19:41:22 +01:00
CatoandClaude adf0aa6785 Estonia's law: every national act in force, from Riigi Teataja (#406)
- A reader for Riigi Teataja, the State Gazette: the register of
  consolidated texts in force from its public search (the same POST its
  own site sends, 30 per page), and each text from the gazette's own
  structured XML, cut into its sections (§) with subsections and points,
  numbered as published, superscripts kept (§ 20¹), amendment notes left
  out; anchored by the gazette's own ids (para4, para20b1)
- An importer like Legilux's: acts of authority `ee` named by the
  gazette's group id, stable across versions; each version dated by the
  day the publisher says it took effect; reruns skip what is held, a
  newer version closes the old one. National acts now, municipalities'
  regulations once they are places
- Authority `ee`, the licence basis (Autoriõiguse seadus § 5 p 1), and
  `xml` as a text format
- `law:text riigiteataja`, the choice in law-text.yml, and a step in the
  weekly law sync
- Run against the live gazette: 9,958 national acts registered, the first
  15 texts stored (1,163 sections), no failures


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-07 16:04:48 +01:00
CatoandClaude e58ec0db75 Load data without anyone remembering to: Places files after each deploy, the law weekly (#404)
Comparing Swiss places gave no tax: every canton's per-head tax, measured
and committed on 2026-10-30, was never loaded into production, so the
estimate (rightly) refused to treat it as zero. The file reached the
repository; the manual "Places load" that would have carried it to the
site was never run. Loaded by hand on 2026-11-07 (587 facts); this makes
the manual step unnecessary.

- src/lib/config/places/repo-files.ts: every file under data/places and
  the source it is a retrieval of, in import order; a test holds every file
  to exactly one row and every row to a real source
- `pnpm run places:import-files`: imports each file whose sha256 differs
  from its source's last applied retrieval; unchanged files are skipped
- places-data.yml: runs it on the box after every successful deploy of main
- law-sync.yml: weekly (Sunday 02:17 UTC) as well as by hand, so every
  publisher, Wyoming included, is read again without anyone running it


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-07 13:57:06 +01:00
CatoandClaude 67f54102ff Wyoming's law: statutes, Constitution and the citizen initiative (#403)
The first place outside Europe (design: docs/design/2026-11-global-law-
and-exit.md, "Beyond Switzerland").

- A reader for the Legislative Service Office's downloads: 45 PDFs, one
  per title, Title 97 the Constitution, cut into sections (15-1-101 …,
  Article 3, Section 52 …). Across all 45 files: 21,461 sections, no
  heading missed, no duplicate anchor, no empty section. Wrapped
  citations ("W.S.\n15-9-134. …"), wrapped headings and structure lines,
  the UCC's lettered articles (34.1-2.A-101) are handled and tested
- An importer like Legilux's: the register (us-wy, one act per title),
  then the text; reruns skip what is held, `--again` stores a new version
  only when a file's bytes changed. Dated by the day read: the publisher
  states its date only on its rendered page
- Authorities `us` and `us-wy`; countryOf reads ISO 3166-2 (US-WY is US);
  the public-domain basis registered as a licence (Georgia v.
  Public.Resource.Org)
- Official routes can state a share-based bar, further requirements and
  limits; Wyoming's citizen initiative from Const. art. 3 § 52, read from
  the official text
- `law:text wyoleg` and the `wyoleg` choice in law-text.yml; the law sync
  reads Wyoming again
- New Hampshire recorded on the roadmap as blocked: the General Court's
  firewall refuses Solon's readers


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-06 20:12:09 +01:00
CatoandClaude Sonnet 5.5 663afd685e feat(law): read the communes' LexWork collections — Zug and Glarus, 14 communes, 1,164 acts with dated versions (#374)
* feat(law): read scanned commune acts by OCR, and never drop text before a late first article

A commune that publishes a scan (pages as pictures, no text layer) failed as
"no text in the PDF": Vaduz 5, Schaan 4, Eschen 2, Schellenberg 2. The
commune loader now draws each page (unpdf + @napi-rs/canvas) and reads it with
tesseract.js in the act's language, in process: nothing to install on the box,
no model called. The version's source says so: law-text-publisher-1+ocr.

Schellenberg's hall regulation numbers sections "1." and "2." before an
"Art. 3"; the cutter kept Art. 3 and dropped the rest. When the first article
found is not article 1, the text before it is now kept as one provision.

Live on schellenberg.li: both scans read (2 of 2), 6 acts, 106 provisions.

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

* fix(law): an act's page address follows the register when the publisher's address changes

An act first listed at a wrong address kept it for ever: the register import
added a page address only for a new act. Schellenberg's 35 acts were first read
without the page's <base href> (fixed in #361) and stayed at /service/files/...,
so the load kept fetching a web page instead of the PDF ("Invalid PDF
structure" x35), and the official page shown to readers was a dead link.

For a known act, a different official_url now supersedes the old one and the
new is current; unchanged is untouched. Reproduced locally with stale
addresses: 35 corrected, 3 acts loaded, 55 provisions.

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

* fix(law): store a PDF's NUL as a space, and find Lilex pages the issue number does not give

Cantonal: a 47-page intercantonal annex (LexFind 24607) failed to insert. Its
PDF holds one NUL where a glyph has no character (a dash between two words),
and Postgres cannot store NUL. cleanPdfText and blockText replace it with a
space, so no reader can hit it.

Lilex: an act's page address came only from its Landesgesetzblatt issue.
- 59 acts had none (Austrian-era decrees, issues like 60/1): the publisher's own
  Gebietssystematik names each page; all 59 resolve (the act's listing, then each
  parent, once per listing).
- The EEA agreement's page is ...001, not ...000; found the same way (the first
  of the rows a treaty is listed under).
- Two acts have no consolidated page at all (a Bekanntmachung of 1941, a 2020
  EEA decision): the gazette entry links a PDF, which is read.
- gesetze.li answers an unknown address with a maintenance notice carrying the
  proof-of-work script; that is now "no page", not a challenge that stops the run.
- refresh reads these the same way, so they stay current.

Live against gesetze.li into a local database: 0.110 (129 provisions), 641.291,
0.110.042.08 (4), 210.109, 210.111, 210.116 all store.

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

* feat(law): read a scanned cantonal document by OCR

LexFind document 13622 (a 881 KB scan, no text layer) failed as "no text in
the document": the cantonal importer had no OCR fallback. It now uses the
shared provisionsOfPdf (the commune loader's), reading German, French and
Italian together because the file's own language is not known. A scanned
version's source carries law-text-cantonal-2+ocr.

On the real scan: scanned, 2 articles (Geltungsdauer und Kuendigung, Aenderung
der Vereinbarung).

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

* docs(law): how Swiss communes publish their law — a survey of the 26 cantons

Five research passes, each reporting only what it opened. No canton hosts its
communes' law centrally except Basel-Stadt (3 communes). Two platforms span many
communes: LexWork (name.tlex.ch, about thirty found) and the i-web.ch CMS (about
fifty estimated). Basel-Landschaft's single CMS is behind a Cloudflare challenge,
reported and not worked around. Lists the order to build in and what is not verified.

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

* feat(law): read the communes' LexWork collections — Zug and Glarus, 14 communes, 1,164 acts with their dated versions

Many communes keep their law in a LexWork (Sitrox) collection at
<commune>.tlex.ch. The app's own JSON interface is open (no login; robots.txt
blocks only the search endpoints), so it is read as data: the list of acts,
each act by systematic number, the day each version took effect (versions are
dated by the publisher), and the article tree. Versions older than the
structured text are held as a PDF and read like any PDF.

- config LEXWORK: the 14 instances verified live (11 Zug communes, 3 Glarus), each
  an authority bfs<number>, within its canton; ACT_TEXT_FORMATS gains json.
- text/lexwork.ts (fetch, dates, versions, article tree), text/import-lexwork.ts.
- law:text lexwork [--host]; Law text load workflow source lexwork.
- Survey doc: the interface is confirmed open.

Live into a local database: Zug 50 versions then 0 failures, Glarus Nord 12 versions /
452 provisions, no failures. Integration test: old version ends the day before the
new one, a second run stores nothing.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 18:52:17 +01:00
CatoandClaude Opus 5.5 7985d5a5bb feat(governance): each organization sets its own humans-only categories (#368)
* feat(governance): each organization sets its own humans-only categories

Which decision categories only people may vote on is now each
organization's own rule, not a platform rule (owner's decision,
2026-11-01).

- organizations.humans_only_categories (text[], not null) defaults to
  exactly the four categories that were hard-coded, so every existing
  and new organization decides as before. A check constraint keeps it
  to real DecisionCategory values. Migration 0019 also adds the
  ELECTORATE_CHANGED audit event type.
- DEFAULT_HUMANS_ONLY_CATEGORIES in config/governance.ts is the one
  default list; CATEGORY_ELECTORATE is gone, DEFAULT_CATEGORY_ELECTORATE
  is derived from the list.
- electorateFor(category, humansOnlyCategories) reads the organization's
  list; openSession passes it and still snapshots the electorate, so no
  past or open vote changes.
- New `humans_only` effect, paired with GOVERNANCE_RULES and applied on
  approval with an ELECTORATE_CHANGED audit event.
- Generic pages describe the default and say each organization can
  change it; the org page, /ecosystem and the proposal form use the
  organization's own list. Home copy updated in all five languages.
- Tests: default equals today's four, empty list opens GOVERNANCE_RULES
  to agents, a larger list blocks agents on the added category, effect
  schema and pairing, and the list changing only by decision.

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

* docs: humans-only categories are each organization's own rule

The owner overrode "red lines, not defaults to tune" on 2026-11-01.
Update .claude/CLAUDE.md, AGENTS.md, README, ROADMAP and the
whitepaper to say the four categories are the default every
organization starts with, changed by a GOVERNANCE_RULES decision.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 10:11:33 +01:00
CatoandClaude 493f1a98e6 feat(law): read the law again every day — what changed, served to every model (#360)
- law-sync.yml: nightly on the box, registers then every text reader, each step continuing past a failure
- law:text refresh: re-read held cantonal and Lilex documents oldest first; same bytes mark checked, changed bytes become a new version (date_basis retrieved); stops at a bot check
- law:text municipal --publisher all
- loadLawChanges + GET /api/v1/law/changes + MCP/chat tool law_changes
- design doc: Staying current


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 06:34:25 +01:00
CatoandClaude Opus 5.5 6b54ea11de feat(law): Luxembourg from Legilux — 1,134 acts and their consolidated text; Schellenberg (#359)
* feat(law): Luxembourg — 1,134 acts in force and their consolidated text, from Legilux

Legilux, the Grand Duchy's official legal database (Ministry of State,
Central Legislation Service), publishes under CC BY 4.0 through a SPARQL
endpoint that speaks JOLux, the ontology Fedlex uses. The reader asks for
every consolidated version Legilux marks `applicable` (one per act, 1,134 on
2026-11-01), registers the acts as the authority `lux` (identifier `lu_eli`),
and stores each version's French HTML cut into its articles under Legilux's
own anchors (`art_710-5`), dated by the day it applies from.

`pnpm run law:text legilux` (and the Law text load workflow, source
`legilux`); resumable, a page asked again on a dropped connection.

So that a French-only act reads everywhere: reading an act, its contents or a
provision prefers the language asked for and falls back to the one held.
So that Luxembourg is not asked about Swiss federal law: the planner adds the
Confederation when a Swiss place is in the question or none is
(`countryOf`, read from config). Tools, MCP instructions and prompts name
Luxembourg.

Loaded live into a fresh database: the 1,134 acts registered, three texts
read and cut, nothing failed.

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

* feat(law): Schellenberg, and naming a commune's act when its link says only "Dokument herunterladen"

Schellenberg's page labels every document "Dokument herunterladen": an act is
now named by the link's title, else by its file's name ("3-1-abwasserreglement.pdf"
→ "Abwasserreglement"); a bare kind ("Reglement") gives way to the file's
fuller name. Hex entities (&#xFC;) are read, and a page that offers the same
act twice under two file names lists it once. Schellenberg: 35 acts, li7008.

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>
2026-11-01 06:15:02 +01:00
CatoandClaude c2faab03ae fix(law): cut cantonal acts into their articles the way the cantons print them, and re-cut what is held (#357)
A sample of 30 in-force acts per authority found many held as one block
("text"): Lucerne 17, Neuchâtel 13, Geneva 10, Schwyz and St. Gallen 6,
Ticino 5 (its tax law, LT 640.100, among them). The cutter missed what the
cantons' PDFs do:
- a paragraph number glued to the text ("Art. 2 1La présente loi");
- a footnote number glued to the article's ("Art. 13" for article 1,
  note 3; "Art. 198328"; "Art. 23)"), read as the shorter number only when
  it is the very next article;
- a numbered title or a sub-letter after the § ("§ 1 1. Gegenstand",
  "§ 4 b) Wirkungsorientierung"), a starred amended article ("Art. 1*");
- "Article premier", "1er", "primo"; "Article"/"Articolo"; any capital (É, À);
- repealed articles printed as one line ("Art. 91-94 …"): the next heading
  may now be up to ten numbers on;
- "Absatz", "alinéa", "capoverso" written out are references, like "Abs.".
On the real texts: Ticino's tax law goes from 1 provision to 300, with
Art. 198 "Dichiarazione d'imposta" and Art. 192 "Termini" where they belong;
Neuchâtel's RELGSU 1 → 26; Schwyz's finance acts 1 → 15, 18 and 65.
One-item decisions ("Ziff. 1") stay whole.

`pnpm run law:text recut [--authority lu]` (and the Law text load workflow,
source `recut`) cuts the held cantonal acts again from their snapshots,
without asking LexFind again; a version's provisions are replaced only when
the new cut finds more, and each version is re-cut once per reader version
(law-text-cantonal-2).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 05:47:45 +01:00