test_event_edges.py

tests/test_event_edges.py

Author-declared @emits/@handles event edges (task #47).

test_a_declared_event_vocabulary_reaches_the_importer

None test_event_edges.test_a_declared_event_vocabulary_reaches_the_importer(Path tmp_path)

THE DEFECT ITSELF (task #317). `import_event_edges` has taken an `event_tags` override since it was written and `cli.py` never passed one, so the 17 built-in English verbs were the entire vocabulary with no route to change them: a repo whose bus is documented `@broadcasts`/`@reacts` got silence, and no unit test could see it because every unit test calls the importer directly and can hand it whatever it likes.

tests/test_event_edges.py:303

Show on the map →

Called by none

Calls _built_event_edges, _write_event_repo

Source · 21 lines
def test_a_declared_event_vocabulary_reaches_the_importer(tmp_path: Path) -> None:
    """THE DEFECT ITSELF (task #317). `import_event_edges` has taken an
    `event_tags` override since it was written and `cli.py` never passed one, so
    the 17 built-in English verbs were the entire vocabulary with no route to
    change them: a repo whose bus is documented `@broadcasts`/`@reacts` got
    silence, and no unit test could see it because every unit test calls the
    importer directly and can hand it whatever it likes.

    So this drives the REAL pipeline. Deleting the argument at the call site
    turns it red again, which is the only check that the parameter is wired
    rather than merely present."""
    root = tmp_path / "declared"
    doxyfile = _write_event_repo(root, "broadcasts", "reacts")
    (root / ".clew.yaml").write_text(
        "event_tags:\n  broadcasts: producer\n  reacts: consumer\n", encoding="utf-8"
    )

    edges = _built_event_edges(root, doxyfile, tmp_path / "declared.db")
    assert edges == [("emit_foo", "on_foo", "EVENT:FOO")]

Activity · 5 steps
lines 314–314root = tmp_path / "declared"lines 315–315doxyfile = _write_event_repo(root, "broadcasts", "reacts")lines 316–318(root / ".clew.yaml").write_text( "event_tags:\n broadcasts: producer\n reacts: consumer\n", encoding="utf-8" )lines 320–320edges = _built_event_edges(root, doxyfile, tmp_path / "declared.db")lines 321–321assert edges == [("emit_foo", "on_foo", "EVENT:FOO")]

test_a_declared_vocabulary_replaces_the_defaults_rather_than_merging

None test_event_edges.test_a_declared_vocabulary_replaces_the_defaults_rather_than_merging(Path tmp_path)

REPLACE, not merge — and this is the test that would catch merge semantics, because every other one here declares verbs the defaults do not have and passes either way.

tests/test_event_edges.py:324

Show on the map →

Called by none

Calls _declared_event_keys

Checks

  • assert keys == {"bcast": PRODUCER}
  • assert "evt_emits" not in keys, "a declared vocabulary must REPLACE the defaults"
  • assert "exceptions" not in keys, "an exception alias must stop being read as an emit"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_a_declared_vocabulary_replaces_the_defaults_rather_than_merging → _declared_event_keys → classify_aliases
Source · 26 lines
def test_a_declared_vocabulary_replaces_the_defaults_rather_than_merging(
    tmp_path: Path,
) -> None:
    """REPLACE, not merge — and this is the test that would catch merge semantics,
    because every other one here declares verbs the defaults do not have and
    passes either way.

    It is load-bearing rather than a style choice. `raises` is a built-in PRODUCER
    verb and an EXCEPTION verb in most codebases, so a repo aliasing
    `raises=@xrefitem exceptions ...` has its exception documentation mined as
    event production. Replacing is that repo's only fix; merging would leave it
    with no way to say "not that word"."""
    doxyfile = tmp_path / "Doxyfile"
    doxyfile.write_text(
        'ALIASES = "broadcasts=@xrefitem bcast \\"B\\" \\"B\\"" \\\n'
        '          "emits=@xrefitem evt_emits \\"E\\" \\"E\\"" \\\n'
        '          "raises=@xrefitem exceptions \\"Throws\\" \\"Exceptions\\""\n',
        encoding="utf-8",
    )
    keys = _declared_event_keys(doxyfile, {"broadcasts": PRODUCER})

    assert keys == {"bcast": PRODUCER}
    assert "evt_emits" not in keys, "a declared vocabulary must REPLACE the defaults"
    assert "exceptions" not in keys, "an exception alias must stop being read as an emit"

Activity · 6 steps
lines 336–336doxyfile = tmp_path / "Doxyfile"lines 337–342doxyfile.write_text( 'ALIASES = "broadcasts=@xrefitem bcast \\"B\\" \\"B\\"" \\\n' ' "emits=@xrefitem evt_emits \\"E\\" \\"E\\"" \\\n' ' "raises=@xrefitem exceptions \\"Throws\\" \\"Exceptions\\""\n', encoding="utf-8", )lines 343–343keys = _declared_event_keys(doxyfile, {"broadcasts": PRODUCER})lines 345–345assert keys == {"bcast": PRODUCER}lines 346–346assert "evt_emits" not in keys, "a declared vocabulary must REPLACE the defaults"lines 347–347assert "exceptions" not in keys, "an exception alias must stop being read as an emit"

test_a_fully_recognised_alias_set_logs_no_hint

None test_event_edges.test_a_fully_recognised_alias_set_logs_no_hint(Path tmp_path, pytest.LogCaptureFixture caplog)

THE CONTROL. A diagnostic that fires on a repo whose vocabulary is already understood is noise, and noise is how a real hint stops being read — so the quiet case has to be pinned as hard as the loud one.

tests/test_event_edges.py:371

Show on the map →

Called by none

Calls _declared_event_keys

Checks

  • assert keys == {"evt_emits": PRODUCER, "evt_handles": CONSUMER}
  • assert "not recognised event verbs" not in caplog.text

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_a_fully_recognised_alias_set_logs_no_hint → _declared_event_keys → classify_aliases
Source · 20 lines
def test_a_fully_recognised_alias_set_logs_no_hint(
    tmp_path: Path, caplog: pytest.LogCaptureFixture
) -> None:
    """THE CONTROL. A diagnostic that fires on a repo whose vocabulary is already
    understood is noise, and noise is how a real hint stops being read — so the
    quiet case has to be pinned as hard as the loud one."""
    doxyfile = tmp_path / "Doxyfile"
    doxyfile.write_text(
        'ALIASES = "emits=@xrefitem evt_emits \\"E\\" \\"E\\"" \\\n'
        '          "handles=@xrefitem evt_handles \\"H\\" \\"H\\""\n',
        encoding="utf-8",
    )
    with caplog.at_level(logging.INFO, logger="clew.event_edges"):
        keys = _declared_event_keys(doxyfile, None)

    assert keys == {"evt_emits": PRODUCER, "evt_handles": CONSUMER}
    assert "not recognised event verbs" not in caplog.text


@_NEEDS_DOXYGEN

test_an_undeclared_repo_vocabulary_is_silent_without_the_declaration

None test_event_edges.test_an_undeclared_repo_vocabulary_is_silent_without_the_declaration(Path tmp_path)

The negative control for the test above, and the reason the diagnostic exists: the SAME repo with the SAME aliases and no declaration produces no event edges, because `broadcasts`/`reacts` are not built-in verbs. Without this, the declared-vocabulary test would pass just as happily against an implementation that recognised every alias it found.

tests/test_event_edges.py:391

Show on the map →

Called by none

Calls _built_event_edges, _write_event_repo

Source · 12 lines
def test_an_undeclared_repo_vocabulary_is_silent_without_the_declaration(
    tmp_path: Path,
) -> None:
    """The negative control for the test above, and the reason the diagnostic
    exists: the SAME repo with the SAME aliases and no declaration produces no
    event edges, because `broadcasts`/`reacts` are not built-in verbs. Without
    this, the declared-vocabulary test would pass just as happily against an
    implementation that recognised every alias it found."""
    root = tmp_path / "undeclared"
    doxyfile = _write_event_repo(root, "broadcasts", "reacts")

    assert _built_event_edges(root, doxyfile, tmp_path / "undeclared.db") == []

1 more lines, not shown

Activity · 3 steps
lines 399–399root = tmp_path / "undeclared"lines 400–400doxyfile = _write_event_repo(root, "broadcasts", "reacts")lines 402–402assert _built_event_edges(root, doxyfile, tmp_path / "undeclared.db") == []

test_an_unrecognised_alias_is_named_in_the_log

None test_event_edges.test_an_unrecognised_alias_is_named_in_the_log(Path tmp_path, pytest.LogCaptureFixture caplog)

THE DIAGNOSTIC. Before it, a repo using `@broadcasts` got zero rows and total silence — indistinguishable from a repo with no event bus at all, which is the same shape as the #29 undeclared-accessor case: the layer was empty because the detector had no way to look, not because there was nothing there.

tests/test_event_edges.py:350

Show on the map →

Called by none

Calls _declared_event_keys

Checks

  • assert _declared_event_keys(doxyfile, None) == {}
  • assert "broadcasts" in caplog.text and "reacts" in caplog.text
  • assert "event_tags" in caplog.text, "the hint must name the declaration that claims them"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_an_unrecognised_alias_is_named_in_the_log → _declared_event_keys → classify_aliases
Source · 21 lines
def test_an_unrecognised_alias_is_named_in_the_log(
    tmp_path: Path, caplog: pytest.LogCaptureFixture
) -> None:
    """THE DIAGNOSTIC. Before it, a repo using `@broadcasts` got zero rows and
    total silence — indistinguishable from a repo with no event bus at all, which
    is the same shape as the #29 undeclared-accessor case: the layer was empty
    because the detector had no way to look, not because there was nothing there.
    """
    doxyfile = tmp_path / "Doxyfile"
    doxyfile.write_text(
        'ALIASES = "broadcasts=@xrefitem bcast \\"B\\" \\"B\\"" \\\n'
        '          "reacts=@xrefitem rct \\"R\\" \\"R\\""\n',
        encoding="utf-8",
    )
    with caplog.at_level(logging.INFO, logger="clew.event_edges"):
        assert _declared_event_keys(doxyfile, None) == {}

    assert "broadcasts" in caplog.text and "reacts" in caplog.text
    assert "event_tags" in caplog.text, "the hint must name the declaration that claims them"

Activity · 6 steps
lines 358–358doxyfile = tmp_path / "Doxyfile"lines 359–363doxyfile.write_text( 'ALIASES = "broadcasts=@xrefitem bcast \\"B\\" \\"B\\"" \\\n' ' "reacts=@xrefitem rct \\"R\\" \\"R\\""\n', encoding="utf-8", )lines 364–364with caplog.at_level(logging.INFO, logger="clew.event_edges")lines 365–365assert _declared_event_keys(doxyfile, None) == {}lines 367–367assert "broadcasts" in caplog.text and "reacts" in caplog.textlines 368–368assert "event_tags" in caplog.text, "the hint must name the declaration that claims them"

test_decl_def_duplicate_collapses_to_the_definition

None test_event_edges.test_decl_def_duplicate_collapses_to_the_definition(Path tmp_path)

Doxygen documents one function twice when it is declared in a header and defined in a .cpp; both rows carry the tag. Collapse to the definition so a single logical emitter does not double its edges.

tests/test_event_edges.py:167

Checks

  • assert topics["EVENT:FOO"][PRODUCER] == {11}
  • assert _edges_for(topics) == [(11, 20, "EVENT:FOO")]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-SCHEMA-009measuredtest_decl_def_duplicate_collapses_to_the_definition → _topic_roles
Source · 14 lines
def test_decl_def_duplicate_collapses_to_the_definition(tmp_path: Path) -> None:
    """Doxygen documents one function twice when it is declared in a header and
    defined in a .cpp; both rows carry the tag. Collapse to the definition so a
    single logical emitter does not double its edges."""
    tagged = [
        ("EVENT:FOO", PRODUCER, "emit_it", 10, False),  # header declaration
        ("EVENT:FOO", PRODUCER, "emit_it", 11, True),  # definition
        ("EVENT:FOO", CONSUMER, "on_foo", 20, True),
    ]
    topics = _topic_roles(tagged)
    assert topics["EVENT:FOO"][PRODUCER] == {11}
    assert _edges_for(topics) == [(11, 20, "EVENT:FOO")]

Activity · 4 steps
lines 171–175tagged = [ ("EVENT:FOO", PRODUCER, "emit_it", 10, False), # header declaration ("EVENT:FOO", PRODUCER, "emit_it", 11, True), # definition ("EVENT:FOO", CONSUMER, "on_foo", 20, True), ]lines 176–176topics = _topic_roles(tagged)lines 177–177assert topics["EVENT:FOO"][PRODUCER] == {11}lines 178–178assert _edges_for(topics) == [(11, 20, "EVENT:FOO")]

test_declared_event_keys_reads_the_repos_own_aliases

None test_event_edges.test_declared_event_keys_reads_the_repos_own_aliases(Path tmp_path)

The xrefitem KEY is repo-chosen, so it is read from the target's ALIASES rather than assumed. Only the author-facing TAG NAME is interpreted.

tests/test_event_edges.py:97

Show on the map →

Called by none

Calls _declared_event_keys

Checks

  • assert keys == {"evt_emits": PRODUCER, "evt_handles": CONSUMER}
  • assert "req_trace" not in keys

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_declared_event_keys_reads_the_repos_own_aliases → _declared_event_keys → classify_aliases
Source · 11 lines
def test_declared_event_keys_reads_the_repos_own_aliases(tmp_path: Path) -> None:
    """The xrefitem KEY is repo-chosen, so it is read from the target's ALIASES
    rather than assumed. Only the author-facing TAG NAME is interpreted."""
    doxyfile = tmp_path / "Doxyfile"
    doxyfile.write_text(_XREFITEM_ALIASES, encoding="utf-8")
    keys = _declared_event_keys(doxyfile, None)
    assert keys == {"evt_emits": PRODUCER, "evt_handles": CONSUMER}
    # req_trace is an alias too, but `req` is not an event verb — correctly ignored.
    assert "req_trace" not in keys

Activity · 5 steps
lines 100–100doxyfile = tmp_path / "Doxyfile"lines 101–101doxyfile.write_text(_XREFITEM_ALIASES, encoding="utf-8")lines 102–102keys = _declared_event_keys(doxyfile, None)lines 103–103assert keys == {"evt_emits": PRODUCER, "evt_handles": CONSUMER}lines 105–105assert "req_trace" not in keys

test_default_vocabulary_still_produces_event_edges_end_to_end

None test_event_edges.test_default_vocabulary_still_produces_event_edges_end_to_end(Path tmp_path)

THE SUCCESS-PATH HALF. A target that declares NOTHING must keep getting DEFAULT_EVENT_TAGS and the same edges it got before the declaration section existed.

tests/test_event_edges.py:284

Show on the map →

Called by none

Calls _built_event_edges, _write_event_repo

Checks

  • assert not (root / ".clew.yaml").exists(), "the control declares nothing"
  • assert edges == [("emit_foo", "on_foo", "EVENT:FOO")]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CLI-001measured
REQ-DDB-CONFIG-001measured
REQ-DDB-CONFIG-004measured
REQ-DDB-CONFIG-005measured
REQ-DDB-CONFIG-006measured
REQ-DDB-CONFIG-007measured
REQ-DDB-CONFIG-009measured
REQ-DDB-INDEX-001measured
REQ-DDB-INDEX-002measured
REQ-DDB-INDEX-003measured
REQ-DDB-INDEX-004measured
REQ-DDB-INDEX-005measured
REQ-DDB-INDEX-006measured
REQ-DDB-INDEX-007measured
REQ-DDB-INDEX-008measured
REQ-DDB-INDEX-009measured
REQ-DDB-INDEX-010measured
REQ-DDB-INDEX-011measured
REQ-DDB-MCP-001measured
REQ-DDB-MCP-004measured
REQ-DDB-PIPE-001measured
REQ-DDB-PIPE-003measured
REQ-DDB-PIPE-004measured
REQ-DDB-PIPE-005measured
REQ-DDB-PIPE-006measured
REQ-DDB-PIPE-007measured
REQ-DDB-PIPE-008measured
REQ-DDB-PIPE-009measured
REQ-DDB-PIPE-010measured
REQ-DDB-PIPE-011measured
REQ-DDB-PIPE-012measured
REQ-DDB-PIPE-013measured
REQ-DDB-PIPE-014measured
REQ-DDB-PIPE-015measured
REQ-DDB-QUERY-003measured
REQ-DDB-QUERY-011measured
REQ-DDB-SCHEMA-001measured
REQ-DDB-SCHEMA-002measured
REQ-DDB-SCHEMA-003measured
REQ-DDB-SCHEMA-004measured
REQ-DDB-SCHEMA-005measured
REQ-DDB-SCHEMA-006measured
REQ-DDB-SCHEMA-007measured
REQ-DDB-SCHEMA-009measured
REQ-DDB-SCHEMA-011measured
REQ-DDB-SCHEMA-012measured
REQ-DDB-SCHEMA-013measured
REQ-DDB-SCHEMA-014measured
REQ-DDB-SCHEMA-015measured
Source · 19 lines
def test_default_vocabulary_still_produces_event_edges_end_to_end(tmp_path: Path) -> None:
    """THE SUCCESS-PATH HALF. A target that declares NOTHING must keep getting
    DEFAULT_EVENT_TAGS and the same edges it got before the declaration section
    existed.

    Written because a check with a test for its failure path and none for its
    success path is this project's standing way of shipping something completely
    broken while the suite stays green — and because the declared-vocabulary test
    below is worthless without a control proving the pipeline reaches this
    importer at all."""
    root = tmp_path / "defaults"
    doxyfile = _write_event_repo(root, "emits", "handles")
    assert not (root / ".clew.yaml").exists(), "the control declares nothing"

    edges = _built_event_edges(root, doxyfile, tmp_path / "defaults.db")
    assert edges == [("emit_foo", "on_foo", "EVENT:FOO")]


@_NEEDS_DOXYGEN

test_edges_only_attach_to_rowids_that_carried_the_tag

None test_event_edges.test_edges_only_attach_to_rowids_that_carried_the_tag(Path tmp_path)

REGRESSION for the bug this importer was first written with.

tests/test_event_edges.py:133

Checks

  • assert rows == [(1, 2, "EVENT:FOO", "event", 1, "keyed", 1)], ("untagged same-named functions must not inherit the edge" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_edges_only_attach_to_rowids_that_carried_the_tag → import_event_edges → _declared_event_keys → classify_aliases
REQ-DDB-SCHEMA-009measuredtest_edges_only_attach_to_rowids_that_carried_the_tag → import_event_edges
Source · 34 lines
def test_edges_only_attach_to_rowids_that_carried_the_tag(tmp_path: Path) -> None:
    """REGRESSION for the bug this importer was first written with.

    `memberdef.name` is UNQUALIFIED: on a C++ codebase the name `react` maps to 60
    memberdefs, one per FSM class, of which exactly ONE declares `@handles`.
    The first implementation harvested tag-carrying NAMES and then re-resolved
    each name through a name index, fabricating an edge for the other 59 — 5294
    edges where 549 are real. An edge must only ever be attributed to a
    memberdef that actually carried the tag."""
    db = tmp_path / "evt.db"
    _make_db(
        db,
        [
            (1, "emit_it", 1, _EMITS.format(topic="EVENT:FOO")),
            (2, "react", 1, _HANDLES.format(topic="EVENT:FOO")),  # the ONE tagged react
            (3, "react", 1, "<para>a different class's react, no tag</para>"),
            (4, "react", 1, ""),  # and another
        ],
    )
    doxyfile = tmp_path / "Doxyfile"
    doxyfile.write_text(_XREFITEM_ALIASES, encoding="utf-8")
    import_event_edges(db, doxyfile)

    conn = sqlite3.connect(db)
    rows = conn.execute(
        "SELECT writer_rowid, reader_rowid, key_name, edge_kind, declared, "
        "dispatch_mode, edge_triggered FROM shared_key_edges"
    ).fetchall()
    conn.close()
    assert rows == [(1, 2, "EVENT:FOO", "event", 1, "keyed", 1)], (
        "untagged same-named functions must not inherit the edge"
    )

Activity · 9 steps
lines 142–142db = tmp_path / "evt.db"lines 143–151_make_db( db, [ (1, "emit_it", 1, _EMITS.format(topic="EVENT:FOO")), (2, "react", 1, _HANDLES.format(topic="EVENT:FOO")), # the ONE tagged react (3, "react", 1, "<para>a different class's react, no tag</para>"), (4, "react", 1, ""), # and another ], )lines 152–152doxyfile = tmp_path / "Doxyfile"lines 153–153doxyfile.write_text(_XREFITEM_ALIASES, encoding="utf-8")lines 154–154import_event_edges(db, doxyfile)lines 156–156conn = sqlite3.connect(db)lines 157–160rows = conn.execute( "SELECT writer_rowid, reader_rowid, key_name, edge_kind, declared, " "dispatch_mode, edge_triggered FROM shared_key_edges" ).fetchall()lines 161–161conn.close()lines 162–164assert rows == [(1, 2, "EVENT:FOO", "event", 1, "keyed", 1)], ( "untagged same-named functions must not inherit the edge" )

test_event_tag_vocabulary_is_overridable

None test_event_edges.test_event_tag_vocabulary_is_overridable(Path tmp_path)

A repo using its own verbs supplies a mapping instead of the defaults — the built-in vocabulary is a default, not a hardcoded assumption.

tests/test_event_edges.py:119

Show on the map →

Called by none

Calls _declared_event_keys

Checks

  • assert _declared_event_keys(doxyfile, None) == {} # not in the default vocabulary
  • assert keys == {"bcast": PRODUCER, "rct": CONSUMER}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_event_tag_vocabulary_is_overridable → _declared_event_keys → classify_aliases
Source · 14 lines
def test_event_tag_vocabulary_is_overridable(tmp_path: Path) -> None:
    """A repo using its own verbs supplies a mapping instead of the defaults —
    the built-in vocabulary is a default, not a hardcoded assumption."""
    doxyfile = tmp_path / "Doxyfile"
    doxyfile.write_text(
        'ALIASES = "broadcasts=@xrefitem bcast \\"B\\" \\"B\\"" \\\n'
        '          "reacts=@xrefitem rct \\"R\\" \\"R\\""\n',
        encoding="utf-8",
    )
    assert _declared_event_keys(doxyfile, None) == {}  # not in the default vocabulary
    keys = _declared_event_keys(doxyfile, {"broadcasts": PRODUCER, "reacts": CONSUMER})
    assert keys == {"bcast": PRODUCER, "rct": CONSUMER}

Activity · 5 steps
lines 122–122doxyfile = tmp_path / "Doxyfile"lines 123–127doxyfile.write_text( 'ALIASES = "broadcasts=@xrefitem bcast \\"B\\" \\"B\\"" \\\n' ' "reacts=@xrefitem rct \\"R\\" \\"R\\""\n', encoding="utf-8", )lines 128–128assert _declared_event_keys(doxyfile, None) == {}lines 129–129keys = _declared_event_keys(doxyfile, {"broadcasts": PRODUCER, "reacts": CONSUMER})lines 130–130assert keys == {"bcast": PRODUCER, "rct": CONSUMER}

test_one_sided_topics_yield_no_edges

None test_event_edges.test_one_sided_topics_yield_no_edges(Path tmp_path)

A topic emitted but never handled (or vice versa) produces no edge — it is reported as a diagnostic instead, since it usually means a real defect.

tests/test_event_edges.py:181

Checks

  • assert _edges_for(topics) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-SCHEMA-009measuredtest_one_sided_topics_yield_no_edges → _topic_roles
Source · 12 lines
def test_one_sided_topics_yield_no_edges(tmp_path: Path) -> None:
    """A topic emitted but never handled (or vice versa) produces no edge — it
    is reported as a diagnostic instead, since it usually means a real defect."""
    topics = _topic_roles(
        [
            ("EVENT:ORPHAN", PRODUCER, "emit_it", 1, True),
            ("EVENT:UNEMITTED", CONSUMER, "on_it", 2, True),
        ]
    )
    assert _edges_for(topics) == []

Activity · 2 steps
lines 184–189topics = _topic_roles( [ ("EVENT:ORPHAN", PRODUCER, "emit_it", 1, True), ("EVENT:UNEMITTED", CONSUMER, "on_it", 2, True), ] )lines 190–190assert _edges_for(topics) == []

test_repo_without_event_aliases_writes_nothing

None test_event_edges.test_repo_without_event_aliases_writes_nothing(Path tmp_path)

demobot and every non-event repo: a correct negative, not an error.

tests/test_event_edges.py:193

Checks

  • assert conn.execute("SELECT COUNT(*) FROM shared_key_edges").fetchone()[0] == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_repo_without_event_aliases_writes_nothing → import_event_edges → _declared_event_keys → classify_aliases
REQ-DDB-SCHEMA-009measuredtest_repo_without_event_aliases_writes_nothing → import_event_edges
Source · 16 lines
def test_repo_without_event_aliases_writes_nothing(tmp_path: Path) -> None:
    """demobot and every non-event repo: a correct negative, not an error."""
    db = tmp_path / "evt.db"
    _make_db(db, [(1, "f", 1, _EMITS.format(topic="EVENT:FOO"))])
    doxyfile = tmp_path / "Doxyfile"
    doxyfile.write_text("PROJECT_NAME = synth\nINPUT =\n", encoding="utf-8")
    import_event_edges(db, doxyfile)

    conn = sqlite3.connect(db)
    assert conn.execute("SELECT COUNT(*) FROM shared_key_edges").fetchone()[0] == 0
    conn.close()


# ─── the DECLARATION route, driven through the real pipeline ─────────────────

Activity · 8 steps
lines 195–195db = tmp_path / "evt.db"lines 196–196_make_db(db, [(1, "f", 1, _EMITS.format(topic="EVENT:FOO"))])lines 197–197doxyfile = tmp_path / "Doxyfile"lines 198–198doxyfile.write_text("PROJECT_NAME = synth\nINPUT =\n", encoding="utf-8")lines 199–199import_event_edges(db, doxyfile)lines 201–201conn = sqlite3.connect(db)lines 202–202assert conn.execute("SELECT COUNT(*) FROM shared_key_edges").fetchone()[0] == 0lines 203–203conn.close()

test_unknown_tag_vocabulary_and_missing_doxyfile_are_correct_negatives

None test_event_edges.test_unknown_tag_vocabulary_and_missing_doxyfile_are_correct_negatives(Path tmp_path)

A repo with no event alias, and an unreadable/synthesized Doxyfile, both yield zero keys — empty, never an error.

tests/test_event_edges.py:108

Show on the map →

Called by none

Calls _declared_event_keys

Checks

  • assert _declared_event_keys(plain, None) == {}
  • assert _declared_event_keys(tmp_path / "absent", None) == {}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-007measuredtest_unknown_tag_vocabulary_and_missing_doxyfile_are_correct_negatives → _declared_event_keys → classify_aliases
Source · 11 lines
def test_unknown_tag_vocabulary_and_missing_doxyfile_are_correct_negatives(
    tmp_path: Path,
) -> None:
    """A repo with no event alias, and an unreadable/synthesized Doxyfile, both
    yield zero keys — empty, never an error."""
    plain = tmp_path / "Doxyfile"
    plain.write_text('ALIASES = "note=@xrefitem notes \\"Note\\" \\"Notes\\""\n', encoding="utf-8")
    assert _declared_event_keys(plain, None) == {}
    assert _declared_event_keys(tmp_path / "absent", None) == {}

Activity · 4 steps
lines 113–113plain = tmp_path / "Doxyfile"lines 114–114plain.write_text('ALIASES = "note=@xrefitem notes \\"Note\\" \\"Notes\\""\n', encoding="utf-8")lines 115–115assert _declared_event_keys(plain, None) == {}lines 116–116assert _declared_event_keys(tmp_path / "absent", None) == {}