Runbook — Migrating a country’s old institution names onto the org chart
Procedures published years ago name their government bodies as free text: “OBFC”, “One-Stop Business Facilitation Centre”, “Registrar of companies”. This runbook is how a country teaches the platform what each of those old names means. You name the day the old names stop being accepted, take stock of every old name still in use, add any missing bodies to the country’s list of government bodies (the org chart), then record one human decision per old name — which body it means, or that it means no body. A computer suggests matches; a person always decides, and a second person approves every decision. When the last name is decided you republish the affected procedures, and one report proves the migration is done.
Scope: this runbook migrates names, never data. Published procedures are never edited — the translation lives in the alias catalog (the governed list recording which old name means which body) and is applied when the platform reads. Applications already in flight keep routing to the body the old name resolves to, with nothing rewritten.
Who can do this
The org-chart tools — the Studio screens and every /org-chart/* endpoint —
admit exactly the admin and domain_steward roles: this is governance
data, not authoring, and a registrar login is refused (403) there. Steps 4
and 5 are the exception: they run in the editor (the publish readiness
report and Republish), which carries ordinary publish rights and no
admin/steward restriction. Two people are required by design: every decision
is proposed by one and approved by a second (four-eyes).
Step 0 — Name the end date BEFORE anything else
Old names on already-published steps keep working during the migration, with a warning, until the day the country itself names. A warning with no end date reads as advice and gets ignored — so the date comes first.
Edit
deployments/<code>/config.yamland set the end-date field (institution_grandfather_until), as an ISO date:```yaml institution_grandfather_until: 2027-06-30 ``` The named day is included — old names are refused the morning after. The sandbox artifact (`deployments/tst-dep/config.yaml`) carries the same field as the worked example.Commit and redeploy. The one-shot start-up service (
init) re-seeds the deployment’s registry row from this file on every boot, so the date is live after the next deploy.Confirm the countdown is real: open the Registers Studio (
https://studio.<wildcard_base>), switch to the Org chart view, open the Sunset report tab — the first line reads “Legacy names stop being accepted in N days — ”. If it says “The country has not set an end date yet”, the field did not reach the deployment: check the artifact shipped in the image and redeploy.
If the two Studio tabs are missing: the migration tools (“Names that need a home” and “Sunset report”) render behind the build flag
VITE_STUDIO_W2_TOOLS=1. With the flag off the Org chart view shows only the chart. If a tab says “This tool is not offered by the service yet”, the running backend predates the migration endpoints — deploy the current image.
Step 1 — Inventory: what is still riding an old name
In the Studio’s Org chart view, open the Sunset report tab. It shows the countdown, the headline percentage of old names already dealt with, and the names still without a home, each with the procedures still using it.
Export the never-reviewed list for the working sessions that follow. The same data the tab renders, as JSON:
```bash curl -s "https://smartrules.<wildcard_base>/api/worldmodel/v1/org-chart/aliases?status=unresolved" \ -H "Authorization: Bearer $TOKEN" > never-reviewed.json ``` Each entry carries the old name exactly as procedures carry it (`legacy_text`), how many steps ride it (`seen_count`), and ranked suggestions (`suggestions`) — candidates only; no score ever writes a mapping. `last_seen_at` is always null: the source data records no timestamp, and the platform reports null rather than inventing one.
Step 2 — Complete the chart
A mapping can only point at a body that exists on the org chart, so any body an old name refers to that is not on the chart yet gets added first — the same propose-and-approve flow every governed record uses.
- If the Org chart view says the country has no org chart yet, the
on-switch is one setting away: the chart draws from the country’s list
of government bodies once that list is kept as reference data. The
empty state names the list and its button (Open …’s panel) opens
the list’s own panel — tick A list kept by a named steward there
and publish the model. (A country that called its list something else
—
ministry,autorité— is fine: the chart is found by the government-bodies role the list holds, never by its name.) The sunset report and the Studio read this same switch, so they can never disagree about whether a chart exists. - In the Studio’s Org chart view, add the missing body: select where it sits and fill in the inspector — the body’s name, its permanent code, its kind, and the body it sits inside. (The code locks once the body exists; it never encodes where the body sits, so pick a short, meaningless code.)
- Press Propose to the queue in the publish bar at the bottom of the view. The change is a proposal — nothing is live yet.
- A second steward opens the Studio’s Queue view and approves the change. The body is now on the chart.
Step 3 — Map: every old name gets one human decision
Work the Names that need a home tab (the alias workbench) until it reads “No names are waiting for a home”. Each name ends in exactly one of two decisions:
- It means a body — press Confirm on the suggestion that names the right body. (Suggestions are ranked by similarity; the person decides, the score never writes.)
- It means no body — press Not a body — skip… and give the one-line reason (required). This records deliberately unmatched — a reviewable row, not an absence — so “decided there is no such body” is never confused with “nobody has looked yet”.
Both actions only propose; a second steward approves in the Queue view before the decision is live. The list re-reads from the server after every action — what you see is what is recorded.
The same decisions via the API (the {legacy_text} path segment is the old
name itself, URL-encoded):
B="https://smartrules.<wildcard_base>"
# Confirm: "this old name means this body" (201 — a pending proposal)
curl -s -X POST "$B/api/worldmodel/v1/org-chart/aliases/OBFC/confirm" \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"institution_code": "obfc"}'
# Skip: "the country looked and there is no such body"
curl -s -X POST "$B/api/worldmodel/v1/org-chart/aliases/Ministry%20of%20Silence/skip" \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"reason": "closed in 2019, nothing replaced it"}'
Case matters. “OBFC” and “obfc” are two different old names and two decisions — matching is exact, on purpose, because normalizing would be the platform guessing. The suggestions surface near-duplicates so you see both.
Step 4 — Gates: publishing agrees with the map
The publish gate (a procedure may not name a body nobody can find) and the registrar gate (a register may not name an accountable office nobody can find) both answer old names through the same translation, so one mapping settles both.
Pick a published procedure whose step rides a now-mapped old name. In the editor, open the procedure and look at the publish readiness report: no refusal, and one informational note naming the translation — “’…’ (OBFC -> obfc). They publish on that translation.” The same dry-run over the API (with
Bas in step 3):```bash curl -s "$B/api/v1/smartrules/procedures/<procedure-id>/publish/readiness" \ -H "Authorization: Bearer $TOKEN" # expect: can_publish true, and the note code role_institution_alias_resolved ```If a register names its accountable office by a now-mapped old name, preview the world-model publish in the Studio: the office is no longer refused or warned about — it resolves to the same body the step resolved to.
Step 5 — Republish the affected procedures
- For each procedure the sunset report names as still using an old name,
republish it: editor → the procedure → Publish Procedure panel →
Republish. (The report’s “Names still without a home” lists each old
name with the procedures still using it; the full name-to-procedures
inventory is also at
GET /api/v1/smartrules/institution-migration/report.) - Confirm the grandfathered warnings are gone. Until now the readiness
report carried the dated warning “These steps are assigned to a body
that is not on the org chart yet … They still publish because an
earlier published version already named this body”
(
role_institution_grandfathered). After the mapping, that warning is replaced by the translation note from step 4 — the step names a body the country’s records map onto the chart.
Step 6 — Verify: the report proves the migration is done
The sunset report reads 100% with nothing left undecided:
```bash curl -s "$B/api/worldmodel/v1/org-chart/sunset-report" \ -H "Authorization: Bearer $TOKEN" # expect: "percent_mapped_or_unresolved": 100.0, # "chart_health": {"warnings": []} ``` `unresolved` is not necessarily empty at 100%: every name skipped in step 3 stays listed there as a deliberate decision — *deliberately unmatched* (`status: "explicitly_unresolved"`) — so it still counts toward the 100%. The proven-done state is 100.0 with every row left in `unresolved` carrying that status; a row still marked never reviewed (`status: "unknown"`) is work left over, and step 3 is not finished. (An empty `chart_health.warnings` also means no body was left pointing at a retired parent and no old-name mapping dangles onto a retired body.)The correction gate is actually on. The same report carries
correction_gate: how many registers this country has, how many the staff-list check on corrections reaches (gated), and one line per register it does not reach with the reason. Anything listed inungatedis still correctable by anyone holding the country-wide registrar badge. Two reasons appear, and they are fixed differently:- *this register names no body accountable for it* — name the accountable body in the authored model. - *this country has drawn no org chart* — draw it (step 2's first checkbox: the list's **A list kept by a named steward** switch, then publish). Until then the check is off for every register, because there is nothing to check a named body against.The named pair resolves to one entity. Find a procedure step bound to “OBFC” and one bound to “One-Stop Business Facilitation Centre”, and run the publish dry-run on each procedure (step 4’s command): both readiness reports name the same chart code in the translation note. Two spellings, one body — that is the migration, proven.
Enforcement day — when the gates go live
The migration runbook above gets a country to 100% mapped-or-explicitly-unresolved. Enforcement day is the moment the platform starts refusing work that cannot be attributed to a body on the org chart. Three things make that day survivable.
1. Seat every body before its officers need it
A body that exists on the org chart but has zero people seated at it is fail-closed: its filings become admin-only until someone is seated there. This is the intended floor, not a bug. The country must add its officers to the staff list before enforcement day, not after officers start receiving 403s.
- For every body that still has work in flight after the republish, open the staff-list surface and add at least one officer.
- Verify each officer can see their own queue: the work-queue endpoint should return the expected rows for that body.
- A body with no seats still resolves correctly in publishing and mapping, but its work is invisible to non-administrators — do not leave a live body unstaffed.
2. Revocation takes effect on the next request
When an officer is transferred or dismissed, the change takes effect on their
very next request because the platform looks up their seat in the database
every time. There is no one-hour token delay. A country that needs a faster
IdP-mediated kill can shorten accessTokenLifespan in Keycloak; that is realm
tuning, not a platform change.
3. Triage order: zero seats before unmapped strings
If an officer cannot see or act on a filing, ask in this order:
- Is the officer seated at the right body? Check the staff list. A body with zero seats explains most “suddenly forbidden” reports on enforcement day.
- Does the procedure name a body the country has not drawn on the org chart? The sunset report lists every unresolved name; map it or mark it as meaning no body.
- Does the procedure name a body that was mapped to the wrong chart row? The dry-run publish note shows which chart code an old name resolves to; compare it with where the officer is seated.
Only after the first two are ruled out should you treat the refusal as a code problem.
4. What enforcement day does NOT cover — say this out loud
Two limits are deliberate. A country told “officers now see only their own body’s work” will read more into that sentence than the platform delivers, so state these before enforcement day rather than after somebody notices.
- A filing shared between bodies is read whole by all of them. If a procedure runs across five bodies — trade, revenue, health, labour, the city council — an officer at any one of them reads everything the other four collected on that filing, including attachments and other bodies’ staff-only notes. An officer has to read a filing’s history to work their own step on it, and slicing a filing per body needs a separate answer for every claim and every document, which does not exist. Recorded as divergence D43.
- A step naming no body at all stays open to everyone. One blank binding in a published procedure makes that whole filing readable by every officer in the country. This mirrors what the acting side already does — a blank binding lets anyone act too — so closing it on the reading side alone would leave officers able to file a decision on a filing they cannot open. Count them on the sunset report and drive the number down; refusing a blank binding at publish is a separate decision the concept seat has not taken.
5. Acting follows the chart, not the roster’s silence
From this wave, whether an officer may act on a step splits on one question: can the org chart place the body the step names?
- The chart places it — acting requires being seated at that body, the same as reading. A real body with an empty staff list therefore refuses both, loudly, naming the body. That is a seating gap; fix it with one staff-list write (§1 above).
- The chart cannot place it — acting keeps the older, lenient behaviour, so work bound to a name not yet mapped is never stranded. One bound, added after review: the leniency reaches only people who can also open the filing. A name nobody’s staff list carries fails closed on the reading side, so it fails closed on the acting side too — nobody records the government’s decision on a case they cannot read. This is the migration bridge, and it closes on its own as the sunset report goes to zero.
Troubleshooting
| Symptom | Likely cause | Action |
|---|---|---|
403 on the org-chart tools or a /org-chart/* endpoint | the login holds registrar (or another authoring role) | use an admin or domain_steward login — these tools are governance data (steps 4-5 run in the editor with ordinary publish rights) |
| The two tool tabs are missing from the Org chart view | the Studio was built without VITE_STUDIO_W2_TOOLS=1 | rebuild the Studio image with the flag set |
| “This tool is not offered by the service yet” | the backend predates the migration endpoints | deploy the current backend image |
| The countdown says “The country has not set an end date yet” | institution_grandfather_until unset, or the registry row not re-seeded | set it in deployments/<code>/config.yaml, redeploy (step 0) |
| Confirm answers 422 | the chosen body is retired or not on the chart | propose-time validation refuses any target that is not an active body — add it (step 2) or pick another |
| The old name still shows after Confirm/Skip | the proposal is not approved yet | a second steward approves it in the Queue view — the decision is live only then |