fix(docs): restore the runbook — my regex in #268 deleted 2203 lines #269
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra!269
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "fix/restore-runbook"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
#268 deleted almost the entire runbook and it is live on
main. It was meant to make two smalledits to
docs/runbook.md. Its diffstat was +10 / −2203, leaving 60 of 2253 lines.Cause
A "tolerant" regex, written to survive prettier reflowing a wrapped command:
With
re.Sthe trailing.*$matches across newlines, and$underre.Mmatches at any line end —so the greedy
.*ran to the end of the document and backtracked to the last line ending, not thenearest. Everything from
4. Then applyto EOF fell insidem.end()and was replaced.The uncomfortable part: the previous, non-regex version of this same edit failed on an exact-string
mismatch (prettier had stripped a continuation indent). That failure was loud and harmless. Reaching for
a regex to make it "robust" converted a visible failure into a silent destructive one — and the
commit's own diffstat said
-2203in plain sight.The fix
Restores
docs/runbook.mdfrom30ca733~1and re-applies only the intended edits usingline-indexed operations with asserted anchors and no pattern spanning newlines:
entry_managed_byrow in the not-declaratively-managed table flips to "Yes, since2026-07-30" and points at the carried patch (the column header becomes "Why / how", since one row is
now a yes)
set-entry-managerstep becomes "then apply", with the command keptbelow as documented break-glass
Diff against the pre-damage file is now +31 / −7 — the four table lines (prettier realigns the block
because the new row is wider) and the three lines of the old steps. Nothing else.
markdownlintclean.Also: upstream issue #32, which is what this turn was for
kanidm-provision builds
preexisting_entity_namesonce and never refreshes it(
src/main.rs:393-403), then passes that snapshot to all three sync phases. So deleting an entity andcreating a same-named entity of a different type in one run fails the create with
… name is already in use by another entity!even though the delete happened. (The issue text doesn'tname this mechanism — verified from source.)
bitborg is not exposed. Checked by rendering the state template:
presentis hardcodedtruein both emitting sites — no code path yieldspresent: false, so thedelete branch is unreachable
systems.oauth2renders{}— no cross-type create to collide with--no-auto-removestops the orphan phase deleting anythingA "rename" here adds the new group and leaves the old one as an undeclared orphan; nothing is deleted.
So the earlier framing of #32 as "a live risk while renaming tier groups" was too pessimistic.
It goes live only if a retire a tier group procedure starts using
present: false, so the runbook nowrecords: retire and re-create across two separate applies, never one.
Documented rather than patched — a second carried patch is real maintenance on every future ref bump,
guarding a path the template cannot currently express. Offered upstream alongside the
entryManagedBypatch. Full analysis appended to
bitborg-internal/copilot/2026-07-30-kanidm-provision-upstream-review.md.