Add run logs command and document API log access #253

Merged
stephen merged 1 commit from fix/run-job-logs into main 2026-08-14 22:10:49 +00:00
Owner

Summary

  • adds fj run logs as the primary command for printing Actions job logs, while keeping singular fj run log as an alias
  • documents how this Forgejo build maps CLI run numbers to internal run ids, job ids, and plaintext job logs
  • updates auth docs so session cookies are no longer described as required for log reads

Endpoint proof

Read-only probe on rasterhub.com with the stored PAT, without printing the token:

GET /api/v1/repos/rasterstate/fleet/actions/runs?page=1&limit=50 -> HTTP 200; run_number=180 internal_run_id=18434
GET /api/v1/repos/rasterstate/fleet/actions/runs/18434/jobs -> HTTP 200; job_index=0 job_id=43624
GET /api/v1/repos/rasterstate/fleet/actions/jobs/43624/logs -> HTTP 200; bytes=11263

Conclusion: the PAT is sufficient for job-log reads on this Forgejo build. A browser session cookie is still needed for cookie-gated web routes such as run watch, rerun, and cancel.

Acceptance output

Command:

fj run logs 180 --repo rasterstate/fleet --job 0

Excerpt from the real failing live-drift job log:

2026-08-14T21:23:01.5719860Z usw-scm-01-fleet(version:v12.10.1) received task 38588 of job live-drift, be triggered by event: schedule
2026-08-14T21:23:40.7125533Z declared in ./rules: 98 alerts
2026-08-14T21:23:40.7127740Z OK: every declared alert is loaded
2026-08-14T21:23:42.7885088Z error: Ops Alerts human receipt is unconfirmed: No positive human receipt/readership confirmation is recorded in this repo as of 2026-08-13.
2026-08-14T21:23:42.7886075Z error: Ops Events human receipt is unconfirmed: No positive human receipt/readership confirmation is recorded in this repo as of 2026-08-13.
2026-08-14T21:24:48.5607967Z discord-confirmations                                    FAIL (exit 1)
2026-08-14T21:24:48.6699638Z 11 declared check(s), 1 failure(s)
2026-08-14T21:24:48.6706974Z RUN exit status 1
2026-08-14T21:24:48.6714133Z Job 'live-drift' failed

Verification

cargo fmt --check
RUSTC_WRAPPER= cargo test run_logs_parses_and_log_remains_alias
RUSTC_WRAPPER= cargo test run_logs_reads_forgejo_api_job_logs_by_job_id
RUSTC_WRAPPER= cargo test
RUSTC_WRAPPER= cargo run --quiet -- run logs 180 --repo rasterstate/fleet --job 0

Full test suite result: 773 passed, 0 failed, 2 ignored, plus the version test passed.

## Summary - adds `fj run logs` as the primary command for printing Actions job logs, while keeping singular `fj run log` as an alias - documents how this Forgejo build maps CLI run numbers to internal run ids, job ids, and plaintext job logs - updates auth docs so session cookies are no longer described as required for log reads ## Endpoint proof Read-only probe on rasterhub.com with the stored PAT, without printing the token: ```text GET /api/v1/repos/rasterstate/fleet/actions/runs?page=1&limit=50 -> HTTP 200; run_number=180 internal_run_id=18434 GET /api/v1/repos/rasterstate/fleet/actions/runs/18434/jobs -> HTTP 200; job_index=0 job_id=43624 GET /api/v1/repos/rasterstate/fleet/actions/jobs/43624/logs -> HTTP 200; bytes=11263 ``` Conclusion: the PAT is sufficient for job-log reads on this Forgejo build. A browser session cookie is still needed for cookie-gated web routes such as `run watch`, `rerun`, and `cancel`. ## Acceptance output Command: ```sh fj run logs 180 --repo rasterstate/fleet --job 0 ``` Excerpt from the real failing `live-drift` job log: ```text 2026-08-14T21:23:01.5719860Z usw-scm-01-fleet(version:v12.10.1) received task 38588 of job live-drift, be triggered by event: schedule 2026-08-14T21:23:40.7125533Z declared in ./rules: 98 alerts 2026-08-14T21:23:40.7127740Z OK: every declared alert is loaded 2026-08-14T21:23:42.7885088Z error: Ops Alerts human receipt is unconfirmed: No positive human receipt/readership confirmation is recorded in this repo as of 2026-08-13. 2026-08-14T21:23:42.7886075Z error: Ops Events human receipt is unconfirmed: No positive human receipt/readership confirmation is recorded in this repo as of 2026-08-13. 2026-08-14T21:24:48.5607967Z discord-confirmations FAIL (exit 1) 2026-08-14T21:24:48.6699638Z 11 declared check(s), 1 failure(s) 2026-08-14T21:24:48.6706974Z RUN exit status 1 2026-08-14T21:24:48.6714133Z Job 'live-drift' failed ``` ## Verification ```text cargo fmt --check RUSTC_WRAPPER= cargo test run_logs_parses_and_log_remains_alias RUSTC_WRAPPER= cargo test run_logs_reads_forgejo_api_job_logs_by_job_id RUSTC_WRAPPER= cargo test RUSTC_WRAPPER= cargo run --quiet -- run logs 180 --repo rasterstate/fleet --job 0 ``` Full test suite result: 773 passed, 0 failed, 2 ignored, plus the version test passed.
Add run logs command and document API log access
All checks were successful
Forseti review / forseti review (advisory) (pull_request_target) Successful in 58s
ci / check (pull_request) Successful in 11m4s
ci / live-e2e (pull_request) Successful in 2m5s
ci / coverage (pull_request) Successful in 3m36s
0e59662cad

Forseti review

No blocking findings from the lead reviewer.

Findings

  • P3 docs/compatibility.md:50 — This row now lists run logs / run view --log under Web route? yes (read), but the rest of this PR documents that t
    [unverified: the quoted evidence below does not appear in this diff, so this finding could not be grounded and does not gate. It is kept because a grounding miss must not hide a real defect.]

This row now lists run logs / run view --log under Web route? yes (read), but the rest of this PR documents that these commands read logs through the token-authenticated Actions API when available. Leaving the matrix unchanged makes the compatibility guidance internally contradictory, especially for users deciding whether a Fjord gateway or PAT host is required.

  • PR: rasterstate/fj#253
  • Head SHA: 0e59662cadea
  • Review job: sha256:b8abd15cc668e7681f7cc1f3a88fc151d6551cff4c1b391afd6986c17b619af5
  • Provider pair: openai:gpt-5.5+anthropic:claude-haiku-4-5-20251001
  • Blocking findings: 0
  • Inline findings: 1
  • Model tokens: 66627 in / 4667 out (32306 from cache) ≈ $0.2058
  • Token source: GITHUB_TOKEN
  • Runner: db3cdb390aa7
  • Run: https://rasterhub.com/rasterstate/fj/actions/runs/481
<!-- forseti:review {"version":2,"repo":"rasterstate/fj","pr":253,"head_sha":"0e59662cadead0b22bfda174d22ad1e69358a819","provider_pair":"openai:gpt-5.5+anthropic:claude-haiku-4-5-20251001","policy_version":"stub-policy-v1","prompt_version":"prompt-v2","context_fingerprint":"fnv64:66deefd03e4f2e46","review_job_key":"sha256:b8abd15cc668e7681f7cc1f3a88fc151d6551cff4c1b391afd6986c17b619af5","base_sha":"f115c1ef85367d8d8e5c81dc50b1607b2710a574","role":"summary","status":"current"} --> ## Forseti review No blocking findings from the lead reviewer. ### Findings - **P3** `docs/compatibility.md:50` — This row now lists `run logs` / `run view --log` under `Web route? yes (read)`, but the rest of this PR documents that t [unverified: the quoted evidence below does not appear in this diff, so this finding could not be grounded and does not gate. It is kept because a grounding miss must not hide a real defect.] This row now lists `run logs` / `run view --log` under `Web route? yes (read)`, but the rest of this PR documents that these commands read logs through the token-authenticated Actions API when available. Leaving the matrix unchanged makes the compatibility guidance internally contradictory, especially for users deciding whether a Fjord gateway or PAT host is required. - PR: `rasterstate/fj#253` - Head SHA: `0e59662cadea` - Review job: `sha256:b8abd15cc668e7681f7cc1f3a88fc151d6551cff4c1b391afd6986c17b619af5` - Provider pair: `openai:gpt-5.5+anthropic:claude-haiku-4-5-20251001` - Blocking findings: `0` - Inline findings: `1` - Model tokens: `66627 in / 4667 out` (`32306` from cache) ≈ `$0.2058` - Token source: `GITHUB_TOKEN` - Runner: `db3cdb390aa7` - Run: https://rasterhub.com/rasterstate/fj/actions/runs/481
forgejo-actions left a comment

