test_doxyfile_refusal_messages.py

tests/test_doxyfile_refusal_messages.py

Tests for gh#4 — the no-Doxyfile message misdescribes a supported path.

test_a_missing_explicit_doxyfile_does_not_propose_passing_one

None test_doxyfile_refusal_messages.test_a_missing_explicit_doxyfile_does_not_propose_passing_one(Path tmp_path)

The explicitly-passed-but-absent case never proposes doxyfile again.

tests/test_doxyfile_refusal_messages.py:62

Checks

  • assert outcome.kind == DOXYFILE_EXPLICIT_MISSING
  • assert str(missing) in outcome.message, "the message must name the path that was tried"
  • assert "--repo-root" in outcome.message, "it must name the flag that changes the outcome"
  • assert "pass --doxyfile" not in outcome.message.lower(), ("it must not propose the flag the user just used" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-001measuredtest_a_missing_explicit_doxyfile_does_not_propose_passing_one → describe_doxyfile_resolution
Source · 16 lines
def test_a_missing_explicit_doxyfile_does_not_propose_passing_one(tmp_path: Path) -> None:
    """The literal gh#4 complaint. The user passed --doxyfile; the path is not on
    disk; the old text answered "Pass --doxyfile". "Never proposes an action
    already taken" is the property, so this asserts the ABSENCE of that advice as
    well as the presence of the path that was actually tried."""
    missing = tmp_path / "nope" / "Doxyfile"
    outcome = describe_doxyfile_resolution(explicit=missing, repo_root=None, candidates=[])

    assert outcome.kind == DOXYFILE_EXPLICIT_MISSING
    assert str(missing) in outcome.message, "the message must name the path that was tried"
    assert "--repo-root" in outcome.message, "it must name the flag that changes the outcome"
    assert "pass --doxyfile" not in outcome.message.lower(), (
        "it must not propose the flag the user just used"
    )

Activity · 6 steps
lines 67–67missing = tmp_path / "nope" / "Doxyfile"lines 68–68outcome = describe_doxyfile_resolution(explicit=missing, repo_root=None, candidates=[])lines 70–70assert outcome.kind == DOXYFILE_EXPLICIT_MISSINGlines 71–71assert str(missing) in outcome.message, "the message must name the path that was tried"lines 72–72assert "--repo-root" in outcome.message, "it must name the flag that changes the outcome"lines 73–75assert "pass --doxyfile" not in outcome.message.lower(), ( "it must not propose the flag the user just used" )

test_a_rejected_candidate_says_where_and_why

None test_doxyfile_refusal_messages.test_a_rejected_candidate_says_where_and_why(Path tmp_path)

A rejected candidate says where it was found and why it was not used.

tests/test_doxyfile_refusal_messages.py:110

Checks

  • assert outcome.kind == DOXYFILE_REJECTED
  • assert not outcome.is_error, "refusing to guess still proceeds via synthesis"
  • assert "sample/Doxyfile" in outcome.message, "it must say WHERE the candidate was found"
  • assert "--doxyfile" in outcome.message, "it must name the flag that selects one"
  • assert "guess" in lowered or "wrong" in lowered, "it must say WHY it was not adopted"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-001measuredtest_a_rejected_candidate_says_where_and_why → describe_doxyfile_resolution
Source · 22 lines
def test_a_rejected_candidate_says_where_and_why(tmp_path: Path) -> None:
    """`discover_doxyfile` refuses to guess among strays rather than picking
    alphabetically, because it was once caught selecting a test FIXTURE's Doxyfile
    to index a whole project. The message must carry that reasoning — a bare "not
    used" invites the reader to conclude the tool failed to find what it plainly
    did find."""
    repo = tmp_path / "repo"
    (repo / "sample").mkdir(parents=True)
    stray = repo / "sample" / "Doxyfile"
    stray.write_text("PROJECT_NAME = fixture\n")

    candidates = [stray]
    outcome = describe_doxyfile_resolution(explicit=None, repo_root=repo, candidates=candidates)

    assert outcome.kind == DOXYFILE_REJECTED
    assert not outcome.is_error, "refusing to guess still proceeds via synthesis"
    assert "sample/Doxyfile" in outcome.message, "it must say WHERE the candidate was found"
    lowered = outcome.message.lower()
    assert "--doxyfile" in outcome.message, "it must name the flag that selects one"
    assert "guess" in lowered or "wrong" in lowered, "it must say WHY it was not adopted"

Activity · 12 steps
lines 116–116repo = tmp_path / "repo"lines 117–117(repo / "sample").mkdir(parents=True)lines 118–118stray = repo / "sample" / "Doxyfile"lines 119–119stray.write_text("PROJECT_NAME = fixture\n")lines 121–121candidates = [stray]lines 122–122outcome = describe_doxyfile_resolution(explicit=None, repo_root=repo, candidates=candidates)lines 124–124assert outcome.kind == DOXYFILE_REJECTEDlines 125–125assert not outcome.is_error, "refusing to guess still proceeds via synthesis"lines 126–126assert "sample/Doxyfile" in outcome.message, "it must say WHERE the candidate was found"lines 127–127lowered = outcome.message.lower()lines 128–128assert "--doxyfile" in outcome.message, "it must name the flag that selects one"lines 129–129assert "guess" in lowered or "wrong" in lowered, "it must say WHY it was not adopted"

test_candidates_are_reported_without_being_adopted

None test_doxyfile_refusal_messages.test_candidates_are_reported_without_being_adopted(Path tmp_path)

Candidate enumeration is exposed so the message can name what was found.

tests/test_doxyfile_refusal_messages.py:175

Checks

  • assert discover_doxyfile(repo) is None, "a stray must still not be adopted"
  • assert [p.relative_to(repo).as_posix() for p in candidates] == ["sample/Doxyfile"]
  • assert discover_doxyfile(repo) == repo / "docs" / "Doxyfile"
  • assert repo / "docs" / "Doxyfile" not in rejected_doxyfile_candidates(repo)
  • assert rejected_doxyfile_candidates(bare) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-001measuredtest_candidates_are_reported_without_being_adopted → discover_doxyfile
Source · 29 lines
def test_candidates_are_reported_without_being_adopted(tmp_path: Path) -> None:
    """`discover_doxyfile` still returns None for a stray — the refusal behaviour is
    unchanged — while the candidates it declined are separately readable, which is
    what lets the message say where they were. Both halves asserted together,
    because a change that started ADOPTING strays would fix the message and
    reintroduce the fixture-indexing defect."""
    from clew.doxygen import rejected_doxyfile_candidates

    repo = tmp_path / "repo"
    (repo / "sample").mkdir(parents=True)
    (repo / "sample" / "Doxyfile").write_text("x\n")

    assert discover_doxyfile(repo) is None, "a stray must still not be adopted"
    candidates = rejected_doxyfile_candidates(repo)
    assert [p.relative_to(repo).as_posix() for p in candidates] == ["sample/Doxyfile"]

    # A TRUSTED location is never reported as a rejected candidate — otherwise the
    # message would name the very file it went on to adopt.
    (repo / "docs").mkdir()
    (repo / "docs" / "Doxyfile").write_text("x\n")
    assert discover_doxyfile(repo) == repo / "docs" / "Doxyfile"
    assert repo / "docs" / "Doxyfile" not in rejected_doxyfile_candidates(repo)

    # A repo with no strays at all has nothing to report.
    bare = tmp_path / "bare"
    bare.mkdir()
    assert rejected_doxyfile_candidates(bare) == []

Activity · 14 steps
lines 181–181from clew.doxygen import rejected_doxyfile_candidateslines 183–183repo = tmp_path / "repo"lines 184–184(repo / "sample").mkdir(parents=True)lines 185–185(repo / "sample" / "Doxyfile").write_text("x\n")lines 187–187assert discover_doxyfile(repo) is None, "a stray must still not be adopted"lines 188–188candidates = rejected_doxyfile_candidates(repo)lines 189–189assert [p.relative_to(repo).as_posix() for p in candidates] == ["sample/Doxyfile"]lines 193–193(repo / "docs").mkdir()lines 194–194(repo / "docs" / "Doxyfile").write_text("x\n")lines 195–195assert discover_doxyfile(repo) == repo / "docs" / "Doxyfile"lines 196–196assert repo / "docs" / "Doxyfile" not in rejected_doxyfile_candidates(repo)lines 199–199bare = tmp_path / "bare"lines 200–200bare.mkdir()lines 201–201assert rejected_doxyfile_candidates(bare) == []

test_no_doxyfile_anywhere_is_described_as_supported

None test_doxyfile_refusal_messages.test_no_doxyfile_anywhere_is_described_as_supported(Path tmp_path)

A repo with no Doxyfile is described as supported, not as an error.

tests/test_doxyfile_refusal_messages.py:94

Checks

  • assert outcome.kind == DOXYFILE_ABSENT
  • assert not outcome.is_error, "a repo with no Doxyfile is a supported configuration"
  • assert "synthesi" in outcome.message.lower(), "it must say synthesis is what happens next"
  • assert str(repo) in outcome.message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-001measuredtest_no_doxyfile_anywhere_is_described_as_supported → describe_doxyfile_resolution
Source · 14 lines
def test_no_doxyfile_anywhere_is_described_as_supported(tmp_path: Path) -> None:
    """The bullet the issue leads with. A repo that ships none gets synthesis, and
    the message must SAY that rather than reading as a refusal — this is the
    sentence a reader meets on the route the tool handles well."""
    repo = tmp_path / "repo"
    repo.mkdir()
    outcome = describe_doxyfile_resolution(explicit=None, repo_root=repo, candidates=[])

    assert outcome.kind == DOXYFILE_ABSENT
    assert not outcome.is_error, "a repo with no Doxyfile is a supported configuration"
    assert "synthesi" in outcome.message.lower(), "it must say synthesis is what happens next"
    assert str(repo) in outcome.message

Activity · 7 steps
lines 98–98repo = tmp_path / "repo"lines 99–99repo.mkdir()lines 100–100outcome = describe_doxyfile_resolution(explicit=None, repo_root=repo, candidates=[])lines 102–102assert outcome.kind == DOXYFILE_ABSENTlines 103–103assert not outcome.is_error, "a repo with no Doxyfile is a supported configuration"lines 104–104assert "synthesi" in outcome.message.lower(), "it must say synthesis is what happens next"lines 105–105assert str(repo) in outcome.message

test_only_the_unresolvable_situations_are_errors

None test_doxyfile_refusal_messages.test_only_the_unresolvable_situations_are_errors(Path tmp_path)

Only the two no-target situations are errors.

tests/test_doxyfile_refusal_messages.py:160

Checks

  • assert describe_doxyfile_resolution(None, None, []).is_error
  • assert describe_doxyfile_resolution(tmp_path / "n" / "Doxyfile", None, []).is_error
  • assert not describe_doxyfile_resolution(None, repo, []).is_error
  • assert not describe_doxyfile_resolution(None, repo, [repo / "s" / "Doxyfile"]).is_error

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-001measuredtest_only_the_unresolvable_situations_are_errors → describe_doxyfile_resolution
Source · 13 lines
def test_only_the_unresolvable_situations_are_errors(tmp_path: Path) -> None:
    """The is_error split is the behavioural claim in a message-only change: the
    two synthesis routes must stay non-errors, or a supported path becomes a
    refusal — which is the regression this change could most easily introduce."""
    repo = tmp_path / "repo"
    repo.mkdir()

    assert describe_doxyfile_resolution(None, None, []).is_error
    assert describe_doxyfile_resolution(tmp_path / "n" / "Doxyfile", None, []).is_error
    assert not describe_doxyfile_resolution(None, repo, []).is_error
    assert not describe_doxyfile_resolution(None, repo, [repo / "s" / "Doxyfile"]).is_error

Activity · 6 steps
lines 164–164repo = tmp_path / "repo"lines 165–165repo.mkdir()lines 167–167assert describe_doxyfile_resolution(None, None, []).is_errorlines 168–168assert describe_doxyfile_resolution(tmp_path / "n" / "Doxyfile", None, []).is_errorlines 169–169assert not describe_doxyfile_resolution(None, repo, []).is_errorlines 170–170assert not describe_doxyfile_resolution(None, repo, [repo / "s" / "Doxyfile"]).is_error

test_the_cli_refusal_uses_the_new_message

None test_doxyfile_refusal_messages.test_the_cli_refusal_uses_the_new_message(Path tmp_path, caplog)

The CLI still refuses, and now with the discriminating message.

tests/test_doxyfile_refusal_messages.py:206

Show on the map →

Called by none

Calls _args, _run_pipeline

Checks

  • assert excinfo.value.code == 1
  • assert str(missing.resolve()) in caplog.text
  • assert "pass --doxyfile" not in caplog.text.lower()

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CLI-001inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → report_stats
REQ-DDB-CLI-002inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → _doxygen_or_partial → _doxygen_stage → _run_doxygen_from_args → run_doxygen → doxygen_supports_sqlite3
REQ-DDB-CONFIG-001inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _apply_declared_document → stated_document_meta
REQ-DDB-CONFIG-003inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml → _is_flat_req_list
REQ-DDB-CONFIG-004inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_preprocessor
REQ-DDB-CONFIG-005inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig
REQ-DDB-CONFIG-006measuredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _recorded_entry_patterns → recorded_explicit
REQ-DDB-CONFIG-007inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-CONFIG-009inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _apply_toolchain_exclusions → load_toolchain_config
REQ-DDB-GUARD-012inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → load_guard_config → read_guard_config → read_requirements_section
REQ-DDB-GUARD-019inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → apply_autobrief
REQ-DDB-INDEX-001measuredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-INDEX-002measuredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → build_lock
REQ-DDB-INDEX-003inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → report_index_coverage
REQ-DDB-INDEX-004inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols
REQ-DDB-INDEX-005inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → stamp_external_provenance
REQ-DDB-INDEX-006inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → record_code_text → code_text_rows
REQ-DDB-INDEX-007inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → record_owners
REQ-DDB-INDEX-008inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_licenses
REQ-DDB-INDEX-009inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc
REQ-DDB-INDEX-010inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes
REQ-DDB-INDEX-011inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_property_keys
REQ-DDB-MCP-001measuredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _operator_excludes → meta_section
REQ-DDB-MCP-004measured
REQ-DDB-PIPE-001inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_database
REQ-DDB-PIPE-003inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → build_call_edges
REQ-DDB-PIPE-004inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → python_entry_seeds
REQ-DDB-PIPE-005inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-PIPE-006inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → run_rustdoc → _require_nightly_rustdoc → clean_subprocess_env
REQ-DDB-PIPE-007inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig_gates
REQ-DDB-PIPE-008inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs
REQ-DDB-PIPE-009inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → prune_dominated_fuzzy_call_edges
REQ-DDB-PIPE-010inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _build_inferred_edges
REQ-DDB-PIPE-011inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes → run_harvest → _harvest_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → build_harvest_plan → js_symbol_harvester
REQ-DDB-PIPE-013inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings
REQ-DDB-PIPE-014inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc → within_repo
REQ-DDB-PIPE-015inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_config_defaults
REQ-DDB-QUERY-003inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → mark_test_scope
REQ-DDB-QUERY-011inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads → _ensure_threads_tables
REQ-DDB-SCHEMA-001inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads
REQ-DDB-SCHEMA-002inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _writer_dispatch_map
REQ-DDB-SCHEMA-003inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-004inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest
REQ-DDB-SCHEMA-005inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_key_alias_prefixes
REQ-DDB-SCHEMA-006inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-SCHEMA-007inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-009inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_event_edges
REQ-DDB-SCHEMA-011inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → extract_context_conflicts
REQ-DDB-SCHEMA-012inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest → declaration_origin
REQ-DDB-SCHEMA-013inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → import_data_model_keys
REQ-DDB-SCHEMA-014inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs → ensure_file_docs_table
REQ-DDB-SCHEMA-015inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-WIKI-054inferredtest_the_cli_refusal_uses_the_new_message → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols → _recover_into → all
Source · 13 lines
def test_the_cli_refusal_uses_the_new_message(tmp_path: Path, caplog) -> None:
    """End-to-end at the real refusal site, because a classifier that is correct in
    isolation and unwired changes nothing a user sees. Only the no-repo-root
    branches reach sys.exit; the synthesis branches are covered by the integration
    build tests."""
    missing = tmp_path / "nope" / "Doxyfile"
    args = _args(doxyfile=str(missing), output=str(tmp_path / "clew.db"))

    with caplog.at_level("ERROR"), pytest.raises(SystemExit) as excinfo:
        cli._run_pipeline(args)
    assert excinfo.value.code == 1
    assert str(missing.resolve()) in caplog.text
    assert "pass --doxyfile" not in caplog.text.lower()

1 more lines, not shown

Activity · 7 steps
lines 211–211missing = tmp_path / "nope" / "Doxyfile"lines 212–212args = _args(doxyfile=str(missing), output=str(tmp_path / "clew.db"))lines 214–214with caplog.at_level("ERROR"), pytest.raises(SystemExit) as excinfolines 215–215cli._run_pipeline(args)lines 216–216assert excinfo.value.code == 1lines 217–217assert str(missing.resolve()) in caplog.textlines 218–218assert "pass --doxyfile" not in caplog.text.lower()

test_the_four_situations_produce_four_distinct_sentences

None test_doxyfile_refusal_messages.test_the_four_situations_produce_four_distinct_sentences(Path tmp_path)

The four sentences are mutually distinct.

tests/test_doxyfile_refusal_messages.py:134

Checks

  • assert len(set(kinds)) == 4, f"situations must be distinguishable, got {kinds}"
  • assert len(set(messages)) == 4, "each situation needs its own sentence"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-001measuredtest_the_four_situations_produce_four_distinct_sentences → describe_doxyfile_resolution
Source · 24 lines
def test_the_four_situations_produce_four_distinct_sentences(tmp_path: Path) -> None:
    """The point of the change is DISCRIMINATION, so this is the assertion that
    actually pins it. Four messages that all improved but two of which still read
    alike would leave the reader exactly where they started."""
    repo = tmp_path / "repo"
    (repo / "sample").mkdir(parents=True)
    (repo / "sample" / "Doxyfile").write_text("x\n")

    outcomes = [
        describe_doxyfile_resolution(
            explicit=tmp_path / "n" / "Doxyfile", repo_root=None, candidates=[]
        ),
        describe_doxyfile_resolution(explicit=None, repo_root=None, candidates=[]),
        describe_doxyfile_resolution(explicit=None, repo_root=repo, candidates=[]),
        describe_doxyfile_resolution(
            explicit=None, repo_root=repo, candidates=[repo / "sample" / "Doxyfile"]
        ),
    ]
    kinds = [o.kind for o in outcomes]
    assert len(set(kinds)) == 4, f"situations must be distinguishable, got {kinds}"
    messages = [o.message for o in outcomes]
    assert len(set(messages)) == 4, "each situation needs its own sentence"

Activity · 8 steps
lines 138–138repo = tmp_path / "repo"lines 139–139(repo / "sample").mkdir(parents=True)lines 140–140(repo / "sample" / "Doxyfile").write_text("x\n")lines 142–151outcomes = [ describe_doxyfile_resolution( explicit=tmp_path / "n" / "Doxyfile", repo_root=None, candidates=[] ), describe_doxyfile_resolution(explicit=None, repo_root=None, candidates=[]), describe_doxyfile_resolution(explicit=None, repo_root=repo, candidates=[]), describe_doxyfile_resolution( explicit=None, repo_root=repo, candidates=[repo / "sample" / "Doxyfile"] ), ]lines 152–152kinds = [o.kind for o in outcomes]lines 153–153assert len(set(kinds)) == 4, f"situations must be distinguishable, got {kinds}"lines 154–154messages = [o.message for o in outcomes]lines 155–155assert len(set(messages)) == 4, "each situation needs its own sentence"

test_with_no_target_at_all_the_message_names_synthesis

None test_doxyfile_refusal_messages.test_with_no_target_at_all_the_message_names_synthesis(Path tmp_path)

With neither flag, nothing was searched — say so, and name synthesis.

tests/test_doxyfile_refusal_messages.py:80

Checks

  • assert outcome.kind == DOXYFILE_NO_TARGET
  • assert "--repo-root" in outcome.message
  • assert "None" not in outcome.message, "no message should render a missing path as 'None'"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-001measuredtest_with_no_target_at_all_the_message_names_synthesis → describe_doxyfile_resolution
Source · 12 lines
def test_with_no_target_at_all_the_message_names_synthesis(tmp_path: Path) -> None:
    """No --doxyfile and no --repo-root: no directory was ever searched, so
    "Doxyfile not found" is not even true. The old text rendered the path as the
    literal string "None". The reader needs to know a repo root is what is missing,
    and that a repo with no Doxyfile is nonetheless indexable."""
    outcome = describe_doxyfile_resolution(explicit=None, repo_root=None, candidates=[])

    assert outcome.kind == DOXYFILE_NO_TARGET
    assert "--repo-root" in outcome.message
    assert "None" not in outcome.message, "no message should render a missing path as 'None'"

Activity · 4 steps
lines 85–85outcome = describe_doxyfile_resolution(explicit=None, repo_root=None, candidates=[])lines 87–87assert outcome.kind == DOXYFILE_NO_TARGETlines 88–88assert "--repo-root" in outcome.messagelines 89–89assert "None" not in outcome.message, "no message should render a missing path as 'None'"