Skip to content

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

Description

@JSONbored

The self-host job audit line (src/selfhost/audit.ts:14) carries event/job_id/payload_type/latency but no repo or PR number, so grepping docker compose logs for 'everything that happened to PR #123' is impossible — you only get the job id. Extend AuditEvent with optional repo and pr_number fields extracted from the job payload (like extractPayloadType already does at audit.ts:32) and thread them through logAudit callers.

Deliverables

  • Add optional repo?:string and pr_number?:number to AuditEvent and include them in the emitted JSON when present
  • Add an extractPayloadContext(payload) helper (mirrors extractPayloadType) that safely pulls repo/pr fields, returning undefined on non-object/missing
  • Do not log full payloads; only the two correlation fields
  • Unit tests for extractPayloadContext: present, missing, malformed-JSON, wrong-types (both nullish arms)

References

  • src/selfhost/audit.ts:14
  • src/selfhost/audit.ts:26
  • src/selfhost/audit.ts:32

size: S · gittensor:feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions