Commit Graph

63 Commits

Author SHA1 Message Date
ea5fbe0bf3 feat(WP-0002): complete Triggers & Ops workstream
Delivers all 12 tasks (T22–T33): Temporal Schedule manager + startup
sync, NATS JetStream event router, FastAPI CRUD + manual trigger,
Prometheus metrics wiring, custom search-attribute tagging, and
operational runbook. Marks workplan status as done.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 01:04:43 +01:00
9f15296e25 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-28:
  - update .custodian-brief.md for activity-core
2026-03-28 00:59:21 +01:00
48fce91536 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-28:
  - update .custodian-brief.md for activity-core
2026-03-28 00:43:49 +01:00
b112f0920f chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-28:
  - update .custodian-brief.md for activity-core
2026-03-28 00:28:33 +01:00
9be8bfecb7 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-28:
  - update .custodian-brief.md for activity-core
2026-03-28 00:11:19 +01:00
4457d6d6b9 chore: add WP-0002 handoff note for CoulombCore continuation
All 12 tasks unblocked (broker decision resolved: NATS + JetStream).
Work interrupted on workstation due to WSL2 Docker pull issues.
Note captures build order, file names, key design decisions, and
state hub IDs for seamless pickup on CoulombCore.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 00:10:33 +01:00
3593f76361 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 23:55:19 +01:00
c565fbc0b1 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 23:39:11 +01:00
d51144872c chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 23:23:12 +01:00
64f76a9939 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 23:07:13 +01:00
bb5475ef14 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 22:51:41 +01:00
682caa4893 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 22:35:29 +01:00
96e754dd2d chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 22:19:19 +01:00
b21dfbdada chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 14:00:12 +01:00
acc913050e chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 13:43:38 +01:00
7df22516d5 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 13:26:40 +01:00
5408caa045 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 12:54:37 +01:00
45e4b6265f chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 09:52:45 +01:00
ffcda0b07e chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 09:36:04 +01:00
459628cd73 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 09:17:51 +01:00
9977884e51 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 05:00:11 +01:00
8fa6072bac chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 04:44:10 +01:00
28ff5e3073 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 04:28:11 +01:00
9270a46a60 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 04:12:19 +01:00
657e30ed61 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 03:56:11 +01:00
328a4bd435 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 03:40:11 +01:00
fef9cddfee chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 03:24:10 +01:00
70a384c6e2 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 03:08:37 +01:00
6ef60f4448 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 02:52:50 +01:00
cabe9b34ab chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 02:37:13 +01:00
c8e20eb3ee chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 02:21:32 +01:00
230be8899d chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 02:05:21 +01:00
284927d550 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 01:49:02 +01:00
dddf7148df chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 01:34:08 +01:00
a62116ed68 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 01:18:09 +01:00
6ef34b4e0d feat(e2e): add run-on-host.sh for automated cron on railiance01
CUST-WP-0028-T06:
- e2e/run-on-host.sh: standalone script for native execution on railiance01
  (no SSH from workstation). git pull → compose up → health wait →
  test_full_flow.py → compose down → report to state-hub via ops-bridge.

Install via: make e2e-cron-install REPO=activity-core  (from ~/the-custodian)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:02:21 +01:00
a57eee51f4 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 01:01:46 +01:00
8d8a353901 feat(e2e): add e2e contract and test script (closes T21)
CUST-WP-0028-T03/T04:
- e2e/e2e.yml: declares stack (docker-compose.dev.yml), Temporal UI
  health check, test command
- e2e/tests/test_full_flow.py: automates WP-0001 T21 — seeds DB, starts
  workers, triggers RunActivityWorkflow, polls completion, asserts
  ActivityRun + TaskInstances written to DB

Run via: make e2e REPO=activity-core  (from ~/the-custodian)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 00:52:47 +01:00
d6fcb1398a chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 00:47:32 +01:00
1df1ebaf99 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-27:
  - update .custodian-brief.md for activity-core
2026-03-27 00:44:25 +01:00
22f9c03474 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-26:
  - update .custodian-brief.md for activity-core
2026-03-27 00:20:25 +01:00
9c8b123457 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-26:
  - update .custodian-brief.md for activity-core