Forseti review

No blocking findings from the lead reviewer.

Findings

  • P3 docs/compatibility.md:50 — This row now lists run logs / run view --log under Web route? yes (read), but the rest of this PR documents that t
    [unverified: the quoted evidence below does not appear in this diff, so this finding could not be grounded and does not gate. It is kept because a grounding miss must not hide a real defect.]

This row now lists run logs / run view --log under Web route? yes (read), but the rest of this PR documents that these commands read logs through the token-authenticated Actions API when available. Leaving the matrix unchanged makes the compatibility guidance internally contradictory, especially for users deciding whether a Fjord gateway or PAT host is required.

  • PR: rasterstate/fj#253
  • Head SHA: 0e59662cadea
  • Review job: sha256:b8abd15cc668e7681f7cc1f3a88fc151d6551cff4c1b391afd6986c17b619af5
  • Provider pair: openai:gpt-5.5+anthropic:claude-haiku-4-5-20251001
  • Blocking findings: 0
  • Inline findings: 1
  • Model tokens: 66627 in / 4667 out (32306 from cache) ≈ $0.2058
  • Token source: GITHUB_TOKEN
  • Runner: db3cdb390aa7
  • Run: https://rasterhub.com/rasterstate/fj/actions/runs/481
<!-- forseti:review {"version":2,"repo":"rasterstate/fj","pr":253,"head_sha":"0e59662cadead0b22bfda174d22ad1e69358a819","provider_pair":"openai:gpt-5.5+anthropic:claude-haiku-4-5-20251001","policy_version":"stub-policy-v1","prompt_version":"prompt-v2","context_fingerprint":"fnv64:66deefd03e4f2e46","review_job_key":"sha256:b8abd15cc668e7681f7cc1f3a88fc151d6551cff4c1b391afd6986c17b619af5","base_sha":"f115c1ef85367d8d8e5c81dc50b1607b2710a574","role":"summary","status":"current"} --> ## Forseti review No blocking findings from the lead reviewer. ### Findings - **P3** `docs/compatibility.md:50` — This row now lists `run logs` / `run view --log` under `Web route? yes (read)`, but the rest of this PR documents that t [unverified: the quoted evidence below does not appear in this diff, so this finding could not be grounded and does not gate. It is kept because a grounding miss must not hide a real defect.] This row now lists `run logs` / `run view --log` under `Web route? yes (read)`, but the rest of this PR documents that these commands read logs through the token-authenticated Actions API when available. Leaving the matrix unchanged makes the compatibility guidance internally contradictory, especially for users deciding whether a Fjord gateway or PAT host is required. - PR: `rasterstate/fj#253` - Head SHA: `0e59662cadea` - Review job: `sha256:b8abd15cc668e7681f7cc1f3a88fc151d6551cff4c1b391afd6986c17b619af5` - Provider pair: `openai:gpt-5.5+anthropic:claude-haiku-4-5-20251001` - Blocking findings: `0` - Inline findings: `1` - Model tokens: `66627 in / 4667 out` (`32306` from cache) ≈ `$0.2058` - Token source: `GITHUB_TOKEN` - Runner: `db3cdb390aa7` - Run: https://rasterhub.com/rasterstate/fj/actions/runs/481
Sign in to join this conversation.
No description provided.