generated from coulomb/repo-seed
205 lines
7.7 KiB
Markdown
205 lines
7.7 KiB
Markdown
---
|
|
id: ACTIVITY-WP-0019
|
|
type: workplan
|
|
title: "Automation schedule inventory Make targets"
|
|
domain: infotech
|
|
repo: activity-core
|
|
status: finished
|
|
owner: codex
|
|
topic_slug: automation-inventory
|
|
created: "2026-06-29"
|
|
updated: "2026-07-01"
|
|
state_hub_workstream_id: "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
|
|
|
|
```task
|
|
id: ACTIVITY-WP-0019-T01
|
|
status: done
|
|
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
|
|
|
|
```task
|
|
id: ACTIVITY-WP-0019-T02
|
|
status: done
|
|
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
|
|
|
|
```task
|
|
id: ACTIVITY-WP-0019-T03
|
|
status: done
|
|
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
|
|
|
|
```task
|
|
id: ACTIVITY-WP-0019-T04
|
|
status: done
|
|
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
|
|
|
|
```task
|
|
id: ACTIVITY-WP-0019-T05
|
|
status: done
|
|
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`.
|
|
|
|
|
|
## Implementation Result
|
|
|
|
Completed 2026-07-01: implemented the read-only scheduled automation inventory
|
|
surface.
|
|
|
|
Delivered:
|
|
|
|
- `scripts/automation_inventory.py` exposes the inventory CLI backed by
|
|
`activity_core.automation_status` shared definition and Temporal helpers.
|
|
- `make automation-list` and `make automation-list-json` list configured
|
|
scheduled ActivityDefinitions with filters for `ENABLED`, `TRIGGER`,
|
|
`ACTIVITY_ID`, and `ACTIVITY_NAME`.
|
|
- JSON output is script-safe; the Make JSON target suppresses command echo and
|
|
recursive make directory chatter.
|
|
- `docs/runbook.md` now distinguishes inventory (what is configured) from status
|
|
(what happened in a time window).
|
|
- Tests cover DB-backed rows, file fallback, disabled filtering, Temporal
|
|
unavailable warnings, and JSON CLI output.
|
|
|
|
Verification:
|
|
|
|
```bash
|
|
/home/worsch/.local/bin/uv run pytest tests/test_automation_status.py tests/test_daily_triage_verifier.py -q
|
|
bash -lc 'export PATH="/home/worsch/.local/bin:$PATH"; make automation-list ACTCORE_DB_URL= TEMPORAL_HOST='
|
|
bash -lc 'export PATH="/home/worsch/.local/bin:$PATH"; make automation-list-json ACTCORE_DB_URL= TEMPORAL_HOST= > /tmp/activity-core-inventory.json && python3 -m json.tool /tmp/activity-core-inventory.json >/tmp/activity-core-inventory.pretty'
|
|
bash -lc 'export PATH="/home/worsch/.local/bin:$PATH"; make automation-list ACTCORE_DB_URL= TEMPORAL_HOST= ENABLED=true TRIGGER=cron'
|
|
bash -lc 'export PATH="/home/worsch/.local/bin:$PATH"; make help'
|
|
```
|
|
|
|
Results:
|
|
|
|
- focused tests: `16 passed`;
|
|
- degraded Make inventory run listed 9 file-backed scheduled automations, with
|
|
5 enabled and 4 disabled;
|
|
- filtered Make run with `ENABLED=true TRIGGER=cron` listed 5 enabled cron
|
|
automations;
|
|
- `automation-list-json` emitted parseable JSON directly;
|
|
- `make help` lists `automation-list` and `automation-list-json`.
|