fix(tasks): cover syncProject wiring and allow deleting orphans after file removal

Review follow-up:

- runtime.test.js: add syncProject wiring tests with a real temp-dir
  project and real project-config runtime — asserts reconcileLoopTasks is
  driven with the discovered loops when the project path is known (task
  created, nextRunAt computed) and that plain listing is used when the
  path cannot be resolved (reconcile not called).
- service.js: DELETE on a loop-owned task is rejected with a 400 only
  while its loop file still exists on disk; once the file is gone the
  orphan task can be deleted directly instead of waiting for the next
  reconcile. Tests use real temp files for both branches.
- DOCUMENTATION.md: delete semantics updated accordingly.
- PR description refreshed for the final HEAD (test counts, reconciliation
  contract, evidence wording).
This commit is contained in:
makeittech
2026-08-06 09:49:31 +03:00
parent 59a6c1b70d
commit 9b6b90504c
4 changed files with 156 additions and 21 deletions
@@ -96,10 +96,11 @@ project write lock on every `syncProject` when the project path is known:
- **UI edits** to a loop-sourced task are preserved in the config but the loop
file remains authoritative: the next reconciliation re-applies the file's
definition (including `enabled`). Use `enabled: false` in the file to
disable. Deleting a loop-sourced task through the API is rejected with a 400 —
the loop file is the removal surface. The scheduled-tasks UI marks loop tasks
as file-managed and disables their edit/enable/delete actions for the same
reason; `run now` remains available.
disable. Deleting a loop-sourced task through the API is rejected with a 400
while its loop file still exists on disk — the loop file is the removal
surface; once the file is gone, deleting the orphan task is allowed. The
scheduled-tasks UI marks loop tasks as file-managed and disables their
edit/enable/delete actions for the same reason; `run now` remains available.
## Public exports (runtime.js)