What happened
On PR #36, the review agent caught a bug in the newly added extract_h1() function in hack/lint-experiment-frontmatter: the function did not skip YAML frontmatter when searching for H1 headings, meaning a YAML comment starting with # inside the frontmatter block could be misidentified as the document's H1 heading. The author fixed this in commit 05bd450e by adding frontmatter-skipping logic. The three lint scripts (lint-experiment-frontmatter, lint-experiment-numbers, lint-experiment-index) have zero test coverage — there are no test files in hack/ or elsewhere for these scripts.
What could go better
The frontmatter-skipping bug was only caught because the review agent reasoned about the code's behavior. A unit test with a frontmatter block containing a comment line (e.g., # this is a YAML comment) would have caught this deterministically during development, before the PR was even opened. As these lint scripts enforce core repo conventions and are modified when conventions evolve (as happened in this PR), they are high-value targets for test coverage. Without tests, future modifications to these scripts rely entirely on code review — human or agent — to catch regressions.
Proposed change
Add a test file (e.g., hack/test_lint_scripts.py) with pytest-based unit tests covering at minimum: (1) extract_h1 correctly skips YAML frontmatter and does not match comments inside it, (2) extract_h1 handles files without frontmatter, (3) H1/title mismatch detection in validate_experiment, (4) missing required frontmatter fields, (5) invalid status values, (6) topics field type validation. Wire the tests into CI via a GitHub Actions step or pre-commit hook. The lint-experiment-frontmatter script already uses standard Python with pyyaml as the only dependency, so tests should be straightforward.
Validation criteria
Tests exist for all three lint scripts covering at least the cases listed above. Tests run in CI on every PR. The specific frontmatter-skipping regression (YAML comment matching as H1) has a dedicated test case that would fail if the extract_h1 fix from commit 05bd450e were reverted.
Generated by retro agent from #36
What happened
On PR #36, the review agent caught a bug in the newly added
extract_h1()function inhack/lint-experiment-frontmatter: the function did not skip YAML frontmatter when searching for H1 headings, meaning a YAML comment starting with#inside the frontmatter block could be misidentified as the document's H1 heading. The author fixed this in commit05bd450eby adding frontmatter-skipping logic. The three lint scripts (lint-experiment-frontmatter,lint-experiment-numbers,lint-experiment-index) have zero test coverage — there are no test files inhack/or elsewhere for these scripts.What could go better
The frontmatter-skipping bug was only caught because the review agent reasoned about the code's behavior. A unit test with a frontmatter block containing a comment line (e.g.,
# this is a YAML comment) would have caught this deterministically during development, before the PR was even opened. As these lint scripts enforce core repo conventions and are modified when conventions evolve (as happened in this PR), they are high-value targets for test coverage. Without tests, future modifications to these scripts rely entirely on code review — human or agent — to catch regressions.Proposed change
Add a test file (e.g.,
hack/test_lint_scripts.py) with pytest-based unit tests covering at minimum: (1)extract_h1correctly skips YAML frontmatter and does not match comments inside it, (2)extract_h1handles files without frontmatter, (3) H1/title mismatch detection invalidate_experiment, (4) missing required frontmatter fields, (5) invalid status values, (6)topicsfield type validation. Wire the tests into CI via a GitHub Actions step or pre-commit hook. Thelint-experiment-frontmatterscript already uses standard Python withpyyamlas the only dependency, so tests should be straightforward.Validation criteria
Tests exist for all three lint scripts covering at least the cases listed above. Tests run in CI on every PR. The specific frontmatter-skipping regression (YAML comment matching as H1) has a dedicated test case that would fail if the
extract_h1fix from commit05bd450ewere reverted.Generated by retro agent from #36