topmark.pipeline.steps.comparer ¶
Classify differences between the current and expected file/header views.
The comparer rejects malformed headers first. It then prefers one valid structured edit as proof of change, falls back to full-image comparison when an updated image is available, and otherwise compares the expected canonical header block with the current marker-delimited block.
ComparerStep ¶
Bases: BaseStep
Classify current versus expected content on the comparison axis.
The step consumes current, header, build, render, structured-edit, and updated
views. It writes only ComparisonStatus and may add comparer diagnostics,
hints, or a malformed-header halt.
Axes written
- comparison
Sets
- ComparisonStatus: {CHANGED, UNCHANGED, SKIPPED}
Source code in src/topmark/pipeline/steps/comparer.py
may_proceed ¶
Return whether a non-halted context has comparison-ready output.
A rendered result is ready. An updated view is ready when its lines
payload is present, including an empty sequence. Resolution, generation,
and empty-file policy are owned by earlier steps and are not re-evaluated
here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context for the current file. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if comparison can run, False otherwise. |
Source code in src/topmark/pipeline/steps/comparer.py
run ¶
Set comparison status using the ordered view-based decision tree.
may_proceed() admits a rendered result or an updated-lines payload. Once
admitted, malformed headers are skipped first. A single in-bounds structured
edit then proves a change without materializing full images. Otherwise an
available updated image is compared with the current image. If neither path
applies, rendered flows compare header/build mappings and exact header/render
text when the existing content is known. A missing header is known empty text,
so a non-empty rendered block is classified as an insertion change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context carrying statuses and comparison views. |
required |
Mutations
ProcessingContext: status.comparison, diagnostics, and halt state as
required by the selected branch.
Source code in src/topmark/pipeline/steps/comparer.py
103 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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
hint ¶
Attach comparison hints (non-binding).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the context contains an unexpected comparison status value. |