Skip to content

fix: unblock CI after #51 — Path import + py39 f-string#233

Merged
Pratiyush merged 1 commit into
masterfrom
fix/candidates-py39-and-lint-rule
Apr 17, 2026
Merged

fix: unblock CI after #51 — Path import + py39 f-string#233
Pratiyush merged 1 commit into
masterfrom
fix/candidates-py39-and-lint-rule

Conversation

@Pratiyush
Copy link
Copy Markdown
Owner

Summary

Two regressions from PR #230 (wiki/candidates/ approval workflow) that surfaced on CI after merge:

  1. StaleCandidates lint rule raised NameError: name 'Path' is not defined. The rule used isinstance(page_path, Path) without importing Path. The seeded-wiki lint job (Lint + build seeded wiki) crashes on every push.
  2. tests/test_candidates.py fails to parse on Python 3.9. Line 55 nested an f-string containing \n inside another f-string — Python 3.9 rejects backslashes in f-string parts; only 3.12+ allows it. The lint-and-test (3.9) CI job aborts before any test runs.

Both fixes are minimal:

  • Added from pathlib import Path inside StaleCandidates.run() (matches the existing lazy-import pattern for llmwiki.candidates).
  • Extracted the default body into a local variable before interpolation in _write_candidate().

Test plan

  • python3 -m pytest tests/test_candidates.py tests/test_lint_rules.py — 80 passed
  • python3 -m llmwiki lint — no more stale_candidates (1): rule raised exception
  • Regression test added: test_stale_candidates_rule_runs_without_nameerror exercises the rule end-to-end
  • Commit GPG-signed
  • CHANGELOG updated

Checklist

  • One intent per PR — fixes only
  • Conventional-commit title (fix:)
  • GPG-signed commits, no AI co-author trailers
  • Regression tests added
  • CHANGELOG entries under ### Fixed
  • No breaking changes
  • Stdlib-only — no new deps

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.
@Pratiyush Pratiyush merged commit 882a478 into master Apr 17, 2026
8 checks passed
@Pratiyush Pratiyush deleted the fix/candidates-py39-and-lint-rule branch April 17, 2026 22:10
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.

1 participant