fix: unblock CI after #51 — Path import + py39 f-string#233
Merged
Conversation
Two regressions from the candidates workflow (PR #230) surfaced on CI after merge: 1. StaleCandidates lint rule referenced `Path` without importing it, so the rule raised NameError against any real page — the seeded wiki lint job crashed on every push. 2. tests/test_candidates.py used a nested f-string with a backslash inside the expression, which Python 3.9 rejects at parse time (only 3.12+ allows backslashes in f-string parts). Both are narrowly scoped: - Add `from pathlib import Path` inside StaleCandidates.run() (matches existing lazy-import style). - Extract the default body into a local variable in _write_candidate(). Regression test added in tests/test_lint_rules.py that exercises the rule end-to-end — the same failure path CI hit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two regressions from PR #230 (wiki/candidates/ approval workflow) that surfaced on CI after merge:
StaleCandidateslint rule raisedNameError: name 'Path' is not defined. The rule usedisinstance(page_path, Path)without importingPath. The seeded-wiki lint job (Lint + build seeded wiki) crashes on every push.tests/test_candidates.pyfails to parse on Python 3.9. Line 55 nested an f-string containing\ninside another f-string — Python 3.9 rejects backslashes in f-string parts; only 3.12+ allows it. Thelint-and-test (3.9)CI job aborts before any test runs.Both fixes are minimal:
from pathlib import PathinsideStaleCandidates.run()(matches the existing lazy-import pattern forllmwiki.candidates)._write_candidate().Test plan
python3 -m pytest tests/test_candidates.py tests/test_lint_rules.py— 80 passedpython3 -m llmwiki lint— no morestale_candidates (1): rule raised exceptiontest_stale_candidates_rule_runs_without_nameerrorexercises the rule end-to-endChecklist
fix:)### Fixed