From 1ab614bfbe040623a28d65f717b85b1cfdf42de7 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 21 Aug 2026 15:06:52 -0400 Subject: [PATCH] =?UTF-8?q?feat(ledger):=20the=20`scoped`=20bucket=20?= =?UTF-8?q?=E2=80=94=20by-construction=20one-offs=20are=20stamped=20by=20t?= =?UTF-8?q?he=20sync,=20not=20judged=20by=20a=20person=20(#2869,=20milesto?= =?UTF-8?q?ne=20294)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 2026-08 audit left 77% of Scribe's ledger `exempt`, most of it a Vue component's scoped \n" + "\n" + ) + defs = extract_definitions(vue) + names = {(d.kind, d.name) for d in defs} + assert {("sym", "load"), ("sym", "save"), ("css", "card"), ("css", "title"), ("css", "global-toast")} <= names + scoped = scoped_definitions("frontend/src/views/A.vue", vue, defs) + assert scoped == {("sym", "load"), ("sym", "save"), ("css", "card"), ("css", "title")} + # Definitions know their line, which is what the scoped-style range uses. + assert next(d for d in defs if d.name == "card").line > next(d for d in defs if d.name == "save").line + # Not a .vue: nothing is scoped, whatever it contains. + assert scoped_definitions("frontend/src/assets/components.css", ".card {\n x: 1;\n}\n", + extract_definitions(".card {\n x: 1;\n}\n")) == set() + assert scoped_definitions("src/a.py", "def load():\n pass\n", extract_definitions("def load():\n pass\n")) == set() + diff --git a/tests/test_shape_ledger.py b/tests/test_shape_ledger.py index a8b17fb..f63c86e 100644 --- a/tests/test_shape_ledger.py +++ b/tests/test_shape_ledger.py @@ -30,7 +30,7 @@ def test_the_todo_state_is_the_default(): assert CodeShape.__table__.c.status.default.arg == "unclassified" assert "unclassified" in SHAPE_STATUSES assert set(SHAPE_STATUSES) == { - "canonical", "instance", "variant", "exempt", "unclassified", + "canonical", "instance", "variant", "exempt", "scoped", "unclassified", } assert set(SHAPE_CLASSIFIERS) == { "agent", "audit", "hook", "mechanical", "import",