Skip to content

feat(frontmatter): [#2281] add frontmatter validator command - #2357

Merged
josecelano merged 36 commits into
torrust:developfrom
josecelano:2281-frontmatter-validator-command
Sep 28, 2026
Merged

josecelano merged 36 commits into
torrust:developfrom
josecelano:2281-frontmatter-validator-command

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

Adds the frontmatter-validator Rust command with explicit-path, --staged, and --all modes, structured NDJSON diagnostics, repository-aware strict-v1 validation, and generated schema support.

Integrates staged Markdown frontmatter validation into the pre-commit hook and documents the migration and relocation workflow.

Validation

  • cargo test --package frontmatter-validator
  • cargo clippy --package frontmatter-validator --all-targets -- -D warnings
  • cargo +nightly fmt --all -- --check
  • linter all
  • contrib/dev-tools/git/hooks/pre-commit.sh
  • Independent Task Reviewer re-review, including GIT_LITERAL_PATHSPECS=1 regression coverage

Closes #2281

@josecelano
josecelano requested a review from a team as a code owner September 28, 2026 07:45
Copilot AI lite review requested due to automatic review settings September 28, 2026 07:45
@josecelano josecelano self-assigned this Sep 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds a repository-aware frontmatter-validator Rust command and supporting policy layer to validate Markdown frontmatter (explicit paths, --staged, --all) with structured NDJSON diagnostics, and wires it into the pre-commit workflow while migrating/normalizing existing frontmatter and schema artifacts.

Changes:

  • Introduces a new frontmatter-validator binary (NDJSON-only stderr, exit code contract) plus git-backed discovery and extensive CLI/policy tests.
  • Adds a pure repository policy module for location-dependent severity, legacy-shape detection, and repository-aware checks (artifacts/skills/spec-path/status).
  • Updates docs/frontmatter across issues/epics, regenerates the v1 schema, and integrates the validator into pre-commit.sh and workflow documentation.
File Description
tests/​AGENTS.md Updates semantic-links metadata to match new frontmatter conventions.
project-words.txt Adds spellchecker allowlist entries related to git/pathspecs and validator work.
docs/​schemas/​frontmatter-v1.schema.json Updates related-artifact regex to reject truncated issue values.
docs/​issues/​open/​2301-1347-review-package-coverage-rollout/​ISSUE.md Frontmatter normalization (status, quoting) to satisfy strict validation.
docs/​issues/​open/​2298-rust-dev-tool-container-integration/​ISSUE.md Frontmatter normalization + fixes a related-artifact path to the closed issue.
docs/​issues/​open/​2283-1347-increase-udp-server-package-coverage/​ISSUE.md Frontmatter normalization + path cleanup for related artifacts.
docs/​issues/​open/​2281-2264-frontmatter-validator-command/​test-design-review.md Adds detailed test-design review record for validator increments.
docs/​issues/​open/​2281-2264-frontmatter-validator-command/​manual-verification-evidence.md Adds manual verification evidence for validator scenarios.
docs/​issues/​open/​2281-2264-frontmatter-validator-command/​implementation-retrospective.md Adds implementation retrospective aligned with new workflow guardrails.
docs/​issues/​open/​2281-2264-frontmatter-validator-command/​agent-review-reports.md Records independent reviewer reports and remediation trail.
docs/​issues/​open/​2281-2264-frontmatter-validator-command/​ISSUE.md Updates issue spec status/progress log and acceptance criteria evidence.
docs/​issues/​open/​2264-2003-refactor-semantic-link-conventions/​EPIC.md Migrates EPIC frontmatter to schema v1 + quoting issue references.
docs/​issues/​open/​2243-review-numeric-conversion-boundaries/​EPIC.md Migrates EPIC frontmatter to schema v1 + normalizes fields.
docs/​issues/​open/​2003-overhaul-guardrails-and-automation/​EPIC.md Migrates EPIC frontmatter to schema v1 + fixes related-artifact paths.
docs/​issues/​open/​1840-improve-pr-workflow-performance-epic/​EPIC.md Migrates EPIC frontmatter to schema v1 + timestamp quoting.
docs/​issues/​open/​1669-overhaul-packages/​EPIC.md Migrates EPIC frontmatter to schema v1 + updates related-artifact locations.
docs/​issues/​open/​1488-overhaul-tracker-shutdown/​ISSUE.md Migrates record to schema v1 + normalizes lifecycle status.
docs/​issues/​open/​1347-overhaul-packages-testing/​EPIC.md Migrates EPIC frontmatter to schema v1 + normalizes lifecycle status.
docs/​issues/​drafts/​increase-main-app-integration-test-coverage/​ISSUE.md Replaces related-issues with strict related-artifact issue references.
docs/​issues/​closed/​2222-1347-package-coverage-regression-ci/​workflow-portability-refactor-plan.md Frontmatter indentation fix to conform to YAML/strict parsing.
docs/​issues/​closed/​2158-2003-inventory-existing-clippy-allows/​udp-protocol-clippy-baseline-draft.md Fixes YAML indentation for semantic-links to satisfy parsing/validation.
docs/​issues/​closed/​2158-2003-inventory-existing-clippy-allows/​numeric-conversion-follow-up-drafts/​README.md Fixes YAML indentation for semantic-links to satisfy parsing/validation.
docs/​issues/​closed/​2158-2003-inventory-existing-clippy-allows/​clippy-allow-inventory.md Fixes YAML indentation for semantic-links to satisfy parsing/validation.
docs/​issues/​closed/​2041-migrate-runtime-service-registry-metadata/​ISSUE.md Replaces related-issues with strict related-artifact issue references.
docs/​issues/​closed/​2036-add-runtime-service-registry-metadata/​ISSUE.md Replaces related-issues with strict related-artifact issue references.
docs/​issues/​closed/​2035-fix-duplicate-port-zero-tracker-instance-bootstrap/​ISSUE.md Replaces related-issues with strict related-artifact issue references.
docs/​analysis/​20260716-shutdown-process/​README.md Replaces related-issues URLs with strict related-artifact issue references.
docs/​adrs/​20260519000000_define_global_cli_output_contract.md Registers frontmatter-validator in global CLI output contract table.
contrib/​dev-tools/​git/​hooks/​pre-commit.sh Adds a named pre-commit step to run the validator in --staged mode.
contrib/​dev-tools/​checks/​frontmatter-validator/​tests/​cli.rs Adds end-to-end CLI tests using disposable git repositories.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​syntax.rs Tightens related-artifact recognition to reject YAML-truncated issue.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​repository.rs Adds pure location-dependent policy + repository-aware checks + tests.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​profile.rs Adds field_path-aware diagnostics and improved reference/type errors.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​lib.rs Exposes repository module and exports Severity; improves diagnostics paths.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​diagnostic.rs Adds serializable kebab-case categories + Severity and field_path support.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​bin/​frontmatter-validator/​record.rs Implements D9 NDJSON record catalog + stderr emitter.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​bin/​frontmatter-validator/​main.rs Adds clap-based CLI parsing, mode dispatch, and contract-driven output.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​bin/​frontmatter-validator/​git.rs Adds read-only git adapter with literal pathspec handling.
contrib/​dev-tools/​checks/​frontmatter-validator/​src/​bin/​frontmatter-validator/​discovery.rs Adds document discovery/expansion logic for paths/staged/all + exclusions.
contrib/​dev-tools/​checks/​frontmatter-validator/​fixtures/​accepted/​issue.md Quotes issue reference in accepted fixture to avoid YAML comment truncation.
contrib/​dev-tools/​checks/​frontmatter-validator/​fixtures/​accepted/​epic.md Quotes issue reference in accepted fixture to avoid YAML comment truncation.
contrib/​dev-tools/​checks/​frontmatter-validator/​README.md Documents usage, severity policy, migration checklist, and relocation plan.
contrib/​dev-tools/​checks/​frontmatter-validator/​Cargo.toml Adds clap + serde_path_to_error and rstest to support CLI and pathful errors.
Containerfile Adds recipe stubs and excludes validator from container test archives (needs git).
.github/​skills/​dev/​git-workflow/​run-pre-commit-checks/​SKILL.md Updates documented pre-commit steps and adds exit-code discipline guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot stopped reviewing on behalf of josecelano due to an error September 28, 2026 08:07

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at df07ba644b364dd74636f42d18772981f9ab87ad (round 1). Recomputed from the bytes at this head.

What this is. 34 commits, 46 files, +3444/−180 over develop 9a94efe (the merge base is the develop tip; git merge-tree is clean). It adds a read-only frontmatter-validator binary to the existing crate: explicit paths, --staged or --all; D9 NDJSON records on stderr only; exit 0/1/2; location-dependent severity; D7 repository checks for strict v1 specs. It also wires --staged into pre-commit.sh as step 3 of 9, registers the binary in the CLI output ADR, migrates the seven D11 EPICs to v1, repairs thirteen other frontmatters so the tree validates, and adds the #2281 records.

What I verified. I checked every AC and D1–D11 against the code. AC1–AC9 and AC11 are realised. D2 ships as a src/bin/frontmatter-validator/ directory binary per the approved R3, and D8 "elsewhere" applies no D7 check, as the T5 entry and README state. AC10 is not met at this head (F1).

  • Tests: 179 effective by attribute count (lib 115, frontmatter-schema 24, validator bin 6, tests/cli.rs 34). Each of AC8's six families is pinned at the command boundary by literal (exit, severity, category, field_path) assertions on single-defect inputs; I traced unknown-field, lifecycle and missing-artifact through profile.rs and repository.rs. missing-required-field has no behavioural test (F3).
  • Git boundary: four invocations, all with --no-optional-locks --literal-pathspecs, NUL-split, output captured. Reproduced with git 2.55.0: literal d*; :(literal) matches nothing under GIT_LITERAL_PATHSPECS=1; a rename reports the new path; D and T are excluded by ACMR; GLOB/ICASE plus a directory argument fails loudly with exit 128.
  • Migrations: an independent standard-library parser with a hand-coded v1 schema and D7 check finds the seven EPICs and #2283/#2298/#2301 schema-valid and D7-clean. The same checker reproduces V4 exactly on pre-rebase develop (44, #2324, the three open specs).
  • Records: V2 and V6 follow from the code. V4, M5b and the reviewer baselines no longer hold after the rebase (F1, F2).

Findings

  • F1 Major: AC10 is false at this head. #2323 and #2342 (status: open) error under --all, the #2324 exception is gone, and the V4 counts are from before the rebase.
  • F2 Minor: review entries that must be append-only were rewritten in place, and the new commit subjects point to post-rebase trees that give different output.
  • F3 Minor: no test produces missing-required-field, and the new field paths for it and invalid-field-value are unasserted.
  • F4 Nit: related-pr, the T8 row, a checkpoint and last-updated-utc were not refreshed after the final review and PR opening.
  • F5 Nit: EPICs #1840 and #1669 keep planned despite completed subissues.
  • F6 Nit: AGENTS.md:168-172 and the skill's line 144 still list three pre-commit steps.
  • F7 Nit: git show :{path} misreads a root-level [0-3]:*.md name; :0: fixes it.

Checked, no finding

  • Stdout: nothing in the binary writes to it. clap runs through try_parse_from: help becomes a help record, every other clap outcome a usage_error. Outcome::from asserts empty stdout on every CLI run.
  • record.rs field order and nullability match the D9 table; category and severity names are pinned.
  • CI: the crate leaves the four container nextest archives but still runs in testing.yaml's workspace-wide cargo test on ubuntu-latest. The cargo-chef stubs match both auto-discovered bins.
  • Hook: IFS='|' step parsing; a failing step stops the hook and prints the log tail; the step has the same cargo run --quiet --package … -- --staged shape as the clippy-allow-reasons step.
  • Dependencies: clap 4.6.7 (one version in the lock), serde_path_to_error 0.1.20 and rstest 0.27.0 were already locked; each is used; features are minimised. Whether they are the latest releases cannot be verified offline.
  • Repairs 79c2562, 56aa85c and b6282bb are correct. The tabs and mis-indentation were YAML errors; the tests/AGENTS.md items were valid YAML folded into one string. (?!issue$) rejects exactly the bare issue that an unquoted issue #<n> leaves, pinned by a regression test and the quoted accepted fixtures.
  • The title scope frontmatter is the one the spec prescribes and the crate's earlier commits use. All 34 subjects are Conventional Commits with [#2281]; seven have no body, which no repository rule requires.
  • Author and committer times are ordered; no AI-attribution trailer; project-words.txt additions are sorted and used; git diff --check is clean.

Orchestrator's server checks (head df07ba644, nightly rustc 1.100.0-nightly (1303417c4 2026-09-21)). Gate (the pre-commit profile: cargo machete --with-metadata, cargo deny check bans, nightly fmt --check, linter all, hadolint, cargo test --doc --workspace): every step pass, wall 78 s. cargo test -p frontmatter-validator --all-targets: 179 passed, 0 failed (lib 115, frontmatter-schema 24, validator bin 6, tests/cli.rs 34), wall 7 s. cargo clippy -p frontmatter-validator --all-targets -- -D warnings: clean, wall 4 s. F1 recomputed with the shipped binary at this head: frontmatter-validator --all exits 1 with nothing on stdout and 41 records on stderr — 35 error legacy-shape, 2 error invalid-allowed-value (docs/issues/open/2323-…/ISSUE.md and docs/issues/open/2342-…/ISSUE.md, both status: open), 4 warnings on closed specs (#2280 reference syntax, #2289 last-updated-utc, #2295 and #2308 related-pr scalar type); docs/issues/closed/2324-… and closed/2179-… exist on this base.

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at e5be240d6bde36524bf58584bf4c01fbf984f149 (round 2). Recomputed from the bytes at this head.

What changed. One commit, e5be240, on top of the round-1 head df07ba644, with no rebase (the merge base is still 9a94efe78). It touches 13 files (+198/−38):

  • git.rs now strips six GIT_* variables from every git subprocess and reads :0:{path};
  • new profile.rs assertions and two new CLI tests;
  • the AGENTS.md and skill step lists;
  • EPIC statuses for #1669 and #1840;
  • the #2323 and #2342 spec statuses;
  • the #2281 records.

All eight threads have replies.

Threads

  • C1 (Copilot, git.rs): fixed as suggested and pinned by it_should_ignore_inherited_git_repository_redirects, which would fail at df07ba644. But the fix also strips GIT_INDEX_FILE, and that breaks the hook (F8).
  • F1: resolved for AC10. At this head --all gives 35 legacy-shape errors, 4 closed-spec warnings and no other error (recomputed independently). The means chosen, in-review for two closed issues, is F10.
  • F2: resolved differently, and the reply is right. open-pull-request/SKILL.md:61-63 forbids merge-bound evidence from citing PR-branch commit ids, so my round-1 "restore the ids" was wrong. The appended Rebase Correction is append-only and marks the earlier counts as pre-rebase. Withdrawn.
  • F3: resolved.
    • The loop test reaches MissingRequiredField with the removed field for every field except schema-version: doc-type through strict_document_type, all others through validate_required_fields, which runs before the allowed-value checks.
    • schema-version is rightly excluded, because its absence selects the permissive profile.
    • The six invalid-field-value assertions now pin the paths the code sets.
  • F4: resolved (related-pr: 2357, T8 DONE, the checkpoint, the timestamp, the log entry).
  • F5: resolved (#1669 and #1840 are in-progress).
  • F6: resolved. The nine AGENTS.md steps match pre-commit.sh:51-61 in name and order.
  • F7: the code is resolved (:0:{path}), but its new test cannot fail (F9).

F8: the pre-commit step checks the wrong index. For a pre-commit hook, git exports GIT_INDEX_FILE pointing at the index it is about to commit. This head removes it, so --staged reads .git/index.

  • With git commit -a, git passes .git/index.lock. .git/index still holds the last git add, so an invalid working-copy change is committed unchecked.
  • With git commit -o <path>, git passes .git/next-index-*.lock. .git/index holds other staged work, so the commit is refused with a diagnostic for a file that is not being committed.

I reproduced both cases with git 2.55.0 alone, in the orchestrator's runs with the built binaries, and against df07ba644, which handled both correctly. Plain git add followed by git commit still works, because there GIT_INDEX_FILE is .git/index. That is also why V3 and V5 could not catch this.

The narrowest fix is to stop removing GIT_INDEX_FILE (keep removing the location variables), or to honour it only when it resolves inside the discovered git rev-parse --absolute-git-dir. Add a CLI test that runs the built binary as .git/hooks/pre-commit under git commit -a and git commit -o.

Records and #2358.

  • My checker's counts match the new "2026-09-28 Rebase Correction" and the reworded AC10, M4 and V4.
  • The spec's own frontmatter and log now hold.
  • The orchestrator's merge-tree of this head against #2358's head conflicts on the #2323 and #2342 specs, 1488-overhaul-tracker-shutdown/ISSUE.md and 1840…/EPIC.md. Whichever PR merges second must, for AC10 to hold on develop:
    • keep #2358's archive of #2323 and #2342 (status: done in closed/, with no copy left in open/);
    • keep this PR's v1 frontmatter in the two EPICs while taking #2358's table rows, but not #2358's last-updated-utc: 2026-09-28. In a strict open/ EPIC that line is an invalid-field-value error, and the new pre-commit step would reject the resolution commit.
  • #2358's own date-only timestamps are only closed/ warnings, so --all would then show 6 warnings.

Findings

  • F8 Major: stripping GIT_INDEX_FILE breaks --staged under git commit -a and git commit <paths>.
  • F9 Minor: the F7 regression test also passes at df07ba644.
  • F10 Nit: in-review misstates #2323 and #2342, which are closed.

Checked, no finding

  • Attribute count at this head: lib 116, frontmatter-schema 24, validator bin 6, tests/cli.rs 36.
  • The C1 test fails at df07ba644: the redirected rev-parse turns the path into an "outside the repository" usage_error.
  • git show :0:1:odd.md reads the staged file (git 2.55.0).
  • Windows: os-compatibility.yaml only runs cargo build on windows-latest, so no Windows run creates 1:odd.md. A Nit at most; not raised.
  • The commit has no body, which no rule requires, and no attribution trailer. Banned token: 0. git merge-tree against develop 6a15e2853 is clean.

Orchestrator's server checks (head e5be240d6, nightly rustc 1.100.0-nightly (1303417c4 2026-09-21)). Gate (the pre-commit profile: cargo machete --with-metadata, cargo deny check bans, nightly fmt --check, linter all, hadolint, cargo test --doc --workspace): every step pass, wall 79 s. cargo test -p frontmatter-validator --all-targets: pass, 0 failed (frontmatter-schema 24, validator bin 6, tests/cli.rs 36; the lib suite line fell outside the captured tail, attribute count 116), wall 3 s. cargo clippy -p frontmatter-validator --all-targets -- -D warnings: clean, wall 1 s. frontmatter-validator --all from this head: exit 1, nothing on stdout, 39 records on stderr — 35 error legacy-shape, 4 warnings on closed specs (#2280, #2289, #2295, #2308), no other error; the two round-1 invalid-allowed-value errors are gone. F8 recomputed with binaries built at both heads (rebuilt from touched sources and compared byte-wise) installed as .git/hooks/pre-commit in a throwaway repository: git handed the hook GIT_INDEX_FILE=.git/index.lock for git commit -a and .git/next-index-<pid>.lock for git commit -o <path>; at df07ba644 the invalid commit -a was refused (exit 1, one commit) and the valid partial commit accepted (exit 0, two commits); at e5be240d6 the invalid commit -a was accepted and the partial commit refused with the diagnostic for the file not being committed. F9 recomputed: with 1:odd.md staged, the df07ba644 binary emits runtime_error with path 1:odd.md and exit 1, the e5be240d6 binary a diagnostic with the same path, so an assertion on paths alone passes at both.

@josecelano
josecelano force-pushed the 2281-frontmatter-validator-command branch from e5be240 to a3cb534 Compare September 28, 2026 09:55
…nostics

Diagnostics now carry a severity and the dotted YAML path of the offending field, and categories and severities serialize to stable kebab-case and lowercase names for the command's NDJSON contract. Serde scalar-type failures report their field through serde_path_to_error, already in the lockfile, because serde_yaml::from_value drops the path.
… unquoted YAML comments

YAML reads an unquoted 'issue #<n>' related artifact as the string 'issue' followed by a comment, which the path syntax accepted. The accepted fixtures and the accept-all-forms test therefore never exercised the issue-reference form. Reject the bare 'issue' value in the predicate and its schema pattern with a quoting hint, quote the fixture and test references, and regenerate the schema. Found by review-finding:pr-2337-f1.
…with rstest

Each category and severity case is now a separate named test, so one failing name cannot hide another. Expected category names come from an exhaustive test-local match, so adding a category fails to compile until it has a contract name.
…icit-path mode

Add the read-only frontmatter-validator binary: clap argument parsing with every outcome rendered as an NDJSON record on stderr (diagnostic, usage_error, runtime_error, help), explicit file paths validated in sorted order, ownership dispatch for Agent Skills and agent profiles, and the no-stdout-result exit codes. This is the T2 vertical slice; discovery, staged and whole-tree modes, severity policy, and repository checks follow.
… modules

Move the binary to a directory target and extract the D9 record catalog into its own module, so discovery and git access can follow as sibling modules. No behavior change; the 14 binary tests pass unchanged.
…ee modes

Require exactly one mode: explicit paths, --staged, or --all. Explicit paths must exist inside the repository and are reported repository-relative; directories expand to tracked Markdown, --all covers tracked Markdown in the working tree, and --staged validates index content of added, copied, modified, and renamed files. Templates and crate fixtures are excluded in every mode. Git runs read-only; command-boundary tests run the binary in disposable repositories isolated from inherited GIT_* variables.
…nd warnings

Add a pure library repository module that classifies a document's lifecycle location, dispatches ownership, and returns every diagnostic for the document. Closed-spec profile findings are advisory warnings while syntax stays an error; draft and open primary specs and issue or EPIC records without schema-version 1 get a legacy-shape error; x- fields in strict profiles get experimental-field warnings. Externally governed files are exempt. The binary now only discovers, reads, renders, and sets the exit code.
…ict specs

Check strict v1 issue and EPIC specs against the repository: status against the lifecycle folder, spec-path against the spec's own path, related-artifact paths against tracked files or directories, and skill links against .github/skills. The checks run on a pure RepositoryFiles snapshot, which the binary builds from the index with --staged and from the working tree otherwise. Draft and open findings are errors; closed specs get only the status and spec-path checks as warnings.
… closed records

Replace tab indentation in three torrust#2158 records and realign list items in the torrust#2222 refactor plan so their frontmatter parses as YAML. Whitespace only; no content change. Found by the frontmatter-validator whole-tree baseline.
… related-artifacts

Five documents listed issues under a related-issues key and tests/AGENTS.md used issue-spec, neither of which the universal semantic-links envelope defines. Move them into related-artifacts as quoted 'issue #<n>' references or a repository path. Also realign three over-indented tests/AGENTS.md entries that YAML had folded into one string. Found by the frontmatter-validator whole-tree baseline.
…pen specs

Replace the unsupported 'open' status with 'planned' in torrust#2283, torrust#2298, and torrust#2301, whose issues are open with no implementation started. Fixing it exposed the next errors, repaired here too: a trailing slash on a torrust#2283 directory artifact, unquoted last-updated-utc values in torrust#2298 and torrust#2301, and a torrust#2298 reference to the torrust#2222 spec, which has moved to docs/issues/closed/. Found by the frontmatter-validator whole-tree baseline.
Add schema-version 1 and epic null, replace the unsupported 'open' status with in-progress (subissues are completed), and quote a UTC-minute last-updated-utc set at migration. Migrated under D11 because every subissue workflow edits its parent EPIC.
Add schema-version 1 and epic null, replace the unsupported 'open' status with in-progress (subissues are completed), and refresh last-updated-utc at migration. The record declares doc-type epic in an ISSUE.md file and is not renamed here. Migrated under D11.
Add schema-version 1 and epic null, drop the issue-only issue-type and priority fields, quote a UTC-minute last-updated-utc set at migration, remove a trailing slash from a directory artifact, and repoint two subissue references to their archived specs under docs/issues/closed/. Migrated under D11.
Add schema-version 1 and epic null, and quote a last-updated-utc set at migration. Migrated under D11.
Add schema-version 1 and epic null, drop the issue-only issue-type field, quote last-updated-utc and the issue reference, and remove trailing slashes from directory artifacts. Migrated under D11.
Add schema-version 1 and epic null, and quote a last-updated-utc set at migration. Migrated under D11.
Add schema-version 1, set status to in-progress (subissues are completed and torrust#2281 is in progress), refresh last-updated-utc, and quote the issue references, which YAML otherwise reads as 'issue'. Migrated under D11.
The previous commit passed a failing linter gate because its exit code was lost in a pipe; cspell rejected 'repoint'.
… document it

Add a named, read-only 'Checking staged Markdown frontmatter' step that runs frontmatter-validator --staged. Document the command, the legacy-spec migration checklist the legacy-shape message points to, and the relocation path under torrust#2003 in a crate README. Register the binary as no-stdout-result in the CLI output ADR, and list the step in the run-pre-commit-checks skill, correcting its stale formatter path and the two steps it had omitted. In the Containerfile, add the cargo-chef stubs for both frontmatter binaries and exclude the crate from the container test archives, whose tester image has no git for the CLI tests.
…mmand boundary

Run the built binary on one open spec per failure family (unknown field, wrong scalar, disallowed value, reference syntax, lifecycle location, missing artifact) and assert the exit code, severity, category, and field path of the single error record. Library tests already prove each rule; this proves the command renders every family end to end (AC8).
…eview, and retrospective

Record manual scenarios M1-M7 with their actual output, the evidence-backed acceptance review (AC10 with the accepted torrust#2324 exception), the T8 test note, and an implementation retrospective covering the container test-stage gap, masked errors under a first-error validator, and a pipe-hidden gate failure.
…e command

Pass directory arguments to git ls-files as literal path patterns so glob characters are not expanded, and report a symlinked file under its own repository path instead of its target's; both have regression tests. Remove hidden state from the command-boundary fixture tests: write fixtures to their own spec-path (and relocate the closed case with a matching status) so each case carries only its named defect instead of a spec-path mismatch masked by the structural error. Harden test git isolation by clearing GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT and disabling hooks on fixture commits.
…ance

Complete the README severity summary with the errors-everywhere and outside-issue-folder rules. Add the retrospective's reusable lessons to Git-tracked guidance: the Containerfile maintenance note now covers excluding crates whose tests need tools the tester image lacks, and the run-pre-commit-checks skill says to gate commits on the hook's own exit code, never a filtered pipeline.
…remediation

Add the Task Reviewer's REVIEW FAILED report, the T8 remediation test-design record with mutation evidence, corrected legacy-shape breakdowns in V4 and the T5 note, retrospective updates, and a progress-log entry that corrects earlier miscounts without rewriting them.
…_PATHSPECS

The :(literal) prefix added for review finding 6 matches nothing when GIT_LITERAL_PATHSPECS=1, which some git front ends export to hooks, so a directory argument silently validated no files. Run git with its global --literal-pathspecs option instead, which treats names literally with or without the variable, and add a regression test that sets it. Test isolation also clears the other path-pattern-mode variables, relocated_fixture now asserts it still matches what it replaces, and the README documents symlink handling and the scope of repository-aware checks. Found by the follow-up pre-PR review.
…diation

Add the Task Reviewer's follow-up REVIEW FAILED report, the N1 test-design record with mutation evidence, and a progress-log entry that also corrects the misstated time of the first review.
@josecelano
josecelano force-pushed the 2281-frontmatter-validator-command branch from a3cb534 to 873f46d Compare September 28, 2026 10:05
@josecelano

Copy link
Copy Markdown
Member Author

ACK 873f46d

@josecelano
josecelano merged commit 8a95372 into torrust:develop Sep 28, 2026
19 checks passed

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 873f46dc80e33805ec4db617f408f98c975dc908 (round 3). Recomputed from the bytes at this head.

Post-merge confirmation. This pull request was merged at 2026-09-28T10:09:34Z as 8a953724d while this round was being computed (the lane finished at 10:16Z; the maintainer's own ACK 873f46dc8… comment of 10:09:01Z is the one the merge tool collected). A merged pull request gets no approval and no ACK, so this is posted as a comment: it confirms that F8, F9 and F10 are resolved at the merged head and that nothing remains live on develop from this review. The text below is otherwise the round as computed.

Rebase and new commit. The branch now sits on develop 17b5e9ebb (after #2358 and #2355), with 36 commits. git range-diff 9a94efe78..e5be240d6 17b5e9ebb..873f46dc8 shows 32 patch-identical commits, three changed and one new:

  • 15 (migrate EPIC #1488) and 17 (migrate EPIC #1840): only the last-updated-utc line differs. The old side is now #2358's date-only 2026-09-28, and the new value is "2026-09-28 09:26".
  • 35 (address PR review findings):
    • the two open/ status: in-review edits are gone, because #2358 archived those specs;
    • it now quotes the archived specs' last-updated-utc as "2026-09-28 09:26";
    • its #1840 hunk no longer touches the timestamp, which commit 17 now sets.
    • Nothing else moved.
  • 36 (new, honour the pre-commit hook index in staged mode): git.rs, tests/cli.rs and the #2281 ISSUE.md.

The conflict resolution keeps what round 2 said it must: the archive (closed/, status: done, no open/ copy) and the EPICs' v1 frontmatter with a quoted UTC-minute timestamp.

Threads

  • F8 (Major): resolved.
    • GIT_INDEX_FILE leaves GIT_REPOSITORY_REDIRECT_ENVIRONMENT. The location variables are still removed, so the C1 test still means what it did.
    • Two new #[cfg(unix)] CLI tests install the built binary as the pre-commit hook through -c core.hooksPath:
      • commit --all with an invalid, unstaged working copy must be refused with a wrong-scalar-type record (round-2 scenario i);
      • commit --only selected.md with an invalid other.md staged must succeed (scenario ii).
    • At e5be240d6 the hook read .git/index, so the first would have committed and the second would have been refused. Both tests fail there.
    • isolated() clears only the outer process's environment. git then sets the hook's own GIT_INDEX_FILE, and the hook execs the binary by absolute path.
  • F9 (Minor): resolved. Through the existing only_record(), the stage-prefix test asserts (kind, path, category) = (diagnostic, 1:odd.md, wrong-scalar-type). With :{path} the record is a runtime_error, so the test fails there.
  • F10 (Nit): resolved by the rebase. Both specs are in closed/ with status: done; no in-review remains.

Records. My standard-library checker at this head gives 35 legacy-shape errors, no other error, and 4 closed-spec warnings (#2280, #2289, #2295, #2308). The archived #2323 and #2342 specs are clean because their timestamps are now quoted, so the count stays at 4; my round-2 prediction of 6 is superseded. AC10 holds, as do the recorded V4 correction and the new 10:02 progress-log entry, which is appended, corrects the 09:21 entry, and says "184 tests pass", matching the attribute count.

Findings: none.

Checked, no finding

  • Attribute count: lib 116, frontmatter-schema 24, validator bin 6, tests/cli.rs 38; 184 in total.
  • The hook tests are Unix-only, and no workflow runs this crate's tests on Windows (os-compatibility.yaml only builds there).
  • Quoting the archived specs' timestamps edits two closed records. The spec's Out of Scope avoids that when the only gain is removing warnings, but here it resolves a real rename conflict on a line commit 35 already changed, in the v1 form.
  • Commit 36 has a subject line and no body or trailers. Banned token: 0. The merge base is 17b5e9ebb, and git merge-tree against develop is clean.

Orchestrator's server checks (head 873f46dc8, base 17b5e9ebb, nightly rustc 1.100.0-nightly (1303417c4 2026-09-21)). Gate (the pre-commit profile: cargo machete --with-metadata, cargo deny check bans, nightly fmt --check, linter all, hadolint, cargo test --doc --workspace): every step pass, wall 76 s. cargo test -p frontmatter-validator --all-targets: pass, 0 failed (frontmatter-schema 24, validator bin 6, tests/cli.rs 38; lib by attribute count 116), wall 2 s. cargo clippy -p frontmatter-validator --all-targets -- -D warnings: clean. frontmatter-validator --all from this head: exit 1, nothing on stdout, 39 records on stderr — 35 error legacy-shape, 4 warnings on closed specs (#2280, #2289, #2295, #2308), no other record. F8 recomputed with a binary built at this head (touched sources, byte-compared against the round-2 binary) installed as .git/hooks/pre-commit in the same throwaway repository as round 2: git commit -a with an invalid working copy was refused with the wrong-scalar-type diagnostic (the hook received GIT_INDEX_FILE=.git/index.lock), and git commit -o <valid path> with an invalid other file staged was accepted (the hook received .git/next-index-<pid>.lock) — both correct, as with the round-1 binary. Range-diff of the rebase recomputed independently: 32 patch-identical, 3 changed as described above, 1 new.

josecelano added a commit that referenced this pull request Sep 28, 2026
…ngs on five merged PRs

30f7419 docs(pr-reviews): [#2347] record PR #2363 review rounds 4 and 5 (Jose Celano)
d5bb52f docs(pr-reviews): [#2347] record Copilot's severity labels in the PR #2363 audit (Jose Celano)
f102d70 docs(pr-reviews): [#2347] record PR #2363 review round 2 (Jose Celano)
068a018 docs(issues): [#2347] map the pre-PR task review finding IDs (Jose Celano)
76aab89 docs(issues): [#2347] count five retrospective improvement candidates (Jose Celano)
bc3eb6b docs(issues): [#2347] name all three findings triage found dead (Jose Celano)
217df51 docs(issues): [#2347] count the three #2320 citations the F29 note moved (Jose Celano)
c8676f7 docs(issues): [#2347] record the approval-timing deviation acceptance (Jose Celano)
1ec319d docs(pr-reviews): [#2347] add PR #2363 review audit (Jose Celano)
f004145 docs(pr-reviews): [#2347] keep the #2320 head-id note at two lines (Jose Celano)
9c99bf5 docs(issues): [#2347] correct stamps and stale claims found by the pre-PR review (Jose Celano)
9f994a4 docs(issues): [#2347] record the pre-PR task review (Jose Celano)
52fccfc docs(issues): [#2347] record verification evidence and retrospective (Jose Celano)
42ae122 docs(pr-reviews): [#2347] record PR #2320 post-merge findings (Jose Celano)
f3e6716 docs(pr-reviews): [#2347] record PR #2313 post-merge findings (Jose Celano)
f20c229 docs(pr-reviews): [#2347] record PR #2300 post-merge findings (Jose Celano)
71c6757 docs(pr-reviews): [#2347] add PR #2293 post-merge review audit (Jose Celano)
7e65e92 docs(pr-reviews): [#2347] add PR #2290 post-merge review audit (Jose Celano)
4fc38fd docs(issues): [#2347] record the rebase and the upstream F3 fix (Jose Celano)
17e7e60 docs(issues): [#2347] restore the #2222 plan stamp after the upstream indentation fix (Jose Celano)
24d4364 docs(issues): [#2347] record the follow-up issues (Jose Celano)
d0ee94a docs(issues): [#2347] route the PR #2293 hosted-evidence finding to #2301 (Jose Celano)
cfcc79c docs(issues): [#2347] route the PR #2300 roster-pin finding to #2278 order 8 (Jose Celano)
1c1b8bb docs(issues): add issue specification for #2362 (Jose Celano)
ba18b32 docs(issues): add issue specification for #2361 (Jose Celano)
c290c2c docs(issues): [#2347] record the T3 routing amendment (Jose Celano)
bb94947 docs(issues): add issue specification for #2360 (Jose Celano)
b170b70 docs(issues): [#2347] record the approved order of work (Jose Celano)
5d8ee9f docs(issues): [#2347] refresh stamps on #2222 and #2261 docs edited by fixes (Jose Celano)
6d53267 docs(pr-reviews): [#2347] correct the #2320 retrospective head-id note (Jose Celano)
01baa61 docs(issues): [#2347] make the #2308 V1 command reproduce its result (Jose Celano)
96beca7 docs(issues): [#2347] cite #2295 review inputs by commit subject (Jose Celano)
de9c790 docs(issues): [#2347] correct #2295 AC6 after the PR audit landed (Jose Celano)
4c422f9 docs(pr-reviews): [#2347] correct PR #2300 audit log stamps (Jose Celano)
8fc2435 docs(skills): [#2347] link implement-workflow to its workflow artifacts (Jose Celano)
f721dab docs(issues): [#2347] map #2222 evidence commits to merged subjects (Jose Celano)
84e3242 docs(testing): [#2347] name the PR coverage workflow correctly (Jose Celano)
61dd5c0 docs(issues): [#2347] name all four #2261 empty_enums modules (Jose Celano)
d984271 docs(issues): [#2347] describe the #2261 parser test action codes (Jose Celano)
f780ad2 docs(issues): [#2347] correct the #2261 M1 result for retained A159 (Jose Celano)
b5f217a docs(issues): [#2347] cite #2261 evidence commits by subject (Jose Celano)
2c7c731 docs(issues): [#2347] record T3 disposition decisions (Jose Celano)
3a95952 docs(issues): [#2347] record T2 triage of post-merge findings (Jose Celano)
da8ac1f docs(issues): [#2347] mark spec in progress on implementation branch (Jose Celano)

Pull request description:

  ## Summary

  Implements #2347 (EPIC #2003, order 12): it processes the 32 review findings that da2ce7 posted after PRs #2290, #2293, #2300, #2313, and #2320 had merged. The maintainer approved every disposition before any fix. Approval record: <#2347 (comment)>. Amendments: <#2347 (comment)> and <#2347 (comment)>.

  The order of work followed the PR #2339 / PR #2344 precedent. First the fixes and follow-up issues were committed and this PR was opened as a draft. Then each of the 32 threads got a disposition reply, and finally one audit commit per merged PR cites those replies. The rationale is in the spec's "Disposition Decisions (T3)" section.

  | Disposition | Count | Findings |
  | ----------- | ----- | -------- |
  | FIXED | 14 | #2290 F1, F2, F3, F5 (the audit itself), F6; #2293 F2, F4, F7; #2300 F5, F6, F9; #2313 F8; #2320 F29 (reviewer F25); #2293 F3, fixed upstream by PR #2357 |
  | NO_ACTION | 9 | #2290 F7; #2293 F6, F8; #2300 F7, F8, F11, F12; #2313 F10; #2320 F28 (reviewer F24) |
  | FOLLOW_UP | 9 | #2290 F4 → #2360; #2293 F1 → #2361; #2293 F5 → #2301; #2300 F10 → #2278 order 8; #2313 F4, F5, F6, F7, F9 → #2362 |

  Following `process-pr-review` "Reviews Submitted After Merge", the 13 fixes in this PR are recorded as `FOLLOW_UP`/`OPEN` until it merges. A close-out PR (T7) then changes them to `FIXED`, replies, and resolves the fixed and declined threads. #2293 F3 was already fixed on `develop`, so its row is `FIXED`/`RESOLVED` and its thread is resolved. FOLLOW_UP threads stay open until their owning issue's fix merges.

  ## Changes

  - Documentation fixes, one signed commit per finding. Most are appended, dated corrections. Two are in-place edits to closed text: the #2261 retrospective's Evidence list now cites commit subjects instead of unreachable ids, and the #2320 retrospective's head-id note is corrected, with the edit recorded in that audit's Processing Log.
    - #2261 folder (PR #2290): the evidence commits are cited by subject, the M1 result is corrected for the retained A159 allowance, the parser test's action codes are described accurately, and all four `empty_enums` modules are named.
    - `docs/testing.md` names the PR coverage workflow correctly.
    - #2222 folder (PR #2293): unreachable evidence commits are mapped to merged subjects.
    - `implement-workflow` skill: `skill-link` markers and a `Skill Links` section. The workflow file gets one comment line.
    - #2300 audit: a Processing Log stamp correction. #2295 folder: an AC6 correction and a review-input citation correction.
    - #2308 folder (PR #2313): the V1 command now reproduces its result.
  - Audits: new `docs/pr-reviews/pr-2290-review/` and `pr-2293-review/`; appended rows in `pr-2300-review` (F5-F12), `pr-2313-review` (F4-F10), and `pr-2320-review` (F28-F29). The approval URL is in each Ownership section. This PR's own review audit is `docs/pr-reviews/pr-2363-review/`.
  - New follow-up issue specs: #2360 (UDP protocol `empty_enums` allowance scope, #2003), #2361 (bug: the coverage summary fails when discovery fails, #1347), and #2362 (remaining audit-contract rules, #2278). The parent EPIC rows are updated, and pointers are added for the existing owners #2301 and #2278 order 8.
  - The #2347 spec with `triage.md` (per-finding live checks), `manual-verification-evidence.md` (M1, M3), `implementation-retrospective.md`, and `agent-review-reports.md`.

  ## Validation

  - `validate-audit-record.py` exits `0` for every audit, with the first parent of each PR's merge commit as `--base`: #2290 (7 rows), #2293 (8), #2300 (12), #2313 (10), and #2320 (29). It also exits `0` for this PR's own audit, `pr-2363-review`, with `--base` set to `develop`.
  - M1 (a GraphQL refetch of all five PRs): all 32 threads carry the #2347 tracking and disposition replies, and only #2293 F3 is resolved. M3 (three seeded random spot checks, one per disposition kind) reproduces the recorded results.
  - `TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh` passed on every commit (stable Rust toolchain; includes `linter all` and the staged frontmatter check). The pre-push hook passed: `cargo +nightly check`, `cargo +nightly doc`, and `cargo +stable test --tests --benches --examples --workspace --all-targets --all-features`.
  - An independent pre-PR task review found documentation defects only: stale stamps, log stamps out of order, and stale claims. They are corrected in `docs(issues): [#2347] correct stamps and stale claims found by the pre-PR review`, and the report is in `agent-review-reports.md`.
  - Temporary working-tree experiments (removing or narrowing the `empty_enums` allowance, and running Clippy) were restored with `git checkout` and are not part of this PR.

  Related to #2347. The issue stays open for the T7 close-out.

ACKs for top commit:
  da2ce7:
    ACK 30f7419 — the commit records review rounds 4 and 5 in the PR #2363 audit (the F14 row and detail, the Round 4/5 paragraph, three log entries) and the #2347 spec, each checked against the posted reviews and replies
  josecelano:
    ACK 30f7419

Tree-SHA512: d545a11e29defea38b63cd5b4596f323a758c9a42adf1499421827a3af79789006021172abe46ea4b804257182135e019e4bd069d059c1017a0a5cffbb79ba24

This branch was previously deployed

1 inactive deployment
coverage — 873f46dc Deployed Sep 28, 2026 by josecelano via Generate Coverage Report #2344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(frontmatter): add validator command and pre-commit rollout

3 participants