2026-03-27 00:20:25 +01:00
34aa70cbd9 feat(workflows): TaskExecutorWorkflow stub + wire worker — T19/T20
activities.py — persist_task_instance (new):
  Idempotent INSERT ... ON CONFLICT (id) DO NOTHING on task_instances.
  task_id passed in from workflow (derived from workflow_id via uuid5).
  Registered on task-execution-tq.

workflows.py — TaskExecutorWorkflow (T19):
  Derives stable task_id = uuid5(NAMESPACE_URL, workflow_id).
  Calls persist_task_instance → status=done, returns immediately.
  Real execution logic to replace stub in a later workstream.

worker.py — T20:
  Registers persist_task_instance on task-execution-tq Worker.
  Both queues fully wired: orchestrator-tq and task-execution-tq.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:30:50 +00:00
da7de6ea3b feat(workflows): implement RunActivityWorkflow — T18
workflows.py — RunActivityWorkflow:
  1. load_activity_definition(activity_id)
  2. resolve_context(context_sources)
  3. evaluate_templates (pure, called in-workflow)
  4. log_run({run_id, ...}) — run_id = uuid5(NAMESPACE_URL, activity_id:trigger_key)
  5. start_child_workflow(TaskExecutorWorkflow, ...) per task spec
     ABANDON parent-close policy (fire-and-forget)
  Returns {"run_id": str, "tasks_spawned": int}

activities.py — log_run updated:
  - now accepts run_id in run_payload (deterministic, passed from workflow)
  - uses pg INSERT ... ON CONFLICT (run_id) DO NOTHING for idempotency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:25:19 +00:00
068780224e feat(activities): implement log_run — T17
Inserts an ActivityRun row via the shared session factory.
Accepts run_payload dict with activity_id, scheduled_for (ISO-8601 or
None), context_snapshot, tasks_spawned, version_used.
Returns run_id as a str UUID.
fired_at is set server-side to now(UTC).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:19:12 +00:00
6e24ef9d3b chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-26:
  - update .custodian-brief.md for activity-core
2026-03-26 23:11:20 +01:00
62df10cc6a chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-26:
  - update .custodian-brief.md for activity-core
2026-03-26 23:11:20 +01:00
bac3efee89 feat(activities): resolve_context stub + evaluate_templates — T15/T16
activities.py — resolve_context (T15):
  - dispatches on source.type: 'static' returns config["value"]
  - 'http_get' / 'db_query' raise ApplicationError(non_retryable=True)
  - unknown types raise ApplicationError(non_retryable=True)

template_engine.py — evaluate_templates (T16, pure function):
  - evaluates optional condition expressions against context snapshot
    (restricted eval, no builtins)
  - interpolates {context.<name>.<key>} placeholders via str.format_map
  - returns list[{task_type, params}] with falsy-condition rows omitted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:06:09 +00:00
5e4dc6c946 feat(activities): implement load_activity_definition — T14
activities.py:
- init_session_factory(url): module-level async_sessionmaker init,
  called once from worker.py before workers start
- load_activity_definition(activity_id): queries activity_definitions
  by UUID, returns JSON-serialisable dict; raises ApplicationError
  (non_retryable=True) if row not found

worker.py:
- reads ACTCORE_DB_URL at startup, fails fast if missing
- calls init_session_factory() before connecting to Temporal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:02:15 +00:00
21edc313db feat(worker): scaffold activities, workflows, worker entrypoint — T13
src/activity_core/activities.py:
  - load_activity_definition, resolve_context, log_run — @activity.defn
    stubs (raise NotImplementedError, bodies in T14–T17)

src/activity_core/workflows.py:
  - RunActivityWorkflow (orchestrator-tq) — @workflow.defn stub (T18)
  - TaskExecutorWorkflow (task-execution-tq) — @workflow.defn stub (T19)

src/activity_core/worker.py:
  - Connects to Temporal via TEMPORAL_HOST / TEMPORAL_NAMESPACE env vars
  - Spawns two Workers: orchestrator-tq and task-execution-tq
  - Runs until cancelled (python -m activity_core.worker)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 21:57:56 +00:00