rvlib-shipkit 2.31.0 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/package.json +1 -1
- package/src/advisors/acts.ts +16 -15
- package/src/advisors/advice.ts +56 -102
- package/src/advisors/advisor-view.ts +122 -76
- package/src/advisors/app-graph.ts +1 -1
- package/src/advisors/app.ts +3 -11
- package/src/advisors/cf-api.ts +1 -1
- package/src/advisors/dir-bucket.ts +4 -3
- package/src/advisors/edge/api.ts +20 -221
- package/src/advisors/edge/bucket.ts +2 -2
- package/src/advisors/edge/handler.ts +13 -155
- package/src/advisors/edge/here.ts +5 -5
- package/src/advisors/edge/pages.ts +12 -9
- package/src/advisors/edge/shell.ts +6 -5
- package/src/advisors/edge/sign-in.ts +101 -36
- package/src/advisors/edge/status.ts +19 -6
- package/src/advisors/edge/types.ts +36 -60
- package/src/advisors/expose.ts +29 -29
- package/src/advisors/here.ts +12 -12
- package/src/advisors/invite-send.ts +79 -35
- package/src/advisors/invite.ts +31 -8
- package/src/advisors/job.ts +24 -16
- package/src/advisors/login.ts +40 -15
- package/src/advisors/owner-store.ts +46 -22
- package/src/advisors/photos.ts +3 -3
- package/src/advisors/project.ts +27 -25
- package/src/advisors/reach.ts +89 -0
- package/src/advisors/rights.ts +1 -1
- package/src/advisors/routes.ts +55 -74
- package/src/advisors/scan.ts +0 -4
- package/src/advisors/setup-run.ts +14 -14
- package/src/advisors/share-trace.ts +3 -3
- package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
- package/src/advisors/speaks.ts +29 -0
- package/src/advisors/sync.ts +97 -183
- package/src/advisors/tunnel.ts +6 -5
- package/src/advisors/users-listen.ts +92 -0
- package/src/advisors/users-router.ts +261 -87
- package/src/advisors/users-store.ts +81 -0
- package/src/agent-time/blocked-scan.ts +181 -0
- package/src/agent-time/registry.ts +12 -5
- package/src/agent-time/store.ts +9 -109
- package/src/asks/ask-bar-fold.ts +2 -1
- package/src/asks/ask-close.ts +2 -1
- package/src/asks/ask-doc.ts +2 -1
- package/src/asks/ask-migrate.ts +3 -2
- package/src/asks/ask-steps-fold.ts +2 -1
- package/src/asks/ask-store.ts +4 -3
- package/src/check.ts +3 -43
- package/src/checks/SK001-package-json-shape.check.ts +4 -55
- package/src/checks/SK004-gitignore-policy.check.ts +24 -69
- package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
- package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
- package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
- package/src/checks/SK020-self-spawning-check.check.ts +5 -7
- package/src/checks/SK035-public-clean.check.ts +1 -1
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK042-post-kinds.check.ts +5 -14
- package/src/checks/SK054-agent-allow-list.check.ts +5 -74
- package/src/checks/SK055-retired-config-keys.check.ts +45 -0
- package/src/cli/cmd_Advisors.ts +11 -45
- package/src/cli/cmd_Asks.ts +3 -10
- package/src/cli/cmd_Backup.ts +25 -127
- package/src/cli/cmd_BackupTargets.ts +1 -1
- package/src/cli/cmd_Capacity.ts +6 -2
- package/src/cli/cmd_Checks.ts +0 -14
- package/src/cli/cmd_Ci.ts +2 -1
- package/src/cli/cmd_Db.ts +3 -82
- package/src/cli/cmd_Home.ts +4 -32
- package/src/cli/cmd_Hq.ts +0 -17
- package/src/cli/cmd_Releases.ts +57 -4
- package/src/cli/cmd_Review.ts +333 -354
- package/src/cli/cmd_Shot.ts +26 -4
- package/src/cli/cmd_SocialDrafts.ts +6 -13
- package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/inbox-hook-run.ts +5 -23
- package/src/cli/registry-heads.ts +5 -55
- package/src/cli/registry.ts +1 -5
- package/src/cli/review-here.ts +1 -1
- package/src/cli.ts +15 -4
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +5 -4
- package/src/core/admission.ts +268 -0
- package/src/core/agent-allow-policy.ts +32 -2
- package/src/core/agent-env.ts +8 -0
- package/src/core/allow-rows.ts +74 -0
- package/src/core/check-file-names.ts +19 -106
- package/src/core/code-lines.ts +36 -21
- package/src/core/footprint.ts +17 -13
- package/src/core/identities-root.ts +1 -4
- package/src/core/layout.ts +1 -2
- package/src/core/machine-db.ts +33 -208
- package/src/core/machine-layout.ts +14 -127
- package/src/core/machine-read.ts +5 -2
- package/src/core/mask-source.ts +60 -0
- package/src/core/memory-watch.ts +17 -14
- package/src/core/motherhome.ts +8 -35
- package/src/core/one-way-in-policy.ts +0 -3
- package/src/core/peer-sk.ts +8 -0
- package/src/core/repo-walk.ts +0 -9
- package/src/core/retention.ts +1 -9
- package/src/core/retired-checks.ts +2 -0
- package/src/core/tmux-policy.ts +1 -1
- package/src/core/tree-watch.ts +2 -2
- package/src/core/when.ts +7 -45
- package/src/gate/admit-heavy.ts +150 -0
- package/src/gate/check-runner.ts +6 -0
- package/src/gate/discover-checks.ts +42 -32
- package/src/gate/gate-checks.ts +21 -131
- package/src/gate/head-gate.ts +1 -1
- package/src/gate/job-run.ts +2 -1
- package/src/gate/pre-commit-discovery.ts +22 -28
- package/src/gate/run-check.ts +3 -4
- package/src/gate/run-ci.ts +4 -0
- package/src/gate/run-fix.ts +5 -17
- package/src/gate/run-fixers.ts +6 -42
- package/src/home/app-sign.ts +2 -2
- package/src/home/backup-status.ts +52 -92
- package/src/home/backup-verdict.ts +2 -2
- package/src/home/daemon-jobs.ts +51 -95
- package/src/home/database-words.ts +1 -2
- package/src/home/databases.ts +9 -25
- package/src/home/home-launchd.ts +0 -6
- package/src/home/home-paths.ts +8 -4
- package/src/home/home-routes.ts +3 -10
- package/src/home/home-state.ts +2 -14
- package/src/home/inbox-shape.ts +14 -15
- package/src/home/inbox.ts +1 -1
- package/src/home/machine-repair.ts +102 -103
- package/src/home/resume.ts +1 -15
- package/src/home/run-daemon.ts +7 -12
- package/src/home/space-page.ts +3 -2
- package/src/home/supervise.ts +3 -7
- package/src/hooks/commit-msg-run.ts +61 -0
- package/src/hooks/commit-run.ts +16 -166
- package/src/hooks/gate-outcome.ts +108 -0
- package/src/hooks/git-hook.ts +9 -9
- package/src/hooks/hook-config.ts +8 -8
- package/src/hooks/leak-guard.ts +1 -1
- package/src/hooks/pre-commit-checks.ts +1 -1
- package/src/hooks/run-hooks.ts +2 -6
- package/src/hooks/shared-file.ts +3 -2
- package/src/hq/daemon-db.ts +8 -8
- package/src/hq/door.ts +3 -16
- package/src/hq/hq-db.ts +4 -3
- package/src/hq/hq-local.ts +1 -2
- package/src/hq/hq-store.ts +0 -15
- package/src/hq/item-direct.ts +8 -10
- package/src/hq/item-fill.ts +37 -0
- package/src/hq/kinds/item-gone.ts +7 -10
- package/src/hq/kinds/item-msg.ts +12 -18
- package/src/hq/kinds/item.ts +13 -19
- package/src/hq/kinds/report.ts +3 -4
- package/src/hq/owner-switch.ts +3 -3
- package/src/hq/report.ts +5 -9
- package/src/hq/switch.ts +2 -11
- package/src/hq/thread-sync.ts +5 -17
- package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
- package/src/http/owner-word.ts +1 -1
- package/src/identities/machine.ts +16 -0
- package/src/init-repo.ts +0 -1
- package/src/ledger/check-stats.ts +6 -5
- package/src/ledger/db.ts +2 -4
- package/src/ledger/record-kept.ts +117 -48
- package/src/ledger/run-log.ts +21 -2
- package/src/ledger/slow-tests.ts +96 -0
- package/src/ledger/store.ts +3 -86
- package/src/ledger/suite-log.ts +8 -2
- package/src/media-store/backup/facts.ts +3 -37
- package/src/media-store/backup/keys.ts +1 -8
- package/src/media-store/backup/manifest.ts +6 -67
- package/src/media-store/backup/restore.ts +4 -13
- package/src/media-store/backup/retention.ts +13 -1
- package/src/media-store/backup/run.ts +6 -267
- package/src/media-store/backup/snapshot.ts +2 -38
- package/src/media-store/backup/sources.ts +3 -113
- package/src/media-store/backup/target-send.ts +5 -29
- package/src/media-store/db.ts +8 -7
- package/src/media-store/forget-one.ts +1 -1
- package/src/media-store/forget.ts +1 -80
- package/src/orchestrator/guards.ts +0 -1
- package/src/orchestrator/presence.ts +2 -2
- package/src/orchestrator/routes.ts +1 -1
- package/src/orchestrator/started.ts +0 -9
- package/src/orchestrator/talk-key.ts +3 -4
- package/src/orchestrator/unheard.ts +1 -1
- package/src/plan/planner.ts +3 -2
- package/src/recordings/edit.ts +3 -3
- package/src/recordings/marks-draw.ts +17 -6
- package/src/recordings/marks.ts +120 -9
- package/src/reflections/reflections-queue.ts +3 -10
- package/src/release/notes.ts +1 -1
- package/src/release/public-clean.ts +66 -6
- package/src/release/run-bump.ts +11 -0
- package/src/release/run-release.ts +4 -0
- package/src/releases/from-thread.ts +3 -3
- package/src/releases/model.ts +186 -36
- package/src/releases/store.ts +13 -3
- package/src/releases/validate.ts +83 -0
- package/src/repo-config.ts +36 -64
- package/src/review/answer-kinds.ts +63 -4
- package/src/review/blocked-guard.ts +11 -0
- package/src/review/blocked-object.ts +298 -0
- package/src/review/cells.ts +144 -230
- package/src/review/close.ts +39 -1
- package/src/review/doc-save.ts +3 -2
- package/src/review/draft-item.ts +1 -1
- package/src/review/events.ts +3 -7
- package/src/review/expect.ts +23 -39
- package/src/review/format.ts +79 -46
- package/src/review/glyphs.ts +1 -0
- package/src/review/hand-over.ts +3 -3
- package/src/review/heard.ts +1 -1
- package/src/review/holds-sync.ts +2 -1
- package/src/review/inbox-hook.ts +2 -2
- package/src/review/inbox-read.ts +39 -33
- package/src/review/instruction-guards.ts +12 -0
- package/src/review/instructions.ts +0 -1
- package/src/review/item-db.ts +13 -43
- package/src/review/item-hq.ts +2 -2
- package/src/review/item-rows.ts +3 -14
- package/src/review/kind-catalog.ts +3 -1
- package/src/review/kinds.ts +18 -8
- package/src/review/live-view.ts +3 -0
- package/src/review/media-kind.ts +1 -1
- package/src/review/mentions.ts +1 -2
- package/src/review/model.ts +158 -114
- package/src/review/move.ts +149 -0
- package/src/review/need-threads.ts +3 -2
- package/src/review/object-card.ts +11 -0
- package/src/review/object-read.ts +6 -1
- package/src/review/one-block.ts +1 -1
- package/src/review/owner-read.ts +1 -1
- package/src/review/phone-push.ts +10 -9
- package/src/review/previews.ts +32 -4
- package/src/review/push.ts +2 -2
- package/src/review/recap.ts +129 -0
- package/src/review/referring.ts +6 -3
- package/src/review/reflection-object.ts +4 -3
- package/src/review/routes.ts +51 -47
- package/src/review/secret-route.ts +3 -2
- package/src/review/settle.ts +0 -6
- package/src/review/snooze.ts +5 -3
- package/src/review/speaker.ts +68 -0
- package/src/review/start-title.ts +19 -0
- package/src/review/store-parties.ts +28 -0
- package/src/review/store.ts +94 -59
- package/src/review/{wakes.ts → thread-events.ts} +92 -7
- package/src/review/thread-md.ts +35 -14
- package/src/review/thread-state.ts +804 -0
- package/src/review/threads.ts +29 -347
- package/src/review/traces.ts +104 -7
- package/src/review/trailer-item.ts +1 -1
- package/src/review/unit.ts +7 -9
- package/src/review/verdict-items.ts +12 -10
- package/src/review/view-layout.ts +25 -1
- package/src/review/watch-feed.ts +1 -2
- package/src/review/working-guards.ts +2 -3
- package/src/rules/untrack-generated.ts +1 -15
- package/src/secrets/copy.ts +4 -4
- package/src/secrets/lapse.ts +2 -1
- package/src/serve/hub-app/advisor-app.tsx +4 -4
- package/src/serve/hub-app/advisor-face.tsx +9 -3
- package/src/serve/hub-app/advisor-host.ts +27 -27
- package/src/serve/hub-app/advisors-model.ts +17 -8
- package/src/serve/hub-app/advisors-rights.tsx +1 -1
- package/src/serve/hub-app/advisors-st.ts +15 -14
- package/src/serve/hub-app/advisors-view.tsx +13 -11
- package/src/serve/hub-app/app-bridge.ts +23 -3
- package/src/serve/hub-app/asks-page.tsx +1 -1
- package/src/serve/hub-app/auto-text.tsx +71 -16
- package/src/serve/hub-app/check-view.tsx +0 -8
- package/src/serve/hub-app/controls.css +14 -3
- package/src/serve/hub-app/database-view.tsx +1 -2
- package/src/serve/hub-app/dock-st.ts +1 -1
- package/src/serve/hub-app/git-view.tsx +3 -1
- package/src/serve/hub-app/hub.css +12 -5
- package/src/serve/hub-app/icons.tsx +1 -1
- package/src/serve/hub-app/inbox-view.tsx +1 -2
- package/src/serve/hub-app/live-sources.ts +2 -2
- package/src/serve/hub-app/main-panel.tsx +2 -1
- package/src/serve/hub-app/panel-repo.ts +0 -9
- package/src/serve/hub-app/pic.tsx +29 -12
- package/src/serve/hub-app/polled.ts +16 -2
- package/src/serve/hub-app/recordings-st.ts +23 -2
- package/src/serve/hub-app/recordings-view.tsx +68 -10
- package/src/serve/hub-app/ref-pill.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +1 -2
- package/src/serve/hub-app/review/advisor-add.tsx +1 -1
- package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
- package/src/serve/hub-app/review/draft-body.tsx +2 -2
- package/src/serve/hub-app/review/heard-line.tsx +1 -1
- package/src/serve/hub-app/review/instructions-view.tsx +1 -8
- package/src/serve/hub-app/review/kind-states.tsx +14 -9
- package/src/serve/hub-app/review/kit.tsx +4 -11
- package/src/serve/hub-app/review/lane-bar.tsx +3 -3
- package/src/serve/hub-app/review/lightbox.tsx +15 -11
- package/src/serve/hub-app/review/line-window.ts +4 -1
- package/src/serve/hub-app/review/live-bar-st.ts +2 -2
- package/src/serve/hub-app/review/live-view.tsx +57 -1
- package/src/serve/hub-app/review/object-panel.tsx +20 -8
- package/src/serve/hub-app/review/question-views.tsx +191 -53
- package/src/serve/hub-app/review/recap-bar.tsx +40 -0
- package/src/serve/hub-app/review/request-cell.tsx +48 -0
- package/src/serve/hub-app/review/review-cells.tsx +154 -96
- package/src/serve/hub-app/review/review-host.ts +8 -4
- package/src/serve/hub-app/review/review-kit.ts +17 -11
- package/src/serve/hub-app/review/review-list.tsx +30 -35
- package/src/serve/hub-app/review/review-st.ts +32 -42
- package/src/serve/hub-app/review/review-thread.tsx +139 -85
- package/src/serve/hub-app/review/review-views.tsx +127 -68
- package/src/serve/hub-app/review/share-lines.tsx +4 -4
- package/src/serve/hub-app/review/start-st.ts +2 -5
- package/src/serve/hub-app/review/superseded-runs.ts +4 -3
- package/src/serve/hub-app/review/thread-close.tsx +10 -7
- package/src/serve/hub-app/review/thread-st.ts +381 -202
- package/src/serve/hub-app/review/tone-bar.tsx +129 -0
- package/src/serve/hub-app/review/tones.ts +53 -0
- package/src/serve/hub-app/review/trailer-body.tsx +2 -2
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
- package/src/serve/hub-app/review.css +189 -106
- package/src/serve/hub-app/search-view.tsx +1 -1
- package/src/serve/hub-app/social/social-model.ts +0 -4
- package/src/serve/hub-app/source-acts.ts +2 -1
- package/src/serve/hub-app/stores/stores-page.tsx +2 -2
- package/src/serve/hub-app/terminal-sources.tsx +2 -1
- package/src/serve/hub-app/thread-row.tsx +3 -4
- package/src/serve/hub-app/tree-build.ts +0 -4
- package/src/serve/hub-app/urls-view.tsx +2 -1
- package/src/serve/hub-app/view-layout.css +13 -3
- package/src/serve/hub-app/wikis-view.tsx +5 -2
- package/src/serve/hub-runtime.ts +7 -37
- package/src/serve/project-gutter-route.ts +6 -2
- package/src/serve/read-thread.ts +20 -2
- package/src/serve/read-worker.ts +9 -1
- package/src/serve/record-pages.ts +46 -0
- package/src/serve/serve-hub.ts +2 -2
- package/src/serve/terminal-host.ts +1 -1
- package/src/serve/terminal-route.ts +1 -3
- package/src/serve/tracked-watch.ts +1 -3
- package/src/setup-house.ts +2 -2
- package/src/shipkit-files.ts +1 -1
- package/src/shipkit.ts +1 -6
- package/src/shot/client.ts +2 -1
- package/src/shot/film-box.ts +0 -20
- package/src/shot/on-place.ts +141 -0
- package/src/social/drafts.ts +1 -1
- package/src/social/kinds.ts +6 -29
- package/src/social/load.ts +2 -2
- package/src/social/post-object.ts +3 -2
- package/src/social/release-stage.ts +1 -1
- package/src/social/stage.ts +2 -2
- package/src/stores/model.ts +4 -0
- package/src/stores/routes.ts +11 -3
- package/src/suite/judge-suites.ts +58 -0
- package/src/suite/red-alone.ts +54 -18
- package/src/suite/runner-shapes.ts +2 -2
- package/src/suite/suite-cli.ts +67 -14
- package/src/suite/test-units.ts +2 -1
- package/src/urls/fill.ts +1 -1
- package/src/urls/places.ts +1 -2
- package/src/vault/vault-config.ts +2 -2
- package/src/vault/vault-init.ts +1 -5
- package/src/wiki/graph-page.ts +14 -2
- package/src/advisors/copy-truth.ts +0 -49
- package/src/advisors/door-child.ts +0 -112
- package/src/advisors/door-serve.ts +0 -52
- package/src/advisors/door.ts +0 -118
- package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
- package/src/checks/SK029-explicit-check-files.check.ts +0 -112
- package/src/checks/SK048-one-local-file.check.ts +0 -36
- package/src/core/config-rewrite.ts +0 -111
- package/src/core/daemon-port.ts +0 -10
- package/src/core/legacy-shapes.ts +0 -263
- package/src/core/migrate-layout.ts +0 -638
- package/src/core/port-check-cli.ts +0 -52
- package/src/core/port-check-file.ts +0 -295
- package/src/core/port-check-files.ts +0 -31
- package/src/gate/discover-legacy-checks.ts +0 -26
- package/src/home/home-move.ts +0 -527
- package/src/home/machine-fold.ts +0 -810
- package/src/hq/item-shapes.ts +0 -54
- package/src/hq/kinds/items-read.ts +0 -4
- package/src/media-store/backup/daemon.ts +0 -220
- package/src/media-store/backup/kept.ts +0 -241
- package/src/media-store/backup/prune.ts +0 -359
- package/src/media-store/backup/secret.ts +0 -88
- package/src/media-store/backup/ssh-space.ts +0 -202
- package/src/media-store/backup/watch.ts +0 -117
- package/src/review/band.ts +0 -182
- package/src/review/folders.ts +0 -216
- package/src/review/hook-ask.ts +0 -58
- package/src/review/role.ts +0 -48
- package/src/review/thread-fold.ts +0 -64
- package/src/review/wait.ts +0 -91
- package/src/rules/rule.ts +0 -43
- package/src/serve/hook-thread.ts +0 -37
- package/src/serve/hook-work.ts +0 -92
- package/src/serve/hook-worker.ts +0 -57
- package/src/serve/hub-app/review/dock.tsx +0 -147
- package/src/serve/hub-app/review/faces.tsx +0 -18
- package/src/serve/hub-app/review/item-verdict.tsx +0 -112
- package/src/serve/hub-app/review/review-board.tsx +0 -48
- /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
package/src/gate/run-fixers.ts
CHANGED
|
@@ -13,14 +13,11 @@ import { dirname, isAbsolute, join } from 'path'
|
|
|
13
13
|
import { fileURLToPath } from 'url'
|
|
14
14
|
import { armHooks } from '../hooks/run-hooks.ts'
|
|
15
15
|
import { FOREIGN_WHY, isForeign } from '../core/foreign.ts'
|
|
16
|
-
import {
|
|
16
|
+
import type { RepoConfig } from '../repo-config.ts'
|
|
17
17
|
import { runFix } from './run-fix.ts'
|
|
18
18
|
import { repoOff } from '../core/when.ts'
|
|
19
|
-
import {
|
|
20
|
-
import { repoCheckFiles } from '../core/repo-walk.ts'
|
|
19
|
+
import { repoUnitFiles } from '../core/repo-walk.ts'
|
|
21
20
|
import { mutateLease, withMutateLease } from '../core/locked-write.ts'
|
|
22
|
-
import { layoutSummary, migrateLayout } from '../core/migrate-layout.ts'
|
|
23
|
-
import { renderPolicy } from '../checks/SK004-gitignore-policy.check.ts'
|
|
24
21
|
import { spawnWithTimeout } from '../core/spawn-timeout.ts'
|
|
25
22
|
import { gitBin } from '../core/git-bin.ts'
|
|
26
23
|
import { LAYOUT } from '../core/layout.ts'
|
|
@@ -190,13 +187,12 @@ const writeMemo = (root: string, key: string): void => {
|
|
|
190
187
|
} catch { /* a memo that cannot be kept only means the next pass runs the fixers */ }
|
|
191
188
|
}
|
|
192
189
|
|
|
193
|
-
/** the bytes of repo.config.ts and the set of
|
|
194
|
-
*
|
|
190
|
+
/** the bytes of repo.config.ts and the set of unit files, as one hash. Read without git, so a repo with no history
|
|
191
|
+
* is covered too */
|
|
195
192
|
function shapeStamp(root: string): string {
|
|
196
193
|
let config = ''
|
|
197
194
|
try { config = readFileSync(join(root, 'repo.config.ts'), 'utf8') } catch {}
|
|
198
|
-
|
|
199
|
-
return String(Bun.hash(`${config}\0${files.join('\0')}`))
|
|
195
|
+
return String(Bun.hash(`${config}\0${repoUnitFiles(root).join('\0')}`))
|
|
200
196
|
}
|
|
201
197
|
|
|
202
198
|
export type FixPassOpts = {
|
|
@@ -254,40 +250,8 @@ export async function runFixPass(root: string, config: RepoConfig, o: FixPassOpt
|
|
|
254
250
|
return { ran: false, touched: [], failed: false, reshaped: false }
|
|
255
251
|
}
|
|
256
252
|
|
|
257
|
-
async function fixPassBody(root: string,
|
|
258
|
-
let config = loaded
|
|
253
|
+
async function fixPassBody(root: string, config: RepoConfig, o: FixPassOpts, verify: boolean): Promise<FixPassResult> {
|
|
259
254
|
const shapeBefore = shapeStamp(root)
|
|
260
|
-
// the old root layout moves under .shipkit/ before anything else reads a
|
|
261
|
-
// path: a move is not a decision, so it lands as one machine commit and
|
|
262
|
-
// only what a machine cannot decide reaches a human. Runs before the tree
|
|
263
|
-
// snapshot, and before hooks arm, because the hooks folder may be what moves.
|
|
264
|
-
// A foreign repo's folders are the team's, whatever their name: none moves
|
|
265
|
-
if (!verify && o.only == null && !isForeign(root)) {
|
|
266
|
-
const m = migrateLayout(root, { config, renderGitignore: (t, legacy, cfg) => renderPolicy(t, cfg ?? config, legacy) })
|
|
267
|
-
// the move rewrote repo.config.ts, so the config loaded before it names
|
|
268
|
-
// folders that are gone, and every fixer below must read the new one
|
|
269
|
-
if (m.swept.includes('repo.config.ts')) {
|
|
270
|
-
try { config = await loadRepoConfig(root, { fresh: true }) } catch (e) {
|
|
271
|
-
o.print(`WARN repo.config.ts does not load after the move rewrote it: ${String((e as Error)?.message ?? e).slice(0, 160)}`)
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
const what = layoutSummary(m)
|
|
275
|
-
if (what !== '') {
|
|
276
|
-
if (m.uncommitted === true) {
|
|
277
|
-
o.print(`WARN layout: ${what}. The commit did not land`)
|
|
278
|
-
const p = m.pending ?? []
|
|
279
|
-
o.print(` fix: commit exactly these paths, never a bare commit: git commit -m 'chore: ${what}' -- ${p.slice(0, 12).join(' ')}${p.length > 12 ? ` (+${p.length - 12} more, listed by git status)` : ''}`)
|
|
280
|
-
} else o.print(`ok: layout: ${what}${m.commit != null ? `, committed as ${m.commit}` : ''}`)
|
|
281
|
-
}
|
|
282
|
-
if (m.deferred != null) {
|
|
283
|
-
o.print(`WARN the move under .shipkit/ is deferred: ${m.deferred}`)
|
|
284
|
-
o.print(' fix: commit or discard that edit, then re-run shipkit ci')
|
|
285
|
-
}
|
|
286
|
-
for (const r of m.refusals) {
|
|
287
|
-
o.print(`WARN ${r.from}/ cannot move to ${r.to}/: ${r.reason}`)
|
|
288
|
-
o.print(` fix: move the files into ${r.to}/ yourself, then delete ${r.from}/`)
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
255
|
// the project's resources file its CLAUDE.md loads (context/project-context.ts), written where no daemon reaches:
|
|
292
256
|
// a worktree, a stranger's repo. Gitignored, so never a fixer rewrite and never a decision; the line is SK003's.
|
|
293
257
|
// Measured: about 80 ms the first time in a process, 10 to 15 ms when nothing moved
|
package/src/home/app-sign.ts
CHANGED
|
@@ -39,8 +39,8 @@ const realOf = (p: string): string => {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** the signing keychain in the user's search list, once, at its path now: codesign finds an identity only there,
|
|
42
|
-
* `--keychain` or not. An entry that names the same file by another path (
|
|
43
|
-
* one
|
|
42
|
+
* `--keychain` or not. An entry that names the same file by another path (`~/.config/shipkit`, a link to the machine's
|
|
43
|
+
* one root) gives way to it */
|
|
44
44
|
export function listed(kc: string, r: Run): void {
|
|
45
45
|
const now = r(['security', 'list-keychains', '-d', 'user']).out.split('\n').map((l) => l.trim().replace(/^"|"$/g, '')).filter((l) => l !== '')
|
|
46
46
|
if (now.includes(kc)) return
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// where every backup of the house lives and whether it works (wiki tools/shipkit/media-store-backup.md, The status):
|
|
2
|
-
// one table, a row a store
|
|
3
|
-
// database of a machine: the hq holds every thread, a machine's rows are its outbox, judged by hq-holds),
|
|
2
|
+
// one table, a row a store (the vault, the hq, the Space; never a machine's untracked files, whose backup is retired,
|
|
3
|
+
// nor a database of a machine: the hq holds every thread, a machine's rows are its outbox, judged by hq-holds),
|
|
4
4
|
// a column a place (its own disk, Time Machine, each backup target), every cell its newest copy, its last proof and its
|
|
5
|
-
// state. ONE judgement, made on the machine that carries the hq: the
|
|
6
|
-
//
|
|
5
|
+
// state. ONE judgement, made on the machine that carries the hq: the other machines read the table from the hq, so
|
|
6
|
+
// every hub (the hq's Mac, a client, the phone) draws the same rows.
|
|
7
7
|
//
|
|
8
8
|
// The constraint a reader breaks first: it reads what the senders and the drills KEPT (the machine db, Litestream's own
|
|
9
9
|
// files, Time Machine's prefs), never the network, so a page asks it often; a store with no working copy off its
|
|
@@ -12,14 +12,15 @@ import { machineGet, machineSet } from '../core/machine-db.ts'
|
|
|
12
12
|
import { ageWords } from '../core/words.ts'
|
|
13
13
|
import type { BackupTarget } from '../hq/backup-targets.ts'
|
|
14
14
|
import { type Drill, healthWords, REPLICA_BEHIND_MS, replicaLag, type ReplicaHealth, type ReplicaPlace } from '../hq/replica.ts'
|
|
15
|
-
import type {
|
|
16
|
-
import
|
|
17
|
-
import { type BackupFacts, isBackupFacts, timeMachineFacts, type TimeMachineFacts } from '../media-store/backup/facts.ts'
|
|
15
|
+
import type { TargetSent } from '../media-store/backup/target-send.ts'
|
|
16
|
+
import { timeMachineFacts, type TimeMachineFacts } from '../media-store/backup/facts.ts'
|
|
18
17
|
import { rowName } from './backup-verdict.ts'
|
|
19
18
|
import type { Proof } from '../media-store/copy/proof.ts'
|
|
20
19
|
import type { ProvedRecord, Sent } from '../vault/vault-snapshot.ts'
|
|
21
20
|
|
|
22
21
|
export type CellState = 'ok' | 'warn' | 'danger' | 'dim'
|
|
22
|
+
/** the stores of the table: the vault, the hq, and the Space, whose one copy off its provider is the second place */
|
|
23
|
+
export type StoreId = 'vault' | 'hq' | 'space'
|
|
23
24
|
/** `row` names the store and its machine; `short` is the cell of the matrix (an age, or a word for a state), `text`
|
|
24
25
|
* and `proof` its full line; `off`: the place is off the store's machine, so it counts as a copy; `of`: a cell judged
|
|
25
26
|
* by the proof of the Space's second copy */
|
|
@@ -38,17 +39,13 @@ const BROKEN = new Set(['drill FAILED', 'proof FAILED', 'stopped', 'stalled'])
|
|
|
38
39
|
export const STORES: { id: StoreId; name: string; what: string }[] = [
|
|
39
40
|
{ id: 'vault', name: 'the vault', what: 'every secret, sealed: OpenBao' },
|
|
40
41
|
{ id: 'hq', name: 'the hq', what: 'hq.sqlite: machines, nodes, the items, messages and events of every thread' },
|
|
41
|
-
{ id: '
|
|
42
|
+
{ id: 'space', name: 'the Space', what: 'every media file the store keeps, the release pictures, the backup runs made before the backup of untracked files retired' },
|
|
42
43
|
]
|
|
43
|
-
/** the stores every machine keeps of its own; the vault and the hq live on the hq's machine alone */
|
|
44
|
-
const OWN_STORES: readonly StoreId[] = ['files']
|
|
45
44
|
|
|
46
45
|
const H = 3_600_000
|
|
47
|
-
/** past these a copy is stale: the vault's snapshot is daily,
|
|
48
|
-
*
|
|
49
|
-
export const BOUNDS = { vault: 26 * H,
|
|
50
|
-
/** a machine's report older than this is stale: its rows are shown as they were, orange, never red */
|
|
51
|
-
export const REPORT_STALE_MS = 15 * 60_000
|
|
46
|
+
/** past these a copy is stale: the vault's snapshot is daily, the hq's copy to a target is hourly, the Space copied
|
|
47
|
+
* to the second place nightly */
|
|
48
|
+
export const BOUNDS = { vault: 26 * H, hqCopy: 2 * H, hqCopyDanger: 26 * H, drill: 8 * 24 * H, timeMachine: 3 * 24 * H, spaceCopy: 26 * H, spaceCopyDanger: 50 * H }
|
|
52
49
|
|
|
53
50
|
/** what the status reads, gathered by `readBackupInputs` in the daemon or handed by a test */
|
|
54
51
|
export type BackupInputs = {
|
|
@@ -62,8 +59,6 @@ export type BackupInputs = {
|
|
|
62
59
|
vaultNear: { count: number; newest: number | null }
|
|
63
60
|
timeMachine: TimeMachineFacts
|
|
64
61
|
secondPlaceKey: boolean | null
|
|
65
|
-
/** every other machine's own stores, as its last hq report said them */
|
|
66
|
-
others?: { machine: string; at: number; facts: BackupFacts | null }[]
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
const ago = (at: number, now: number): string => `${ageWords(at, now)}`
|
|
@@ -112,28 +107,30 @@ function sentCell(s: TargetSent | null, now: number, warnAt: number, dangerAt: n
|
|
|
112
107
|
return { state: age > dangerAt ? 'danger' : age > warnAt ? 'warn' : 'ok', short: ago(s.at, now), text: `${s.name}, ${(s.bytes / 1e6).toFixed(1)} MB, ${ago(s.at, now)}`, proof: 'its sha checked on arrival', fix }
|
|
113
108
|
}
|
|
114
109
|
|
|
115
|
-
/** a store
|
|
116
|
-
|
|
117
|
-
function cellOf(store: StoreId, p: Place, d: BackupInputs, machine: string, mine: Pick<BackupInputs, 'get' | 'timeMachine'>): Draft {
|
|
110
|
+
/** a store at a place, judged on `machine`, the one that carries the hq */
|
|
111
|
+
function cellOf(store: StoreId, p: Place, d: BackupInputs, machine: string): Draft {
|
|
118
112
|
const now = d.now
|
|
119
113
|
const c = (state: CellState, short: string, text: string, proof: string | null = null, fix: string | null = null): Draft => ({ state, short, text, proof, fix })
|
|
120
|
-
const shortOf = (state: CellState, at: number
|
|
114
|
+
const shortOf = (state: CellState, at: number): string => (state === 'danger' ? `${ago(at, now)}, stale` : ago(at, now))
|
|
115
|
+
const target = d.targets.find((x) => x.id === p.id)
|
|
116
|
+
const space = target?.address.kind === 's3' && target.address.config === 'mediaSpace'
|
|
117
|
+
// the Space is at its provider, on no disk of a machine: its one copy off it is the second place
|
|
118
|
+
if (store === 'space' && !(target?.address.kind === 's3' && !space)) return c('dim', space ? 'itself' : 'not here', space ? 'the Space itself, at its provider' : `the Space is not copied to ${p.label}: its copy off its provider is the second place`)
|
|
121
119
|
if (p.kind === 'mac') {
|
|
122
120
|
if (store === 'vault') return c('dim', 'live', `the live vault on ${machine}${d.vaultNear.count > 0 ? `, ${d.vaultNear.count} sealed snapshots beside it${d.vaultNear.newest == null ? '' : `, the newest ${ago(d.vaultNear.newest, now)}`}` : ''}`, 'the same disk: no help if it dies')
|
|
123
|
-
return c('dim', 'live',
|
|
121
|
+
return c('dim', 'live', `the live hq.sqlite on ${machine}`, 'the same disk: no help if it dies')
|
|
124
122
|
}
|
|
125
123
|
if (p.kind === 'disk') {
|
|
126
|
-
const tm =
|
|
124
|
+
const tm = d.timeMachine
|
|
127
125
|
if (tm?.configured === false) return c('dim', 'not set up', `Time Machine is not set up on ${machine}: no copy there`, null, 'System Settings › General › Time Machine')
|
|
128
126
|
if (tm?.newest == null) return c('warn', 'unknown', `no Time Machine snapshot known on ${machine}`, null, 'System Settings › General › Time Machine')
|
|
129
127
|
const age = now - tm.newest
|
|
130
128
|
return c(age > BOUNDS.timeMachine ? 'warn' : 'ok', ago(tm.newest, now), `in its last snapshot, ${ago(tm.newest, now)}`, 'encrypted; not restore tested by shipkit (no Full Disk Access)', age > BOUNDS.timeMachine ? 'plug the disk in, or Time Machine › Back Up Now' : null)
|
|
131
129
|
}
|
|
132
|
-
const t =
|
|
130
|
+
const t = target!
|
|
133
131
|
const stream = d.replica.place === undefined ? 'mediaSpace' : d.replica.place
|
|
134
132
|
if (t.address.kind === 'ssh' && sameHost(t.address.host, machine)) return c('dim', 'itself', `${p.label} is the machine of this store: no copy off it`)
|
|
135
133
|
if (!p.on) return c('warn', 'off', 'the target is switched off', null, `sk backup targets on ${p.id}`)
|
|
136
|
-
const space = t.address.kind === 's3' && t.address.config === 'mediaSpace'
|
|
137
134
|
if (space) {
|
|
138
135
|
if (store === 'vault') {
|
|
139
136
|
const sent = d.get<Sent>('vault-snapshot-sent')
|
|
@@ -141,17 +138,9 @@ function cellOf(store: StoreId, p: Place, d: BackupInputs, machine: string, mine
|
|
|
141
138
|
if (sent == null) return c('danger', 'none', 'no sealed snapshot sent yet', null, 'sk vault snapshot')
|
|
142
139
|
const age = now - sent.at
|
|
143
140
|
const back = proved?.key === sent.key ? `restored with the seal key alone ${ago(proved.at, now)}` : proved == null ? 'never restored' : `the newest not restored yet (the last proof ${ago(proved.at, now)})`
|
|
144
|
-
return c(age > BOUNDS.vault ? 'danger' : proved?.key === sent.key || age < H ? 'ok' : 'warn', shortOf(age > BOUNDS.vault ? 'danger' : 'ok', sent.at
|
|
141
|
+
return c(age > BOUNDS.vault ? 'danger' : proved?.key === sent.key || age < H ? 'ok' : 'warn', shortOf(age > BOUNDS.vault ? 'danger' : 'ok', sent.at), `sealed snapshot ${ago(sent.at, now)}, ${sent.names} names`, back, age > BOUNDS.vault ? 'sk vault status' : null)
|
|
145
142
|
}
|
|
146
|
-
|
|
147
|
-
const last = mine.get<{ at: string }>('backup-last')
|
|
148
|
-
const parsed = last == null ? NaN : Date.parse(last.at)
|
|
149
|
-
const at = Number.isFinite(parsed) ? parsed : null
|
|
150
|
-
if (at == null) return c('danger', 'none', last == null ? 'no backup run yet' : 'its last run has no time that reads', null, 'sk backup')
|
|
151
|
-
const fresh: CellState = now - at > BOUNDS.run ? 'danger' : 'ok'
|
|
152
|
-
const drill = mine.get<BackupDrill>('backup-drill')
|
|
153
|
-
const dw = drillWords(drill?.at, drill == null ? null : drill.failed === 0, now, BOUNDS.drill, `restored with every sha${drill == null ? '' : ` (${drill.restored} files)`}${drill?.first == null ? '' : `: ${drill.first.path}: ${drill.first.error}`}`)
|
|
154
|
-
return c(worse(fresh, dw.state), shortOf(fresh, at, dw.state), `the backup run of ${ago(at, now)}`, dw.text, fresh === 'danger' ? 'sk backup' : dw.state === 'ok' ? null : 'sk backup drill')
|
|
143
|
+
return stream === 'mediaSpace' ? streamCell(d) : notStreamed(stream)
|
|
155
144
|
}
|
|
156
145
|
const second = t.address.kind === 's3'
|
|
157
146
|
if (second && d.secondPlaceKey === false) return c('warn', 'no key yet', 'no key yet: nothing goes there', null, 'ask 035: the three rv/shipkit/copy-* secrets')
|
|
@@ -159,7 +148,7 @@ function cellOf(store: StoreId, p: Place, d: BackupInputs, machine: string, mine
|
|
|
159
148
|
if (store === 'vault') return sentCell(d.get<TargetSent>(`target-sent:vault:${p.id}`), now, BOUNDS.vault, BOUNDS.vault + 2 * H, 'sk daemon job backup targets')
|
|
160
149
|
if (store === 'hq') return sentCell(d.get<TargetSent>(`target-sent:hq:${p.id}`), now, BOUNDS.hqCopy, BOUNDS.hqCopyDanger, 'sk daemon job backup targets')
|
|
161
150
|
if (second) {
|
|
162
|
-
// the second place copies the whole Space each night, the
|
|
151
|
+
// the second place copies the whole Space each night, the old backup runs with it
|
|
163
152
|
const proof = d.get<Proof>('space-copy-proof')
|
|
164
153
|
const copy = (x: Draft): Draft => ({ ...x, of: 'space copy' })
|
|
165
154
|
if (proof == null) return copy(d.get<boolean>('space-copy') === true ? c('warn', 'not yet', 'the first copy of the Space runs each night until it is whole: no proof yet', null, 'sk space') : c('warn', 'not yet', 'the Space is not copied there: the nightly copy is off', null, 'sk space copy --auto on'))
|
|
@@ -167,7 +156,7 @@ function cellOf(store: StoreId, p: Place, d: BackupInputs, machine: string, mine
|
|
|
167
156
|
const of = `the nightly copy of ${first}`
|
|
168
157
|
if (!proof.ok) return copy(c('danger', 'proof FAILED', `${of} failed its proof ${ago(proof.at, now)}`, proof.why[0] ?? 'the proof failed', 'sk space proof'))
|
|
169
158
|
const age = now - proof.at
|
|
170
|
-
// the backup runs are
|
|
159
|
+
// the backup runs are counted, each night's copy sends them first: the media filling behind them is not
|
|
171
160
|
const waiting = proof.kinds.find((k) => k.kind === 'backup')?.waiting ?? 0
|
|
172
161
|
const state: CellState = age > BOUNDS.spaceCopyDanger ? 'danger' : age > BOUNDS.spaceCopy || waiting > 0 ? 'warn' : 'ok'
|
|
173
162
|
const proved = `${of}, proved ${ago(proof.at, now)}`
|
|
@@ -179,11 +168,7 @@ function cellOf(store: StoreId, p: Place, d: BackupInputs, machine: string, mine
|
|
|
179
168
|
}
|
|
180
169
|
return copy(c(state, state === 'danger' ? `${ago(proof.at, now)}, stale` : ago(proof.at, now), waiting > 0 ? `${proved}; ${waiting} files of the backup runs are not there yet` : proved, 'counts and a sample hashed', state === 'ok' ? null : 'sk space proof'))
|
|
181
170
|
}
|
|
182
|
-
|
|
183
|
-
const sent = sentCell(d.get<TargetSent>(`target-sent:files:${p.id}`), now, BOUNDS.run, BOUNDS.run * 4, 'sk daemon job backup targets')
|
|
184
|
-
const drill = d.get<BackupDrill>(`target-drill:files:${p.id}`)
|
|
185
|
-
const dw = drillWords(drill?.at, drill == null ? null : drill.failed === 0, now, BOUNDS.drill, `restored from it with every sha${drill == null ? '' : ` (${drill.restored} files)`}${drill?.first == null ? '' : `: ${drill.first.path}: ${drill.first.error}`}`)
|
|
186
|
-
return { ...sent, state: worse(sent.state, dw.state), short: dw.state === 'danger' ? 'drill FAILED' : sent.short, proof: dw.text, fix: dw.state === 'ok' || sent.state !== 'ok' ? sent.fix : `sk backup drill --target ${p.id}` }
|
|
171
|
+
return c('dim', 'not here', `nothing of ${store} goes to ${p.label}`)
|
|
187
172
|
}
|
|
188
173
|
|
|
189
174
|
const whereOf = (t: BackupTarget): string => (t.address.kind === 'ssh' ? `${t.address.host}:${t.address.folder}` : t.address.config === 'mediaSpace' ? 'the private Space (s3)' : 'the second place (s3)')
|
|
@@ -201,47 +186,33 @@ export function backupStatus(d: BackupInputs): BackupStatus {
|
|
|
201
186
|
return a?.kind === 'ssh' ? a.host : ''
|
|
202
187
|
}
|
|
203
188
|
const offOf = (p: Place, machine: string): boolean => p.kind === 's3' || (p.kind === 'ssh' && !sameHost(hostOf(p.id), machine))
|
|
204
|
-
const none: Pick<BackupInputs, 'get' | 'timeMachine'> = { get: () => null, timeMachine: null }
|
|
205
|
-
const groups: { machine: string; stale: string | null; mine: Pick<BackupInputs, 'get' | 'timeMachine'>; ids: readonly StoreId[] }[] = [
|
|
206
|
-
{ machine: judge, stale: null, mine: d, ids: STORES.map((s) => s.id) },
|
|
207
|
-
...(d.others ?? []).map((o) => {
|
|
208
|
-
// a machine whose report holds no backup records (an older shipkit, records of a wrong shape) is a row too,
|
|
209
|
-
// orange: a machine left out of the table would let the headline go green over it
|
|
210
|
-
if (o.facts == null) return { machine: o.machine, stale: `${o.machine} does not report its backups (its shipkit is older, or its records did not read): not judged`, mine: none, ids: OWN_STORES }
|
|
211
|
-
const rec = o.facts.records as Record<string, unknown>
|
|
212
|
-
const get = <T,>(k: string): T | null => (k in rec ? ((rec[k] ?? null) as T | null) : null)
|
|
213
|
-
return { machine: o.machine, stale: d.now - o.at > REPORT_STALE_MS ? `${o.machine}'s last report is ${ageWords(o.at, d.now, { short: true })} old: its rows as they were` : null, mine: { get, timeMachine: o.facts.timeMachine }, ids: OWN_STORES }
|
|
214
|
-
}),
|
|
215
|
-
]
|
|
216
189
|
const cells: Cell[] = []
|
|
217
190
|
const stores: StoreRow[] = []
|
|
218
191
|
const alarms: string[] = []
|
|
219
|
-
for (const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
for (const id of g.ids) {
|
|
230
|
-
const s = STORES.find((x) => x.id === id)!
|
|
231
|
-
const row = `${g.machine}/${id}`
|
|
232
|
-
const mine = drafts.get(id)!
|
|
233
|
-
cells.push(...mine)
|
|
234
|
-
const off = mine.filter((c) => c.off)
|
|
235
|
-
const good = off.filter((c) => c.state === 'ok')
|
|
236
|
-
const label = rowName({ id, name: s.name, machine: g.machine })
|
|
237
|
-
if (g.stale == null) {
|
|
238
|
-
// a copy there but not proven (never restored, behind) is said as such: the fix differs from a copy gone
|
|
239
|
-
if (good.length === 0) alarms.unshift(off.some((c) => c.state === 'warn') ? `${label}: NO proven copy off ${g.machine}` : `${label}: NO working copy off ${g.machine}`)
|
|
240
|
-
for (const c of off.filter((x) => x.state === 'danger' && BROKEN.has(x.short))) alarms.push(`${label} on ${places.find((p) => p.id === c.place)!.label}: ${c.text}`)
|
|
192
|
+
for (const s of STORES) {
|
|
193
|
+
const row = `${judge}/${s.id}`
|
|
194
|
+
const mine = places.map((p): Cell => {
|
|
195
|
+
// a record that does not read leaves its cell orange, never the whole table thrown
|
|
196
|
+
let cell: Draft
|
|
197
|
+
try {
|
|
198
|
+
cell = cellOf(s.id, p, d, judge)
|
|
199
|
+
} catch (e) {
|
|
200
|
+
cell = { state: 'warn', short: 'unknown', text: `its records do not read (${(e as Error).message}): not judged`, proof: null, fix: null }
|
|
241
201
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
202
|
+
// the Space's own place and a place it never goes to are no copy of it
|
|
203
|
+
return { ...cell, row, store: s.id, place: p.id, off: offOf(p, judge) && !(s.id === 'space' && cell.state === 'dim') }
|
|
204
|
+
})
|
|
205
|
+
cells.push(...mine)
|
|
206
|
+
const off = mine.filter((c) => c.off)
|
|
207
|
+
const good = off.filter((c) => c.state === 'ok')
|
|
208
|
+
const label = rowName(s)
|
|
209
|
+
// the Space is its provider's: its second copy missing is orange, a broken one red, never « no copy »
|
|
210
|
+
const none = good.length === 0 && s.id !== 'space'
|
|
211
|
+
// a copy there but not proven (never restored, behind) is said as such: the fix differs from a copy gone
|
|
212
|
+
if (none) alarms.unshift(off.some((c) => c.state === 'warn') ? `${label}: NO proven copy off ${judge}` : `${label}: NO working copy off ${judge}`)
|
|
213
|
+
for (const c of off.filter((x) => x.state === 'danger' && BROKEN.has(x.short))) alarms.push(`${label} on ${places.find((p) => p.id === c.place)!.label}: ${c.text}`)
|
|
214
|
+
const state: CellState = none ? 'danger' : off.some((c) => c.state === 'danger') ? 'danger' : off.some((c) => c.state === 'warn') || good.length === 0 ? 'warn' : 'ok'
|
|
215
|
+
stores.push({ row, id: s.id, machine: judge, name: s.name, what: s.what, state, line: `${good.length} of ${off.length} copies off ${judge} work` })
|
|
245
216
|
}
|
|
246
217
|
// the headline is the cells': a cell not proven (unknown, never drilled, behind) keeps it from green
|
|
247
218
|
const unproven = cells.some((c) => c.state === 'warn' || c.state === 'danger') || stores.some((r) => r.state !== 'ok')
|
|
@@ -250,7 +221,7 @@ export function backupStatus(d: BackupInputs): BackupStatus {
|
|
|
250
221
|
}
|
|
251
222
|
|
|
252
223
|
/** every input, read on the machine that carries the hq: the targets of its hq, the kept records, Litestream's files,
|
|
253
|
-
* pm's word on the replica's process, the vault's snapshot folder, Time Machine's prefs
|
|
224
|
+
* pm's word on the replica's process, the vault's snapshot folder, Time Machine's prefs */
|
|
254
225
|
export async function readBackupInputs(now = Date.now()): Promise<BackupInputs> {
|
|
255
226
|
const [{ carriedHq }, { carriesHq }] = await Promise.all([import('../hq/hq-local.ts'), import('../hq/hq-role.ts')])
|
|
256
227
|
const { listTargets } = await import('../hq/backup-targets.ts')
|
|
@@ -264,16 +235,6 @@ export async function readBackupInputs(now = Date.now()): Promise<BackupInputs>
|
|
|
264
235
|
const store = carriesHq() ? carriedHq() : null
|
|
265
236
|
const targets = store == null ? [] : listTargets(store.db)
|
|
266
237
|
const machine = machineName()
|
|
267
|
-
const others: NonNullable<BackupInputs['others']> = []
|
|
268
|
-
// every machine of the owner's (a live node with the grant all), its newest report: one that says nothing of its
|
|
269
|
-
// backups is a row too, orange; a guest's node never adds rows
|
|
270
|
-
for (const m of store?.machines(null) ?? []) {
|
|
271
|
-
if (sameHost(m.name, machine)) continue
|
|
272
|
-
const latest = m.nodes.filter((n) => n.ended == null && n.report != null && store!.seesAll(n.id)).sort((a, b) => b.report!.at - a.report!.at)[0]
|
|
273
|
-
if (latest == null) continue
|
|
274
|
-
const b = latest.report!.body.backups
|
|
275
|
-
others.push({ machine: m.name, at: latest.report!.at, facts: isBackupFacts(b) ? b : null })
|
|
276
|
-
}
|
|
277
238
|
const r = (await askPm().catch(() => null))?.resources.find((x) => x.id === 'hq-replica')
|
|
278
239
|
let folder: string | null = null
|
|
279
240
|
try {
|
|
@@ -303,7 +264,6 @@ export async function readBackupInputs(now = Date.now()): Promise<BackupInputs>
|
|
|
303
264
|
vaultNear: { count, newest },
|
|
304
265
|
timeMachine: await timeMachineFacts(now),
|
|
305
266
|
secondPlaceKey: second == null ? null : !('failed' in second && second.failed.startsWith('no key yet')),
|
|
306
|
-
others,
|
|
307
267
|
}
|
|
308
268
|
}
|
|
309
269
|
|
|
@@ -335,7 +295,7 @@ export const alarmKeys = (s: BackupStatus): string[] =>
|
|
|
335
295
|
s.stale != null
|
|
336
296
|
? []
|
|
337
297
|
: [
|
|
338
|
-
...s.stores.filter((r) => r.stale !== true && !s.cells.some((c) => c.row === r.row && c.state === 'ok' && c.off)).map((r) => `${r.row}:none`),
|
|
298
|
+
...s.stores.filter((r) => r.stale !== true && r.id !== 'space' && !s.cells.some((c) => c.row === r.row && c.state === 'ok' && c.off)).map((r) => `${r.row}:none`),
|
|
339
299
|
...s.cells.filter((c) => c.state === 'danger' && BROKEN.has(c.short) && c.off && s.stores.find((r) => r.row === c.row)?.stale !== true).map((c) => `${c.row}@${c.place}`),
|
|
340
300
|
]
|
|
341
301
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// check. Pure: the hub's bundle imports it
|
|
3
3
|
import type { BackupStatus, StoreRow } from './backup-status.ts'
|
|
4
4
|
|
|
5
|
-
/** the name a line says:
|
|
6
|
-
export const rowName = (r: Pick<StoreRow, '
|
|
5
|
+
/** the name a line says: every store of the table is the house's */
|
|
6
|
+
export const rowName = (r: Pick<StoreRow, 'name'>): string => r.name
|
|
7
7
|
|
|
8
8
|
export function verdictWords(s: BackupStatus): string {
|
|
9
9
|
if (s.stale != null) return `not read: ${s.stale}`
|