atlas-github-comments
Source: pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs and pkgs/atlas-search/crates/atlas-core/src/github_comments.rs (extraction feed #6023; the writer is #10688).
atlas-github-comments is a one-verb writer: it extracts GitHub comments — issue comments, pull-request review comments, and pull-request reviews — from the repositories Drew controls, and appends them as atlas-github-comment/v1 records to a JSONL file, so the comments become a corpus source (source class github comments, source id github-comments). There are no subcommands and no other mode; the single invocation below is the whole tool.
There is no help output at all. The complete surface exists only in the source header, and — stated plainly, because it surprises everyone — every failure in this binary exits 1, including pure argument errors. --help is not a help path; it is an unknown argument, exit 1. There is no exit-2 path.
Invocation
atlas-github-comments --state <watermarks.json> --out <records.jsonl> [--repo <owner/name>]... [--skip-reviews] [--observed-date <YYYY-MM-DD>]
| Flag | Argument | Default | Meaning |
|---|---|---|---|
--state | path to a JSON watermark store | required | Per-repo progress: the stored updated_at watermark for each repository already extracted. Missing flag: --state is required, exit 1. |
--out | path to a JSONL file | required | Append target for the emitted atlas-github-comment/v1 records. Missing flag: --out is required, exit 1. |
--repo | <owner>/<name> | — (whole estate) | Restrict the run to these repositories. Repeatable. With no --repo, the estate is enumerated from the GitHub API: the developing-today and developing-today-forks organisations plus the dezren39 account — the #6023 our-repos estate. External repositories are never extracted here; that is gated on #6024. |
--skip-reviews | (switch) | off | Skip the per-PR reviews walk (issue comments and review comments are still extracted). |
--observed-date | YYYY-MM-DD | today, UTC (via date -u +%F) | The observation date stamped on the emitted documents. |
Any other argument — including --help, -h, and the literal word help — is atlas-github-comments: unknown argument: <arg>, exit 1. A flag missing its value is named the same way, for example --state needs a path, exit 1.
Behaviour
Extraction is done with the gh CLI only (gh api, with --paginate), and repositories are walked sequentially, as rate-limit discipline. For each repository the tool collects its issue comments, its review comments, and (unless --skip-reviews) its reviews, shapes them into comment documents, and appends one atlas-github-comment/v1 record per document to --out. Each record carries its provenance — repository, thread number, comment id, and the observed date — so a record in the corpus names the exact comment it came from.
Progress is reported on stdout as it goes: an opening estate: <n> repos line, one line per repository — <repo>: issue_comments=N review_comments=N reviews=N documents=N — and a closing totals: … line.
Idempotency and dedupe shape
Re-running the tool is the normal case, and it is safe by construction:
- Extraction is incremental per repository via the watermark: the state file stores each repo’s
updated_atwatermark, and a run only extracts what is newer than the stored mark. Already-extracted comments are not emitted again. - Watermarks are persisted after every repository, not at the end of the run. An interrupted run therefore resumes where it stopped: rerun the same command and the repos already done are skipped by their watermarks, with their records already in
--out. - A
ghfailure stops the run, but with state saved: the error carries the suffix(state saved; rerun resumes), and the rerun picks up from the last persisted watermark rather than starting over.
The HTTP 451 exception
One failure does not stop the run: a repository that is permanently access-blocked (HTTP 451, for example a DMCA block) is logged as <repo>: skipped — repository access blocked (HTTP 451), counted in a final skipped_repos: N (repository access blocked, HTTP 451) line, and the run continues with the next repository. If nothing else failed, the run still exits 0.
See Ingest today: staging, classification, promotion for how an extracted source like this one proceeds through staging and classification.
Worked example
Extracting one toy repository into a fresh state and records file:
$ atlas-github-comments --state /tmp/toy-watermarks.json --out /tmp/toy-records.jsonl --repo toy-owner/toy-repo
estate: 1 repos
toy-owner/toy-repo: issue_comments=2 review_comments=1 reviews=1 documents=4
totals: …
Running the identical command again appends nothing for that repository unless new comments have appeared since the stored watermark — the second run is the resume/idempotency check, not a duplicate import.
Failure shapes
- Missing
--stateor--out, an unknown argument (including--help), or a flag missing its value:atlas-github-comments: <message>on stderr, exit 1. - A
ghfailure mid-run: the run stops, watermarks saved so far stay saved, the error notes(state saved; rerun resumes), exit 1. - File errors on the state or output paths: exit 1.
- The one non-failure: HTTP 451 repositories are skipped and counted, and do not by themselves change the exit code.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success — including runs in which HTTP 451 repositories were skipped. |
| 1 | Everything else: argument errors, gh failures, and file errors alike. This binary has no exit-2 path. |