test_enum_subject.py

tests/test_enum_subject.py

gh#6 — an enum type is in the index and `dossier` could not describe it.

test_an_enum_subject_has_no_caller_fields_at_all

None test_enum_subject.test_an_enum_subject_has_no_caller_fields_at_all(Path tmp_path)

BY ABSENCE, NOT BY EMPTINESS — the rule `VariableSubject` states. An enum has no callers and no callees, so `callers: []` on one would be a measurement of something that was never measurable, and this whole session has been spent removing exactly that shape.

tests/test_enum_subject.py:112

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert doss is not None and doss.enumeration is not None
  • assert not hasattr(doss.enumeration, "callers")
  • assert not hasattr(doss.enumeration, "callees")
  • assert doss.function is None, "an enum must not be answered as a function"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → connect
REQ-DDB-QUERY-002inferredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_an_enum_subject_has_no_caller_fields_at_all → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 14 lines
def test_an_enum_subject_has_no_caller_fields_at_all(tmp_path: Path) -> None:
    """BY ABSENCE, NOT BY EMPTINESS — the rule `VariableSubject` states. An enum has no
    callers and no callees, so `callers: []` on one would be a measurement of something
    that was never measurable, and this whole session has been spent removing exactly that
    shape.
    """
    db, repo = _index(tmp_path)
    doss = q.dossier(db, "ent_decision_t", repo_root=repo)
    assert doss is not None and doss.enumeration is not None
    assert not hasattr(doss.enumeration, "callers")
    assert not hasattr(doss.enumeration, "callees")
    assert doss.function is None, "an enum must not be answered as a function"

Activity · 6 steps
lines 118–118db, repo = _index(tmp_path)lines 119–119doss = q.dossier(db, "ent_decision_t", repo_root=repo)lines 120–120assert doss is not None and doss.enumeration is not Nonelines 121–121assert not hasattr(doss.enumeration, "callers")lines 122–122assert not hasattr(doss.enumeration, "callees")lines 123–123assert doss.function is None, "an enum must not be answered as a function"

test_an_enum_type_resolves_to_its_own_subject

None test_enum_subject.test_an_enum_type_resolves_to_its_own_subject(Path tmp_path)

The kind is `enumeration`, which is the string `search` already puts on these rows — so the value a consumer reads off a search result passes straight back into `dossier`, which is what `search`'s own description promises.

tests/test_enum_subject.py:82

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert doss is not None
  • assert doss.kind == "enumeration"
  • assert doss.enumeration is not None
  • assert doss.enumeration.name == "ent_decision_t"
  • assert doss.enumeration.brief == "Consumer decision returned from delegation callbacks."
  • assert doss.enumeration.detail == "Used by both callbacks."
  • assert doss.enumeration.file == "include/api.h"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_an_enum_type_resolves_to_its_own_subject → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_an_enum_type_resolves_to_its_own_subject → dossier → connect
REQ-DDB-QUERY-002inferredtest_an_enum_type_resolves_to_its_own_subject → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_an_enum_type_resolves_to_its_own_subject → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_an_enum_type_resolves_to_its_own_subject → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_an_enum_type_resolves_to_its_own_subject → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_an_enum_type_resolves_to_its_own_subject → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_an_enum_type_resolves_to_its_own_subject → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 15 lines
def test_an_enum_type_resolves_to_its_own_subject(tmp_path: Path) -> None:
    """The kind is `enumeration`, which is the string `search` already puts on these rows —
    so the value a consumer reads off a search result passes straight back into `dossier`,
    which is what `search`'s own description promises."""
    db, repo = _index(tmp_path)
    doss = q.dossier(db, "ent_decision_t", repo_root=repo)
    assert doss is not None
    assert doss.kind == "enumeration"
    assert doss.enumeration is not None
    assert doss.enumeration.name == "ent_decision_t"
    assert doss.enumeration.brief == "Consumer decision returned from delegation callbacks."
    assert doss.enumeration.detail == "Used by both callbacks."
    assert doss.enumeration.file == "include/api.h"

