Files
stack/tests/dev/test_gen_config_comment_pull.py
kert 592b845584
All checks were successful
CI / lint (push) Successful in 1m9s
CI / notebooks-smoke (push) Successful in 1m54s
Deploy / changes (push) Successful in 23s
CI / test (push) Successful in 4m25s
Infra CI / notebooks (push) Successful in 1m8s
Infra CI / zotero (push) Successful in 19s
Infra CI / docs (push) Successful in 1m21s
Infra CI / api (push) Successful in 1m15s
Infra CI / llm (push) Successful in 52s
Infra CI / mc (push) Successful in 17s
Infra CI / bcda (push) Successful in 1m47s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
Deploy / docs (push) Successful in 46s
Package Supply Chain / pkg-supply-chain (push) Successful in 1m31s
Deploy / api (push) Successful in 1m12s
Deploy / bcda (push) Successful in 1m47s
Deploy / mc (push) Has been skipped
Deploy / llm (push) Successful in 1m13s
Deploy / report (push) Successful in 14s
feat(bib): nightly pull of every open regulations.gov docket
Nothing pulled open dockets on a schedule, so the FY2027 Hospice
(CMS-2026-1156, 215 comments) and CY2027 ESRD (CMS-2026-2245, 228)
proposed-rule dockets sat unpulled for months.

- `stack bib pull-open-dockets`: walk every unsealed docket from its
  watermark (attachments on), then enrich the new stubs at the 1000/hr
  reg.gov budget. Sealed dockets cost nothing; a docket quiet long enough
  after its period closes seals itself, so the job idles between seasons.
- Comment Pull workflow (02:30 nightly, generated): register this year's
  PFS proposed rule when it appears, pull + enrich the open dockets in
  the api container, index new comments in the llm container.
- compose: api gets REGULATIONS_GOV_API_KEY and ./.state/comments (rw);
  the llm extra gains typer so `stack llm index` runs inside llm.
- CLI reference regenerated for the new command.

Security: streamlit 1.66.0 capped pillow <13, leaving pillow 12.3.0 with
41 advisories (5 critical) fixed only in 13.0. streamlit 1.66.1 (Oct 21)
lifts the cap; exempted from the 7-day cooldown via exclude-newer-package,
and constraint-dependencies holds pillow >=13. Lock scans clean.
2026-10-27 15:40:05 -04:00

46 lines
1.7 KiB
Python

"""Snapshot tests for the generated Comment Pull nightly workflow.
``dev/scripts/backends/gitea.py::_gen_comment_pull`` pulls every open
regulations.gov docket inside the ``api`` container and indexes the new
comments inside ``llm``. These guard the workflow's shape without a live
Gitea Actions run (see test_gen_config_llm_golden.py for the pattern).
"""
from __future__ import annotations
import sys
from pathlib import Path
_DEV_SCRIPTS = Path(__file__).resolve().parents[2] / "dev" / "scripts"
if str(_DEV_SCRIPTS) not in sys.path:
sys.path.insert(0, str(_DEV_SCRIPTS))
from backends import gitea # noqa: E402
def test_gen_comment_pull_path_and_shape():
path, content = gitea._gen_comment_pull("ubuntu-latest", "latest")
assert path == ".gitea/workflows/comment-pull.yml"
assert 'cron: "30 2 * * *"' in content
assert "workflow_dispatch:" in content
assert "stack bib fetch-pfs-comments --since" in content
assert "docker exec api uv run --no-sync stack bib pull-open-dockets" in content
assert (
"docker exec llm uv run --no-sync stack llm index --collection comments"
in content
)
assert '--workflow "Comment Pull" --job "comment-pull"' in content
def test_comment_pull_runs_before_the_other_nightlies():
"""02:30 keeps it clear of notebooks (03:30), golden (03:40) and the
Zotero sync (04:15), which stops the desktop."""
_, content = gitea._gen_comment_pull("ubuntu-latest", "latest")
_, zotero = gitea._gen_zotero_sync("ubuntu-latest", "latest")
assert 'cron: "30 2 * * *"' in content and 'cron: "15 4 * * *"' in zotero
def test_emit_includes_comment_pull():
files = gitea.emit([], [], {"registry": "r", "repo": "o/r"}, {})
assert ".gitea/workflows/comment-pull.yml" in files