fix(ci): correct Forgejo exporter status semantics #14

Open
john wants to merge 1 commit from feat/forgejo-ci-exporter-status into main
Owner

Outcome

Establishes the previously host-only Forgejo CI exporter as versioned source and corrects status interpretation for Forgejo 15.0.3.

Changes

  • defines and tests the verified enum 0..7 (unknown, success, failure, cancelled, skipped, waiting, running, blocked)
  • selects the current task via job.task_id, falling back to latest attempt, and treats failed step 2 as strongest retained terminal evidence
  • removes timestamp-derived success and all status-4-as-failure/status-3-as-success logic
  • mirrors Forgejo's exact aggregate ordering for parent runs
  • excludes cancelled/skipped from success/failure-rate denominators
  • adds explicit historical trust-boundary and parent-disagreement metrics
  • preserves existing metric names/labels consumed by Grafana and Operator
  • requires the database DSN at startup, uses a PostgreSQL read-only session, and moves secrets to an environment file
  • adds a locked uv package, systemd unit, tests, and path-scoped Forgejo CI workflow

Validation

  • uv run ruff check .
  • uv run ruff format --check .
  • uv run pytest — 22 passed, including every status 0–7 and representative Prometheus labels
  • generated CTE smoke test completed in a production READ ONLY transaction
  • full collector completed through an SSH tunnel with PostgreSQL read-only mode: last_collection_success = 1
  • current Prometheus target forgejo-ci verified up, one-minute scrape, no error
  • public CI Run Analytics dashboard verified with 11 panels and existing label contracts; Operator only embeds its public token

Representative corrected values were success_rate_7d=0.8602356, runs_today=670, and runs_today_failed=92. The deployed incorrect exporter had shortly before reported approximately 0.453844, 648, and 359.

Production boundary

This PR does not install or restart the exporter and does not edit Grafana. Deployment/restart and the dashboard caveat/threshold update require an explicit production checkpoint. The large metric shift is expected semantic blast radius, not proof of fully reconstructed historical truth.

Spec Drift Callouts

  • The live exporter had no authoritative repository copy; it was created directly on the production host. This PR establishes the source under haskytech-ops.
  • The July 30 claim that step-derived history represented true success was too strong. Pre-containment data is explicitly labeled historically corrupted and unrepaired.
## Outcome Establishes the previously host-only Forgejo CI exporter as versioned source and corrects status interpretation for Forgejo 15.0.3. ## Changes - defines and tests the verified enum `0..7` (unknown, success, failure, cancelled, skipped, waiting, running, blocked) - selects the current task via `job.task_id`, falling back to latest attempt, and treats failed step `2` as strongest retained terminal evidence - removes timestamp-derived success and all status-4-as-failure/status-3-as-success logic - mirrors Forgejo's exact aggregate ordering for parent runs - excludes cancelled/skipped from success/failure-rate denominators - adds explicit historical trust-boundary and parent-disagreement metrics - preserves existing metric names/labels consumed by Grafana and Operator - requires the database DSN at startup, uses a PostgreSQL read-only session, and moves secrets to an environment file - adds a locked uv package, systemd unit, tests, and path-scoped Forgejo CI workflow ## Validation - `uv run ruff check .` - `uv run ruff format --check .` - `uv run pytest` — 22 passed, including every status 0–7 and representative Prometheus labels - generated CTE smoke test completed in a production `READ ONLY` transaction - full collector completed through an SSH tunnel with PostgreSQL read-only mode: `last_collection_success = 1` - current Prometheus target `forgejo-ci` verified `up`, one-minute scrape, no error - public `CI Run Analytics` dashboard verified with 11 panels and existing label contracts; Operator only embeds its public token Representative corrected values were `success_rate_7d=0.8602356`, `runs_today=670`, and `runs_today_failed=92`. The deployed incorrect exporter had shortly before reported approximately `0.453844`, `648`, and `359`. ## Production boundary This PR does not install or restart the exporter and does not edit Grafana. Deployment/restart and the dashboard caveat/threshold update require an explicit production checkpoint. The large metric shift is expected semantic blast radius, not proof of fully reconstructed historical truth. ## Spec Drift Callouts - The live exporter had no authoritative repository copy; it was created directly on the production host. This PR establishes the source under `haskytech-ops`. - The July 30 claim that step-derived history represented true success was too strong. Pre-containment data is explicitly labeled historically corrupted and unrepaired.
fix(ci): correct Forgejo exporter status semantics
All checks were successful
Forgejo CI Exporter / test (pull_request) Successful in 9s
3b6182d2a5
All checks were successful
Forgejo CI Exporter / test (pull_request) Successful in 9s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/forgejo-ci-exporter-status:feat/forgejo-ci-exporter-status
git switch feat/forgejo-ci-exporter-status
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
haskytech/haskytech-ops!14
No description provided.