From 8a00ce97f58a92a906bd8048750cfb0ae972134d Mon Sep 17 00:00:00 2001 From: nvaldez Date: Fri, 2 Oct 2026 11:50:22 +0200 Subject: [PATCH] sanity fix --- SPEC.md | 11 +++++++---- src/fiona/librarian/toc_generator.py | 6 +++++- tests/test_sanity_manager.py | 4 ++-- tests/test_toc_generator.py | 2 ++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/SPEC.md b/SPEC.md index 0cf5dc7..9011581 100644 --- a/SPEC.md +++ b/SPEC.md @@ -1,6 +1,6 @@ --- name: Fiona-Assistant Specification -version: 1.5.1 +version: 1.5.2 title: Project Spec Sheet created: 2026-09-23 updated: 2026-10-02 @@ -121,7 +121,9 @@ Revision 1.4.0 names the core-file record `corefiles.json` `wiki update` writes that file. Revision 1.5.0 omits markdown files matched by `fiona.wiki.graph.ignore_files` from the graph (*7.1.4.20.*). The shipped list is `*/table_of_contents.md`, -because a table of contents links to every page. +because a table of contents links to every page. Revision 1.5.2 +gives that file frontmatter `name` and `version` (*7.3.1.1.1.*) +so `fmlint` accepts it. Each feature section starts with a `Status` line. Requirements use `- *N.M.K.*`. Each `*acceptance*` sits under the requirement it tests. @@ -2872,8 +2874,9 @@ Requirements for `librarian`. > Status: Implemented - *7.3.1.1.* Folder TOC (`librarian toc`). - - *7.3.1.1.1.* `table_of_contents.md` has frontmatter `title`, - `created`, `updated`, and `type: toc`. + - *7.3.1.1.1.* `table_of_contents.md` has frontmatter `name`, + `version`, `title`, `created`, `updated`, and `type: toc`. + `name` is `Table of Contents` and `version` is `1.0.0`. - *7.3.1.1.2.* Entries list subfolders, file links, and `v`, or `v0.0.0` when version is missing or unreadable. - *7.3.1.1.3.* Headers become nested GitHub-style anchor links. diff --git a/src/fiona/librarian/toc_generator.py b/src/fiona/librarian/toc_generator.py index 606a1a8..8fb5260 100644 --- a/src/fiona/librarian/toc_generator.py +++ b/src/fiona/librarian/toc_generator.py @@ -162,15 +162,19 @@ def build_toc( ) -> str: """Build a table of contents that nests folders, files and their headers. + Generated by CURSOR: 2026-10-02 - frontmatter name and version for fmlint. + Args: folder: The folder the table of contents covers. files: Relative md file paths to list (as returned by collect_md). max_header_depth: Maximum header level to list per file (3 = h1 through h3). None or 0 mean unlimited. """ - # Add YAML frontmatter + # CURSOR: name and version are required by fmlint on every markdown file. today = datetime.datetime.now(datetime.UTC).date().isoformat() frontmatter = f"""--- +name: Table of Contents +version: 1.0.0 title: Table of Contents created: {today} updated: {today} diff --git a/tests/test_sanity_manager.py b/tests/test_sanity_manager.py index 4fe073e..f01c1c1 100644 --- a/tests/test_sanity_manager.py +++ b/tests/test_sanity_manager.py @@ -121,8 +121,8 @@ class TestRunWikiChecks: def test_path_rule_exemption_hides_markdownlint_rules(self, minimal_wiki): """SPEC 7.1.3.4: path_rule_exemptions filter wiki sanity markdownlint only.""" tasks = minimal_wiki / "tasks" / "tasks.md" - long_line = "x" * 120 - _write_md(tasks, "tasks", f"# Tasks\n\n- {long_line}\n") + long_line = ("word " * 29) + "words" + _write_md(tasks, "tasks", f"# Tasks\n\n{long_line}\n") without = run_wiki_checks(str(minimal_wiki)) assert without["checks"]["markdownlint"]["violation_count"] > 0 diff --git a/tests/test_toc_generator.py b/tests/test_toc_generator.py index eff9415..9350ef3 100644 --- a/tests/test_toc_generator.py +++ b/tests/test_toc_generator.py @@ -355,6 +355,8 @@ class TestBuildToc: # Result should include frontmatter and TOC header assert "---" in result, "Result should include frontmatter delimiter" + assert "name: Table of Contents" in result, "Result should include name in frontmatter" + assert "version: 1.0.0" in result, "Result should include version in frontmatter" assert "title: Table of Contents" in result, "Result should include title in frontmatter" assert "# Table of Contents" in result, "Result should include TOC header"