FastAPI Code One Task Group

This documentation was generated with the assistance of AI. Please report any inaccuracies.

Implement one bucket of FastAPI tasks from a plan’s task group end to end: one quality baseline up front, each task implemented with its fast tests, then the whole bucket validated once — with the container-backed stage serialized behind a repository-wide lock.

Purpose

iru-fastapi-code-one-task-group is the FastAPI counterpart to iru-nestjs-code-one-task-group and iru-php-code-one-task-group, built on the shared Python gate skills (iru-python-test, -coverage, -code-quality, -docstrings), each run through an iru-gate-runner agent. Step 1 detects the runner prefix, layout, persistence stack, sync versus async, Alembic, the fast versus integration test split, wired quality tools and Docker availability, and captures one pre-change quality baseline. It then implements each task through iru-fastapi-code-one-task (in parallel agents when allowed, except tasks sharing main.py, dependencies.py, a model module or conftest.py, or each adding an Alembic revision).

Step 3 validates cheapest first: license headers, docstrings, scoped fast tests, optional import boundaries, an 80% coverage gate measured from container-free tests alone, the full fast suite, Ruff plus mypy/pyright (plus Bandit) diffed against the baseline, an app-import and OpenAPI-build smoke check with a single-head Alembic check, and last the container-backed stage behind the atomic mkdir-based .integration-test.lock (stale after 60 minutes, bounded ~45-minute wait, released on every exit path). That stage runs iru-python-test integration and, when models or migrations changed, an alembic upgrade, check and downgrade round trip against a throwaway PostgreSQL. Integration results never count toward coverage, and a stage needing Docker when it is unavailable is reported unverified.

Plugin

Shipped by the iru-python plugin of the ai-catalog marketplace (install with /plugin install iru-python@ai-catalog; see Plugins).

Invocation

/iru-fastapi-code-one-task-group <bucket text>

Inputs

Argument Required Description Default

Bucket text

Yes

Every FastAPI-tagged task/sub-task in the bucket with its own text, the group’s Parallelizable verdict, and any relevant "Current code state" context.

None — always invoked with a specific bucket’s text, by iru-code-one-task-group.

Outputs

  • Source files, fast tests, integration tests and Alembic revisions created or modified per task, via iru-fastapi-code-one-task.

  • License headers and docstrings kept current across the files the bucket touched.

  • Container-free test coverage of at least 80% lines for changed or new production files, never satisfied by integration tests.

  • No new Ruff, mypy/pyright or Bandit issues versus the baseline, an app that imports with an OpenAPI schema that builds, and a single Alembic head.

  • implementation_plan.md with each task’s checkbox checked and its note replaced by the final outcome, quoting the container-free coverage, the integration result and the Alembic result separately.

  • A bucket report to the caller: detected shape, per-task results, accepted coverage exceptions, type-check and security findings, the smoke check, the container-backed outcome (passed, fixed, unverified with reason, or no integration selection), lock behavior, and any blocked task.

Execution flow

flowchart TD A[Start /iru-fastapi-code-one-task-group] --> S0["Step 0: only one container-backed run\nrepository-wide, enforced by the lock"] S0 --> B["Step 1: detect shape, classify tests,\ncheck Docker"] B --> B2["Capture one pre-change quality baseline\n(iru-python-code-quality, via iru-gate-runner)"] B2 --> C{"Bucket Parallelizable?"} C -- yes --> D["Step 2: invoke fastapi-code-one-task for every task\nconcurrently; shared-file and Alembic tasks sequential"] C -- no --> E["Step 2: invoke fastapi-code-one-task\none at a time"] D --> F["Confirm or backfill each task's box;\nnotify user; blocked tasks excluded"] E --> F F --> G["Step 3: derive scope from agent reports\nand git status/diff"] G --> G1["3.1 license headers, 3.2 docstrings,\n3.3 scoped fast tests, 3.4 import boundaries"] G1 --> G5{"3.5 container-free coverage\n80% lines?"} G5 -- no --> G5b["Add fast tests via the owning task"] G5b --> G1 G5 -- yes --> G6["3.6 full fast suite"] G6 --> G7{"3.7 new Ruff, mypy or Bandit\nissues vs baseline?"} G7 -- yes --> G7b["Fix, re-run 3.3 and 3.6"] G7b --> G7 G7 -- no --> G8["3.8 app import, OpenAPI build,\nAlembic heads"] G8 --> H{"Integration selection or migrations,\nand Docker available?"} H -- no --> H1["Report container-backed stage\nskipped or unverified"] H -- yes --> I["3.9a: acquire mkdir lock\n(wait, break stale, or time out)"] I -- timed out --> H1 I -- acquired --> J["3.9: integration tests and\nAlembic round trip on PostgreSQL"] J --> K["3.9b: release lock"] K --> L["Step 4: replace each task note\nwith final outcome; notify user"] H1 --> L L --> M["Step 5: report the bucket's outcome\nto the caller"]

Dependencies

Invokes

Each of the following is invoked via the iru-gate-runner agent so reports stay out of this skill’s context:

  • Python Code Quality — Step 1 (baseline) and Step 3.7 (Ruff, mypy/pyright, Bandit vs baseline).

  • Check License — Step 3.1, license headers for every file the bucket touched.

  • Python Docstrings — Step 3.2, docstrings for the production files.

  • Python Test — Steps 3.3, 3.6 and 3.9, scoped fast tests, the full fast suite and the integration run.

  • Python Coverage — Step 3.5, container-free coverage for the bucket’s changed files.

Invoked by

  • iru-isolated-skill-executor — one per task in Step 2, so each task’s transcript stays out of this skill’s context.

  • iru-gate-runner — the baseline (Step 1) and every validation check (Step 3), including the import-boundary check, the smoke check, the Alembic round trip and the lock-protected integration run.

Source

SKILL.md on GitHub — the file this page was generated from.