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 !
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
- Idempotence on Wikipedia - why running the repair again changes nothing.
- Kanban (development) on Wikipedia - boards, lists and swimlanes.
- In WeKan: Migrations.md, Summary.md (the Repair broken cards and Restore buttons), Data-Health.md, Broken-Cards.md.
How to use it
Nothing has to be started: the repairs run by themselves.
Repair one board
- Log in as an admin of that board.
- 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
- Open Admin Panel → Problems → Summary. A running board data-repair
is listed under Status as
done/totalboards. - Or run
snap run wekan.problems migrationson a snap server (Snap.md).
Skip the startup pass
- Set
WEKAN_SKIP_STARTUP_REPAIR=true. - 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:
- Server startup —
server/startup/repairBoardsOnStartup.jsruns 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 withWEKAN_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. - Board open — when a board opens, the client
(client/components/boards/boardBody.js)
calls
boardRepairNeededonce per board; if something needs fixing and the viewer is a board admin (canRepair), it runsrepairBoardDatafor 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. - 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
#2573a7to#1a5276gradient 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
- tests/boardRepair.test.cjs - the planner: missing and orphaned cards, archived swimlanes, and that lists are never un-bound.
- tests/listUnbindRepair.test.cjs - the explicit list un-bind.
- tests/listSwimlaneRestore.test.cjs - the #6670 restore.
- tests/cardListEntryStartup.test.cjs - the startup pass restores list entry dates first.
Commits
- Restore the date each card entered its list in the startup pass
- Restore the lists the old repair un-bound, from Problems / Summary
- Stop showing a finished board-repair as running
- The startup and board-open repair no longer un-binds per-swimlane lists
- First version of this page
- Show a running repair in the Problems Status overview and in snap
- Shared board repairs on board open and during the migration, with the progress dashboard