test: extend coding standards enforcement and fix handler error paths#411
Closed
cursor[bot] wants to merge 4 commits into
Closed
test: extend coding standards enforcement and fix handler error paths#411cursor[bot] wants to merge 4 commits into
cursor[bot] wants to merge 4 commits into
Conversation
Update version across package.json, both manifest files, and the release-metadata test that keeps them in sync. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> AI-Session-Id: 1b46c8db-abe4-4e9f-a38b-750362ead8ac AI-Tool: claude-code AI-Model: unknown
Expand automated architecture guardrails to cover: - Global fetch() limited to documented exceptions (HarnessClient, log-resolver CDN blobs, audit webhooks) - HarnessClient instantiation only in src/index.ts - Zod v4 import convention in tool handlers and config - Explicit openWorldHint annotations on all tool handlers - No deprecated server.tool() usage - Runtime registry contract checks (scope, identifierFields, operationPolicy) Document fetch() exceptions in docs/coding-standards.md. Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
…Fields Add registry-metadata.test.ts to guard listFilterFields/list operation alignment, write-handler elicitation wiring, and Zod .describe() on tool inputs. Move get-only params from listFilterFields to get.paramsSchema on 15 resources so harness_list no longer advertises non-list filters. Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Add handler-contract and toolset-extractors test suites to enforce error-handling patterns, stdout safety, pagination defaults, inline extractor ceiling, and create/update/delete risk classification. Fix harness_describe and harness_schema to follow the documented errorResult/toMcpError convention for infrastructure failures. Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
|
|
7 tasks
Collaborator
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
Extends the automated coding-standards guardrails introduced in #406 and fixes two handler error-handling gaps.
Changes
New test suites (
pnpm standards:check)handler-contract.test.ts— API handlers must import/usetoMcpError+errorResult; outer catch blocks throwtoMcpErrorfor infrastructure failures;harness_listpagination defaults (page=0, size=20, max=100); noprocess.stdout.writeinsrc/.toolset-extractors.test.ts— Blocks new inlineresponseExtractorfunctions outside a grandfathered allowlist; caps inline extractor count at 14 until promoted toextractors.ts.Registry contract
registry-contract.test.ts—create/update/deleteoperations must not userisk: "read"(execute actions withrisk: "read"remain allowed — they are intentional read-only queries viaharness_execute).Handler fixes
harness_describe— Outer try/catch withisUserError→ graceful JSON; unexpected failures →toMcpError.harness_schema— Catch block now distinguishes user-fixable errors (errorResult) from infrastructure failures (toMcpError).Verification
Standards coverage
The suite now enforces the registry-driven architecture rules from
docs/coding-standards.md:architecture.test.tsarchitecture.test.tsconsole.log/ stdout writesarchitecture.test.ts,handler-contract.test.tsHarnessClient, no rawfetcharchitecture.test.ts.describe()on inputsarchitecture.test.ts,registry-metadata.test.tsarchitecture.test.ts,registry-contract.test.tslistFilterFieldsonly withlistregistry-metadata.test.tsregistry-metadata.test.tsoperationPolicyon every endpointregistry-contract.test.tsrisk: readon CRUD opsregistry-contract.test.tstoolset-extractors.test.tshandler-contract.test.ts