Skip to content

ci(fork-sync): mock-allowlist for fork-boundary vi.mock calls (Option 4 — DEFERRED) #2440

@alexey-pelykh

Description

@alexey-pelykh

Status

DEFERRED — see Revisit Conditions below. Tracked for visibility, not actively scheduled.

Problem (when revisited)

Module-level vi.mock(...) calls on fork-boundary modules (src/agents/*, src/middleware/*) make stub regressions invisible by replacing the real module entirely. A lint rule requiring each such mock to be in an allowlist would force reviewer attention on any new fork-boundary mock added during sync PRs.

Proposed solution (when revisited)

scripts/check-mock-allowlist.mjs parses *.test.ts for vi.mock(...) calls on fork-boundary modules. Each must be in .mock-allowlist.json with { file, module, reason }. Adding a new entry requires PR description text. Same baseline pattern as check-stub-debt.mjs.

Why deferred

  • Standalone value too low — only flags NEW mocks; existing mocks (which include all the broken cases) are grandfathered into the initial allowlist
  • Composes well with reflective mock factory (other deferred child issue) — would become its enforcement layer
  • Without the factory, this is mostly hygiene theater

Revisit when

Effort (estimated when revisited)

1 day

Dependencies

Tracked under: #2433
Couples with: reflective mock factory (other deferred child issue of #2433)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-discussionApproach is opinionated or uncertain — needs team alignment before implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions