Skip to content

T-C4Q0-intersect-registry

Status: closed/done · Impact: medium · Complexity: small

Implement index() over labeled pattern-sets — throwing on a duplicate id, retaining registration order — and Registry.applicableTo(scope) / matching(path) returning the applicable ids in registration order, so the “which guidelines/standards apply to this scope” query (DR-0014) works.

The registry surface and its fixtures exist as stubs from T-FGMJ; the path API it builds on is implemented by T-IRYT.

LocationRole today
plugin/lib/intersect/registry.tsRegistry surface — throwing stubs.
plugin/lib/intersect/index.tsThe path-API primitives it builds on.
plugin/lib/intersect/fixtures/registry.cases.jsonRegistry spec, all pending.

index(entries) compiles each entry once, throws on a duplicate id, and keeps entry order; applicableTo(scope) returns the ids whose set overlaps scope, matching(path) the ids whose set matches a concrete path — both in registration order. Registry fixtures are active and green.

  1. index(entries, opts): iterate entries in order; reject a duplicate id with a clear Error naming the id; compile each entry’s patterns to a Matcher (via the path API’s compile); store { id, matcher } in order.
  2. applicableTo(scope): for each entry in order, keep its id iff its matcher intersects scope.
  3. matching(path): for each entry in order, keep its id iff its matcher matches path.
  4. Expose entries as a readonly, ordered view.
  5. Flip registry.cases.json to active.
LocationKindChange
plugin/lib/intersect/registry.tsmodifyImplement index / Registry.
plugin/lib/intersect/fixtures/registry.cases.jsonmodifyActivate.
  • AC-1: All registry.cases.json cases pass; bun test plugin/lib/intersect is green.
  • AC-2: Registering the same id twice throws, and the error message contains the offending id.
  • AC-3: A fixture that registers entries in a deliberately non-alphabetical order asserts that applicableTo and matching return ids in registration order, not sorted.
  • AC-4: registry.ts imports only from the path API (./index), not the fs layer; bunx tsc --noEmit passes.
  • The filesystem layer — T-ZAZO.
  • Precedence resolution (picking a winner): the registry returns ordered ids; the caller applies precedence, per PR-0002-intersect boundary.
  • Requires the implemented path API from T-IRYT.
  • Motivated by DR-0014; the registry section of D-4FRD-intersect-api layered-api.md.

T-IRYT


← Back to Tasks