Files
wekan/docs/Features/Admin-Panel/Problems/Repairs.md
T
Lauri Ojansivu acd6c500e5 Docs: Admin Panel / Problems: what each feature is, how to use it, how its numbers are calculated, how it works, and its commits.
RAM usage, the Problems README, Recovery, Repairs, Rules Report, Security
Report, Snap, Speed, Summary and Tests now open with what the feature is,
links to read more, step-by-step use, how each number is computed and how it
is implemented, and end with the commits that built it.

Corrected from the code: the automatic board repair no longer un-binds lists
(since #6515); Recovery's rule email section has Review, Resend, Mark as sent
and Drop, and a section for legacy rule emails; Delete is under Settings; the
Product name is in Settings / Appearance; Speed rows fold per kind of request,
not per path; the RAM row detail has WeKan RSS and no load; the snap command
falls back to MONGO_URL and prints the Databases section.

Thanks to xet7 !
2026-11-22 18:04:25 +02:00

9.6 KiB

Admin Panel → Problems: automatic board data-repairs

Status: Implemented · Owner: xet7 · Related: models/lib/boardRepair.js, models/lib/listUnbindRepair.js, server/lib/repairBoardData.js, server/methods/repairBoardData.js, server/startup/repairBoardsOnStartup.js, client/components/boards/boardBody.js, client/components/settings/migrationProgress.*.

What it is

WeKan repairs a small set of board data problems automatically: cards that do not show in the Swimlanes view because their swimlane is missing or was deleted. The repair runs at server start, when a board admin opens a board, and during the database migration, so nobody has to remember to run it. All repairs are idempotent (a clean board changes nothing) and scoped to one board at a time.

Read more

How to use it

Nothing has to be started: the repairs run by themselves.

Repair one board

  1. Log in as an admin of that board.
  2. Open the board. If something needs fixing, the Board Migration in Progress dashboard appears while the repair runs, and closes when it is done. A board member who is not a board admin sees nothing and nothing is changed.

See a repair that is running

  1. Open Admin Panel → Problems → Summary. A running board data-repair is listed under Status as done/total boards.
  2. Or run snap run wekan.problems migrations on a snap server (Snap.md).

Skip the startup pass

  1. Set WEKAN_SKIP_STARTUP_REPAIR=true.
  2. Restart WeKan.

Cards with no board at all, and lists that lost their swimlane

These are not part of this automatic set. Use Repair broken cards and Restore on Problems → Summary (Summary.md).

How the numbers are calculated

From models/lib/boardRepair.js and server/startup/repairBoardsOnStartup.js:

Number How it is computed
cardsAssigned cards of the board whose swimlaneId is not a non-empty string (null, '' or missing).
cardsRescued cards whose swimlaneId is a string that is not the id of any swimlane of the board. A swimlane that exists but is archived counts as existing.
listsUnbound always 0: the automatic set no longer un-binds lists (see below); the field is kept so the counters keep their shape.
total listsUnbound + cardsAssigned + cardsRescued; the board-open repair runs only when it is above 0.
Startup delay 30 seconds after boot (START_DELAY_MS = 30 * 1000).
Startup version gate the pass runs when the stored marker is below REPAIR_VERSION (2 today), then stores 2, so it runs once per repair version, not on every boot.
boardsDone/boardsTotal boards processed so far of all boards; the progress is persisted every 25 boards (PERSIST_EVERY), and the final state is written once when it finishes.
Dashboard progress the board-open repair shows 20 % while it runs, then completes.

How it works in WeKan

What is repaired

Problem Symptom Repair
Missing-swimlane card A card with no swimlaneId (null / '' / missing) never renders in the Swimlanes view. Assign it to the board's first usable swimlane (not archived, not a template, lowest sort), creating a Default swimlane if the board has none.
Orphaned card A card whose swimlaneId points at a deleted swimlane is invisible. Reassign it to the board's first usable swimlane. A card on an existing but archived swimlane is not treated as orphaned.

The decision of what to fix is a pure, unit-tested planner (models/lib/boardRepair.js, planBoardRepair); the server applies it (server/lib/repairBoardData.js).

No longer repaired automatically: the #6484 bound list. This page used to list a third repair: a board-wide list (shown under every swimlane) that was nudged in the Swimlanes view and got bound to one swimlane, so it disappeared from the other swimlanes, was un-bound by clearing its swimlaneId back to null. Since #6515 the automatic repair never clears a list's swimlaneId: a list that belongs to one swimlane is a legitimate per-swimlane layout and cannot be told apart from a #6484 list in the data, and un-binding them on upgrade made every per-swimlane list show in every swimlane. The #6484 code bug itself is fixed. A board admin can still un-bind one board's lists on purpose with the repairBoardWideLists method (server/models/lists.js, uses models/lib/listUnbindRepair.js); no menu calls it. Lists the old repair un-bound are put back with Restore on Summary (#6670).

When repairs run

The same repair set runs in three places, so it does not depend on any one trigger — in particular it does not depend on a user staying on a progress page:

  1. Server startup — server/startup/repairBoardsOnStartup.js runs the repairs across every board once, in the background, ~30 s after boot. It is version-gated (a full scan is expensive, so it runs once per repair version, not on every boot) and can be skipped with WEKAN_SKIP_STARTUP_REPAIR=true. Before the boards, the same pass also restores the date each card entered its list from the movement history (server/lib/cardListEntryBackfill.js); if that is deferred by concurrent changes, the pass fails and runs again on the next start.
  2. Board open — when a board opens, the client (client/components/boards/boardBody.js) calls boardRepairNeeded once per board; if something needs fixing and the viewer is a board admin (canRepair), it runs repairBoardData for that board. This catches anything corrupted after the startup pass. The method completes server-side even if the browser navigates away. A failed repair is allowed to run again.
  3. During the database migration — the MongoDB ↔ SQLite text migration runs the repairs on the live database before copying, so the migrated copy is clean too (server/methods/migrateTextDatabase.js). See Migrations.md.

Permissions

server/methods/repairBoardData.js: boardRepairNeeded needs a logged-in board member and returns the counts plus canRepair; repairBoardData needs a board admin and refuses anybody else with not-authorized.

Progress dashboard

While a repair (or migration) runs, the shared migration-progress dashboard (client/components/settings/migrationProgress.js) is shown. It is:

  • mounted app-wide, so it appears on a board and on the Admin Panel alike;
  • styled in WeKan blue (a #2573a7 to #1a5276 gradient in its header; this page used to say #2980b9, which the dashboard does not use);
  • branded with the configured Product name (Admin Panel → Settings → Appearance → Custom Product Name), falling back to WeKan, followed by "Board Migration in Progress".

The startup and migration repairs also persist their progress (the board-repair document of text_migration_status), so Problems → Summary and snap run wekan.problems show them even with no browser open.

Limits

Repairs make invisible cards visible. They do not reconstruct which swimlane a card was originally in (that information is lost once the swimlane is deleted) — cards are moved to the first swimlane. To restore an exact prior layout, recover from a backup.

Tests

Commits