Skip to content

feat(log): add self-host audit PR correlation - #2511

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
oktofeesh1:codex/audit-pr-correlation
Jul 2, 2026
Merged

feat(log): add self-host audit PR correlation#2511
JSONbored merged 1 commit into
JSONbored:mainfrom
oktofeesh1:codex/audit-pr-correlation

Conversation

@oktofeesh1

Copy link
Copy Markdown
Contributor

Summary

  • add safe repo and PR-number fields to self-host job audit JSON lines
  • extract correlation fields from internal queue jobs and GitHub webhook payloads without logging full payloads
  • cover the extractor and durable queue audit emission paths

What changed

  • Added extractPayloadContext beside extractPayloadType for safe scalar correlation.
  • Threaded extracted context through SQLite and Postgres self-host queue lifecycle audits.
  • Added helper regression tests plus queue emission assertions for webhook audit lines.

Why

Self-host operators need to grep Docker logs for everything that happened to a specific PR without relying on opaque queue job IDs or exposing raw job payloads.

Closes #2087

Validation

  • npm run test:coverage
  • npm run test:ci
  • npm audit --audit-level=moderate

Emit safe repo and PR-number correlation fields on self-host job audit lines so operators can grep queue lifecycle logs for a specific pull request without logging full payloads.

Closes JSONbored#2087
@oktofeesh1
oktofeesh1 requested a review from JSONbored as a code owner July 2, 2026 06:27
@dosubot dosubot Bot added the size:L label Jul 2, 2026
@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-02 06:43:41 UTC

6 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
The change adds structured repo and PR correlation labels to self-host audit JSON lines and threads that context through both SQLite and Postgres queue lifecycle logging. The extractor is scoped to top-level internal job fields and nested GitHub webhook payloads, returns only scalar values, and the queue integrations reuse the same extracted context for complete/error/dead/rate-limited events. The visible diff is coherent with the PR description and the tested paths cover the main internal, webhook, malformed, and queue emission cases.

Nits — 5 non-blocking
  • nit: src/selfhost/audit.ts:122 accepts any finite number for pr_number, so malformed payloads can emit `0`, negative, or fractional PR numbers; consider requiring positive integers for log hygiene.
  • nit: src/selfhost/audit.ts:82 gives top-level `repoFullName` priority over nested webhook `repository.full_name`, which is fine for internal jobs but could preserve a stale or spoofed top-level value if a webhook job ever carries both; add a comment or test documenting that precedence.
  • src/selfhost/audit.ts:122 could tighten `numberField` for PR numbers by adding a dedicated `prNumberField` helper using `Number.isInteger(value) && value > 0`.
  • test/unit/selfhost-audit.test.ts should include a precedence test for webhook jobs that have both top-level and nested repo/PR fields, since that is now a behavioral contract of `extractRepo` and `extractPrNumber`.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2087
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 65 registered-repo PR(s), 58 merged, 4 issue(s).
Contributor context ✅ Confirmed Gittensor contributor oktofeesh1; Gittensor profile; 65 PR(s), 4 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Triage stale or unlinked PRs.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added gittensor gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.96%. Comparing base (118d537) to head (e241af6).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2511      +/-   ##
==========================================
+ Coverage   95.93%   95.96%   +0.02%     
==========================================
  Files         225      226       +1     
  Lines       25338    25463     +125     
  Branches     9218     9265      +47     
==========================================
+ Hits        24308    24435     +127     
  Misses        417      417              
+ Partials      613      611       -2     
Files with missing lines Coverage Δ
src/selfhost/audit.ts 100.00% <100.00%> (ø)
src/selfhost/sqlite-queue.ts 99.24% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dosubot dosubot Bot added the lgtm label Jul 2, 2026
@JSONbored
JSONbored merged commit 7bab053 into JSONbored:main Jul 2, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

feat(log): add repo/pr correlation fields to the self-host job audit line

2 participants