treeproof silently mislabels git trees
- Dominant language
- Python
- Stars
- 9
- Forks
- 31
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 16
Description
## Description
[treeproof.py](https://github.com/profusion/dashboard/blob/b38f943a6f33906ff094a1de1d202349993b3e22/backend/kernelCI_app/management/commands/treeproof.py) creates a one-to-one correspondence (tree-names <-> urls) for data ingestion;
However, this silently breaks data. One example is detailed [below](#examples), but many other cases can lead to wrong mapping.
Ultimately, I believe the one-to-one mapping itself is not ideal - git is decentralized by nature, so a single tree can live (desynced) on many places. I think tree tracking should be refactored along these ideas:
- Each tree-name has a canonical URL that tracks it
- Current branch names/heads are tracked for each canonical URL
- On ingestion of checkouts:
- if `tree_name` is available, check `git_commit_hash` and `git_repository_branch` are available on the canonical URL
- if not, reject the submission and notify submitter
- if `git_repository_url` is available, check `git_commit_hash` and `git_repository_branch` are available on this URL
- if not, reject the submission and notify submitter
- if only one of `tree_name` or `git_repository_url` is available, try to populate the other (maybe with a prefix or suffix to indicate this)
## Examples
Mainline mislabeling
Suppose you have a `checkouts` table with two rows, with the following relevant columns:
| tree_name | git_repo_url |
|-----------|----------------------------------------------------------------------|
| mainline | `https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git` |
| mainline | `https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git` |
Then,the script will map (depending on ordering) `mainline <-> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git` and `torvalds-linux <-> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git`
---
## Related Issues
- #1947
- #1952
Contributor guide
Research direction
Start by reading backend/kernelCI_app/management/commands/treeproof.py and the related issues #1947 and #1952. Trace how checkouts are mapped during data ingestion, then define the tracking model around canonical URLs, branches, commit hashes, and missing metadata. Done means distinct repositories are not silently mislabelled and invalid submissions are rejected or completed according to the stated rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, data
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100