Activity · 9 steps
lines 86–86db, repo = _index(tmp_path)lines 87–87doss = q.dossier(db, "ent_decision_t", repo_root=repo)lines 88–88assert doss is not Nonelines 89–89assert doss.kind == "enumeration"lines 90–90assert doss.enumeration is not Nonelines 91–91assert doss.enumeration.name == "ent_decision_t"lines 92–92assert doss.enumeration.brief == "Consumer decision returned from delegation callbacks."lines 93–93assert doss.enumeration.detail == "Used by both callbacks."lines 94–94assert doss.enumeration.file == "include/api.h"

test_asking_for_a_VALUE_answers_with_the_enum_that_declares_it

None test_enum_subject.test_asking_for_a_VALUE_answers_with_the_enum_that_declares_it(Path tmp_path)

THE REPORTER'S ACTUAL CALL. They asked about four enum symbols they knew existed and got a definitive negative on all four; the symbols were VALUES, not types.

tests/test_enum_subject.py:147

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert doss is not None and doss.enumeration is not None
  • assert doss.enumeration.name == "ent_decision_t", "the record describes the enum"
  • assert doss.enumeration.matched_enumerator == "ENT_DECISION_ACCEPT", ("the reply must say which value the caller actually asked for" )
  • assert [e.name for e in doss.enumeration.enumerators] == [

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → connect
REQ-DDB-QUERY-002inferredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_asking_for_a_VALUE_answers_with_the_enum_that_declares_it → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 22 lines
def test_asking_for_a_VALUE_answers_with_the_enum_that_declares_it(tmp_path: Path) -> None:
    """THE REPORTER'S ACTUAL CALL. They asked about four enum symbols they knew existed and
    got a definitive negative on all four; the symbols were VALUES, not types.

    The record's `name` stays the ENUM's, because that is what this record describes —
    renaming it to the queried string would report a symbol under a name it does not have,
    which is the `macro_collision` failure one subject over. `matched_enumerator` is how the
    reply says the query named a value and this is what declares it.
    """
    db, repo = _index(tmp_path)
    doss = q.dossier(db, "ENT_DECISION_ACCEPT", repo_root=repo)
    assert doss is not None and doss.enumeration is not None
    assert doss.enumeration.name == "ent_decision_t", "the record describes the enum"
    assert doss.enumeration.matched_enumerator == "ENT_DECISION_ACCEPT", (
        "the reply must say which value the caller actually asked for"
    )
    assert [e.name for e in doss.enumeration.enumerators] == [
        "ENT_DECISION_ACCEPT",
        "ENT_DECISION_REJECT",
    ]

Activity · 6 steps
lines 156–156db, repo = _index(tmp_path)lines 157–157doss = q.dossier(db, "ENT_DECISION_ACCEPT", repo_root=repo)lines 158–158assert doss is not None and doss.enumeration is not Nonelines 159–159assert doss.enumeration.name == "ent_decision_t", "the record describes the enum"lines 160–162assert doss.enumeration.matched_enumerator == "ENT_DECISION_ACCEPT", ( "the reply must say which value the caller actually asked for" )lines 163–166assert [e.name for e in doss.enumeration.enumerators] == [ "ENT_DECISION_ACCEPT", "ENT_DECISION_REJECT", ]

test_asking_for_the_enum_itself_reports_no_matched_value

None test_enum_subject.test_asking_for_the_enum_itself_reports_no_matched_value(Path tmp_path)

THE CONTROL. `matched_enumerator` fires only when the query named a value, so a consumer can tell the two calls apart — a field populated on every reply says nothing.

tests/test_enum_subject.py:169

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert doss is not None and doss.enumeration is not None
  • assert doss.enumeration.matched_enumerator == ""

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → connect
REQ-DDB-QUERY-002inferredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_asking_for_the_enum_itself_reports_no_matched_value → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 9 lines
def test_asking_for_the_enum_itself_reports_no_matched_value(tmp_path: Path) -> None:
    """THE CONTROL. `matched_enumerator` fires only when the query named a value, so a
    consumer can tell the two calls apart — a field populated on every reply says nothing."""
    db, repo = _index(tmp_path)
    doss = q.dossier(db, "ent_decision_t", repo_root=repo)
    assert doss is not None and doss.enumeration is not None
    assert doss.enumeration.matched_enumerator == ""

Activity · 4 steps
lines 172–172db, repo = _index(tmp_path)lines 173–173doss = q.dossier(db, "ent_decision_t", repo_root=repo)lines 174–174assert doss is not None and doss.enumeration is not Nonelines 175–175assert doss.enumeration.matched_enumerator == ""

test_asking_for_the_enumeration_kind_filters_rather_than_relabels

None test_enum_subject.test_asking_for_the_enumeration_kind_filters_rather_than_relabels(Path tmp_path)

`kind` is a FILTER, not an override — the rule `_chosen_kind` records. A name that is not an enum must return nothing when one is asked for, rather than something else wearing the label.

tests/test_enum_subject.py:126

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert q.dossier(db, "ent_decision_t", kind="enumeration", repo_root=repo) is not None
  • assert q.dossier(db, "no_such_name", kind="enumeration", repo_root=repo) is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → connect
REQ-DDB-QUERY-002inferredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_asking_for_the_enumeration_kind_filters_rather_than_relabels → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 9 lines
def test_asking_for_the_enumeration_kind_filters_rather_than_relabels(tmp_path: Path) -> None:
    """`kind` is a FILTER, not an override — the rule `_chosen_kind` records. A name that
    is not an enum must return nothing when one is asked for, rather than something else
    wearing the label."""
    db, repo = _index(tmp_path)
    assert q.dossier(db, "ent_decision_t", kind="enumeration", repo_root=repo) is not None
    assert q.dossier(db, "no_such_name", kind="enumeration", repo_root=repo) is None

Activity · 3 steps
lines 130–130db, repo = _index(tmp_path)lines 131–131assert q.dossier(db, "ent_decision_t", kind="enumeration", repo_root=repo) is not Nonelines 132–132assert q.dossier(db, "no_such_name", kind="enumeration", repo_root=repo) is None

test_the_body_carries_the_enumerators_verbatim

None test_enum_subject.test_the_body_carries_the_enumerators_verbatim(Path tmp_path)

WHY THIS IS A SUBJECT AND NOT A STUB. doxygen emits no `enumvalue` rows at all — zero on entropic — so the individual enumerators are not indexed and cannot be listed from the database. They ARE in the body span the enumeration row carries, so returning it answers "what are the values" from the source rather than from an invented layer.

tests/test_enum_subject.py:97

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert doss is not None and doss.enumeration is not None
  • assert body is not None, "an enum with a body span must return it"
  • assert "ENT_DECISION_ACCEPT" in text and "ENT_DECISION_REJECT" in text

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_the_body_carries_the_enumerators_verbatim → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_the_body_carries_the_enumerators_verbatim → dossier → connect
REQ-DDB-QUERY-002inferredtest_the_body_carries_the_enumerators_verbatim → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_the_body_carries_the_enumerators_verbatim → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_the_body_carries_the_enumerators_verbatim → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_the_body_carries_the_enumerators_verbatim → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_the_body_carries_the_enumerators_verbatim → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_the_body_carries_the_enumerators_verbatim → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 15 lines
def test_the_body_carries_the_enumerators_verbatim(tmp_path: Path) -> None:
    """WHY THIS IS A SUBJECT AND NOT A STUB. doxygen emits no `enumvalue` rows at all —
    zero on entropic — so the individual enumerators are not indexed and cannot be listed
    from the database. They ARE in the body span the enumeration row carries, so returning
    it answers "what are the values" from the source rather than from an invented layer.
    """
    db, repo = _index(tmp_path)
    doss = q.dossier(db, "ent_decision_t", repo_root=repo)
    assert doss is not None and doss.enumeration is not None
    body = doss.enumeration.body
    assert body is not None, "an enum with a body span must return it"
    text = "\n".join(body.lines)
    assert "ENT_DECISION_ACCEPT" in text and "ENT_DECISION_REJECT" in text

Activity · 7 steps
lines 103–103db, repo = _index(tmp_path)lines 104–104doss = q.dossier(db, "ent_decision_t", repo_root=repo)lines 105–105assert doss is not None and doss.enumeration is not Nonelines 106–106body = doss.enumeration.bodylines 107–107assert body is not None, "an enum with a body span must return it"lines 108–108text = "\n".join(body.lines)lines 109–109assert "ENT_DECISION_ACCEPT" in text and "ENT_DECISION_REJECT" in text

test_the_enum_lists_the_values_the_index_holds

None test_enum_subject.test_the_enum_lists_the_values_the_index_holds(Path tmp_path)

The recovered `enumvalue` rows, read back through `scope`. A C enum is a `memberdef` and not a `compounddef`, so there is no compound for a `member` link to point at and the relation is carried by `scope` — which is why this reads that column rather than the member table the class view uses.

tests/test_enum_subject.py:135

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert doss is not None and doss.enumeration is not None
  • assert got == [("ENT_DECISION_ACCEPT", "0"), ("ENT_DECISION_REJECT", "1")]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_the_enum_lists_the_values_the_index_holds → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_the_enum_lists_the_values_the_index_holds → dossier → connect
REQ-DDB-QUERY-002inferredtest_the_enum_lists_the_values_the_index_holds → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_the_enum_lists_the_values_the_index_holds → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_the_enum_lists_the_values_the_index_holds → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_the_enum_lists_the_values_the_index_holds → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_the_enum_lists_the_values_the_index_holds → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_the_enum_lists_the_values_the_index_holds → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 12 lines
def test_the_enum_lists_the_values_the_index_holds(tmp_path: Path) -> None:
    """The recovered `enumvalue` rows, read back through `scope`. A C enum is a `memberdef`
    and not a `compounddef`, so there is no compound for a `member` link to point at and the
    relation is carried by `scope` — which is why this reads that column rather than the
    member table the class view uses."""
    db, repo = _index(tmp_path)
    doss = q.dossier(db, "ent_decision_t", repo_root=repo)
    assert doss is not None and doss.enumeration is not None
    got = [(e.name, e.value) for e in doss.enumeration.enumerators]
    assert got == [("ENT_DECISION_ACCEPT", "0"), ("ENT_DECISION_REJECT", "1")]

Activity · 5 steps
lines 140–140db, repo = _index(tmp_path)lines 141–141doss = q.dossier(db, "ent_decision_t", repo_root=repo)lines 142–142assert doss is not None and doss.enumeration is not Nonelines 143–143got = [(e.name, e.value) for e in doss.enumeration.enumerators]lines 144–144assert got == [("ENT_DECISION_ACCEPT", "0"), ("ENT_DECISION_REJECT", "1")]

test_the_enum_subject_survives_the_mcp_flatten

None test_enum_subject.test_the_enum_subject_survives_the_mcp_flatten(Path tmp_path)

The MCP payload for an enumeration subject is populated, not a miss.

tests/test_enum_subject.py:225

Show on the map →

Called by none

Calls _index

Checks

  • assert reply.get("found") is not False, "an indexed enum must not read as a negative"
  • assert reply["subject_kind"] == "enumeration"
  • assert reply["name"] == "ent_decision_t"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measured
REQ-DDB-MCP-003measured
REQ-DDB-QUERY-001measured
REQ-DDB-QUERY-003measured
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-010measured
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measured
REQ-DDB-QUERY-014measured
Source · 30 lines
def test_the_enum_subject_survives_the_mcp_flatten(tmp_path: Path) -> None:
    """THE HALF OF gh#6 THAT WAS NEVER WIRED. Every other test here calls the query API,
    which built the enumeration subject correctly from the day it landed. `_flatten_subject`
    reads `SubjectDossier.section` to make the MCP payload, and that property carried a
    hand-written tuple of seven sections which `enumeration` was left out of — so the tool a
    model actually calls answered `found: false` for every enum in every index, while
    `search` listed the same names and `resolve_subject` reported the kind.

    IT IS THE CONFIDENT NEGATIVE, not merely a gap. `unresolved_kinds` deliberately stopped
    naming `enumeration` when it became a subject kind, so the reply no longer carried the
    coverage-limitation clause that made the ORIGINAL gh#6 report survivable — it became a
    bare "definitive negative from the database" for a symbol the index holds with a brief,
    a body span and its enumerators.

    Measured live on the released server before the fix:

        dossier("ent_decision_t") -> found: false, "a kind `dossier` does not describe yet"

    @brief The MCP payload for an enumeration subject is populated, not a miss.
    @return None.
    @version 1
    """
    from clew.mcp_server.tools_query import QueryTools

    db, repo = _index(tmp_path)
    tools = QueryTools(lambda: db, lambda: repo)
    reply = tools.dossier("ent_decision_t")
    assert reply.get("found") is not False, "an indexed enum must not read as a negative"
    assert reply["subject_kind"] == "enumeration"
    assert reply["name"] == "ent_decision_t"

1 more lines, not shown

Activity · 7 steps
lines 247–247from clew.mcp_server.tools_query import QueryToolslines 249–249db, repo = _index(tmp_path)lines 250–250tools = QueryTools(lambda: db, lambda: repo)lines 251–251reply = tools.dossier("ent_decision_t")lines 252–252assert reply.get("found") is not False, "an indexed enum must not read as a negative"lines 253–253assert reply["subject_kind"] == "enumeration"lines 254–254assert reply["name"] == "ent_decision_t"

test_the_natural_word_enum_reaches_a_C_enum

None test_enum_subject.test_the_natural_word_enum_reaches_a_C_enum(Path tmp_path)

gh#27, a regression gh#6's own fix introduced. `_KIND_ALIASES` mapped `enum -> class`, correct when the only enum-ish thing with a subject was a `compounddef` row (a C++ scoped `enum class`, Rust's `impl EnumName`). A C enum is a `memberdef` with kind `'enumeration'`, not a compound, so the alias sent the caller to a subject the name cannot resolve as and `_chosen_kind` correctly returned None:

tests/test_enum_subject.py:178

Show on the map →

Called by none

Calls _index, dossier

Checks

  • assert doss is not None, "the natural word must reach the enum it names"
  • assert doss.kind == "enumeration"
  • assert doss.enumeration is not None and doss.enumeration.name == "ent_decision_t"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_the_natural_word_enum_reaches_a_C_enum → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_the_natural_word_enum_reaches_a_C_enum → dossier → connect
REQ-DDB-QUERY-002inferredtest_the_natural_word_enum_reaches_a_C_enum → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_the_natural_word_enum_reaches_a_C_enum → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_the_natural_word_enum_reaches_a_C_enum → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_the_natural_word_enum_reaches_a_C_enum → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013inferredtest_the_natural_word_enum_reaches_a_C_enum → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_the_natural_word_enum_reaches_a_C_enum → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 24 lines
def test_the_natural_word_enum_reaches_a_C_enum(tmp_path: Path) -> None:
    """gh#27, a regression gh#6's own fix introduced. `_KIND_ALIASES` mapped `enum -> class`,
    correct when the only enum-ish thing with a subject was a `compounddef` row (a C++ scoped
    `enum class`, Rust's `impl EnumName`). A C enum is a `memberdef` with kind
    `'enumeration'`, not a compound, so the alias sent the caller to a subject the name cannot
    resolve as and `_chosen_kind` correctly returned None:

        dossier("ent_decision_t", kind="enum")  ->  None

    `enum` is the word a human types; `enumeration` is doxygen's spelling, learned only by
    reading a `search` row. The natural guess failing SILENTLY is the shape gh#6 was filed
    over in the first place.

    THE ALIAS IS NOW CONDITIONAL ON WHAT THE NAME IS. It offers `class` first — the compound
    reading, which is what the alias was written for and must keep working — and falls to
    `enumeration` when the name is not a compound.
    """
    db, repo = _index(tmp_path)
    doss = q.dossier(db, "ent_decision_t", kind="enum", repo_root=repo)
    assert doss is not None, "the natural word must reach the enum it names"
    assert doss.kind == "enumeration"
    assert doss.enumeration is not None and doss.enumeration.name == "ent_decision_t"

Activity · 5 steps
lines 195–195db, repo = _index(tmp_path)lines 196–196doss = q.dossier(db, "ent_decision_t", kind="enum", repo_root=repo)lines 197–197assert doss is not None, "the natural word must reach the enum it names"lines 198–198assert doss.kind == "enumeration"lines 199–199assert doss.enumeration is not None and doss.enumeration.name == "ent_decision_t"