fix(accounting,assets): a conversion claim counts only where the code wrote it
Both red guards green, and the whole suite is 2204 passed / 1 skipped (2199 before this round, +5 new tests, no golden moved). TWO HALVES, AND NEITHER IS SUFFICIENT ALONE. The judge now reads the clause only from inside a POINTER BLOCK -- the markdown image line plus the detail line under it -- and only where the clause names the asset that block points at, anchored to the end of the line because the build writes it last. That closes ordinary body text and a table cell. It cannot close an image's own alt text, because a label is document text that the build writes INSIDE a pointer block, which is the second half: `assets._inline` disarms a checksum field in anything that came from the document. WHERE THE BOUNDARY RUNS, stated in both files. Everything `_inline` returns came from the document -- an alt attribute, an STS caption, a publisher's file name. Everything `render_block` appends after it came from the run: the size it measured, the type it sniffed, the digests it computed. The second line carries both, so document text may not emit the grammar the run writes there. The digits are kept, because a reader is owed what the document said; the colon that makes them a FIELD is not. The judge's expression stays restated rather than imported, for the reason `asset_holds` already gives about the naming rule: a judge sharing the judged's own expression agrees with it by construction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
39f6f0a4fb
commit
24a828469f
2 changed files with 61 additions and 4 deletions
|
|
@ -938,6 +938,12 @@ def asset_href(image: ExtractedImage) -> str:
|
|||
return f"/{ASSETS_DIR}/{asset_name(image)}"
|
||||
|
||||
|
||||
#: `sha256:` immediately in front of 64 hex digits -- the CHECKSUM FIELD this
|
||||
#: module writes on a pointer's second line, and the grammar the content
|
||||
#: accounting gate reads a conversion claim with.
|
||||
_CHECKSUM_FIELD = re.compile(r"sha256:(?=[0-9a-fA-F]{64})")
|
||||
|
||||
|
||||
def _inline(value: str) -> str:
|
||||
"""A label, made safe for the one line it is written on.
|
||||
|
||||
|
|
@ -947,9 +953,21 @@ def _inline(value: str) -> str:
|
|||
and this text reaches a title through no route, but the pointer is body text
|
||||
a proposer reads, and a half-open link there is a pointer that resolves
|
||||
nowhere.
|
||||
|
||||
WHERE THE BOUNDARY RUNS. Everything this function returns came from the
|
||||
DOCUMENT -- an `alt` attribute, an STS `<caption>`, a file name a publisher
|
||||
chose. Everything `render_block` appends after it came from the run: the
|
||||
size it measured, the type it sniffed, the digests it computed. The second
|
||||
line carries both, so document text must not be able to emit the metadata
|
||||
grammar the run writes there. Measured by PM 2026-09-19: an `alt` attribute
|
||||
stating `converted from ... sha256:<a> to ... sha256:<b>` made the content
|
||||
accounting gate report a picture as carried that was refused
|
||||
`asset_too_large` and is not in `assets/` at all. A checksum field is
|
||||
therefore disarmed here -- the digits are kept, because a reader is owed
|
||||
what the document said, and the colon that makes them a FIELD is not.
|
||||
"""
|
||||
collapsed = " ".join(value.split())
|
||||
return collapsed.replace("[", "(").replace("]", ")")
|
||||
return _CHECKSUM_FIELD.sub("sha256 ", collapsed.replace("[", "(").replace("]", ")"))
|
||||
|
||||
|
||||
def render_block(image: ExtractedImage) -> str:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue