diff --git a/.github/workflows/navigation.yml b/.github/workflows/navigation.yml index 343b18831..dbd073fdd 100644 --- a/.github/workflows/navigation.yml +++ b/.github/workflows/navigation.yml @@ -3,7 +3,7 @@ name: Research navigation and public source checks push: branches: [chatgpt/navigation-price-20260924] pull_request: - paths: ['README.md', 'docs/**', 'tools/navigation_check.py', 'tests/test_navigation*.py', '.github/workflows/navigation.yml'] + paths: ['README.md', 'docs/**', 'formal/README.md', 'formal/GLOSSARY.md', 'formal/REVIEW_LANE.md', 'tools/navigation_check.py', 'tests/test_navigation*.py', '.github/workflows/navigation.yml'] workflow_dispatch: permissions: contents: read diff --git a/tests/test_navigation_workflow.py b/tests/test_navigation_workflow.py index 334c00eb8..0b1387349 100644 --- a/tests/test_navigation_workflow.py +++ b/tests/test_navigation_workflow.py @@ -1,14 +1,17 @@ -"""Static contract for the navigation workflow's top-level test path filter. +"""Static contract for the navigation workflow's page and test path filters. This reads the workflow's existing single-line, quoted flow-list syntax. It is not a general YAML parser, a GitHub event replay, or a whole-workflow audit. The basename matcher is limited to direct children of tests/: unlike a raw fnmatch over the whole path, its '*' cannot consume a directory separator. +Declared-page coverage recognizes literal paths and the existing docs/** +pattern only; it deliberately does not implement general GitHub glob matching. """ from __future__ import annotations import ast import fnmatch +import json from pathlib import Path import re import unittest @@ -52,11 +55,29 @@ def test_filter_is_narrow_and_retains_existing_triggers(self): self.assertEqual(self.paths, [ 'README.md', 'docs/**', + 'formal/README.md', + 'formal/GLOSSARY.md', + 'formal/REVIEW_LANE.md', 'tools/navigation_check.py', 'tests/test_navigation*.py', '.github/workflows/navigation.yml', ]) + def test_every_declared_navigation_page_has_a_trigger(self): + manifest = json.loads((ROOT / 'docs' / 'NAVIGATION.json').read_text( + encoding='utf-8')) + pages = manifest['pages'] + self.assertIsInstance(pages, list) + self.assertTrue(pages, 'declared-page coverage must not be empty') + for page in pages: + with self.subTest(page=page): + self.assertIsInstance(page, str) + self.assertTrue( + page in self.paths + or ('docs/**' in self.paths and page.startswith('docs/')), + f'declared navigation page lacks a trigger: {page}', + ) + def test_original_navigation_test_is_selected(self): self.assertTrue(selected_test_path('tests/test_navigation.py', self.paths))