Skip to content

feat(api): schedules ingest endpoint for agents and CI - #244

Merged
ajianaz merged 1 commit into
developfrom
feat/242-schedules-ingest
Sep 2, 2026
Merged

feat(api): schedules ingest endpoint for agents and CI#244
ajianaz merged 1 commit into
developfrom
feat/242-schedules-ingest

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What

  • Adds POST /api/schedules/ingest — creates a draft schedule from machine-originated callers (agents, CI pipelines).
  • New request schema IngestSchedule that deliberately has no auto_approve field — the HITL gate is structural, not conventional. Machine-originated schedules can never skip human approval.
  • Validation is shared with regular create: caption length limit, reply_to_id restricted to TEXT media type with target existence check.
  • New source column (migration 016, duplicate-column-tolerant like 005/014) records free-form provenance such as cmo-agent or ci-pipeline; set at creation, immutable afterwards. Regular creates leave it NULL.
  • OpenAPI entry for the new endpoint.

Why

Closes #242 (split from #191). Agent/CI callers need a first-class way to enqueue content without widening the regular create path — and without any risk of bypassing the human-approval workflow that #232 established.

Testing

  • cargo test -p titen-api --test api_schedules → 12 passed (3 new: draft creation with source, caption-over-limit rejection, invalid reply target rejection)
  • cargo test --workspace → 216 passed, 0 failed
  • cargo clippy --workspace --all-targets -- -D warnings → clean
  • cargo fmt --check → clean
  • Local pre-commit cora review → passed

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

/// The schedule is ALWAYS created as `draft` — the human-approval gate is
/// non-negotiable for machine-originated content. `source` badges the item
/// with its origin so the calendar/UI can show where it came from.
pub async fn ingest_schedule(
POST /api/schedules/ingest creates a DRAFT schedule from machine-originated
callers. HITL gate: the ingest schema has no auto_approve field — approval
always stays with a human. Validation is shared with regular create (caption
limit, reply_to_id TEXT-only + target existence). New 'source' column
(migration 016) records free-form provenance, e.g. 'cmo-agent' or 'ci-pipeline';
immutable after creation. OpenAPI entry + 3 new API tests.
@ajianaz
ajianaz force-pushed the feat/242-schedules-ingest branch from 813bcbb to 84c99ff Compare September 2, 2026 05:43
@ajianaz
ajianaz merged commit a82389e into develop Sep 2, 2026
12 checks passed
@ajianaz
ajianaz deleted the feat/242-schedules-ingest branch September 2, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(api): schedules ingest endpoint for agent drafts

2 participants