Repository navigation
#26 criterion 3: the built-in operations engine and the Operations API (first slice) - #774
Merged
Merged
Conversation
… 3, first slice) The built-in engine runs each operation template's steps in the cmapi worker, as jobs of kind operation_step, with their state in PostgreSQL (migration 0013: operations, operation_steps). Templates: tiers-rerender and rebuild-verify end to end; reconcile and cluster-onboard as far as what they need is built (#761, #762, #763, #765). Routes: POST, GET /api/v1/operations, GET /api/v1/operations/{id}, POST /api/v1/operations/{id}:cancel, each needing operations:run where the run acts. Steps open ordinary requests as svc-cmapi-workflows on behalf of the starter, retry as the template's retry block says, survive a dead worker by the job lease and a per-row Idempotency-Key, and an engine with no adapter answers 503 operations-engine-unavailable.
… types docs/reviews/2026-12-01-issue-26-operations/design.md records the decisions the design left open, with their sources. docs/02, 14, 16, 18, GLOSSARY and the build tracker say what is built. contract/openapi.json, samples.json, docs/04 and the portal's generated API types are regenerated.
This was referenced Dec 1, 2026
…own approvals; starter identity checked; stored scope on replay and dispatch; cancel seen under the lock; start lock before the key; bounded step keys; Gitea paging; report order Reviewer 1 (Codex gpt-6.2-astra) 12 of 13 accepted, #6 rejected; reviewer 2 (Fable) R2-1..R2-3. Applied by the coordinator after a line-by-line read. Record: docs/reviews/2026-12-01-issue-26-operations/.
ephico2real2
marked this pull request as ready for review
December 1, 2026 17:25
… the counts of the contract - rebuild-verify passed the watch cache to watch_sync._live, which since #753 B4 (merged from main) takes the cluster's reader and reads every object live: every verify-namespace step failed with AttributeError. It now passes the reader, so the verify reads the API server as the read that ends a request does. - The start's Idempotency-Key description promises the original request in its current state, as #587 requires of every write's key (the operation the key started, as GET returns it now). Behaviour unchanged. - core/plugins.py CORE gains operations: routers/operations.py is a core router (docs/02), so plugins.yaml cannot switch it and GET /admin/plugins lists it. test_plugins_switch's expected sets name the core parts, so they gain operations: the expectation changes because the core gained a part, not to pass a test. - docs/diagrams/portal-architecture/README.md and docs/08: the contract has 50 operations, and the four operations routes are listed as called by no mockup action (the mockup has no Operations view). - The contract and the portal's generated types written again for the key's text.
…cated, spans checked)
ephico2real2
added a commit
that referenced
this pull request
Dec 1, 2026
…ions relocated, docs/14 pipeline.py:298 corrected by hand
ephico2real2
added a commit
that referenced
this pull request
Dec 1, 2026
…revises 0013 #774 merged first with 0013_operations revising 0012, so 0014 revises 0013 and REQUIRED_REVISION stays 0014. Conflicts combined from both sides: REQUIRED_REVISION's comment names 0013; test_usage_verdicts_310 reads REQUIRED_REVISION; docs/14 keeps this branch's step 5 and #789 rows with the citations relocated; GLOSSARY lists 0013 and 0014; docs/16's schema block written again at head 0014 (16 tables) with scripts/db-schema-doc.py. citations.lock.json is the union of both sides (ours over theirs, except main.py:204-208, where main's text is the file's), relocated and written; every entry's text is one side's, so no span changed. The texts that said 0013 was #774's and unmerged now say 0014 revises 0013; the 0014 tests start and downgrade at 0013.
BlackYuriJDU
pushed a commit
to BlackYuriJDU/cmapi
that referenced
this pull request
Dec 1, 2026
…n approval and is an approvals row ephico2real2#779 (security): :reject checked only requests:reject in the environment, so an approver in no approving group of the request could veto it, and a requester could reject their own request where selfApproval is false. :reject now locks the request, checks the environment and the state, and runs ApprovalLedger.reject, which shares _eligible with approve: 403 not-eligible, 409 self-approval, 409 already-approved (a person decides a request once). One eligible rejection still ends the request. ephico2real2#780: docs/01 says "Each decision is an approvals row and an audit event". Migration 0014 adds approvals.decision (approve | reject, default approve, check ck_approvals_decision); a rejection writes a row with counted_for, the group of the open seat it was decided for. RequestRepo.approvals reads approvals only, so no rejection fills a slot. The downgrade refuses while a rejection is stored (refuse, never drop). REQUIRED_REVISION is 0014. 0014 revises 0012: 0013 is PR ephico2real2#774's, not merged. Docs 01, 12, 14, 16, GLOSSARY, the authorization figure, openapi.json and the portal types updated; the design and its sources are in docs/reviews/2026-12-01-issue-779-780/design.md. Closes ephico2real2#779 Closes ephico2real2#780 Part of ephico2real2#18
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.
Part of #26
Story #26, criterion 3: "Built-in cluster-onboard, rebuild-verify, reconcile and tier re-render operations report progress, survive retries and honor approvals; optional workflow engines are not required." This is the first slice: the built-in engine, the Operations API and four templates. The Argo Workflows and Tekton adapters are out of scope (the criterion does not need them). No screen: the portal mockup has no Operations view, and a screen needs an approved mockup first.
What it builds
cmapi/src/cmapi/core/operations.py): each step that is due is oneoperation_stepjob in the jobs table; state inoperationsandoperation_steps(migration 0013, security class: two reviewers). One scheduler (advance) under an advisory lock creates the rows of ready steps, starts Pending rows withinmaxConcurrentSteps(integrations.yaml, default 4) and a fan-out step'sparallelism/perCluster, and ends a run with nothing in flight (Succeeded, Failed, Error, Stopped) with its report in the row.cmapi/src/cmapi/ops/): tiers-rerender and rebuild-verify end to end; reconcile and cluster-onboard as far as what they need is built.cmapi/src/cmapi/routers/operations.py):POST /api/v1/operations(Idempotency-Key required),GET /api/v1/operations,GET /api/v1/operations/{id}(status of record: every step row with phase, attempts, outputs, last error; the report once ended),POST /api/v1/operations/{id}:cancel. Each needsoperations:runwhere the run acts; reconcile also needsapprovals:pause. New problems:operations-engine-unavailable(503),operation-template-unknown(422).Pipeline.plan_namespace+submit) assvc-cmapi-workflows, with the starter as requester; it polls the request; the ledger refuses the starter as approver where self-approval is off.limitretries,limit + 1attempts, backoff × factor); a step that dies mid-transaction leaves nothing, its job lease runs out and another worker reruns it; a per-row Idempotency-Key finds a request already opened.Design decisions and sources
docs/reviews/2026-12-01-issue-26-operations/design.md(D1 to D14), each source fetched 2026-12-01: RFC 8693 §1.1 (delegation, the step identity), Argo Workflowsworkflow_types.go(RetryStrategy, Backoff, WithParam), Argoparallelism,argo stop, googlelongrunning/operations.proto(CancelOperation), draft-ietf-httpapi-idempotency-key-header-07 §2.3–2.4.Not built (listed, each refuses with its issue)
POST /api/v1/admin/clusters:propose; repository of clusters.yaml is an owner decision)adoption-sweep and bulk-migrate templates,
onExit, and the Argo/Tekton adapters are not built.Tests
cmapi/tests/service/test_operations_26.py(20 tests): start and progress; an approval-gated step waiting until approver-platform approves; decrease below use skipped; rejection reported; retry with backoff; out of retries; a worker that dies mid-step (one request); batchSize and cancel; 403 withoutoperations:runand outside the environment; refusals at start; Idempotency-Key replay; 503operations-engine-unavailable; bad integrations.yaml;maxConcurrentSteps; rebuild-verify drift report; reconcile (both ways); cluster-onboard (registered, and waiting for an import); migration 0013 constraints, down and up.test_api_samples.pyrecords the four new operations.Measured locally (fakes, PostgreSQL 16, no cluster):
test_operations_26.py19 passed before the migration test was added (the 20th,test_0013_roundtrip_and_its_constraints, has not run);test_api_samples.py3 passed (samples recorded); the contract written, Spectral lint clean,scripts/doc-citations.py --check0 problems. After that run,cancelwas changed to take the engine's lock before the run's row (a lock-order fix) and has not been run.Not tested locally: a run of the related suites (docs, standard, authz walk, migrations, contract) was stopped on the coordinator's hold while it showed 3 failures not yet identified; CI is the gate. Nothing ran on kind or CRC.
Who wrote what
All commits and files: Opus 5.5 (high), the implementer. No review yet; one outside model family (Codex) is available for reviewer 1.