Skip to content

API Reference parrot.flows.dev_loop.test_scope.report

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.flows.dev_loop.test_scope.report

View source

Structured pytest result recording for the SDD cycle (FEAT-695).

Stdlib-only, like the rest of the kernel. Records are temporary artifacts under report_root(); they are never written into a worktree or committed.

Alias Invocation

Re-exported from parrot.flows.dev_loop.test_scope.datatypes.Invocation.

Alias OVERRIDE_MARKER_EXPRESSION

Re-exported from parrot.flows.dev_loop.test_scope.planner.OVERRIDE_MARKER_EXPRESSION.

Attribute REPORT_ROOT_ENV

Attribute RERUN_RECORD

Alias RunReport

Re-exported from parrot.flows.dev_loop.test_scope.datatypes.RunReport.

Attribute STATUSES

Class SuiteResult

Outcome recorded for one pytest invocation.

Parameter Type Default Description
suite str
tests int
passed int
failed int
errors int
skipped int
duration_s float
exit_code int
argv tuple[str, ...]
status str
nodes tuple[tuple[str, str], ...] ()
unmapped int 0
baseline tuple[tuple[str, str], ...] ()

Fields:

Field Type Default Description
suite str
tests int
passed int
failed int
errors int
skipped int
duration_s float
exit_code int
argv tuple[str, ...]
status str
nodes tuple[tuple[str, str], ...] ()
unmapped int 0
baseline tuple[tuple[str, str], ...] ()

Class TaskTestRecord

All latest suite outcomes recorded for one task execution history.

Parameter Type Default Description
feature_id str
task_id str
head_sha str
base_ref str
tier str
source str
recorded_at str
attempts int
suites tuple[SuiteResult, ...]
notes tuple[str, ...] tuple()
cached tuple[str, ...] tuple()

Fields:

Field Type Default Description
feature_id str
task_id str
head_sha str
base_ref str
tier str
source str
recorded_at str
attempts int
suites tuple[SuiteResult, ...]
notes tuple[str, ...] field(default_factory=tuple)
cached tuple[str, ...] field(default_factory=tuple)

Function append_cached

Merge cached target paths into a task record, returning None for I/O failures.

append_cached(feature_id: str, task_id: str, targets: Sequence[str], *, head_sha: str, base_ref: str, tier: str, source: str) -> Path | None

Parameter Type Default Description
feature_id str
task_id str
targets Sequence[str]
head_sha str
base_ref str
tier str
source str

Returns: Path | None

Function append_suite

Merge one suite into a task record, returning None for I/O failures.

append_suite(feature_id: str, task_id: str, result: SuiteResult, *, head_sha: str, base_ref: str, tier: str, source: str, note: str | None = None) -> Path | None

Parameter Type Default Description
feature_id str
task_id str
result SuiteResult
head_sha str
base_ref str
tier str
source str
note str | None None

Returns: Path | None

Function junit_path_for

Return a fresh junit path for an invocation and ensure its directory exists.

Any file left at the path by an earlier attempt is removed, so a run killed before pytest writes its XML can never be reported with a previous attempt's counts. Unsafe ids are mapped to a neutral directory name.

junit_path_for(feature_id: str, task_id: str, suite: str, ordinal: int) -> Path

Parameter Type Default Description
feature_id str
task_id str
suite str
ordinal int

Returns: Path

Function load_records

Load valid feature records and notes for corrupt records that were skipped.

load_records(feature_id: str) -> tuple[dict[str, TaskTestRecord], list[str]]

Parameter Type Default Description
feature_id str

Returns: tuple[dict[str, TaskTestRecord], list[str]]

Attribute logger

Function nodeid_from_testcase

Return a canonical pytest node id or <file>::<name> for another runner.

A pytest testcase whose file lies above the rootdir is never mapped. pytest writes such a path when it collected a file outside --rootdir -- another checkout's copy of the test (issue:14262fe241fd: xdist workers started from the main checkout). Normalising it would record that checkout's results as this tree's evidence, so it stays unmapped and the verdict fails closed.

nodeid_from_testcase(file_attr: str | None, classname: str, name: str, *, runner: str = 'pytest') -> str | None

Parameter Type Default Description
file_attr str | None
classname str
name str
runner str 'pytest'

Returns: str | None

Function parse_junit

Parse junit counters without allowing absent or invalid reports to raise.

parse_junit(junit_path: Path, *, suite: str, argv: tuple[str, ...], exit_code: int, duration_s: float, timed_out: bool = False) -> SuiteResult

Parameter Type Default Description
junit_path Path
suite str
argv tuple[str, ...]
exit_code int
duration_s float
timed_out bool False

Returns: SuiteResult

Function parse_junit_report

Parse any junit file into a report while retaining failure text per node.

parse_junit_report(junit_path: Path, *, runner: str, suite: str, exit_code: int, duration_s: float, timed_out: bool = False) -> RunReport

Parameter Type Default Description
junit_path Path
runner str
suite str
exit_code int
duration_s float
timed_out bool False

Returns: RunReport

Function render_markdown

Render a deterministic Tests section including aggregate and per-task evidence.

render_markdown(records: dict[str, TaskTestRecord], task_ids: list[str], *, final_head: str, rerun: TaskTestRecord | None, rerun_skip_reason: str | None, notes: tuple[str, ...] = ()) -> str

Parameter Type Default Description
records dict[str, TaskTestRecord]
task_ids list[str]
final_head str
rerun TaskTestRecord | None
rerun_skip_reason str | None
notes tuple[str, ...] ()

Returns: str

Function report_root

Return the configured report root or the sandbox-shared default root.

report_root() -> Path

Returns: Path

Function should_rerun

FEAT-699: re-run whenever the feature has at least one task.

should_rerun(task_count: int) -> bool

Parameter Type Default Description
task_count int

Returns: bool

Function suite_name

Record key for one invocation: <dist>, <dist>[contract] or <dist>[markers].

suite_name(invocation: Invocation) -> str

Parameter Type Default Description
invocation Invocation

Returns: str

Function with_report

Return report arguments for pytest; other runners already carry them.

with_report(invocation: Invocation, report_path: Path) -> tuple[str, ...]

Parameter Type Default Description
invocation Invocation
report_path Path

Returns: tuple[str, ...]

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