test_draft_becomes_a_statable_option_without_a_file

Tests › tests/test_propose.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#360. The test above proves the draft parses when an owner ACTIVATES IT IN A FILE; this proves the other route exists at all. An agent has nowhere to write that file — a third-party repo must stay byte-identical, and anywhere else is untracked or `git clean`ed — so before this, `propose_declaration` returned prose and `options` took a structure, with no path between them.

Given

  1. root, db = _acme(tmp_path)
→

When

  1. proposal = propose(root, db)
  2. active = tmp_path / "activated"
  3. active.mkdir()
5 more
  1. (active / DECLARATION_NAME).write_text(uncomment(proposal.yaml_text), encoding="utf-8")
  2. statement = statement_from_draft(proposal.yaml_text)
  3. load_declaration(active)
  4. args = SimpleNamespace(**dict.fromkeys(statement))
  5. apply_options(args, statement, root)
→

Then

  1. ✓ _section(proposal, SECTION_SHARED_KEY).status is SectionStatus.PROPOSED
  2. ✓ statement equals load_declaration(active)
  3. ✓ apply_options(args, statement, root) equals sorted(statement)
  4. ✓ getattr(args, SECTION_SHARED_KEY)["writers"] equals [{"name_prefix": "ACME_SET_"}]

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

clew — `main` (clew/cli.py) · 98 of 400 steps

… 3 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesalt (line 1171)altopt (line 529)optmain4–5. propose_main → _refusal4_refusal +1 more6. propose → db_status_summary6db_status_summary▶ test enters7–10. db_status_summary → index_defect7index_defect +3 more11. propose → build_context11build_context12. build_context → derive_scope12derive_scope13. derive_scope → _declared_index_scope13_declared_index_scope14. _declared_index_scope → load_declaration_located14load_declaration_located15–18. load_declaration_located → _read_mapping15_read_mapping +3 more19–20. _checked_section → _checked_list_section19_checked_list_section +1 more

… 14 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesloop (line 569)loopopt (line 571)optopt (line 547)opttry (line 548)tryopt (line 696)opttry (line 1003)trymain35. _checked_tests → _checked_list_section35_checked_list_section36. _checked_tests → 36… 1 call not run37–41. _checked_section → check_manifest_document37check_manifest_document +4 more42–44. _declared_index_scope → _existing_paths42_existing_paths +2 more45–46. derive_scope → whole_repo_scope45whole_repo_scope +1 more47. _gitignored_paths → git_argv47git_argv48–49. git_argv → _no_ext_diff48_no_ext_diff +1 more50. _gitignored_paths → git_env50git_env51. whole_repo_scope → list51list

… 15 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyother filesother filesother filesother filesother filesopt (line 385)optloop (line 239)looploop (line 268)loopopt (line 270)optelif (line 274)elifloop (line 369)loopmain67–68. whole_repo_scope → _vendored_clause67_vendored_clause +1 more69. derive_scope → whole_repo_scope69whole_repo_scope70–73. build_context → repo_source_files70repo_source_files +3 more74–75. _grammar_available → has_language74has_language +1 more76. _ts_language_for → _try_import_ts_module76_try_import_ts_module77–85. build_context → scope_membership77scope_membership +8 more86–88. _ast_parse_one_file → _disambiguate_header86_disambiguate_header +2 more89. scan_repo → _absorb_file89_absorb_file90. _absorb_file → definition_record90definition_record91–109. definition_record → _signature91_signature +18 more110. _absorb_file → _accessor_site110_accessor_site111. _accessor_site → callee_name111callee_name112–113. build_context → load_declaration112load_declaration +1 more114. propose → _sections114_sections▶ test enters115–117. _sections → _blocking115_blocking +2 more118. _blocking → is_derived118is_derived119–127. _sections → _blocked_section119_blocked_section +8 more128. candidate_dirs → 128… 1 call not run129–130. report_not_indexed → _dir_lines129_dir_lines +1 more131. propose → scope_summary131scope_summary132. scope_summary → is_derived132is_derived133. scope_summary → ast_readable_in_scope133ast_readable_in_scope134–147. propose → render_declaration134render_declaration +13 more148. _rejections → _wrap148_wrap149–150. _section_block → _notes149_notes +1 more151–152. propose_main → _resolve_db151_resolve_db +1 more

… 248 later steps

4 more

tests/test_propose.py:534 · its file's page

What it checks (4)

  1. assert _section(proposal, SECTION_SHARED_KEY).status is SectionStatus.PROPOSED observes _section
  2. assert statement == load_declaration(active), "one proposal, two spellings of it" observes load_declaration
  3. assert apply_options(args, statement, root) == sorted(statement) observes apply_options
  4. assert getattr(args, SECTION_SHARED_KEY)["writers"] == [{"name_prefix": "ACME_SET_"}] not attributed

Where the product reaches it

  • build_wiki → _build_site → symbol_pages → _section (flow)
  • main → propose_main → propose → build_context → load_declaration (flow)
  • main → propose_main → propose (flow)

Call flow

test_draft_becomes_a_statable_option_without_a_file→_acme→propose→_section→uncomment→statement_from_draft→load_declaration→apply_options

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_draft_becomes_a_statable_option_without_a_file · 4 checksload_declarationREQ-DDB-CONFIG-001 · measured_acme_indexwrite_build_signatureREQ-DDB-CONFIG-006 · measured_acme_indexwrite_build_signatureREQ-DDB-CONFIG-007 · measuredstatement_from_draftREQ-DDB-CONFIG-008 · measuredload_declaration… 4 calls …_validate_nodeREQ-DDB-GUARD-012 · inferredproposedb_status_summaryread_build_signatureREQ-DDB-PIPE-005 · measuredpropose… 3 calls …_parseable_fileREQ-DDB-PIPE-011 · measuredpropose… 4 calls …has_languageREQ-DDB-PIPE-012 · inferredload_declaration… 4 calls …allREQ-DDB-WIKI-054 · inferred
Also reaches 15 requirements

Its run touches their code; that is reach, not proof.