GitNexus/gitnexus/bench/group-link-matching
samuel mbabhazi 1f5ac81157
fix(group): match a manifest link's consumer only in the repo it names (#3881)
* fix(group): match a manifest link's consumer only in the repo it names

A group.yaml link adds a consumer contract to the exact and wildcard
passes, and those passes matched it on the contract id alone. Declaring
`gen-question → learning POST /import` in a group where user-service also
serves `POST /import` produced a second, undeclared cross-link from
gen-question to user-service.

The consumer contract a link creates now carries the repo the link names
(`meta.providerRepo`), and both passes skip providers outside it. In the
wildcard pass the filter runs before the thrift ambiguity check, so a
same-named service elsewhere in the group no longer blocks the declared
one. Consumers found in source still match across the whole group.

The field only steers matching. Sync drops it before writing the
registry, so contracts.json keeps its shape and a consumer whose provider
could not be read does not name that repo.

* fix(group): address review feedback on declared-repo matching (#3881)

- Track matched consumers as records in the exact and wildcard passes.
  Two consumers can share `repo::contractId` and still end differently
  now that a link consumer only matches the repo its link names, so the
  shared key hid the one that matched nothing from `unmatched`.
- Tests: the bookkeeping in both passes, a service-wildcard link through
  syncGroup, the strip on `unmatched`, the contracts handed to the
  bridge write, the exact pass on topic, lib, thrift and method-agnostic
  http contracts, and a declared repo that prefixes another repo's name.
- PIPELINE.md: say that the rule covers every link type and what still
  matches across the whole group.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(group): gate manifest-link matching on identity and linear scaling (#1188)

Build-free bench for the matching stage of syncGroup (provider index,
exact pass, wildcard pass, strip of the matching-only providerRepo) over
a synthetic group shaped like #1188: each link's route is served by four
repos, half the links have a source-extracted twin consumer, and every
fifth link names a repo that contributes nothing.

- fingerprint over every cross-link and unmatched contract at 8,000
  links. The matcher from before #1188 and the repo::contractId
  bookkeeping both move it; a missing strip fails a separate count.
- scaling ratio between 2,000 and 8,000 links, budget 1.8. Measured
  1.04-1.19; a sweep from 1,000 to 32,000 links has a log-log slope of
  1.13. An extra provider-index walk per consumer measures 2.0-2.3.

Wired into the benchmarks job. baselines.json also records two costs
that predate #1188 and are not gated: service-wildcard links and
method-agnostic http links each walk the provider index once per link.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 16:22:31 +00:00
..
baselines.json fix(group): match a manifest link's consumer only in the repo it names (#3881) 2026-11-15 16:22:31 +00:00
measure.mjs fix(group): match a manifest link's consumer only in the repo it names (#3881) 2026-11-15 16:22:31 +00:00