Jump to content

MindAttic.Scheduler/SPEC

From MindAttic Docs

MindAttic.Scheduler — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

In the ecosystem (docs/ECOSYSTEM.md at the workspace root): Platform: owns scheduled jobs (every recurring job is declared in its manifest and nowhere else).

MindAttic.Scheduler is the one home for every scheduled job on the owner's PC. Each job is a line in jobs.json; install.ps1 makes Windows Task Scheduler match it; a run wrapper records every run in a SQL run log; overnight jobs arrange themselves; apps add their own runtime jobs; a WPF dashboard shows and edits them all. It also keeps the local databases safe: a nightly local SQL backup and a DbSync engine that copies every local database to a remote SQL server. The finished product runs every job from current R: deploys, with no Azure leftovers, and copies the databases off-site every night.

2. Scope boundary

2.1 In the product

  • The manifest, install.ps1, quiet headless jobs, daemon restart.
  • The run wrapper, run log with spooling, overnight arrangement and lock.
  • Runtime jobs for apps and the jobs dashboard.
  • Local SQL backup and off-site DbSync.
  • The R: run menu.

2.2 Never in the product

  • Running jobs on Linux or other machines (systemd timer provider, M.SCHD-T57, T59): it schedules one PC.
  • An Azure job provider, Azure backups or Entra token code: Azure is decommissioned (MAT-T297).
  • A C:-drive temp-cleanup job (M.SCHD-T28): the Orchestrator's disk-cleanup floor (M.ORCH-T1449) owns it.
  • Its own cron daemon: Windows Task Scheduler fires the jobs.
  • Owning a job's own logic: a job's script or exe lives in its own repo.
  • Generic bughunt sweeps as tickets (M.SCHD-T56).
  • Deciding GridGame.Nightly: GridGame's charter decides it (M.SCHD-T78).

3. Users and roles

  • The owner edits jobs.json or the dashboard and reads last night's runs.
  • Apps (Psst and others) add and cancel runtime jobs under their own owner folder.
  • Task Scheduler fires the jobs; the run log keeps their history.

4. Requirements

Status is built (closed ticket, with evidence) or MS-n: the milestone in §7 that delivers it.

E1. Manifest and install — M.SCHD-T97 — built

F1.1 One manifest — M.SCHD-T98 — built

  • S1.1.1 Idempotent install — M.SCHD-T99 — built As the owner, I want install.ps1 to make Task Scheduler match jobs.json, so a job is one line to change. Acceptance: Given an unchanged manifest, when install runs again, then nothing changes. Evidence: tests/install.Tests.ps1.
  • S1.1.2 Retired jobs unregistered — M.SCHD-T100 — built (M.SCHD-LAW-1).
  • S1.1.3 Manifest without jobs refused — M.SCHD-T101 — built (M.SCHD-LAW-2).
  • S1.1.4 Quiet jobs — M.SCHD-T102 — built Acceptance: Given any job, when it fires, then no window opens and no password or elevation is needed.
  • S1.1.5 Daemons restart up to 999 times — M.SCHD-T51 — built. Evidence: b52ac18.

E2. Run recording and arrangement — M.SCHD-T103 — built

F2.1 Run log — M.SCHD-T104 — built

  • S2.1.1 Every run recorded — M.SCHD-T105 — built Acceptance: Given a wrapped job, when it ends, then start, end and exit code are in the run log and Last Run Result is accurate.
  • S2.1.2 Spool when the log is down — M.SCHD-T106 — built (M.SCHD-LAW-3).
  • S2.1.3 Run log on any SQL Server — M.SCHD-T107 — built. Evidence: 519732d.

F2.2 Overnight arrangement — M.SCHD-T108 — built

  • S2.2.1 Overnight jobs arrange themselves — M.SCHD-T42 — built. Evidence: 8806562.
  • S2.2.2 One overnight job at a time — M.SCHD-T109 — built.

E3. Runtime jobs and dashboard — M.SCHD-T110 — built

F3.1 Runtime jobs — M.SCHD-T111 — built

  • S3.1.1 App-owned jobs — M.SCHD-T112 — built As an app, I want scheduler job add|cancel|list|status|enable|disable under my own folder, so install.ps1 never touches my jobs.

F3.2 Jobs dashboard — M.SCHD-T113 — built

  • S3.2.1 Job list and schedule editor — M.SCHD-T114 — built (M.SCHD-LAW-4).
  • S3.2.2 Optimize preview and last night — M.SCHD-T115 — built.

E4. Database copies — M.SCHD-T116 — built

F4.1 Local SQL backup — M.SCHD-T117 — built

  • S4.1.1 Every local database backed up nightly — M.SCHD-T73 — built. Evidence: f5a463a.

F4.2 Incremental DB sync to the remote host — M.SCHD-T60 — built

  • S4.2.1 dbsync.json settings — M.SCHD-T61 — built. Evidence: d4f2887.
  • S4.2.2 Change Tracking setup — M.SCHD-T63 — built. Evidence: ed7bd99.
  • S4.2.3 One database, one run — M.SCHD-T69 — built. Evidence: f25d0af.
  • S4.2.4 dbsync CLI — M.SCHD-T70 — built. Evidence: 6d87f5d.
  • S4.2.5 Bootstrap a missing target — M.SCHD-T72 — built. Evidence: 548f6e7.
  • S4.2.6 Job registered, disabled until a target exists — M.SCHD-T71 — built. Evidence: 0d43ffa.

E5. Deploy — M.SCHD-T118 — built

F5.1 Run menu — M.SCHD-T119 — built

  • S5.1.1 Deploy to R: — M.SCHD-T120 — built. Evidence: dc84b95.

E6. Jobs on current paths — M.SCHD-T79 — MS-61

F6.1 Daemon job runs the current Orchestrator — M.SCHD-T80 — MS-61

  • Orchestrator.Daemon runs MindAttic.Orchestrator.Daemon.exe from its current deploy — M.SCHD-T22 (task) Acceptance: Given install.ps1, when it runs, then the task runs MindAttic.Orchestrator.Daemon.exe, not MindAttic.Orchestrator.exe --daemon.

F6.2 No C: deploy remains — M.SCHD-T81 — MS-61

  • C:\Apps\MindAttic.Scheduler deleted after nothing runs it — M.SCHD-T77 (task)

E7. Manifest is the truth — M.SCHD-T82 — MS-61

F7.1 Requested jobs registered — M.SCHD-T83 — MS-61

  • IdiotProof.AllDayMovers registered — M.SCHD-T45 (task)

F7.2 Azure leftovers retired — M.SCHD-T84 — MS-61

  • Remove the Azure jobs, AzureJobProvider and EntraTokenCache — M.SCHD-T85 (task)

E8. Database copies are reliable — M.SCHD-T121 — MS-61

F8.1 Database sync proven on main — M.SCHD-T122 — MS-61

  • A row written after the start version arrives next run — M.SCHD-T90 (fix)
  • Vectors in a temporal pair are copied exactly — M.SCHD-T91 (fix)

E9. Off-site database copies — M.SCHD-T123 — MS-137

F9.1 Remote target live — M.SCHD-T124 — MS-137

  • S9.1.1 Remote target configured — M.SCHD-T125 — MS-137 (owner hands-on: the target and its login in Vault) Acceptance: Given the target in dbsync.json, when dbsync --dry-run runs, then every database reports configured.
  • S9.1.2 First full sync — M.SCHD-T126 — MS-137 (requires T125) Acceptance: Given an empty target, when dbsync --full runs, then the schema is created and every table copied; a second run reports Unchanged.
  • S9.1.3 Nightly sync enabled — M.SCHD-T127 — MS-137 (requires T126) Acceptance: Given the job enabled in jobs.json, when the night passes, then its run shows in the dashboard's Last-night view.

F9.2 Polish and release 1.1 — M.SCHD-T128 — MS-137

  • S9.2.1 Docs match 1.1 — M.SCHD-T129 — MS-137
  • S9.2.2 Owner signs off 1.1 — M.SCHD-T130 — MS-137 (owner hands-on)

Coordination

  • Scheduler follows the GridGame move — M.SCHD-T94 — lives in GridGame.Unity's rename feature (GG-T2261).

5. Non-functional requirements

  • Windows Task Scheduler on the user's Interactive token; no stored password, no elevation, no window.
  • Core and CLI net10.0; dashboard net10.0-windows; NUnit and Pester tests.
  • Logging never breaks a job; secrets and connection strings only through Vault or dbsync.json placeholders.

6. Interfaces and dependencies

Platform repos used, by concern: credentials and connection settings: MindAttic.Vault; the Orchestrator daemon it keeps running: MindAttic.Orchestrator; off-site database target: the Hetzner server (MindAttic.Agency MS-94); shipping: the run menu.

  • Jobs call other repos' exes and scripts: Launcher, Orchestrator, IdiotProof, Prose, Tickets, JellyFinPoster, Unstuck, Automata.
  • Apps use scheduler job ... for runtime jobs.
  • DbSync reads the local SQL Server and writes the remote target (the Hetzner server, MAT-T221).

7. Release sequence

  1. MS-61 (active): every job runs from current paths, nothing points at retired infrastructure, main is green — epics E6, E7, E8.
  2. MS-137: Scheduler 1.1, off-site database copies — epic E9, ending with polish and release. This is the finished product.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from README, BIBLE, jobs.json, code and the ticket history; DbSync test fixes added to MS-61; MS-137 added as the finishing milestone MAT-T381
2026-11-30 MAT-T462 single-source pass: 4 renamed (E8 Database copies are reliable, features as outcomes); single-feature E8 kept as the reliability outcome that MS-137 builds on; 3 requires added (daemon job waits on M.ORCH-T2360, off-site copies wait on Hetzner MAT-T221 and on T122) MAT-T464
From MindAttic.Scheduler/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.