Skip to content

test(klient): add real-server smoke coverage#1713

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:test/klient-smoke
Jul 15, 2026
Merged

test(klient): add real-server smoke coverage#1713
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:test/klient-smoke

Conversation

@sailist

@sailist sailist commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. The Klient package had unit coverage for its transports but no repeatable smoke checks against a real kap-server, especially for persisted sessions across the v1-to-v2 engine transition.

Problem

Klient examples mostly printed responses without assertions and were not included in package type checking. This made it difficult to verify HTTP and WebSocket behavior across core, session, and agent scopes, or to distinguish an actually missing session from a persisted cold session that the v2 dispatcher cannot materialize.

What changed

  • Add a real-server transport smoke script covering authentication, channel discovery, HTTP and WebSocket calls, event subscriptions, scoped services, error paths, fixture cleanup, and an optional model prompt.
  • Add a persisted-session history smoke script covering global and workspace indexes, v1/v2 projections, Windows path aliases, duplicate/orphan detection, cold-session access, and optional message/context markers.
  • Add dedicated examples type checking and include it in the package's normal typecheck command.
  • Document remote-server usage, required environment variables, and persistence side effects.
  • Fix existing examples so all examples pass the new type-check configuration.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset. Tests/examples-only change; no release bump is needed.
  • Ran gen-docs skill, or this PR needs no doc update. Package README usage was updated; user documentation is unaffected.

Verification

  • pnpm --filter @moonshot-ai/klient test
  • pnpm --filter @moonshot-ai/klient typecheck
  • pnpm --filter @moonshot-ai/klient build
  • pnpm exec oxlint --type-aware examples/smoke.ts examples/session-history-smoke.ts examples/inspect-init.ts
  • Windows real-server transport smoke passed against Kimi Code 0.24.1.
  • The history smoke reproduced an indexed cold session returning session.not_found through the v2 session scope while workspace and v1 projections remained intact.

Add transport and persisted-session smoke scripts for HTTP, WebSocket, and scoped service calls.
Type-check all examples and document remote-server usage and side effects.
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 553b56e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@553b56e
npx https://pkg.pr.new/@moonshot-ai/kimi-code@553b56e

commit: 553b56e

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 553b56ec4c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

assert.equal(matches.length, 1, `expected cwd must identify exactly one session; found ${String(matches.length)}`);
return matches[0];
}
return sessions[0];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require a real cold session for the history probe

When neither KIMI_SMOKE_EXPECT_SESSION_ID nor KIMI_SMOKE_EXPECT_CWD is set, this falls back to sessions[0]; ISessionIndex.list is recency-sorted and includes currently live sessions, so on an active server the "cold" metadata read can hit a live scope and pass without exercising the persisted cold-session regression this smoke is meant to catch. Please require an explicit target or otherwise avoid treating an arbitrary indexed session as cold.

Useful? React with 👍 / 👎.

});
const listenErrors: unknown[] = [];
const errorSubscription = ws.onDidListenError((error) => listenErrors.push(error));
const subscription = ws.listen('events', resolveEvent);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Filter the WebSocket smoke event by session

The core events stream is process-wide, but this handler resolves the smoke's eventReceived promise on the first event from any session. On a shared or active real server, an unrelated event can arrive within the 5s window and make this check pass even if the profile update for the owned smoke session is never delivered over WebSocket, so the subscription coverage becomes a false positive.

Useful? React with 👍 / 👎.

@sailist
sailist merged commit a160915 into MoonshotAI:main Jul 15, 2026
15 checks passed
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.

1 participant