Skip to content

Migrate the transcript sink tests to CI (phase 9a) - #522

Merged
MatiasFernandez merged 2 commits into
mainfrom
mfernandez/migrate-gci-tests-phase-9a
Aug 31, 2026
Merged

MatiasFernandez merged 2 commits into
mainfrom
mfernandez/migrate-gci-tests-phase-9a

Conversation

@MatiasFernandez

@MatiasFernandez MatiasFernandez commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

The 9 live-stone tests for the Transcript sink lived in client/src/__tests__/gci/gciTranscriptSink.test.ts — the gci vitest project, which npm test excludes. They only ever ran when someone remembered npm run test:gci, so in practice they never ran in CI at all. This moves them onto the useIntegrationTest harness in the default project, and takes the opportunity to stop the live-mode tests hand-rolling machinery that production already shares.

Why the old file needed a rewrite, not just a move

Everything the harness does, that file did itself: its own GciTsLogin/GciTsLogout in beforeAll/afterAll, its own session object, its own transaction discipline, and a version/platform gate. None of that survives the move — the harness owns login, the per-test transaction and its abort, and the commit guard.

The gate went too. GciTsNbPoll appeared only in that file's own polling helper, never in production code, so there was nothing version-specific left to gate once the polling moved to the shared runner.

The one production change

runNbCall's onReady widens from () => T to () => T | Promise<T>, matching pollNbToCompletion, which has always awaited it and documents the async case explicitly (the transcript-forwarding settle loop is the reason it does). Without the widening, an async onReady infers T as a promise and the call answers a nested Promise<Promise<…>>. Every existing caller passes a sync function, so nothing else moves.

Verification

npm run lint, npm run format:check, npm run compile and npm test all pass against a live stone — 6718 client / 322 server / 92 mcp-server tests green, with the 8 migrated tests among them (they were invisible to npm test before this PR).

🤖 Generated with Claude Code

The 9 live-stone tests in gci/gciTranscriptSink.test.ts never ran in
CI — that project is excluded from `npm test`. Move them under
src/__tests__ as a *.integration.test.ts so the default project picks
them up.

Move only: this commit relocates the file and changes nothing inside
it, so git records a pure rename and the file's history survives the
rewrite that follows. It does not compile or lint at this commit — its
relative imports and its gciTestConfig login still point at the old
directory, and the harness lint rules now apply to it (hence
--no-verify) — all of which the next commit resolves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@MatiasFernandez
MatiasFernandez force-pushed the mfernandez/migrate-gci-tests-phase-9a branch from deead3c to 8ddbb1d Compare August 31, 2026 17:06
@MatiasFernandez MatiasFernandez changed the title Migrate transcript sink tests to CI Migrate the transcript sink tests to CI (phase 9a) Aug 31, 2026
@MatiasFernandez
MatiasFernandez force-pushed the mfernandez/migrate-gci-tests-phase-9a branch from 8ddbb1d to 4cff900 Compare August 31, 2026 17:53
@MatiasFernandez
MatiasFernandez marked this pull request as ready for review August 31, 2026 17:53
@ericwinger
ericwinger self-requested a review August 31, 2026 18:26

@ericwinger ericwinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice migration — this genuinely closes a coverage hole (9 tests that never ran
in CI), and dropping the hand-rolled login/transaction/polling machinery in
favour of the shared harness and nbRunner is the right shape. The runNbCall
widening is correct and matches what pollNbToCompletion has always documented.
Full matrix green on 3.6.2 and 3.6.8 confirms the shared runner's socket-poll
fallback carries these tests on pre-3.7 stones.

Five notes inline, none blocking. The one I'd act on first is the fetchString
truncation guard: every vendored gcits.hf (3.6.2 → 3.7.5) says GciTsFetchUtf8
returns -1 only when *err is set, so a result too long for the 256-byte buffer
comes back silently truncated — the assertion as written is equivalent to the
err.number check above it, and the doc comment states the opposite of the
header.

One thing not in the diff: the description says the old file had "a version/
platform gate" that was removed. main's copy has no gate — no skipIf, no version
or platform check, and none in gciTestConfig.ts either. What it had was an
undeclared dependency on GciTsNbPoll in its own polling helper, which would just
have failed on a pre-3.7 stone. And GciTsNbPoll is in production code —
nbRunner.pollNbResultReady calls it when available. The accurate point is the
better one: production wraps it behind a GciTsSocket fallback, so moving onto
the shared runner removes the version dependency outright.

Comment thread client/src/__tests__/transcriptSink.integration.test.ts Outdated
Comment thread client/src/__tests__/transcriptSink.integration.test.ts Outdated
Comment thread client/src/__tests__/transcriptSink.integration.test.ts
Comment thread client/src/__tests__/transcriptSink.integration.test.ts
Comment thread client/src/nbRunner.ts
@MatiasFernandez
MatiasFernandez force-pushed the mfernandez/migrate-gci-tests-phase-9a branch from 4cff900 to cdb4f97 Compare August 31, 2026 19:52
Now that the file lives in the default project, put it on
useIntegrationTest: the harness owns login, the per-test transaction
and its abort, and the commit guard, so the hand-rolled login/logout
and the version/platform gate go away. GciTsNbPoll only appeared in
the old file's own polling helper, never in production, so nothing
here needs gating.

The harness's afterEach wipes SessionTemps every test, and the sink
lives only there, so it is installed per test instead of once in
beforeAll — a spike confirmed reinstalling after the wipe reliably
returns 'installed', never 'already installed'. The idempotency test
is strengthened to catch a non-idempotent install losing the buffer,
and the old "session remains healthy" test folds into the
error-handling test, which is where health is actually in doubt.

The live-mode tests no longer hand-roll start-then-poll. They go
through runNbCall, the same shared loop Execute It uses, so
settleNbResult is exercised where it actually runs rather than
detached from it. That means the nb result is decoded with the typed
helpers too: oopToInteger and executeAndFetchInteger instead of a raw
GciTsOopToI64 whose success flag went unchecked and a printString
round-trip, and a local fetchString that fails on a dropped
GciTsFetchUtf8 error or an over-long result instead of silently
truncating. One memoized ActiveSession serves the whole file, as the
extension has: nbRunner keeps per-session state keyed off the object
it is handed.

runNbCall's onReady widens to `() => T | Promise<T>`, matching
pollNbToCompletion, which has always awaited it. Without that, an
async onReady infers T as a promise and the call answers a nested
Promise<Promise<…>>. Every existing caller passes a sync function.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@MatiasFernandez
MatiasFernandez added this pull request to the merge queue Aug 31, 2026
@MatiasFernandez
MatiasFernandez removed this pull request from the merge queue due to a manual request Aug 31, 2026
@MatiasFernandez
MatiasFernandez force-pushed the mfernandez/migrate-gci-tests-phase-9a branch from cdb4f97 to 7206640 Compare August 31, 2026 20:35
@MatiasFernandez
MatiasFernandez added this pull request to the merge queue Aug 31, 2026
Merged via the queue into main with commit 5888228 Aug 31, 2026
21 checks passed
@MatiasFernandez
MatiasFernandez deleted the mfernandez/migrate-gci-tests-phase-9a branch August 31, 2026 20:50
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.

2 participants