Skip to content

fix: resolve v0.4.0 audit — CI, Action, cache/fail-on bugs, packaging#10

Merged
musharna merged 2 commits into
mainfrom
worktree-audit-fixes-2026-07-01
Jul 1, 2026
Merged

fix: resolve v0.4.0 audit — CI, Action, cache/fail-on bugs, packaging#10
musharna merged 2 commits into
mainfrom
worktree-audit-fixes-2026-07-01

Conversation

@musharna

@musharna musharna commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Resolves the full v0.4.0 audit (Critical 1–9 + quick wins; net-new features intentionally out of scope). Every claim was verified against live source before patching.

Critical

  1. CI green — merged the test-collection fix (tests/__init__.py + py3.9 annotation imports) and moved FakeClient into tests/conftest.py instead of cross-importing test modules. Bare pytest now collects and passes.
  2. Action works on its defaults — CLI accepts multiple paths and walks directories for *.bib/*.md (hidden dirs skipped), so paths: . works as documented. Findings are attributed with their filename (text path:Lnn, JSON file) when >1 file is scanned. release.yml now force-moves the v1 major tag on each release.
  3. Cache determinismDoiCache.get() reads back is_preprint/has_preprint_relation; a preprint from a warm cache is downgraded identically to a cold lookup (was an intermittent false-positive Tier B year failure).
  4. --fail-on validated — a typo like --fail-on retractions used to silently no-op the CI gate; it now errors at parse time (like --cross-check).

Important

  1. Markdown/DOI-list entries (no parsed title) no longer emit a misleading "possibly wrong DOI" on author mismatch — neutral message instead.
  2. DOIs are URL-encoded before being spliced into CrossRef/OpenAlex/doi.org URLs (a # no longer truncates into a different query).
  3. .claude/ git-ignored + excluded from the sdist (was leaking worktrees into uv build); verified the built sdist is clean. Added Typing :: Typed.
  4. release.yml gains a test gate (build needs test) — no publish on red; Action inputs passed via env: (no shell injection) and the install is pinned.
  5. --json --dry-run emits valid JSON; test_semantic_live.py gains the live marker and the weekly workflow sets GHOSTCITE_LIVE=1.

Quick wins

CITATION.cff → 0.4.0 · README pre-commit rev → v0.4.0 + pass_filenames: true · example outputs gain the retractions: line · action fail-on default gains title · fetch-retractions shown in --help · CI matrix +3.10/3.12 · schema_version in --json · CHANGELOG [Unreleased] section.

Deliberately skipped

  • Committing uv.lock — it's intentionally .gitignored (library-lockfile decision left to you).
  • Net-new features (GitHub annotations, --ignore-doi, config file, concurrency, library README) — out of scope per request.

Verification

305 passed / 5 skipped, ruff + mypy + ruff format --check clean, coverage 90.6% (>85 gate). Built sdist confirmed to contain no .claude/ / worktree files. Real-execution walkthroughs: ghostcite ., --json --dry-run, --fail-on typo, and markdown neutral-message all behave as intended.

🤖 Generated with Claude Code

musharna and others added 2 commits June 22, 2026 20:43
Two independent matrix breakages (the version `CI` job was red on main
since 06-20; `Live tests` was unaffected):

- Py3.9: `tests/test_preprint.py` and `tests/test_venue.py` used
  `list[str] | None` / `str | None` in function default-arg annotations,
  which 3.9 evaluates at definition time -> TypeError (GenericAlias | None).
  Add `from __future__ import annotations` so annotations stay strings.
- Py3.13: `tests/test_cli_semantic.py` imports `from tests.test_cli import
  FakeClient`, but `tests/` was not an importable package. Add empty
  `tests/__init__.py`.

Verified: `pytest -m "not live"` passes on 3.9 and 3.13 (290 passed,
2 skipped), ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HjKoaVFk7CFQfdkS18TWHm
Addresses the full v0.4.0 audit (Critical 1-9 + quick wins).

Correctness fixes:
- cache: get() now reads back is_preprint/has_preprint_relation, so a preprint
  served from a warm cache is downgraded identically to a cold lookup (was an
  intermittent false-positive Tier B year failure).
- --fail-on: validate tier names at parse time — a typo (e.g. "retractions")
  used to silently empty the fail-set and turn the CI gate into a no-op.
- compare: markdown/DOI-list entries (no parsed title) no longer emit a
  misleading "possibly wrong DOI" on author mismatch — neutral message instead.
- crossref/openalex: URL-encode DOIs before splicing into request URLs so a DOI
  containing '#' isn't truncated into a different query.
- cli: --json --dry-run now emits valid JSON.

Action / multi-file input:
- CLI accepts multiple paths and walks directories for *.bib/*.md (hidden dirs
  skipped), so the Action's default `paths: .` works as documented. Findings are
  attributed with their filename (text path:Lnn, JSON `file`) when >1 file.
- action.yml: pass inputs via env (no shell interpolation), pin the install,
  default fail-on gains `title`.
- release.yml: force-move the `v1` major tag to each release commit.
- pre-commit hook: pass_filenames now that the CLI takes multiple files.

CI / packaging:
- release.yml gains a test gate (build needs test) — no publish on red.
- .claude/ git-ignored + excluded from sdist (was leaking worktrees into
  `uv build`); added Typing :: Typed classifier; CI matrix +3.10/3.12.
- test_semantic_live.py gains the `live` marker; live-tests sets GHOSTCITE_LIVE=1.

Test collection / housekeeping:
- merged the CI-collection fix (tests/__init__.py + py3.9 annotation imports);
  FakeClient moved to tests/conftest.py instead of cross-importing test modules.

Docs: CITATION.cff->0.4.0, README pre-commit rev->v0.4.0, example outputs gain
the retractions: line, fetch-retractions shown in --help, schema_version added
to --json, CHANGELOG [Unreleased] section.

305 passed / 5 skipped, ruff+mypy+format clean, coverage 90.6%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AS7DtpsXwhB2eevQyqFxxe
@musharna musharna marked this pull request as ready for review July 1, 2026 23:24
@musharna musharna merged commit 54879d9 into main Jul 1, 2026
10 checks passed
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