Files
activity-core/workplans/ACTIVITY-WP-0019-automation-schedule-inventory-targets.md
2026-07-01 20:12:04 +02:00

5.9 KiB

id, type, title, domain, repo, status, owner, topic_slug, created, updated, state_hub_workstream_id
id type title domain repo status owner topic_slug created updated state_hub_workstream_id
ACTIVITY-WP-0019 workplan Automation schedule inventory Make targets infotech activity-core ready codex automation-inventory 2026-06-29 2026-06-29 21c73763-9adc-42f6-8fd2-1b8b33c2c770

Automation schedule inventory Make targets

Goal

Provide a repo-native, non-LLM way to list every scheduled automation that activity-core knows about.

ACTIVITY-WP-0018 added the status surface for questions like "How did our automations go since Friday?". The next operator question is the inventory baseline: "What automations are scheduled at all?" That should be answerable through Make targets backed by activity-core's own ActivityDefinitions, database, and Temporal schedule metadata when available, independent of any coding assistant automation infrastructure.

Review notes

  • Makefile currently exposes automation-status and automation-status-json, but no dedicated inventory/list target.
  • scripts/automation_status.py and src/activity_core/automation_status.py already load scheduled ActivityDefinitions and compute their Temporal schedule ids. The inventory target should reuse that parsing/loading posture where it fits rather than creating a second discovery path.
  • make sync-schedules reconciles Temporal schedules from the activity_definitions database, but it is an action target, not a read-only operator inventory command.
  • The inventory command should remain useful in degraded local mode: file-backed definitions are enough to list configured scheduled automations, while live DB and Temporal visibility can enrich the output.

Task: Define the automation inventory contract

id: ACTIVITY-WP-0019-T01
status: todo
priority: high
state_hub_task_id: "8de24590-f9ee-4d0e-8692-b7ada9f232ed"

Define the fields and source precedence for a deterministic scheduled automation inventory report.

Acceptance:

  • The report includes every ActivityDefinition with trigger_type of cron or scheduled, including disabled definitions.
  • Each row includes id, name, enabled/disabled state, trigger type, schedule expression or one-shot datetime, timezone, overlap/catchup policy when known, and the derived Temporal schedule id.
  • The report identifies its source for each row: database, repo definition file, Temporal visibility, or a combination.
  • If Temporal is reachable, the report adds paused/missing/drift hints without mutating schedules.
  • Missing optional sources produce warnings, not silent omissions.
  • The JSON shape is stable enough for scripts and tests.

Task: Implement a non-mutating inventory CLI

id: ACTIVITY-WP-0019-T02
status: todo
priority: high
state_hub_task_id: "538cb9a5-48f3-470c-8518-29ee66c96678"

Add a deterministic CLI path for listing scheduled automations without requiring LLM credentials or coding assistant tooling.

Acceptance:

  • A script or module command, likely sharing code with activity_core.automation_status, supports human and JSON output.
  • The command is read-only: it does not call sync-schedules, upsert schedules, delete schedules, enqueue workflows, or write State Hub evidence.
  • It supports filters by activity id, activity name, enabled state, and trigger type.
  • It loads from the database when configured and falls back to repo definition files when the database is unavailable or explicitly disabled.
  • It optionally enriches rows from Temporal when TEMPORAL_HOST is configured, with bounded timeouts so an unreachable service does not hang the command.
  • Unit tests cover DB rows, file fallback, disabled definitions, Temporal enrichment unavailable, and JSON output.

Task: Add Make targets

id: ACTIVITY-WP-0019-T03
status: todo
priority: high
state_hub_task_id: "f2001721-07f3-42f5-a15e-0c7d1b0ed801"

Expose the inventory command through Make targets that are easy for humans, scripts, and coding assistants to run before asking for a prose summary.

Acceptance:

  • make automation-list prints a concise human-readable inventory.
  • make automation-list-json emits the same inventory as JSON.
  • Optional Make variables pass through cleanly, for example ENABLED=true, TRIGGER=cron, ACTIVITY_ID=<uuid>, or FORMAT=json.
  • make help lists both targets with clear one-line descriptions.
  • The targets do not require LLM access, Codex automation tooling, or interactive prompts.

Task: Document the inventory workflow

id: ACTIVITY-WP-0019-T04
status: todo
priority: medium
state_hub_task_id: "f687743b-3936-413e-ae50-d35484ae9a81"

Update operator documentation so the scheduled automation inventory path is discoverable next to the status path.

Acceptance:

  • docs/runbook.md documents make automation-list and make automation-list-json.
  • The docs distinguish inventory from status: inventory answers what is configured; status answers what happened in a time window.
  • The docs state that the command is read-only and uses activity-core-owned scheduling evidence.
  • The docs include a compact example of the expected human output.

Task: Verify against current repo and live/degraded sources

id: ACTIVITY-WP-0019-T05
status: todo
priority: medium
state_hub_task_id: "5317b532-5cef-4eff-b6d8-3e85bbca8e8a"

Prove the target against the current scheduled automation definitions and degraded local conditions.

Acceptance:

  • make automation-list shows the current scheduled automations, including daily triage and weekly scheduled definitions when present in the selected source.
  • JSON output is valid and includes the same rows.
  • A DB-unavailable run falls back to repo definition files or reports a clear warning if no definitions are discoverable.
  • A Temporal-unavailable run exits successfully with Temporal warnings rather than hanging.
  • Focused tests pass and the result is recorded in this workplan before the workplan is moved to finished.