Preflight
preflight
Single read-only preflight core shared by both batch_edit surfaces.
The rules themselves live in :mod:axm_edit.core.precheck (pure, in-memory)
and :mod:axm_edit.core.precheck_fs (filesystem-resolving). This module owns
no rule: it orchestrates them over a raw batch payload, merges their
diagnostics into one deterministically ordered list, and partitions that list
into a blocking / non-blocking report both tool surfaces can consume.
Strictly read-only: every path resolution is delegated to the checks (which
go through resolve_safe), and nothing here opens a file for writing,
creates a temporary file or takes a checkpoint.
collect_preflight_diagnostics(root, raw_ops)
Collect every preflight diagnostic for a raw batch, without writing.
Merges the key rules that need the payload as authored (unknown edit
keys, rewrite payload shape) with the static and filesystem rules of
:func:~axm_edit.core.precheck_fs.run_fs_checks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Project root the batch would be applied to. |
required |
raw_ops
|
Sequence[Mapping[str, object]]
|
Operations in batch order, as authored (raw mappings). |
required |
Returns:
| Type | Description |
|---|---|
list[CheckDiagnostic]
|
Every diagnostic, ordered by |
Source code in packages/axm-edit/src/axm_edit/core/preflight.py
merge_diagnostics(*groups)
Merge diagnostic groups into one deterministically ordered list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups
|
Sequence[CheckDiagnostic]
|
One diagnostic sequence per rule layer, in any order. |
()
|
Returns:
| Type | Description |
|---|---|
list[CheckDiagnostic]
|
Every diagnostic, ordered by |
list[CheckDiagnostic]
|
the same input always yields an equal list. |
Source code in packages/axm-edit/src/axm_edit/core/preflight.py
partition_diagnostics(diagnostics)
Split diagnostics into blocking errors and informative warnings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
diagnostics
|
Sequence[CheckDiagnostic]
|
Diagnostics in the order they should be reported. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
PreflightReport
|
class: |
PreflightReport
|
and |
|
PreflightReport
|
True iff at least one diagnostic blocks the batch. |