Commit Graph

9 Commits

Author SHA1 Message Date
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
027e41dbc0 feat(db): add dev seed script for ActivityDefinition — T12
src/activity_core/seed.py: inserts one example ActivityDefinition
('example-heartbeat', cron every minute, static context source,
log_message task template). Idempotent — skips by name on re-run.

Run with:
  ACTCORE_DB_URL=postgresql+asyncpg://actcore:actcore@localhost:5433/actcore \
      python -m activity_core.seed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 21:53:59 +00:00
cb7cf3bc8c feat(db): ORM models + Alembic migrations 0001–0003 — T09/T10/T11
SQLAlchemy ORM (src/activity_core/orm.py):
  - ActivityDefinition, ActivityRun, TaskInstance mapped to Base.metadata
  - Wired into migrations/env.py for autogenerate support

Migrations (chained 0001 → 0002 → 0003):
  - 0001: activity_definitions (id, name, enabled, trigger_type,
          trigger_config JSONB, context_sources JSONB, task_templates JSONB,
          dedupe_key_strategy, version, created_at, updated_at)
  - 0002: activity_runs (run_id, activity_id FK→activity_definitions,
          scheduled_for, fired_at, context_snapshot JSONB, tasks_spawned,
          version_used) + index on activity_id
  - 0003: task_instances (id, run_id FK→activity_runs CASCADE,
          type, params JSONB, status, created_at) + index on run_id

Apply with: ACTCORE_DB_URL=... alembic upgrade head

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 21:51:01 +00:00
f55f497107 feat(db): init Alembic (async) + SQLAlchemy declarative base — T08
- alembic init -t async migrations
- alembic.ini: dev fallback URL postgresql+asyncpg://…:5433/actcore;
  ACTCORE_DB_URL env var overrides at runtime; src/ added to sys.path
- migrations/env.py: reads ACTCORE_DB_URL, wires target_metadata to Base.metadata
- src/activity_core/db.py: DeclarativeBase subclass + make_engine() helper

Tool choice: Alembic + SQLAlchemy[asyncio] (already declared in pyproject.toml).
Migrations run with: ACTCORE_DB_URL=... alembic upgrade head

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 21:45:40 +00:00
c39c32abcd fix(docker): use fully-qualified docker.io image refs; mark T07 done
Prefix all image names with docker.io/ to avoid registry ambiguity
on hosts where containerd/Podman default to docker.io but the pull
fails without an explicit registry prefix.

Also marks T07 (smoke-test Temporal cluster and UI) as done in the
workplan now that the stack boots cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 21:26:33 +00:00
045461282d chore: add .custodian-brief.md protocol and unblock T07
- CLAUDE.md: read .custodian-brief.md as Step 1 (offline-safe orientation
  before MCP call); matches pattern now standard across all domain repos
- T07 (Smoke test Temporal): remove stale Docker TLS blocking_reason;
  status → todo (WSL2 MTU issue resolved by implementing on CoulombCore)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 21:03:56 +01:00
6f9132314f Add project scaffold: contracts, schemas, docker-compose, workplans
Phase 0 contracts (event envelope, ActivityDefinition, idempotency doc,
naming conventions) and Phase 1 Temporal cluster setup (docker-compose.dev.yml,
Temporal dynamic config) are complete. Includes Pydantic models, JSON schemas,
wiki architecture docs, and ADR-001 workplan files for both workstreams.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 22:45:40 +01:00