mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
d1be2d2131714d023a22a6ffc0a94de651dc7f4e
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d9cf523f9e |
Admin Panel / Problems: Data health, a nightly scan of broken references, with repairs.
The scan counts what points at nothing: cards on a missing or another board's list or swimlane, ghost and duplicate board members, boards with no active admin, custom field values and boards that no longer exist, checklist items without a checklist, and subtasks or linked cards whose card is gone. It runs nightly when the CPU is low, claimed so that only one pod scans or repairs. A repair that only moves data reuses the upgrade steps; one that deletes asks twice, and the server refuses it without that confirmation. Every repair edits with $pull or a guarded update, so a concurrent edit is not overwritten, and a member dedupe keeps the admin entry. Legacy scalar boardId and string boardIds of custom fields are understood. Translations done with low confidence: ay, csb, lld, kok, wa-RR, ve-CC, bi, tpi. Thanks to Raymond-Voogt and xet7 ! Fixes #6818. |
||
|
|
06b7ce994a |
Backup status: every run recorded, failures and overdue backups shown, old local backups pruned - in Admin Panel too.
The result of an Admin Panel backup lived only in the memory of the server process that ran it. After a restart, or on another pod of a multi-pod deployment, the Backup pane said "idle", so nobody could see whether last night's backup had worked. There was no history, no warning when a scheduled backup failed or did not run, and local backups were never cleaned up. - Every run, scheduled or "Backup now", is recorded in backupRuns: start and end, who or the schedule, scope, storage, status, size, duration and error. Records are kept 400 days. A run still "running" after 24 hours counts as failed, and a scheduled run skipped for another backup is recorded as failed. - Admin Panel / Problems / Backup shows the last success (overdue when its period has passed), the last failure with its error, the next run and the last 30 runs. The same status is above the schedule in Attachments / Backup. - Problems / Summary lists "Backup failed" and "Backup overdue". /metrics adds wekan_backup_last_success_timestamp_seconds, wekan_backup_last_run_timestamp_seconds, wekan_backup_last_run_success and wekan_backup_overdue for alerting. - BACKUP_KEEP_DAYS: after a successful backup, local backups of the same scope older than N days are deleted. The newest is always kept, and only a directory inside the backup root holding a backup.zip is removed. From the patch by Raymond-Voogt, and in Admin Panel as well: - BACKUP_KEEP_DAYS is the catalog's backup section (models/lib/authConfigCatalog.js), overridable beside the schedule in Admin Panel / Attachments / Backup and resolved through authEnv at every backup. - It is listed on every platform: the compose files, start-wekan.sh and .bat, the snap config and help, and the Dockerfile, which the patch's version had missed. Its platform hunks, written before #6789, were re-applied by hand. tests/backupRuns.test.cjs (21): the run records, overdue and pruning against a real directory, and the Admin Panel override, including that nothing reads the variable around it. tests/authConfigCatalog.test.cjs checks every platform. admin-attachment-retention.e2e.js checks the Backup pane shows the field. Thanks to Raymond-Voogt and xet7 ! Fixes #6790. |
||
|
|
eb49a4b1b6 |
Override every login environment variable in Admin Panel / People.
Each login method has its own section: LDAP, OAuth2 (OpenID Connect and Oracle OIM), CAS and Header login are new or complete, and the Login pane gets PASSWORD_LOGIN_ENABLED and ACCOUNTS_COMMON_LOGIN_EXPIRATION_IN_DAYS. models/lib/authConfigCatalog.js lists all 103 variables; server/lib/ authConfig.js resolves each one at run time (Admin Panel value first, then the environment variable) for the app and, through globalThis.__wekanAuthEnv, for the wekan-ldap, wekan-oidc and wekan-accounts-cas packages. OAuth2 and CAS service configurations and LDAP background sync are reapplied when their settings are saved. Passwords and client secrets (LDAP_AUTHENTIFICATION_PASSWORD, OAUTH2_SECRET) never reach the browser: the page learns only whether one is set and where it comes from. Other values have credentials written inside a URL masked on the server, and a URL field refuses them. Fixed on the way: - The Admin Panel LDAP overrides never applied. The bridge read Settings with a server-side findOne(), which Meteor 3 refuses; the error was swallowed and the environment used. The settings are now held in an observed cache. - LDAP Test connection never existed on the server (testConnection.js was not imported) and used the synchronous Meteor.user(). - PROPAGATE_OIDC_DATA=false turned the feature on. - CAS read only the misspelled CASE_VALIDATE_URL; CAS_VALIDATE_URL now works and the old name still does. - snap help named three group-filter keys snap set does not know. Every catalog variable is now listed in the Dockerfile, the docker-compose files, snap config and help, and start-wekan.sh/.bat; 14 were missing. tests/authConfigCatalog.test.cjs pins resolution, secrets, input validation, platform coverage, and - across the whole tree - that no code reads a login variable outside the catalog or straight from process.env, and that no server code calls the synchronous Settings.findOne() or Meteor.user(). tests/playwright/specs/admin-login-env-overrides.e2e.js drives the pages. Thanks to xet7 ! |
||
|
|
290cdc6a4d |
Restore lost list swimlanes from Admin Panel / Problems
Boards opened under the versions before #6515 had every per-swimlane list
un-bound automatically: the board data-repair treated any list with a
swimlaneId as #6484 corruption and cleared it, and a per-swimlane list is
indistinguishable from a corrupted board-wide one at the data level. #6515
stopped it. Nothing put the bindings back, so those lists still render under
every swimlane, and deleting one from a swimlane deletes the only list document
there is - which is what #6670 reports.
The old value is recoverable, not guessable. That clearing went through
Lists.direct.updateAsync, which bypasses collection hooks, so it only ever
touched the list document - while the binding each list was CREATED with is
recorded in a different collection:
// models/lists.js - Lists.after.insert -> trackOriginalPosition()
originalSwimlaneId: this.swimlaneId || null,
if (!existingHistory) { PositionHistory.insertAsync(document); }
That insert is insert-ONLY, written once at creation and never overwritten, so
it survived untouched for every list created since list position tracking
landed (2025-10-16,
|
||
|
|
1fb382f0eb |
Stop Admin Panel / Problems showing a finished board-repair and info CPU rows.
#6520: the Problems "Status" page showed "Board data-repair — 146/146 boards" running forever (plus a matching "Migration or repair" login warning), and the CPU area showed dozens of "new problems" on an idle server. Board repair stuck at "running": getInProgress() trusted the raw `running` flag. The startup repair DOES write running:false on completion, but its progress callback also fired a NON-awaited running:true write when boardsDone === boardsTotal; being fire-and-forget, that write could land AFTER the awaited completion write and pin the doc at "running, 146/146". A process killed mid-repair leaves running:true too. Both now clear: * the startup progress callback no longer writes the terminal boardsDone === boardsTotal update (the completion write owns the final state), closing the race at the source; * getInProgress() now asks the new pure isStatusActive() instead of reading `running` directly - a doc is "in progress" only while running AND not in a terminal phase (completed/error/done) AND not already finished by count (done >= total) AND updated recently (a running flag with no recent progress write is a crashed run). This also heals docs already stuck on an instance, and fixes the same class of stale flag for the text migration. Because the login "Migration or repair" warning keys off getInProgress(), it clears too. CPU "57 new problems" on an idle server: the count in eventLogProblemAreas counted every unacknowledged row in a stream. The CPU monitor writes one 'detected' row when a high-CPU period starts and several severity:'info' rows ('remediated' when it ends, 'rate-limited' for mitigation, FerretDB governor chatter), so each brief, already-over spike looked like several "new problems". The count now excludes severity:'info' rows (via the new newProblemsSelector) - notices that a problem was handled or cleared are not problems. Rows with no severity are still counted, so nothing unclassified is silently dropped. Both decisions are pure, unit- and negative-tested (statusActive.test.cjs, eventLogProblems.test.cjs), and registered in test:unit:node. Thanks to Alishara and xet7 ! Fixes #6520, |
||
|
|
a440d44ea4 |
Remove the cron migration subsystem: it never ran and had no UI.
Nothing scheduled it and nothing rendered it, but every logged-in client still paid for it: - initializeCronJobs() (server/cronMigrationManager.js) was NEVER called, so the SyncedCron.add() registrations and the 5s job-queue processor never started. - boardMigrationDetector.start() sat behind a commented-out Meteor.startup hook, with the note "Automatic migration detector is disabled - migrations only run when opening boards". - The Admin Panel had no Cron page at all: no route in config/router.js, no button in settingHeader.jade, no template ever included, and every helper, event and reactive var for it commented out in settingBody.js. - Yet imports/cronMigrationClient.js WAS imported by client/imports.js, so every client subscribed to three publications and polled cron.getMigrationProgress every 10 seconds, forever, for a feature with no user interface. Migrations already run - and are already reported - through the paths that work: Admin Panel -> Attachments (database migration) and the on-board-open repair, both driven by the shared migrationProgress overlay dashboard mounted app-wide in defaultLayout, plus the in-progress list on Admin Panel -> Problems -> Summary. Removed: cronSettings.jade/.css, imports/cronMigrationClient.js, models/cronJobStatus.js, server/cronMigrationManager.js (28 admin-gated cron.* methods that no UI called), server/cronJobStorage.js, server/boardMigrationDetector.js and the three publications that fed only the deleted client module (cronJobs, cronMigrationStatus, migrationProgress). KEPT on purpose: server/cron/syncedCron.js, which is SyncedCron itself and is used by the backup schedule (server/methods/backup.js) and scheduled rules (server/scheduledRules.js). getInProgress() in server/lib/systemStatus.js no longer reads cronJobStatus. Leaving that check would have been worse than useless: a leftover status:'running' doc from an older version now has nothing to clear it, so Admin Panel -> Problems would report "Migration job X running" forever. The 40 i18n keys that only the deleted template used are left in place - dropping them from every language file would discard human translations for keys that may be reused. Thanks to xet7 ! |
||
|
|
d168a9d302 |
Add a Repair button for "Broken cards N" in Admin Panel / Problems / Summary.
The Summary page reported "Broken cards N" and told the admin to "open the board to auto-repair, or run the repair migration", but there was no button anywhere to run one - and worse, no repair in the app could actually clear that count. countBrokenCards() counts every card missing a boardId OR a swimlaneId OR a listId. repairAllBoards() walks only NON-ARCHIVED boards and only ever sets swimlaneId, so three kinds of counted card could never be repaired by anything: cards on an archived board, cards with a missing listId, and cards with no boardId at all. The count sat there forever with nothing to press. The new repairBrokenCards method (admin only) runs the standard per-board pass and then closes those gaps: orphaned-swimlane cards on archived boards, and cards missing a listId and/or swimlaneId on any board, are assigned to that board's first usable list/swimlane (creating a default one if the board has none). Each board resolves its default list/swimlane once rather than once per card. Cards with no boardId cannot be placed on any board - guessing would drop a user's card onto an unrelated board - so they are reported back as `unfixable` and left alone, never deleted, and the result line says so instead of leaving a count that never reaches zero unexplained. What counts as broken now lives in one pure module, models/lib/brokenCardsRepair.js, used by BOTH the count and the repair, so they can no longer drift apart and leave the admin pressing a button that does not move the number. Progress is persisted through setBoardRepairStatus, so a running repair shows up in the same "in progress" list as the startup pass. Adds unit tests (positive + negative) for the shared rule, including the regression itself: every card the count reports as broken must be either repairable or explicitly unfixable, never silently neither. Thanks to xet7 ! |
||
|
|
5a1c9a61e9 |
Admin Panel / Problems "Status" overview + snap run wekan.problems: show migrations/repairs in progress and login-page "Must be logged in" causes; run repairs server-side.
Motivated by the 10.16-10.21 reports where, after an upgrade, the login page showed "Must be logged in" or sat on the logo + "Loading, please wait." spinner, pages took 5+ minutes, All Boards counts stayed 0 and i18n showed raw keys — the FerretDB v1 (SQLite) process pegged ~2 cores for a long time under WeKan's poll load, i.e. a migration/repair or a saturated backend, with no way to see it without the Admin Panel. Server-side, independent of any client / progress page: - server/startup/repairBoardsOnStartup.js runs the shared board data-repairs once (version-gated, background, 30s after boot) so corrupted data is fixed even if no user opens a board and nobody watches a progress page. - The MongoDB <-> SQLite text migration and the startup repair now PERSIST their progress to the text_migration_status collection (models/textMigrationStatus.js), so a separate process can see "a migration/repair is in progress" (an in-memory object could not). Status overview (server/lib/systemStatus.js), shown in Admin Panel / Problems -> Summary and via the method systemStatusReport (admin-gated, server/methods/ systemStatus.js): - everything in progress (text migration, board repair, recovery, cron migration, attachment migration) aggregated from the persisted status collections; - detected problems (broken cards; failing login-page checks); - login-page "Must be logged in" / "Loading, please wait" cause checklist (migration in progress, ROOT_URL, LDAP, Sandstorm) — models/lib/loginProblems.js; - a CPU detail area that calls out a pegged ferretdb process and the mitigation. Snap: `snap run wekan.problems` (snap-src/bin/wekan-problems[.mjs], snapcraft app `problems`) prints the same overview as text — problems, migrations/repairs in progress, login checks — so an admin with only server access can see it WITHOUT Admin Panel access. Sub-commands: migrations | login | broken-cards | cpu | help. Pure helpers models/lib/loginProblems.js and models/lib/problemsOverview.js are unit-tested; tests/problemsStatus.test.cjs (14 checks) also source-guards the server hub, method, startup pass, migration persistence and snap command. Thanks to xet7 ! |