test_wiki_architecture.py

tests/test_wiki_architecture.py

The Architecture tab: C4's four levels, derived from the index (round 5, P5.6).

test_a_long_component_name_is_never_cut

None test_wiki_architecture.test_a_long_component_name_is_never_cut()

L3: labels fit their boxes.

tests/test_wiki_architecture.py:104

Show on the map →

Called by none

Calls _level, architecture_html

Checks

  • assert width >= len(long) * 7, width

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-046measuredtest_a_long_component_name_is_never_cut → architecture_html
Source · 18 lines
def test_a_long_component_name_is_never_cut() -> None:
    """FOUND BY LOOKING: "Build: concurrency and config layer" overflowed its box. The box is as
    wide as its longest label.

    @brief L3: labels fit their boxes.
    """
    long = "Build: concurrency and config layer, the long one"
    graph = {
        "components": [{"id": long, "declared": True, "functions": 1, "files": 1}],
        "links": [],
    }
    l3 = _level(architecture_html("Demo", graph, []), 3)
    width = float(
        l3.split('class="c4-comp declared"', 1)[1].split('width="', 1)[1].split('"', 1)[0]
    )
    assert width >= len(long) * 7, width

Activity · 5 steps
lines 110–110long = "Build: concurrency and config layer, the long one"lines 111–114graph = { "components": [{"id": long, "declared": True, "functions": 1, "files": 1}], "links": [], }lines 115–115l3 = _level(architecture_html("Demo", graph, []), 3)lines 116–118width = float( l3.split('class="c4-comp declared"', 1)[1].split('width="', 1)[1].split('"', 1)[0] )lines 119–119assert width >= len(long) * 7, width

test_a_main_is_named_by_its_file_not_main

None test_wiki_architecture.test_a_main_is_named_by_its_file_not_main()

L2: a main is named by its file's path.

tests/test_wiki_architecture.py:92

Show on the map →

Called by none

Calls _level, architecture_html

Checks

  • assert ">tools/serve.py</text>" in l2 and ">main</text>" not in l2

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-046measuredtest_a_main_is_named_by_its_file_not_main → architecture_html
Source · 12 lines
def test_a_main_is_named_by_its_file_not_main() -> None:
    """L2: a `main` is named by its file, never a row of `main`s. SPEC CHANGED (UX review E-19,
    owner Q/A 2026-11-22): by its PATH (`tools/serve.py`) — `main.py` alone named nothing beside
    the console-script names.

    @brief L2: a main is named by its file's path.
    """
    entries = [Entry("main", "main", "tools/serve.py", "", None)]
    l2 = _level(architecture_html("Demo", _GRAPH, entries), 2)
    assert ">tools/serve.py</text>" in l2 and ">main</text>" not in l2

Activity · 3 steps
lines 99–99entries = [Entry("main", "main", "tools/serve.py", "", None)]lines 100–100l2 = _level(architecture_html("Demo", _GRAPH, entries), 2)lines 101–101assert ">tools/serve.py</text>" in l2 and ">main</text>" not in l2

test_components_are_the_blocks_declared_and_inferred_apart

None test_wiki_architecture.test_components_are_the_blocks_declared_and_inferred_apart()

L3: first-party blocks with their links; inferred drawn distinct; vendor not inside.

tests/test_wiki_architecture.py:64

Show on the map →

Called by none

Calls _level, architecture_html

Checks

  • assert 'class="c4-comp declared"' in l3 and 'class="c4-comp inferred"' in l3
  • assert ">vendor/zlib</text>" not in l3
  • assert 'data-link="API→pkg/core"' in l3

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-046measuredtest_components_are_the_blocks_declared_and_inferred_apart → architecture_html
Source · 8 lines
def test_components_are_the_blocks_declared_and_inferred_apart() -> None:
    """@brief L3: first-party blocks with their links; inferred drawn distinct; vendor not inside."""
    l3 = _level(architecture_html("Demo", _GRAPH, _ENTRIES), 3)
    assert 'class="c4-comp declared"' in l3 and 'class="c4-comp inferred"' in l3
    assert ">vendor/zlib</text>" not in l3
    assert 'data-link="API→pkg/core"' in l3

Activity · 4 steps
lines 66–66l3 = _level(architecture_html("Demo", _GRAPH, _ENTRIES), 3)lines 67–67assert 'class="c4-comp declared"' in l3 and 'class="c4-comp inferred"' in l3lines 68–68assert ">vendor/zlib</text>" not in l3lines 69–69assert 'data-link="API→pkg/core"' in l3

test_containers_are_the_runnable_entry_points_said_to_be_derived

None test_wiki_architecture.test_containers_are_the_runnable_entry_points_said_to_be_derived()

L2: one container per script / main, linked to its flow; threads are not containers.

tests/test_wiki_architecture.py:56

Show on the map →

Called by none

Calls _level, architecture_html

Checks

  • assert ">demo</text>" in l2 and ">run</text>" in l2 and ">worker</text>" not in l2
  • assert 'href="flow-main.html"' in l2
  • assert "derived from entry points" in l2 and "data stores" in l2

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-046measuredtest_containers_are_the_runnable_entry_points_said_to_be_derived → architecture_html
Source · 8 lines
def test_containers_are_the_runnable_entry_points_said_to_be_derived() -> None:
    """@brief L2: one container per script / main, linked to its flow; threads are not containers."""
    l2 = _level(architecture_html("Demo", _GRAPH, _ENTRIES), 2)
    assert ">demo</text>" in l2 and ">run</text>" in l2 and ">worker</text>" not in l2
    assert 'href="flow-main.html"' in l2
    assert "derived from entry points" in l2 and "data stores" in l2

Activity · 4 steps
lines 58–58l2 = _level(architecture_html("Demo", _GRAPH, _ENTRIES), 2)lines 59–59assert ">demo</text>" in l2 and ">run</text>" in l2 and ">worker</text>" not in l2lines 60–60assert 'href="flow-main.html"' in l2lines 61–61assert "derived from entry points" in l2 and "data stores" in l2

test_context_is_the_system_its_actors_and_its_external_systems

None test_wiki_architecture.test_context_is_the_system_its_actors_and_its_external_systems()

L1: one system box, actors from entry kinds, the vendor area external.

tests/test_wiki_architecture.py:48

Show on the map →

Called by none

Calls _level, architecture_html

Checks

  • assert ">Demo</text>" in l1
  • assert ">command-line user</text>" in l1 and ">program launcher</text>" in l1
  • assert ">vendor/zlib</text>" in l1 and 'class="c4-ext"' in l1

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-046measuredtest_context_is_the_system_its_actors_and_its_external_systems → architecture_html
Source · 8 lines
def test_context_is_the_system_its_actors_and_its_external_systems() -> None:
    """@brief L1: one system box, actors from entry kinds, the vendor area external."""
    l1 = _level(architecture_html("Demo", _GRAPH, _ENTRIES), 1)
    assert ">Demo</text>" in l1
    assert ">command-line user</text>" in l1 and ">program launcher</text>" in l1
    assert ">vendor/zlib</text>" in l1 and 'class="c4-ext"' in l1

Activity · 4 steps
lines 50–50l1 = _level(architecture_html("Demo", _GRAPH, _ENTRIES), 1)lines 51–51assert ">Demo</text>" in l1lines 52–52assert ">command-line user</text>" in l1 and ">program launcher</text>" in l1lines 53–53assert ">vendor/zlib</text>" in l1 and 'class="c4-ext"' in l1

test_tooling_entry_points_are_listed_not_drawn_as_containers

None test_wiki_architecture.test_tooling_entry_points_are_listed_not_drawn_as_containers()

L2: tooling is listed, not drawn.

tests/test_wiki_architecture.py:78

Show on the map →

Called by none

Calls _level, architecture_html

Checks

  • assert "scripts/probe.py" not in svg
  • assert "1 tooling entry point" in l2 and "scripts/probe.py" in l2

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-046measuredtest_tooling_entry_points_are_listed_not_drawn_as_containers → architecture_html
Source · 14 lines
def test_tooling_entry_points_are_listed_not_drawn_as_containers() -> None:
    """FOUND BY LOOKING (clew's own site): 27 of 30 containers were `main`s under `scripts/` and
    `acceptance/`, burying the three real ones. An entry the `tooling` globs classify is the
    repository's tooling, not a container of the system: listed below, folded, never drawn.

    @brief L2: tooling is listed, not drawn.
    """
    entries = [*_ENTRIES, Entry("main", "main", "scripts/probe.py", "", None, role="tooling")]
    l2 = _level(architecture_html("Demo", _GRAPH, entries), 2)
    svg = l2.split("</svg>", 1)[0]
    assert "scripts/probe.py" not in svg
    assert "1 tooling entry point" in l2 and "scripts/probe.py" in l2

Activity · 5 steps
lines 85–85entries = [*_ENTRIES, Entry("main", "main", "scripts/probe.py", "", None, role="tooling")]lines 86–86l2 = _level(architecture_html("Demo", _GRAPH, entries), 2)lines 87–87svg = l2.split("</svg>", 1)[0]lines 88–88assert "scripts/probe.py" not in svglines 89–89assert "1 tooling entry point" in l2 and "scripts/probe.py" in l2