Repository navigation
feat(custom-app): one-shot status detection (HLD §10 — Feature 4 close-out) - #149
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a657fcb7f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| state = (getattr(container, 'attrs', None) or {}).get('State') or {} | ||
| return state.get('ExitCode') |
There was a problem hiding this comment.
Return no exit code for containers that have never run
For a newly created Docker container, State.ExitCode is initialized to 0 even though the container has never run. Returning that field directly therefore exposes {"name": "worker", "exit_code": 0} through the new status endpoint, incorrectly presenting a pending service as having exited successfully instead of returning the promised null. Check for the created state before reading the exit code, and exercise that case with realistic Docker attrs; the added test currently supplies None itself and consequently misses this behavior.
Useful? React with 👍 / 👎.
…e-out)
get_status classifies a container at rest in exited with code 0 under
restart policy no/absent (compose default) as completed and excludes
it from the aggregate — an app plus a healthy migration helper reports
running. The policy is the discriminator the raw exit code cannot
carry: graceful-stop images (the platform's own nginx sidecar) exit 0
on docker stop, and a manual stop SUPPRESSES always/unless-stopped —
those rest visibly, as does on-failure (catalog mains share it).
The all-excluded aggregate is stopped (never the undeliverable
unknow the callback vocabulary rejects and the cold-backup
quiesce-wait treats as never-stopped — the review traced this
strictly improving three backup paths); an empty container set keeps
the documented unknow conflation. Detail payload: completed (service
names via the compose label) and exited ({name, exit_code} for every
non-running non-ignored container) — carried by a new
GET /greffon/{id}/status/ read; the legacy bare GET keeps its exact
shape (pydantic drops the new keys).
Review folds:
- adversarial P2 (live-daemon probed): the daemon reports ExitCode 0
for never-run created containers and for paused ones (the process
is alive) — _exit_code now gates on State.Status == 'exited', and
the fixtures are daemon-realistic (the old mock's ExitCode: None
was a shape the daemon never produces, masking the leak).
- matrix gaps filled: migrate-named in neither detail list, label
primary over the policy rule (labeled exited:0 policy-no → neither
list), the always-policy row, and paused/created rows.
- The feared RestartPolicy-missing-from-list() concern was refuted
with SDK source + live probe (non-sparse list() inspects every
container) — the classifier is live in production.
Suites: compose 52 OK, full 1139 passed with only the pre-existing
oracle/catalog-pin artifact. Manager relay proxy next.
0a657fc to
f177631
Compare
Implements HLD §10 (merged as #288): the one-shot status mechanism, greffer half — the last Feature 4 slice's detection core.
What
get_statusclassification: a container at rest inexitedwithExitCode == 0under restart policyno/absent (compose's default) iscompleted— excluded from the aggregate like a label-ignored container, so an app plus a healthy migration helper reportsrunningthe moment the helper finishes. The policy is the discriminator the raw exit code cannot carry (graceful-stop images — the platform's own nginx sidecar — exit 0 on stop;always/unless-stoppedresting = operator-suppressed restart, stays visible;on-failuredeliberately not completed — catalog mains share that policy, labeled on-failure one-shots ride the label).stopped: containers present but every one label/legacy/completed →stopped, never the undeliverableunknow(the monitor callback vocabulary can't deliver it; the cold-backup quiesce-wait would never see "stopped"). An EMPTY container set keeps today's documentedunknowconflation.completed(service names via thecom.docker.compose.servicelabel — container names are never parsed) andexited({name, exit_code}for every non-running non-ignored container;createdcarries no code; completed names appear here too, by design).GET /api/controller/greffon/{id}/status/(offloaded under the metrics limiter like the stats/disk family). The legacy bareGET /greffon/{id}/keeps its exact response shape — pydantic drops the new keys (asserted in the route test).Tests
The full §10 scenario matrix in
OneShotStatusTests(healthy one-shot → running; failed → loud; on-failure rest → counted; suppressed-restart sidecar → counted; all-excluded → stopped; empty set → unknow; label-ignored in neither list; created without a code; attrs-less containers never complete), the failed-unlabeled case re-derived with realistic attrs, and the route test proving the carrier and the legacy shape both.Suites: compose 46 OK, routes/heartbeat/backup-retention 93 OK, full 1135 passed with only the pre-existing oracle/catalog-pin artifact.
Not here
The manager half (the
_relayproxy route) is the next PR; the user-marking stays deferred per §10 (trigger recorded).