Skip to content

Dedupe candidates by canonical GitHub key - #19

Merged
justincasher merged 1 commit into
mainfrom
justin/dedupe-candidates
May 9, 2026
Merged

justincasher merged 1 commit into
mainfrom
justin/dedupe-candidates

Conversation

@justincasher

Copy link
Copy Markdown
Collaborator

Summary

The rendered candidates table had ~80 duplicate rows where the same GitHub repo appeared once via Reservoir and once via manual.txt. Two failure modes caused this:

  1. Suffix mismatch. The previous filter stopped at . when extracting names from Reservoir source URLs but allowed dots when parsing manual URLs, so argumentcomputer/Blake3 and argumentcomputer/Blake3.lean ended up as different keys.
  2. GitHub URL redirects. gh api repos/<old-owner>/<name> returns metadata for the repo's current location, so a manual URL like reaslab/jixia silently became frenzymath/jixia after fetch — and frenzymath/jixia is already in Reservoir.

This PR adds canonical keying that handles both cases and dedupes at render time so future drift between Reservoir and manual.txt resolves itself:

  • canonical_key(owner, name) lowercases and strips .lean / .git suffixes.
  • package_key(package) reads from sources[*].repoUrl/gitUrl (Reservoir's fullName is the lakefile name, which can differ from the GitHub path), falling back to splitting fullName only when no source URL is present.
  • render_table now dedupes by package_key, keeping the first occurrence. The CLI passes Reservoir packages before manual ones, so Reservoir always wins on conflicts.
  • One-shot filter against the current manifest removed 10 stale entries from manual.txt (9 suffix-bug dupes + 1 internal dup).

After this PR the rendered README has 1489 unique packages (down from a 1604-with-duplicates figure on the previous PR).

The previous filter for manual.txt missed entries that differed from
their Reservoir counterparts only by a `.lean` suffix or by case, and
GitHub URL redirects mean some manual URLs canonicalise to repos
already in Reservoir at fetch time. Result: ~80 duplicated rows in
the rendered table.

Adds canonical_key(owner, name) and package_key(package) in render.py
that lowercase and strip `.lean`/`.git` suffixes, deriving the key
from the package's source URL rather than its lakefile name (which
Reservoir sets independently of the GitHub path).

render_table now deduplicates by package_key keeping the first
occurrence, so when the CLI puts the Reservoir manifest before the
manual list, Reservoir entries win on conflicts and any future
overlaps disappear automatically.

Also one-shot filters manual.txt with the new helper, removing 10
entries (9 suffix-bug duplicates plus 1 internal duplicate).
@justincasher
justincasher merged commit 9a78cc4 into main May 9, 2026
2 checks passed
@Vilin97
Vilin97 deleted the justin/dedupe-candidates branch May 9, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant