Repository navigation
Commit 892b713
committed
fix(cross-repo): require an absolute URL's host to name the target project
After the previous two fixes the fleet still produced 4 false edges: psd2-service
and dolph-service, both CLIENTS of the same third-party URL
(https://api.tink.com/api/v1/credentials/third-party/callback/relayed), paired
with each other because their canonical paths were identical. Path equality alone
cannot tell "both call this API" from "one serves the other".
A client call whose url_path is absolute now only matches when the host names the
target project. Candidates are the host, its -service counterpart in BOTH
directions (bare "ddi" -> "ddi-service", and "api-service" -> "api"; this fleet
uses both spellings for one project), and -- only for .run.app hosts or suffixes
listed in CBM_CROSS_REPO_INTERNAL_DOMAINS -- the host's first label. First-label
extraction is deliberately NOT a general rule: applied to any dotted host it
would turn api.tink.com into "api" and recreate the defect. The env list is empty
by default, so no site-specific DNS is compiled in.
A candidate names a project when it equals the project's full name or its repo
basename. The basename comparison is the load-bearing one: real project names are
mangled paths ("Users-x-repos-anyfin-api"), so whole-name equality alone could
never match a bare hostname on a real fleet -- it would have rejected EVERY
absolute-URL edge while every unit test stayed green, because the fixtures seeded
bare names. A test now seeds a realistically mangled name for exactly this.
An edge is emitted only when THIS target is named and no other project is, so two
repos sharing a basename yield nothing rather than a guess.
Host parsing takes the text after the last '@' in the authority (userinfo appears
in real config: postgres://user:pass@host, Sentry DSNs), strips the port, and
folds case. IPv6 literals keep their brackets and can therefore never name a
project -- a deliberate conservative reject.
Also here, both necessary to make the above work or observable:
- cr_store_project_ident stops counting "<name>::missed" shadow rows toward its
single-primary check. Any project that ever recorded a parse miss carries two
rows, which made it unresolvable as source AND target and reported as not
indexed when it plainly was (DeusData#1609) -- the same defect mcp.c fixed for
list_projects in DeusData#1044; this site never learned it.
- cross_project_links now surfaces the direction marker added by 85b8ed9.
Storing it was pointless while the human-facing report still could not tell a
forward row from a reverse one, which is what misdirected this investigation.
Fleet effect: 4 -> 0 stored CROSS_HTTP_CALLS, from 75 before this series.
Note what the fleet does NOT prove: it contains no literal internal-host absolute
calls (every absolute URL is third-party or has a placeholder host), so 0 links is
equally consistent with correct attribution and with rejecting everything
absolute. The unit tests are the evidence for the former, and each is pinned by a
mutation.
Co-Authored-By: Claude Agent1 parent f35f949 commit 892b713
8 files changed
Lines changed: 832 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11469 | 11469 | | |
11470 | 11470 | | |
11471 | 11471 | | |
11472 | | - | |
| 11472 | + | |
| 11473 | + | |
11473 | 11474 | | |
11474 | 11475 | | |
11475 | 11476 | | |
| |||
11542 | 11543 | | |
11543 | 11544 | | |
11544 | 11545 | | |
11545 | | - | |
| 11546 | + | |
11546 | 11547 | | |
11547 | 11548 | | |
11548 | 11549 | | |
| |||
11551 | 11552 | | |
11552 | 11553 | | |
11553 | 11554 | | |
11554 | | - | |
| 11555 | + | |
11555 | 11556 | | |
11556 | 11557 | | |
11557 | 11558 | | |
| |||
11618 | 11619 | | |
11619 | 11620 | | |
11620 | 11621 | | |
| 11622 | + | |
11621 | 11623 | | |
11622 | 11624 | | |
11623 | 11625 | | |
| |||
11632 | 11634 | | |
11633 | 11635 | | |
11634 | 11636 | | |
| 11637 | + | |
11635 | 11638 | | |
11636 | 11639 | | |
11637 | 11640 | | |
| 11641 | + | |
| 11642 | + | |
| 11643 | + | |
| 11644 | + | |
11638 | 11645 | | |
11639 | | - | |
| 11646 | + | |
11640 | 11647 | | |
11641 | 11648 | | |
11642 | 11649 | | |
| |||
0 commit comments