Documentation

Docs / Reference

ADR 0021 - Test scope at composition and matching time

Status: Accepted (developer review, 2026-10-12) Date: 2026-10-12

Context

Test FastAPI apps tie production Langflow registrations, blocking four real client links. Helpers also contribute paths production never serves. The original the T011g investigation found that preferring production for test calls creates 33 wrong self-index fixture links; Revision 1 limits scope filtering to production calls and accepts the parsing sample's source-consistent link.

Options considered

Decision

Add internal/testscope with a pure Classify(path, Rules) function. Rules are validated once by strict tests.include/exclude decoding; the zero value uses only built-ins. Implement the specified case-sensitive gitignore subset using standard-library segment matching and whole-segment ** traversal. The scanner and dependencies stay unchanged. Exclude wins over includes and built-ins.

Pass current rules to route and client linkers through optional rule arguments, preserving callers that use built-ins. Each composition chain combines test scope from root definitions, composition sites, contributing FastAPI helper bodies and invocation sites, and registrations. Merged paths remain production when any chain is production; slash flags remain distinct. Prefix values do not carry scope. Route registrations and client invocation sites receive scope=test independently of composed paths and wrapper implementations.

Apply existing method, specificity and slash-twin selection first. Production calls drop test-only entries in a mixed winning tier; entirely test-only tiers produce test_only with no edge and no lower-tier fallback. Test calls ignore scope entirely. Node status order is dynamic, unmatched, test_only, ambiguous, then linked; inner wrapper sites retain wrapper status. Candidates remain capped at ten with their full ambiguous count. Queries continue traversing test calls.

Scope is derived graph data in extensible contract-v1 attributes. No cached per-file syntax, identity, span, hash, transport version, store interface/schema or dependency changes. Aggregate extractor version remains extractors-13.

Consequences

Configuration-only edits relink cached syntax without parsing unchanged files. Test routes/calls remain available to impact and callers. Production scope means path classification, not proof of deployment: documentation and parsing samples deliberately remain production-scope unless configured otherwise.

Known gaps

Rust cfg(test) module bodies, Cargo examples/benches and documentation examples are outside built-in classification. Gitignore negation and backslash escapes are rejected. Scope cannot distinguish unrelated fixture repositories sharing URLs; preserving baseline matching for test calls prevents scope from creating wrong confident links between them. Other route and client precision limits remain those of ADRs 0013, 0016, 0018, 0019 and 0020.

Review notes (developer, 2026-10-12)

Report a problem with this pageSource: docs/adr/0021-test-scope.md