etherpad-lite/bin
John McLear d6a55c2283
feat(7642): bin/compactStalePads — staleness-gated bulk compaction (#7708)
* feat(7642): bin/compactStalePads — staleness-gated bulk compaction

Adds bin/compactStalePads with --older-than / --keep / --dry-run.
Composes listAllPads → getLastEdited → compactPad so hot pads in
active timeslider use are left alone and only the cold tail is
compacted. Targeting stays a CLI concern; compactPad's API surface
is unchanged.

Per-pad failures (including a getLastEdited fault) don't stop the
run — same error-tolerance shape as compactAllPads. End-to-end test
plumbs through the real /api/1.3.1/getLastEdited + compactPad
endpoints to lock the adapter contract.

Daily-cron variant (cleanup.compactOlderThanDays setting) deferred
to a follow-up so this PR stays focused on the on-demand operator
tool from the issue's primary acceptance bullet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(7642): TOCTOU recheck before compaction + admin CLI docs

Qodo flagged two real issues:

1. Race window between staleness selection and compaction. On a long
   bulk run a pad could become active between first-pass filtering and
   compactPad, which would then kick those sessions. Added a getLastEdited
   recheck right before each compact call; if the pad is now fresh it's
   reclassified as skippedFresh rather than failed (the user did the
   right thing — edited it — and we bow out).

2. doc/cli.md had nothing on pad compaction at all (gap predates this
   PR; #6194 landed without doc updates). Added a Pad compaction section
   covering all three CLIs — compactPad, compactAllPads, compactStalePads
   — so the toolset is discoverable as a unit.

Tests cover both the recheck-skip path and a recheck-failure path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 22:41:52 +02:00
..
deb-src cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
nsis cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
plugins chore: removed axios (#7685) 2026-05-06 22:06:04 +02:00
buildDebian.sh cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
buildForWindows.sh chore: updated node to supported 22,24,25 (#7628) 2026-04-28 22:45:28 +02:00
checkAllPads.ts Fixed bin scripts. 2024-08-08 21:23:10 +02:00
checkPad.ts Fixed checkPad script not returning 2024-07-12 08:34:53 +02:00
cleanRun.sh cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
commonPlugins.ts fix(plugins): updatePlugins.sh actually updates installed plugins (closes #6670) (#7644) 2026-05-02 07:22:25 +01:00
compactAllPads.ts chore: removed axios (#7685) 2026-05-06 22:06:04 +02:00
compactPad.ts chore: removed axios (#7685) 2026-05-06 22:06:04 +02:00
compactStalePads.ts feat(7642): bin/compactStalePads — staleness-gated bulk compaction (#7708) 2026-05-10 22:41:52 +02:00
convertSettings.json.template cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
createRelease.sh chore: Rename some occurences of etherpad-lite to etherpad (#7552) 2026-04-19 16:53:57 +02:00
createUserSession.ts chore: removed axios (#7685) 2026-05-06 22:06:04 +02:00
debugRun.sh cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
deleteAllGroupSessions.ts chore: removed axios (#7685) 2026-05-06 22:06:04 +02:00
deletePad.ts chore: removed axios (#7685) 2026-05-06 22:06:04 +02:00
extractPadData.ts Fixed bin scripts. 2024-08-08 21:23:10 +02:00
fastRun.sh chore: fixed fastRun.sh script (#7063) 2025-08-05 18:24:19 +02:00
functions.sh chore: updated node to supported 22,24,25 (#7628) 2026-04-28 22:45:28 +02:00
generateReleaseNotes.ts chore: fixed generatereleasenotes to respect filename 2025-11-05 22:14:58 +01:00
importSqlFile.ts chore: migrated settings to esm6 (#7062) 2025-08-04 22:42:50 +02:00
installDeps.sh cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
installer.ps1 chore: updated node to supported 22,24,25 (#7628) 2026-04-28 22:45:28 +02:00
installer.sh chore: updated node to supported 22,24,25 (#7628) 2026-04-28 22:45:28 +02:00
installLocalPlugins.sh Fix installation of local plugins 2025-04-05 15:31:36 +02:00
make_docs.ts Enforce 2-space indentation across codebase (#7426) 2026-04-01 19:48:45 +01:00
migrateDB.ts chore: adapted documentation for migrateDB.ts (#7088) 2025-08-24 20:50:16 +02:00
migrateDirtyDBtoRealDB.ts chore: migrated settings to esm6 (#7062) 2025-08-04 22:42:50 +02:00
package.json build(deps-dev): bump the dev-dependencies group across 1 directory with 6 updates (#7706) 2026-05-08 19:44:25 +02:00
plugins.ts fix(plugins): updatePlugins.sh actually updates installed plugins (closes #6670) (#7644) 2026-05-02 07:22:25 +01:00
push-after-release.sh cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
rebuildPad.ts chore: migrated settings to esm6 (#7062) 2025-08-04 22:42:50 +02:00
release.ts chore: use jq for version replacement [skip ci] 2026-05-06 23:40:23 +02:00
repairPad.ts Fixed bin scripts. 2024-08-08 21:23:10 +02:00
run-frontend-tests-with-disables.sh fix(test): disables helper auto-detect must follow symlinks (#7654) 2026-05-02 19:25:16 +08:00
run.sh Feat/bundle js (#6511) 2024-07-18 08:51:30 +02:00
safeRun.sh cleanup after workspace refactoring (#6174) 2024-02-21 21:50:11 +01:00
setup-trusted-publishers.sh fix: setup-trusted-publishers.sh works with real npm trust CLI (#7491) 2026-04-08 10:56:13 +01:00
tsconfig.json Removed deprecated js files. 2024-08-18 19:22:08 +02:00
updatePlugins.sh fix(plugins): updatePlugins.sh actually updates installed plugins (closes #6670) (#7644) 2026-05-02 07:22:25 +01:00