Skip to content

test(server): share one Session stub so a new method is a compile error - #747

Closed
kushals256 wants to merge 1 commit into
reticlehq:mainfrom
kushals256:test/fake-session
Closed

test(server): share one Session stub so a new method is a compile error#747
kushals256 wants to merge 1 commit into
reticlehq:mainfrom
kushals256:test/fake-session

Conversation

@kushals256

@kushals256 kushals256 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds createFakeSession so tool tests no longer cast Partial<Session> as Session. The helper is typed as the public Session shape, so a new method is a compile error in one file instead of a runtime miss in seven.
  • Rewires the seven stubs named in Session test stubs break every time Session gains a method (4th occurrence) #726. Each still passes only the fields it actually exercises (queryEvents, blindSpots, health, …). Assertions are unchanged.
  • Declares the helper as a test-only orphan (DECLARED_UNWIRED), matching project/memory-fs.ts.

Closes #726.

Test plan

  • New fake-session.test.ts: inert defaults for lostSince / bufferHealth / takeSessionLease; overrides win
  • Converted specs stay green: session-health, contradiction-plumbing, coverage-honesty, source-attribution, throttled-window, transport-gap, assert-advice
  • orphan-modules accepts the declared unwired helper
  • CI verify (format / lint / typecheck / unit)

Ad-hoc Partial<Session> as Session casts hid missing methods until runtime, and lostSince had to be copied into seven unrelated files. createFakeSession lists the public shape once; the seven stubs pass only the fields they exercise.

Signed-off-by: Kushal S <skushal.mys@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@divshekhar

Copy link
Copy Markdown
Contributor

Superseded by #737, which landed the same shared Session stub. Same idea, and #737 was green against current main first — no reflection on this one.

@divshekhar

Copy link
Copy Markdown
Contributor

Closing — #737 landed the same shared Session stub. Same idea, and it was green against current main first. Nothing wrong with this one.

@divshekhar divshekhar closed this Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session test stubs break every time Session gains a method (4th occurrence)

2 participants