Run artifact

workspace/targets/commonmark/evidence/block-8.md

Evidence: Block 8 · Service (block-8)

Stories built

Stacked context

Build directory changes

Pre-build acceptance observation

intent: A decimal reference decodes to the character with the bound code point. return code: 1 stdout: <p>x &amp;#65; y</p> stderr: --- drydock: values at failure --- code_point = 65 result = CompletedProcess(args=['./commonmark'], returncode=0, stdout='<p>x &amp;#65; y</p>\n', stderr='') --- drydock: end values --- Traceback (most recent call last): File "entities-decimal-reference.py", line 7, in <module> assert chr(code_point) in result.stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

intent: Lowercase and uppercase hexadecimal references decode to the same character. return code: 1 stdout: <p>&amp;#x42;</p> stderr: --- drydock: values at failure --- code_point = 66 first = CompletedProcess(args=['./commonmark'], returncode=0, stdout='<p>&amp;#x42;</p>\n', stderr='') --- drydock: end values --- Traceback (most recent call last): File "entities-hex-reference.py", line 11, in <module> assert chr(code_point) in first.stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

intent: The named ampersand reference round trips to the same escaped form. return code: 0 stdout: <p>a &amp;amp; b</p>

intent: An unknown entity name is literal text with its ampersand escaped. return code: 0 stdout: <p>&amp;MadeUpEntity;</p>

intent: The reference for code point zero decodes to the same output as a literal U+FFFD character. return code: 1 stdout: <p>&amp;#0;</p> stderr: --- drydock: values at failure --- first = CompletedProcess(args=['./commonmark'], returncode=0, stdout='<p>&amp;#0;</p>\n', stderr='') second = CompletedProcess(args=['./commonmark'], returncode=0, stdout='<p>�</p>\n', stderr='') --- drydock: end values --- Traceback (most recent call last): File "entities-nul-reference-replaced.py", line 10, in <module> assert first.stdout == second.stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

intent: A reference inside a code span is not decoded, so its ampersand is escaped. return code: 0 stdout: <p><code>&amp;amp;</code></p>

Post-build programmatic acceptance

intent: A decimal reference decodes to the character with the bound code point. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/CommonMark/runs/20261014.053711/build/commonmark/.venv/bin/python provisioning: not required return code: 0 stdout: <p>x A y</p>

intent: Lowercase and uppercase hexadecimal references decode to the same character. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/CommonMark/runs/20261014.053711/build/commonmark/.venv/bin/python provisioning: not required return code: 0 stdout: <p>B</p>

intent: The named ampersand reference round trips to the same escaped form. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/CommonMark/runs/20261014.053711/build/commonmark/.venv/bin/python provisioning: not required return code: 0 stdout: <p>a &amp; b</p>

intent: An unknown entity name is literal text with its ampersand escaped. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/CommonMark/runs/20261014.053711/build/commonmark/.venv/bin/python provisioning: not required return code: 0 stdout: <p>&amp;MadeUpEntity;</p>

intent: The reference for code point zero decodes to the same output as a literal U+FFFD character. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/CommonMark/runs/20261014.053711/build/commonmark/.venv/bin/python provisioning: not required return code: 0 stdout: <p>�</p>

intent: A reference inside a code span is not decoded, so its ampersand is escaped. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/CommonMark/runs/20261014.053711/build/commonmark/.venv/bin/python provisioning: not required return code: 0 stdout: <p><code>&amp;amp;</code></p>

Build summary

I'll start by checking the build directory and the existing application files.The earlier blocks are already built. Next I'll look at the existing mdparser package, tests, and whether an entities module exists yet.The package already has unescape and ASCII_PUNCTUATION in entities.py, and the inline loop escapes & as plain text. Before changing anything I'll record the baseline test result so any regression is visible.Baseline is green: 358 tests pass. I'll read the two files I need to edit so the edit tool accepts them.Now I'll write the entity decoder into entities.py, keeping the existing unescape and ASCII_PUNCTUATION unchanged.Next, I'll hook the reference decoder into the inline loop as a plain-text branch, so decoded characters are escaped and never treated as markup.I'll also mention the reference rule in the parse_inline docstring so it matches the module's existing style.Before writing tests, a quick smoke check of the executable and the two-codepoint entity.The output matches the spec rules. Now I'll write tests/test_entities.py. It transcribes the six declared acceptance checks and adds finer tests that compare exact returned strings and exact stdout.Before running, I checked several expected values by hand and found three mistakes in my own test file: two reference end offsets are off by one (&#0000065; is 10 characters, not 11), and &AMP; is actually in the HTML5 table, so it is not a good case-sensitivity example. I'll fix those and clarify one misnamed test.Now I'll run the new entity tests, then the full project suite to check for regressions in the earlier blocks.All 419 tests pass: the 358 existing tests plus 61 new ones. I'll confirm the changed-file set and that no staged assets were touched.Block 8 (entities) is implemented. The full project suite passes, 419 tests, and I did not run the conformance runner because no criterion in this block invokes it.

What changed

Choices I made

Not done in this block

RESULT: SUCCESS

FILES CHANGED:

SUMMARY: Implemented HTML5 named, decimal and hexadecimal character reference decoding. Entity references decode in the inline loop as escaped plain text, are inert in code spans, and are exposed through the shared unescape_and_decode helper for later stories. Test runs: pytest -q over the whole project, 419 passed (358 existing, 61 new in tests/test_entities.py, including all six declared acceptance checks). Staged sources/ assets are untouched. The conformance runner was not invoked because no criterion in this block calls it.

<blueprint-decisions> [{"spec":"FEATURE-Entities.md","severity":"Low","subject":"Shared destination/title/info-string helper design","decision":"The spec asks for a shared helper but does not define its shape. I added unescape_and_decode in mdparser/entities.py, a single left-to-right pass that applies backslash escapes and character references together, so an escaped ampersand is not re-read as a reference. The existing backslash-only unescape is kept unchanged. Is that acceptable, or should the helper be split into two passes?"}] </blueprint-decisions>