test_file_subject.py

tests/test_file_subject.py

A FILE PATH IS A SUBJECT (C1 of the 1.1.0 acceptance review).

test_a_documented_file_path_is_a_subject_and_carries_its_documentation

test_file_subject.test_a_documented_file_path_is_a_subject_and_carries_its_documentation(rich_db, repo_root)

A documented file resolves as a file subject carrying its documentation.

tests/test_file_subject.py:40

Show on the map →

Called by none

Calls dossier

Checks

  • assert built is not None, "a file path the index holds rows for must resolve as a subject"
  • assert built.kind == "file"
  • assert built.file is not None
  • assert built.file.path == "src/event_bus/event_bus.c"
  • assert built.file.documentation, ("file_docs holds a row for this path; the subject must serve it" )
  • assert built.file.symbol_count == 9

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004inferredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → connect
REQ-DDB-QUERY-002inferredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_a_documented_file_path_is_a_subject_and_carries_its_documentation → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 19 lines
def test_a_documented_file_path_is_a_subject_and_carries_its_documentation(rich_db, repo_root):
    """RED BEFORE THE FIX: `resolve_subject` has no `file` probe, so this returns None and
    the served refusal names `search(corpus='prose')`.

    `event_bus.c` is the fixture's richest documented file — 9 symbols and a `file_docs` row.
    The assertion is on the DOCUMENTATION being present, because that is the field the 31
    weight was lost on; a path echo and a count were already reachable through `list_files`.
    """
    built = q.dossier(rich_db, "src/event_bus/event_bus.c", repo_root=repo_root)
    assert built is not None, "a file path the index holds rows for must resolve as a subject"
    assert built.kind == "file"
    assert built.file is not None
    assert built.file.path == "src/event_bus/event_bus.c"
    assert built.file.documentation, (
        "file_docs holds a row for this path; the subject must serve it"
    )
    assert built.file.symbol_count == 9

Activity · 7 steps
lines 48–48built = q.dossier(rich_db, "src/event_bus/event_bus.c", repo_root=repo_root)lines 49–49assert built is not None, "a file path the index holds rows for must resolve as a subject"lines 50–50assert built.kind == "file"lines 51–51assert built.file is not Nonelines 52–52assert built.file.path == "src/event_bus/event_bus.c"lines 53–55assert built.file.documentation, ( "file_docs holds a row for this path; the subject must serve it" )lines 56–56assert built.file.symbol_count == 9

test_a_file_path_asked_for_as_a_function_resolves_to_nothing

test_file_subject.test_a_file_path_asked_for_as_a_function_resolves_to_nothing(rich_db, repo_root)

Asking for a non-file kind on a file path is still a filter, not an override.

tests/test_file_subject.py:122

Show on the map →

Called by none

Calls dossier

Checks

  • assert q.dossier(rich_db, "src/main.c", kind="function", repo_root=repo_root) is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004inferredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → connect
REQ-DDB-QUERY-002inferredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_a_file_path_asked_for_as_a_function_resolves_to_nothing → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 9 lines
def test_a_file_path_asked_for_as_a_function_resolves_to_nothing(rich_db, repo_root):
    """The rule every other kind obeys — "AN EXPLICIT KIND IS A FILTER, NOT AN OVERRIDE" —
    and worth pinning here because a file path is the one subject whose spelling makes the
    caller's intent unambiguous, which is exactly when a surface is tempted to be helpful
    and hand back the thing it was told to rule out.
    """
    assert q.dossier(rich_db, "src/main.c", kind="function", repo_root=repo_root) is None

Activity · 1 steps
lines 128–128assert q.dossier(rich_db, "src/main.c", kind="function", repo_root=repo_root) is None

test_a_file_subject_lists_the_symbols_it_defines

test_file_subject.test_a_file_subject_lists_the_symbols_it_defines(rich_db, repo_root)

A file's members are listed so the subject answers "what is in here".

tests/test_file_subject.py:133

Show on the map →

Called by none

Calls dossier

Checks

  • assert len(names) == built.file.symbol_count
  • assert "event_bus_publish" in names, f"expected the publisher among {sorted(names)}"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004inferredtest_a_file_subject_lists_the_symbols_it_defines → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_file_subject_lists_the_symbols_it_defines → dossier → connect
REQ-DDB-QUERY-002inferredtest_a_file_subject_lists_the_symbols_it_defines → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_a_file_subject_lists_the_symbols_it_defines → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_a_file_subject_lists_the_symbols_it_defines → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_a_file_subject_lists_the_symbols_it_defines → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_a_file_subject_lists_the_symbols_it_defines → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_a_file_subject_lists_the_symbols_it_defines → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 14 lines
def test_a_file_subject_lists_the_symbols_it_defines(rich_db, repo_root):
    """A count alone does not answer the graded question, which is what the file CONTAINS.
    The members come from the same `memberdef`/`file_id` join `list_files` counts, so the
    list and the count cannot disagree.
    """
    built = q.dossier(rich_db, "src/event_bus/event_bus.c", repo_root=repo_root)
    names = {m.name for m in built.file.members}
    assert len(names) == built.file.symbol_count
    assert "event_bus_publish" in names, f"expected the publisher among {sorted(names)}"


# ─── the thin-schema contract, which this feature's first draft broke ─────────

Activity · 4 steps
lines 138–138built = q.dossier(rich_db, "src/event_bus/event_bus.c", repo_root=repo_root)lines 139–139names = {m.name for m in built.file.members}lines 140–140assert len(names) == built.file.symbol_countlines 141–141assert "event_bus_publish" in names, f"expected the publisher among {sorted(names)}"

test_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one

test_file_subject.test_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one(rich_db, repo_root)

A file the index knows of but harvested nothing from says which of the two it is.

tests/test_file_subject.py:77

Show on the map →

Called by none

Calls dossier

Checks

  • assert known is not None, "a path row is knowledge of the file, and must resolve"
  • assert known.file.symbol_count == 0
  • assert known.file.harvested is False
  • assert q.dossier(rich_db, "src/nothing/invented.c", repo_root=repo_root) is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004inferredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → connect
REQ-DDB-QUERY-002inferredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 20 lines
def test_a_known_file_with_no_harvested_content_is_distinguishable_from_an_unknown_one(
    rich_db, repo_root
):
    """THE DISTINCTION THIS WHOLE SUBJECT IS FOR. `pthread.h` is a `path` row doxygen
    recorded from an `#include` and never resolved to content: 0 symbols, no documentation.
    An unknown path resolves to nothing at all.

    Both would read as "nothing here" if the subject reported only counts, and they are
    different facts — the first is "I know this file exists and could not read it", which is
    `DirectoryEntry.unresolved_files` at one-file granularity, and the second is "not in this
    index". `harvested` carries it.
    """
    known = q.dossier(rich_db, "pthread.h", repo_root=repo_root)
    assert known is not None, "a path row is knowledge of the file, and must resolve"
    assert known.file.symbol_count == 0
    assert known.file.harvested is False

    assert q.dossier(rich_db, "src/nothing/invented.c", repo_root=repo_root) is None

Activity · 5 steps
lines 89–89known = q.dossier(rich_db, "pthread.h", repo_root=repo_root)lines 90–90assert known is not None, "a path row is knowledge of the file, and must resolve"lines 91–91assert known.file.symbol_count == 0lines 92–92assert known.file.harvested is Falselines 94–94assert q.dossier(rich_db, "src/nothing/invented.c", repo_root=repo_root) is None

test_an_undocumented_file_resolves_and_reports_no_documentation

test_file_subject.test_an_undocumented_file_resolves_and_reports_no_documentation(rich_db, repo_root)

A file with symbols but no file-level comment resolves, and says so by absence.

tests/test_file_subject.py:61

Show on the map →

Called by none

Calls dossier

Checks

  • assert built is not None
  • assert built.kind == "file"
  • assert built.file.documentation == ""
  • assert built.file.symbol_count == 10

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004inferredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → connect
REQ-DDB-QUERY-002inferredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_an_undocumented_file_resolves_and_reports_no_documentation → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 14 lines
def test_an_undocumented_file_resolves_and_reports_no_documentation(rich_db, repo_root):
    """ABSENCE IS NOT EMPTINESS, applied to the one field this subject exists to carry.
    `event_bus.h` has 10 symbols and no `file_docs` row — the file was read and carries no
    file-level comment. That is a measurement, and it must not be confused with the file
    being unknown (which returns None) or with the corpus being absent (which
    `has_file_docs` reports).
    """
    built = q.dossier(rich_db, "src/event_bus/event_bus.h", repo_root=repo_root)
    assert built is not None
    assert built.kind == "file"
    assert built.file.documentation == ""
    assert built.file.symbol_count == 10

Activity · 5 steps
lines 68–68built = q.dossier(rich_db, "src/event_bus/event_bus.h", repo_root=repo_root)lines 69–69assert built is not Nonelines 70–70assert built.kind == "file"lines 71–71assert built.file.documentation == ""lines 72–72assert built.file.symbol_count == 10

test_kind_file_from_a_search_row_round_trips

test_file_subject.test_kind_file_from_a_search_row_round_trips(rich_db, repo_root)

kind='file ` is accepted rather than refused.

tests/test_file_subject.py:110

Show on the map →

Called by none

Calls dossier

Checks

  • assert built is not None
  • assert built.kind == "file"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004inferredtest_kind_file_from_a_search_row_round_trips → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_kind_file_from_a_search_row_round_trips → dossier → connect
REQ-DDB-QUERY-002inferredtest_kind_file_from_a_search_row_round_trips → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_kind_file_from_a_search_row_round_trips → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_kind_file_from_a_search_row_round_trips → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_kind_file_from_a_search_row_round_trips → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013inferredtest_kind_file_from_a_search_row_round_trips → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_kind_file_from_a_search_row_round_trips → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 10 lines
def test_kind_file_from_a_search_row_round_trips(rich_db, repo_root):
    """`search`'s own description promises "READ `kind` ON EVERY ROW: it is what you pass
    back", and the `files` corpus labels its rows `file`. That promise was false for this one
    kind: `_KIND_NO_SUBJECT` raised, naming a route that could not answer the question.
    """
    built = q.dossier(rich_db, "src/main.c", kind="file", repo_root=repo_root)
    assert built is not None
    assert built.kind == "file"

Activity · 3 steps
lines 115–115built = q.dossier(rich_db, "src/main.c", kind="file", repo_root=repo_root)lines 116–116assert built is not Nonelines 117–117assert built.kind == "file"

test_long_file_documentation_is_capped_with_an_explicit_notice

test_file_subject.test_long_file_documentation_is_capped_with_an_explicit_notice(tmp_path)

A long file-level comment is capped, and says that it was.

tests/test_file_subject.py:209

Checks

  • assert len(built.documentation) < len(doc), "an unbounded scalar defeats the payload budget"
  • assert "truncated" in built.documentation, (f"a silent cut reads as a complete document: {built.documentation[-120:]!r}" )
  • assert str(len(doc)) in built.documentation, ("the notice must state the true length, so a reader knows how much it is not seeing" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-003measuredtest_long_file_documentation_is_capped_with_an_explicit_notice → file_subject → has_columns
REQ-DDB-QUERY-004measuredtest_long_file_documentation_is_capped_with_an_explicit_notice → file_subject
Source · 40 lines
def test_long_file_documentation_is_capped_with_an_explicit_notice(tmp_path):
    """THE ONE FIELD ON THIS SUBJECT THAT IS UNBOUNDED BY ANYTHING THE INDEX CONTROLS.
    `members` is a list and is trimmed by `_DOSSIER_LISTS` like every other list on the
    surface; `documentation` is a scalar string and is therefore invisible to
    `_shrink_to_budget`. Measured in this repository: `clew/tiers.py` carries 2,794
    characters of module docstring, `clew/cli.py` more, and a generated header's `@file`
    block has no ceiling at all. An unbounded scalar inside a budgeted payload is how the
    65,536-byte cap gets exceeded by a reply that every list-trimmer reports as compliant.

    CAPPED WITH THE SAME CONSTANT AND THE SAME NOTICE as a function's `@details` prose, from
    one implementation rather than a second copy of the convention. A truncation notice that
    is nearly the same in two places is the one that drifts into saying two different things.

    @brief File documentation is bounded and discloses the cut.
    @return None.
    @version 1
    """
    import sqlite3

    from clew.query._common import DETAIL_CAP
    from clew.query.corpus import file_subject

    doc = "x" * (DETAIL_CAP + 500)
    db = tmp_path / "long.db"
    conn = sqlite3.connect(db)
    conn.execute("CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT, type INTEGER)")
    conn.execute("INSERT INTO path (name, type) VALUES ('src/verbose.c', 1)")
    conn.execute("CREATE TABLE file_docs (file_path TEXT NOT NULL, doc TEXT NOT NULL)")
    conn.execute("INSERT INTO file_docs VALUES ('src/verbose.c', ?)", (doc,))
    conn.commit()

    built = file_subject(conn, "src/verbose.c")
    assert len(built.documentation) < len(doc), "an unbounded scalar defeats the payload budget"
    assert "truncated" in built.documentation, (
        f"a silent cut reads as a complete document: {built.documentation[-120:]!r}"
    )
    assert str(len(doc)) in built.documentation, (
        "the notice must state the true length, so a reader knows how much it is not seeing"
    )
    conn.close()

1 more lines, not shown

Activity · 16 steps
lines 226–226import sqlite3lines 228–228from clew.query._common import DETAIL_CAPlines 229–229from clew.query.corpus import file_subjectlines 231–231doc = "x" * (DETAIL_CAP + 500)lines 232–232db = tmp_path / "long.db"lines 233–233conn = sqlite3.connect(db)lines 234–234conn.execute("CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT, type INTEGER)")lines 235–235conn.execute("INSERT INTO path (name, type) VALUES ('src/verbose.c', 1)")lines 236–236conn.execute("CREATE TABLE file_docs (file_path TEXT NOT NULL, doc TEXT NOT NULL)")lines 237–237conn.execute("INSERT INTO file_docs VALUES ('src/verbose.c', ?)", (doc,))lines 238–238conn.commit()lines 240–240built = file_subject(conn, "src/verbose.c")lines 241–241assert len(built.documentation) < len(doc), "an unbounded scalar defeats the payload budget"lines 242–244assert "truncated" in built.documentation, ( f"a silent cut reads as a complete document: {built.documentation[-120:]!r}" )lines 245–247assert str(len(doc)) in built.documentation, ( "the notice must state the true length, so a reader knows how much it is not seeing" )lines 248–248conn.close()

test_no_path_table_is_not_a_file

test_file_subject.test_no_path_table_is_not_a_file(tmp_path)

An index with no path table at all resolves no file and does not raise.

tests/test_file_subject.py:188

Checks

  • assert is_indexed_file(conn, "src/thin.c") is False

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-003measuredtest_no_path_table_is_not_a_file → is_indexed_file → table_exists
REQ-DDB-QUERY-004measuredtest_no_path_table_is_not_a_file → is_indexed_file
Source · 19 lines
def test_no_path_table_is_not_a_file(tmp_path):
    """The outermost degradation step, and the one `table_exists` is for.

    @brief A `path`-less index answers no rather than raising.
    @return None.
    @version 1
    """
    import sqlite3

    from clew.query.corpus import is_indexed_file

    conn = sqlite3.connect(tmp_path / "empty.db")
    assert is_indexed_file(conn, "src/thin.c") is False
    conn.close()


# ─── the documentation is the payload, so it is the thing that needs a bound ──

Activity · 5 steps
lines 195–195import sqlite3lines 197–197from clew.query.corpus import is_indexed_filelines 199–199conn = sqlite3.connect(tmp_path / "empty.db")lines 200–200assert is_indexed_file(conn, "src/thin.c") is Falselines 201–201conn.close()

test_the_file_probe_degrades_on_a_minimal_path_table

test_file_subject.test_the_file_probe_degrades_on_a_minimal_path_table(tmp_path)

The file probe degrades on an index whose path table has no type column.

tests/test_file_subject.py:149

Checks

  • assert is_indexed_file(conn, "src/thin.c") is True
  • assert is_indexed_file(conn, "src/absent.c") is False
  • assert built is not None
  • assert built.members == ()
  • assert built.symbol_count == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-003measuredtest_the_file_probe_degrades_on_a_minimal_path_table → file_subject → has_columns
REQ-DDB-QUERY-004measuredtest_the_file_probe_degrades_on_a_minimal_path_table → file_subject
Source · 37 lines
def test_the_file_probe_degrades_on_a_minimal_path_table(tmp_path):
    """RED WHEN WRITTEN, AGAINST CODE ALREADY IN THE TREE. The first draft of
    `is_indexed_file` named `path.type` unconditionally. This repository's minimal fixtures
    create `path (rowid, name)` and nothing else, so the probe raised `no such column: type`
    — and because `resolve_subject` runs EVERY probe against EVERY bare name, it took 14
    unrelated tests down with it: every enum subject, both kconfig subjects, three recovery
    hints.

    That is the `has_columns` graceful-degradation contract, and the blast radius is the
    argument for pinning it here rather than trusting the next probe author to remember: a new
    probe is the one kind of change that can make an unrelated subject kind raise.

    @brief A thin `path` table answers thinly rather than raising.
    @return None.
    @version 1
    """
    import sqlite3

    from clew.query.corpus import file_subject, is_indexed_file

    db = tmp_path / "thin.db"
    conn = sqlite3.connect(db)
    conn.execute("CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT)")
    conn.execute("INSERT INTO path (name) VALUES ('src/thin.c')")
    conn.commit()

    assert is_indexed_file(conn, "src/thin.c") is True
    assert is_indexed_file(conn, "src/absent.c") is False
    built = file_subject(conn, "src/thin.c")
    assert built is not None
    ## No `memberdef` table at all: zero members is what this index knows, and it must not
    ## raise on the way to saying so.
    assert built.members == ()
    assert built.symbol_count == 0
    conn.close()

Activity · 14 steps
lines 165–165import sqlite3lines 167–167from clew.query.corpus import file_subject, is_indexed_filelines 169–169db = tmp_path / "thin.db"lines 170–170conn = sqlite3.connect(db)lines 171–171conn.execute("CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT)")lines 172–172conn.execute("INSERT INTO path (name) VALUES ('src/thin.c')")lines 173–173conn.commit()lines 175–175assert is_indexed_file(conn, "src/thin.c") is Truelines 176–176assert is_indexed_file(conn, "src/absent.c") is Falselines 177–177built = file_subject(conn, "src/thin.c")lines 178–178assert built is not Nonelines 181–181assert built.members == ()lines 182–182assert built.symbol_count == 0lines 183–183conn.close()

test_the_synthetic_stl_path_is_not_a_file_subject

test_file_subject.test_the_synthetic_stl_path_is_not_a_file_subject(rich_db, repo_root)

The synthetic [STL] path is never a subject.

tests/test_file_subject.py:99

Show on the map →

Called by none

Calls dossier

Checks

  • assert q.dossier(rich_db, "[STL]", repo_root=repo_root) is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004inferredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → connect
REQ-DDB-QUERY-002inferredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-010measuredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013measuredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-WIKI-054inferredtest_the_synthetic_stl_path_is_not_a_file_subject → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 9 lines
def test_the_synthetic_stl_path_is_not_a_file_subject(rich_db, repo_root):
    """`list_files` excludes it by `SYNTHETIC_PATH` and so must this. It is doxygen's
    placeholder owner for standard-library symbols, not a file in the repository, and
    serving it as one would put a path nobody can open into a reply whose whole purpose is
    naming files that can be read.
    """
    assert q.dossier(rich_db, "[STL]", repo_root=repo_root) is None

Activity · 1 steps
lines 105–105assert q.dossier(rich_db, "[STL]", repo_root=repo_root) is None