feat(backend): sync git commit metadata into commits tables (#2079) - #2118
Open
felipebergamin wants to merge 10 commits into
Open
felipebergamin wants to merge 10 commits into
felipebergamin wants to merge 10 commits into
Conversation
felipebergamin
force-pushed
the
feat/2079/sync-commit-metadata
branch
from
September 18, 2026 19:04
2185f8e to
93ed169
Compare
felipebergamin
marked this pull request as ready for review
September 21, 2026 19:28
* Add `Commits` model: unique `git_commit_hash`, nullable author/committer/subject/message/`fetched_from_url` * Add `CommitParents` model: FKs to `commits.id`, `ord` with 0 = first parent, unique `(commit_id, ord)` * Add migration `0021_commits_and_commit_parents` (`commits`, `commit_parents` tables and indexes) * Join from `checkouts.git_commit_hash` without new checkout columns Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
Dump commits and commit_parents in full so git ancestry survives restore. Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
…ci#2089) Keep commits rows narrow: unique git name/email in commit_identity, subject plus UTF-8 body in commit_message as bytea. update_db dumps and restores the new tables and still accepts a flat legacy commits CSV.
felipebergamin
force-pushed
the
feat/2079/sync-commit-metadata
branch
from
September 23, 2026 20:19
93ed169 to
85dcd65
Compare
| @@ -0,0 +1,59 @@ | |||
| --- | |||
Contributor
There was a problem hiding this comment.
maybe we shoudl keep those skill related files only on the dedicated PR.
| parser.add_argument( | ||
| "--dry-run", | ||
| action="store_true", | ||
| help="Parse as requested, write nothing to the database or tips file.", |
Contributor
There was a problem hiding this comment.
the dry run still updates with fetch (so it is not totally dry), even if we are not writing to database, might be something worth pointing.
| for metadata in metadatas | ||
| ] | ||
| Commits.objects.bulk_create( | ||
| rows, ignore_conflicts=True, batch_size=UPSERT_BATCH_SIZE |
Contributor
There was a problem hiding this comment.
we are ignoring on conflicts here, we should opt to either update on conflict or change the upsert name.
4 tasks
felipebergamin
force-pushed
the
feat/2079/sync-commit-metadata
branch
from
September 25, 2026 20:00
85dcd65 to
16397d9
Compare
Add a SHA-only helper for commit author/parents so later sync can reuse parsing without duplicating git format handling. Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
- Move fetch timeout and max pack size to Django settings (GIT_FETCH_TIMEOUT_SECONDS, GIT_FETCH_MAX_PACK_BYTES) - Document URL preference tiers and why the git CLI is used - Reuse author/committer constants in tests
…nelci#2079) Fetch allowlisted trees into GIT_MIRROR_DIR and ingest the tip delta into commits / commit_parents (not checkout hashes). Probe filter support, keep kernel.org packs, split mirror vs ingest crons, and exclude stored tips with ^sha on rev-list stdin. Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
Commit objects are immutable, so existing hashes stay as stored. Dry-run help now says the mirror fetch still updates the repo on disk, while ingest does not fetch.
Author and committer now live on commit_identity, and subject and message on commit_message.
felipebergamin
force-pushed
the
feat/2079/sync-commit-metadata
branch
from
September 25, 2026 21:01
80974f5 to
07d64ab
Compare
Nested identity and message stores pushed commit_store over the complexity limit.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Fill
commits/commit_parentsfrom git objects, not KCIDB. A persistent bare mirror atGIT_MIRROR_DIRfetches allowlisted trees; a second cron ingests the tip delta from that mirror (ancestor closure, notDISTINCT checkouts.git_commit_hash). Does not writecheckouts.git_commit_message.Closes #2109. Part of #2079. Schema #2089 and parse helper #2090 are still on this branch if they have not merged yet.
How to review
Read in this order:
docs/sync-commits.md— decisions (filter probe, kernel.org full packs, no googlesource remap, pack rollback vs keep-on-FAILED).backend/kernelCI_app/helpers/gitCommit.py— parse + one-shot SHA fetch ([#2079] Fetch commit metadata via SHA-only partial clone on tmpfs #2090).backend/kernelCI_app/helpers/commitSync.py— mirror fetch + ingest.sync_commit_mirror.py/sync_commit_ingest.py— two crons (0 4fetch,0 10ingest).commitSync_test.py,gitCommit_test.py.Skip unless you care about ops: compose
git-mirrorvolume,.env*.example,measure_git_mirror.py.Behavior that changed since the first PR description
sync_commits+ flags:sync_commit_mirrorandsync_commit_ingest.fetch=filter(git.kernel.org) still fetch;--filter=tree:0only when advertised. No URL remap.postBuffer; keep completed packs on transportFAILEDand retry once; kill the git process group on timeout.rev-list --remoteswith^shaon stdin.--not --stdindoes not exclude tips (that bug re-listed ~1.9M commits every run).--fill-gapsstays on ingest (one-shot SHA, no ancestry).Risk / rollout
GIT_MIRROR_DIRat the same time.git-mirrorvolume if an old unfiltered pack slipped in during early runs.0021is additive; no checkout column rewrite.Test plan
poetry run pytest kernelCI_app/tests/unitTests/helpers/commitSync_test.py kernelCI_app/tests/unitTests/helpers/gitCommit_test.pymanage.py sync_commit_mirror --dry-runthenmanage.py sync_commit_ingest --dry-run0 new commits(known_tips> 0)ord=0