# Evidence: Block 1 · Foundational (block-1)

- block type: block
- date: 2026-10-14
- resulting state: closed/verified
- story points (combined assembled cost): 6696
- execution id: 20261014.055305.566Z-d7256828

## Stories built
- Stand up the Python project tree, the mdparser package skeleton, and the pytest runner. (foundation) [story]

## Reusable compacts
- ARCHITECTURE_compact.md

## Stacked context
- compass: COMPASS.md (SP 1072)
- implements: ARCHITECTURE.md (SP 1831)
- stack: common.md (SP 2769)
- stack: python.md (SP 600)

## Build directory changes
- .env.example
- .gitignore
- bin/test.sh
- data/logs/test_2026-10-14_015406.log
- mdparser/__init__.py
- mdparser/blocks.py
- mdparser/cli.py
- mdparser/entities.py
- mdparser/inlines.py
- mdparser/refs.py
- mdparser/render.py
- pyproject.toml
- tests/conftest.py
- tests/test_foundation.py
- uv.lock

## Pre-build acceptance observation
- RED: foundation-package-imports (ARCHITECTURE.md)
  intent: The mdparser package and each reserved module import cleanly using only the standard library.
  return code: 1
  stderr:
    Traceback (most recent call last):
      File "foundation-package-imports.py", line 7, in <module>
        importlib.import_module("mdparser")
      File "/home/barlo/.local/share/uv/python/cpython-3.12.13-linux-x86_64-gnu/lib/python3.12/importlib/__init__.py", line 90, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'mdparser'

## Post-build programmatic acceptance
- PASS: foundation-package-imports (ARCHITECTURE.md)
  intent: The mdparser package and each reserved module import cleanly using only the standard library.
  target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/CommonMark/runs/20261014.053711/build/commonmark/.venv/bin/python
  provisioning: not required
  return code: 0

## Build summary
The build directory holds only the staged `sources/` assets and a git repo, so the foundation has to be created from scratch. I'll start with the project manifest and check the toolchain.The build backend isn't needed: this is a stdlib-only app that runs from the source tree, so I'll drop the packaging section and put the source root on pytest's path instead.The `pyproject.toml` change above is my own `readme` removal, so it matches what I intended. Next I'll write the package skeleton, the launcher, and the test scaffolding.Now the foundation tests. The declared acceptance check goes in verbatim, with extra tests for the reserved modules, the no-third-party-dependency rule, and a clean import under plain `python3`.All 20 tests pass through the declared launcher. Next I'll confirm the staged sources are untouched and see what's changed.<reusable-compact filename="ARCHITECTURE.md">
Package: mdparser (stdlib only, no runtime deps, Python >=3.11)
Executable: ./commonmark (root, plain python3, no venv needed); calls mdparser.cli.main
Modules: cli (stdin bytes to stdout bytes, exit 0 always, diagnostics to stderr only), blocks (phase 1 block tree), refs (reference map, normalize_label = casefold + whitespace collapse), inlines (phase 2 delimiter stack), entities (html.entities.html5 names ending in ';' only, numeric refs, backslash unescape), render (HTML escape, URL percent-encoding)
Decisions: unicodedata P*/S* for flanking punctuation; soft line breaks render as a line ending; no third-party Markdown library
Guardrails: never write to sources/ staged assets; stdout carries only rendered HTML
</reusable-compact>

RESULT: SUCCESS

FILES CHANGED:
- pyproject.toml
- uv.lock
- .gitignore
- .env.example
- bin/test.sh
- mdparser/__init__.py
- mdparser/blocks.py
- mdparser/inlines.py
- mdparser/refs.py
- mdparser/entities.py
- mdparser/render.py
- mdparser/cli.py
- tests/conftest.py
- tests/test_foundation.py

SUMMARY:
The language foundation is in place. `pyproject.toml` declares `requires-python >=3.11`, no runtime dependencies, and `pytest` in the dev group; `uv.lock` was generated by `uv`. The `.venv` was created with `uv venv` and synced with `uv sync`; it is gitignored. `bin/test.sh` follows the standard launcher template, runs `pytest -q` inside `.venv`, and logs to `data/logs/`.

The `mdparser` package is an importable skeleton with six reserved modules (`blocks`, `inlines`, `refs`, `entities`, `render`, `cli`). Each has a docstring stating its responsibility and no public behavior yet.

Acceptance check `foundation-package-imports` is implemented verbatim in `tests/test_foundation.py`. Additional tests cover the module docstrings, the absence of behavior in reserved modules, the `mdparser` name, the empty runtime dependency list, the committed lockfile, the launcher being executable, and an import under plain `python3` with no venv.

Test run: `bin/test.sh` gives 20 passed, 0 failed. The staged `sources/` files are unchanged (`git diff` is empty). Nothing has been committed.

Choices I made:
- Project name is `mdparser`, not `commonmark`, so the package cannot be mistaken for a public Markdown library.
- No build backend or README. The app runs from the source tree and the test path is set via `pythonpath = ["."]`.
- The root `commonmark` executable is not created. The block only covers the package skeleton, and the executable depends on `cli.main`, which belongs to a later block. Until it exists, `sh sources/full_test.sh` will fail with the "no executable" message.
- `.env.example` says no environment variables are read.

BLOCKERS:
- None for this block.
