Skip to content

API Reference parrot.sdd.scripts.check_task_graph

github-actions[bot] edited this page Nov 10, 2026 · 4 revisions

parrot.sdd.scripts.check_task_graph

View source

check_task_graph.py — deterministic lint for a per-spec task graph.

depends_on is the ONLY thing that orders tasks; parallel: false marks a task as exclusive (never dispatched alongside another task). Both are written by an LLM in /sdd-task, which is how querysource FEAT-147 shipped 18 tasks chained 1→2→…→18 with one copy-pasted rationale, so the sdd-coder engine ran a parallelizable feature strictly in series. This script checks the graph against what the task files actually declare, instead of trusting the prose:

Errors (exit 1):

  • unknown-dependency — a depends_on id that is not in the index.
  • cycle — the depends_on graph has a cycle.
  • file-overlap — two tasks declare the same file and neither depends (transitively) on the other, so they could run concurrently and conflict.
  • missing-validation-commands — a task has no ## Validation Commands section (error only when the index header declares "validation_contract": "required"; warning otherwise — FEAT-563).
  • broad-validation-command — a task's validation command is an over-broad pytest invocation (FEAT-563).
  • directory-validation-target — a task's validation command targets an existing directory instead of a file or node id (FEAT-563).
  • non-pytest-validation-command — no registered test runner (pytest, vitest, cargo, parrot-e2e or a .parrot/test_runners.toml extension) recognises a task's declared validation command (e.g. true or ruff check .); it is silently invisible to select_tests.py's declared-command handling, so the task effectively has no enforced test coverage (FEAT-563). A warning instead when sdd/config.json sets test_command (FEAT-633 rev 0.8 C29): that repository runs its own command instead of select_tests, so a command no runner recognises (go test ./..., make test) is acceptable there.
  • test-contract-malformed — the index header's cached test_contract cannot be validated (FEAT-699).
  • test-contract-operand-missing — a test_contract test operand does not exist and no task in the index declares it (FEAT-699).
  • test-contract-real-llm — a test_contract test operand is under a real_llm directory (FEAT-699).

Warnings (exit 0):

  • unjustified-edge — B depends on A, but they share no file, B's task file never references a file A declares (by path or dotted module), and B's parallelism_notes do not name A.
  • possible-missing-dependency — B references a file A creates, yet B does not depend on A, and B's parallelism_notes do not name A (a note that names A is the author arguing the non-edge, e.g. "mentions it in prose only").
  • duplicate-notes — the same parallelism_notes on 3+ tasks.
  • exclusive-without-notes — parallel: false with no named resource.
  • legacy-semantics — the header lacks "parallel_semantics": "exclusive", so the engine ignores every parallel flag.
  • missing-validation-commands — see above; warning when the header does not declare "validation_contract": "required" (legacy indexes).
  • validation-path-unknown — a validation command's operand neither exists under root nor is declared in the task's own ## Files to Create / Modify (FEAT-563).
  • test-contract-task-tests-uncovered — a task validation test file is absent from the test_contract operands (FEAT-699).

Class Finding

One graph problem.

Fields:

Field Type Default Description
level str
code str
tasks list[str]
message str

Class GraphReport

Result of checking one per-spec index.

Fields:

Field Type Default Description
index str
task_count int
waves list[list[str]]
exclusive list[str]
findings list[Finding]

Attributes:

Attribute Type Description
errors list[Finding] Findings that fail the check.

Attribute PARALLEL_SEMANTICS

Alias SddConfigError

Re-exported from parrot.sdd.config.SddConfigError.

Attribute VALIDATION_CONTRACT

Function check_graph

Check one per-spec index against its task files.

check_graph(index_path: Path, root: Path) -> GraphReport

Parameter Type Default Description
index_path Path sdd/tasks/index/<feature>.json.
root Path Repository root the index's file paths are relative to.

Returns: GraphReport — The graph report.

Function format_report

Human-readable rendering of a report.

format_report(report: GraphReport) -> str

Parameter Type Default Description
report GraphReport

Returns: str

Alias load_sdd_config

Re-exported from parrot.sdd.config.load_sdd_config.

Function main

CLI entry point: exit 1 when any index has errors.

main(argv: list[str] | None = None) -> int

Parameter Type Default Description
argv list[str] | None None

Returns: int

Function module_of

Dotted import path of a .py file (src-layout aware), or None when too generic to match.

module_of(path: str) -> str | None

Parameter Type Default Description
path str

Returns: str | None

Function parse_declared_files

Map each path under '## Files to Create / Modify' to whether its row says CREATE.

parse_declared_files(task_md: str) -> dict[str, bool]

Parameter Type Default Description
task_md str The task markdown.

Returns: dict[str, bool] — {path: is_create} in declaration order.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally