test: strengthen coding standards guardrails and consolidate allowlists#572
Draft
cursor[bot] wants to merge 2 commits into
Draft
test: strengthen coding standards guardrails and consolidate allowlists#572cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
Remote clients (e.g. the claude.ai connector) were being prompted to
re-authenticate very frequently. The connection was not actually expiring
— the server was losing the session and returning "Session not found",
which the client surfaces as a re-auth prompt. Two independent causes:
1. Multi-replica with a per-pod in-memory session store and no session
affinity. Sessions live in a process-local Map, so a request
load-balanced to a different replica than the one that initialized the
session 404s. With 2 replicas this hit a large fraction of requests
("every prompt"). Set replicas to 1 and add Service sessionAffinity
ClientIP; document that scaling out requires an externalized session
store (SDK eventStore) plus sticky ingress.
2. Aggressive 5-minute idle session TTL reaped sessions during normal
think-time (the connector holds no persistent SSE stream between
prompts). Raise the default MCP_SESSION_TTL_MS to 30 minutes.
Also add HARNESS_MCP_TRUST_PROXY so per-IP rate limiting keys on the real
client behind a load balancer instead of bucketing all users together.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AI-Session-Id: b8e26a07-057c-406c-bfde-245eb0c917ae
AI-Tool: claude-code
AI-Model: unknown
- Add tests/coding-standards/allowed-tools.ts as single source of truth for the 11 fixed MCP tool handlers and handler file paths - Refactor coding-standards tests to import shared allowlists - Add AGENTS.md consistency checks (11 tools, Zod v4, standards:check) to prevent regression to outdated 10-tool / Zod v3 snapshots
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audited the codebase against
docs/coding-standards.md(the canonical architecture rules). All 83 automated guardrail tests pass, and the full suite (2512 tests) passes after build.This PR adds a small hardening layer to prevent future drift:
tests/coding-standards/allowed-tools.ts— single source of truth for the 11 fixed MCP tool names and handler file paths (previously duplicated across 6 test files)pnpm standards:check)Standards compliance review
registerTool)architecture.test.tsarchitecture.test.tsarchitecture.test.ts+structural-validation.test.tstoolset-scope.test.ts,registry-contract.test.tsidentifierFields+operationPolicyon endpointsregistry-contract.test.tstoMcpError/errorResult)error-handling.test.tsconsole.log()insrc/architecture.test.ts.describe()on inputsarchitecture.test.ts,registry-metadata.test.tsregistry-metadata.test.tsHarnessClientarchitecture.test.tsfile-organization.test.tsCI (
.github/workflows/ci.yml) runspnpm standards:checkon every PR.Note on standards snapshot
The automation prompt referenced an older snapshot (10 tools, Zod v3). The current canonical docs (
docs/coding-standards.md,AGENTS.md) correctly document 11 tools (includingharness_schema) and Zod v4.Checklist
pnpm buildpassespnpm typecheckpassespnpm testpasses (2512 tests)pnpm standards:checkpasses (83 tests)console.log()insrc/