feat(api): schedules ingest endpoint for agents and CI - #244
Merged
Conversation
🔍 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
force-pushed
the
feat/242-schedules-ingest
branch
from
September 2, 2026 05:43
813bcbb to
84c99ff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
POST /api/schedules/ingest— creates a draft schedule from machine-originated callers (agents, CI pipelines).IngestSchedulethat deliberately has noauto_approvefield — the HITL gate is structural, not conventional. Machine-originated schedules can never skip human approval.reply_to_idrestricted to TEXT media type with target existence check.sourcecolumn (migration 016, duplicate-column-tolerant like 005/014) records free-form provenance such ascmo-agentorci-pipeline; set at creation, immutable afterwards. Regular creates leave itNULL.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 withsource, caption-over-limit rejection, invalid reply target rejection)cargo test --workspace→ 216 passed, 0 failedcargo clippy --workspace --all-targets -- -D warnings→ cleancargo fmt --check→ clean