From 8b1567cf2cd5997da217b258a18aba753b698454 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 1 Oct 2026 08:45:14 -0400 Subject: [PATCH] feat(shapes): a component file is a candidate shape in its own right (milestone 439 step 5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A single-file component defines `.card`, `.title` and a `Props`, never anything named after itself — so the ledger could not hold "StatusChip is canon" and could not say a new card was built where one already existed. - coverage.is_file_unit: a file that RENDERS (its markup names classes, or it opens a \n\n", True), + ("web/views/Card.vue", "\n", True), + # A TSX component already has its row: the function named after the file. + ("web/Card.tsx", "export function Card() {\n return
;\n}\n", False), + # A JSX file whose markup names classes but whose component is named otherwise. + ("web/index.jsx", "function App() {\n return
;\n}\n", True), + # Modules render nothing: their definitions account for them. + ("internal/api/upnext.go", "func stageOf(x int) int {\n\treturn x\n}\n", False), + ("src/app/util.py", "def helper():\n pass\n", False), + ("web/button.css", ".btn {\n color: red;\n}\n", False), +]) +def test_a_file_is_a_unit_when_it_renders_and_nothing_inside_carries_its_name(path, text, unit): + """Milestone 439: one structural test, not a framework list.""" + from scribe.services.coverage import class_references, extract_definitions, is_file_unit + + assert is_file_unit(path, text, extract_definitions(text), class_references(path, text)) is unit