Skip to content

Store git commit metadata (author, parents) for hashes we already ingest #2079

Description

@felipebergamin

Context

checkouts stores CI submissions, not git objects. For each checkout we currently keep:

  • git_commit_hash / git_commit_name / git_commit_tags
  • git_commit_message (often empty; submitters rarely send it)
  • git_repository_url / git_repository_branch

KCIDB has no author, committer, or parent fields, so we cannot get this from ingestion. We also have no parent chain, which is why #1958 / #2054 had to approximate “next checkout” with start_time.

The same git_commit_hash can appear on many checkouts (origins, labs). Author / parents are properties of the git object, not of a checkout row. Storing them only on checkouts would duplicate data and go stale independently per origin.

Goal

Persist git metadata for commits we already see in checkouts, filled from the real repositories (not from KCIDB submissions).

Store at least

  • author name, email, date
  • committer name, email, date
  • parent hashes (ordered; first parent = mainline parent on merges)
  • subject (first line of the message)
  • backfill git_commit_message when we have it from git and the checkout row is null

Nice to have later: tree hash, merge flag (array_length(parents) > 1).

Proposed shape

New commits table keyed by git_commit_hash (the object is globally unique). Keep a fetched_from_url of the repo we used. Join from checkouts.git_commit_hash.

Do not add these columns onto checkouts.

Filling it

Background command / cron, incremental:

  1. Distinct hashes in checkouts that are missing from commits
  2. Resolve a fetch URL from an existing checkout (prefer a known-good tree URL; same mapping treeproof already uses)
  3. git cat-file / git log -1 --format against a local mirror (fetch, do not clone from scratch every run)
  4. Upsert; skip / log hashes we cannot resolve (bad URL, object not on that remote)

Must tolerate missing objects, private remotes, and the malformed git_repository_url cases from #1952 / #1953 without crashing the job.

Why this is useful

  • Real first-parent history instead of ordering checkouts by start_time
  • Author on tree / commit / issue views
  • Search / filter by author
  • Honest merge vs first-parent walks

Out of scope

  • Changing the KCIDB submission schema or waiting for origins to send this
  • UI (follow-up once the table is populated)
  • Rewriting treeproof / tree-name mapping (#1953)

Related

  • #1958 next checkout after last seen
  • #1509 reject checkouts without commit_hash

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BackendMost or all of the changes for this issue will be in the backend code.Data QualityDatabaseIssue that alters only configs of a database itselfenhancementNew feature or request

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions