Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/api/src/hackproof/github/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def is_pinned(candidate: Candidate) -> bool:


def should_keep(candidate: Candidate, window: Window, discovery: Discovery) -> bool:
if candidate.full_name.lower() in {name.lower() for name in discovery.exclude_repos}:
return False
if is_pinned(candidate):
return True
if candidate.fork or candidate.owner.lower() in {o.lower() for o in discovery.exclude_owners}:
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/hackproof/hackathon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Discovery(BaseModel):
github_string_queries: list[str]
dependency_fingerprints: dict[str, list[str]]
exclude_owners: list[str]
exclude_repos: list[str] = []
known_infra_accounts: list[str]


Expand Down
4 changes: 4 additions & 0 deletions apps/api/src/hackproof/linking/reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ async def reconcile(connection: asyncpg.Connection) -> Report:
official = (window.start, window.end)
await connection.execute(REPO_PROJECTS, *official, MIN_WINDOW_COMMITS, MIN_LIKELY_COMMITS)
await connection.execute(ACCOUNT_PROJECTS, *official, settings.friendbot_account)
await connection.execute(
"DELETE FROM projects WHERE lower(project_id) = ANY($1)",
[f"repo:{name.lower()}" for name in hackathon.discovery.exclude_repos],
)

methods = await connection.fetch("SELECT method, count(*) AS n FROM links GROUP BY method")
footprints = await connection.fetch(
Expand Down
7 changes: 7 additions & 0 deletions apps/api/tests/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
github_string_queries=[],
dependency_fingerprints={},
exclude_owners=["stellar"],
exclude_repos=["team/tool"],
known_infra_accounts=[],
)

Expand Down Expand Up @@ -50,6 +51,12 @@ def test_repos_named_in_wasm_metadata_bypass_every_filter():
assert should_keep(stale, WINDOW, DISCOVERY)


def test_excluded_repos_stay_out_even_when_wasm_metadata_names_them():
assert not should_keep(
candidate(full_name="Team/Tool", discovered_via={"wasm_meta"}), WINDOW, DISCOVERY
)


async def test_split_range_slices_until_every_range_fits_the_cap():
matches = [value for value in range(0, 10_000, 7)]

Expand Down
14 changes: 14 additions & 0 deletions apps/api/tests/test_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,17 @@ async def test_a_chain_item_matched_by_two_repos_is_credited_to_the_older_one(sc
second = await db.fetchval("SELECT full_name FROM attribution WHERE subject = 'C1'")

assert first == second == "team/original"


async def test_an_excluded_repo_never_becomes_a_project(scratch_db):
db = scratch_db
await add_repo(db, "stellar-scaffold/cli", window_commits=9)
await add_ref(db, "stellar-scaffold/cli", "contract", "C1")
await add_contract(db, "C1", "GDEPLOYER", "w1")

await reconcile(db)

found = await db.fetchval(
"SELECT count(*) FROM projects WHERE project_id = 'repo:stellar-scaffold/cli'"
)
assert found == 0
73 changes: 0 additions & 73 deletions data/2026/cli.yml

This file was deleted.

119 changes: 0 additions & 119 deletions data/2026/stellar-private-payments.yml

This file was deleted.

1 change: 1 addition & 0 deletions data/hackmeridian-2026.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ discovery:
python: [stellar-sdk, stellar_sdk]
go: [github.com/stellar/go]
exclude_owners: [stellar, stellar-expert, soroban, creit-tech, stellar-light]
exclude_repos: [stellar-scaffold/cli, NethermindEth/stellar-private-payments]
known_infra_accounts: []
Loading