topmark.pipeline.steps.patcher¶
topmark / pipeline / steps / patcher
Patch (diff) generation step for the TopMark pipeline (view-based).
This step compares the original file image (ctx.image) with the pipeline's
updated image (ctx.views.updated) and produces a unified diff suitable for CLI/CI
consumption. It mutates only the processing context and performs no I/O.
Inputs
ctx.views.image-FileImageViewcarrying the original file image view.ctx.views.updated-UpdatedViewcarrinyng the updated file image (orNone)).
Outputs
ctx.views.diff-DiffViewcarrying the unified diff text (orNone).
PatcherStep ¶
Bases: BaseStep
Produce a unified diff between original and updated file images.
Generates a unified diff (CLI/CI friendly) when comparison indicates a
change and an updated image is present. Normalizes ComparisonStatus to
UNCHANGED if computed diff is empty.
This step does not print; the CLI or API decides how to display diffs.
Axes written
- comparison (normalization only; no new comparisons are computed here)
Sets/normalizes: - PatchStatus: {PENDING, GENERATED, SKIPPED, FAILED} - PATCH_* hint codes for patch/patcher semantics: PATCH_GENERATED: patch generated and available PATCH_SKIPPED: no patch needed (unchanged) PATCH_FAILED: change detected but patch generation failed - ComparisonStatus: {PENDING, CHANGED, UNCHANGED, SKIPPED, CANNOT_COMPARE}
Source code in src/topmark/pipeline/steps/patcher.py
may_proceed ¶
Determine if processing can proceed to the patcher step.
Processing can proceed if: - The comparison step was performed (ctx.status.comparison is CHANGED or UNCHANGED)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context for the current file. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if processing can proceed to the patcher step, False otherwise. |
Source code in src/topmark/pipeline/steps/patcher.py
run ¶
Generate and attach a unified diff to the processing context (view-based).
The step runs only after comparison. If the comparison status is
UNCHANGED or if no updated image is present, the diff is omitted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context holding original/updated images and statuses. |
required |
Mutations
ProcessingContext: The same context with ctx.views.diff set when a change is
detected, and with comparison status normalized when applicable.
Source code in src/topmark/pipeline/steps/patcher.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
hint ¶
Attach diff hints (non-binding).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context. |
required |