Skip to content

fix: enforce Zod describe ordering and extend coding standards checks#387

Closed
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/mcp-server-coding-standards-1b19
Closed

fix: enforce Zod describe ordering and extend coding standards checks#387
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/mcp-server-coding-standards-1b19

Conversation

@cursor

@cursor cursor Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Builds on the automated coding standards enforcement from #377 by fixing real Zod 4 schema violations and adding guardrails for two more checklist items.

Changes

Zod describe ordering fixes (6 handlers)

In Zod 4, .optional() / .default() return new schema wrappers that do not inherit .description from an earlier .describe() call. Fixed chaining order in:

  • harness_list, harness_get, harness_search, harness_status, harness_diagnose, harness_describe

All optional/default params now use .optional().describe(...) / .default(...).optional().describe(...) so MCP tool metadata exposes descriptions to LLMs.

Extended automated enforcement

  • scripts/check-standards.js: flags .describe() before .optional()/.default(); verifies write handlers expose confirm + confirmViaElicitation()
  • tests/coding-standards/architecture.test.ts: matching Vitest coverage (11 tests total)

Verification

pnpm standards:check   # pass
pnpm test              # 2106 tests pass
pnpm build && pnpm typecheck

Standards coverage status

Rule Enforced by
Fixed 11 MCP tools only standards:check + architecture tests
No console.log in src/ standards:check + architecture tests
No raw fetch in tools/toolsets standards:check + architecture tests
Toolset purity (no HarnessClient/MCP/Registry imports) standards:check + architecture tests
Toolset registry ↔ ToolsetName sync standards:check
HarnessClient singleton standards:check
Zod .describe() ordering newstandards:check + architecture tests
Write confirmation gating newstandards:check + architecture tests
identifierFields, scope, operationPolicy tests/registry/structural-validation.test.ts (full test suite)
Open in Web View Automation 

cursoragent and others added 4 commits June 22, 2026 10:03
…ctFn path

Add regression tests for recent production fixes where coverage was thin:

- GitOps supportedScopes: lock account/org/project declaration on the four
  scopeOptional resources fixed in #342 and verify account-scope list dispatch
  omits org/project params; contrast with gitops_application fallback behavior
- hasRequiredDiscoveryScope: direct unit tests for account/org/project gating
  used by execution-summary and pipeline-yaml resources (#325)
- HarnessClient: include config-service in x-tenant-id gRPC-proxy coverage (#361)
- compactItems: test custom compactFn delegation and openInHarness merge

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
… pipeline-yaml edges

Add regression tests for recently merged production paths with thin coverage:

- HarnessClient: append API description field on /chaos/ and /loadTest/ errors
  for both request() and requestStream(); verify non-matching paths stay unchanged;
  extend requestStream x-tenant-id coverage to schema-service and config-service
- templateV1BasePathFromScope: explicit account/org/project paths, legacy inference,
  validation errors, and URL encoding
- pipeline-yaml resource: scopeOptional bypass and pipeline_v1 discovery when
  HARNESS_PIPELINE_VERSION is v1

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
- Add docs/coding-standards.md as the canonical architecture guide
- Add scripts/check-standards.js and tests/coding-standards/architecture.test.ts
- Wire pnpm standards:check into CI alongside build/test/typecheck
- Fix ToolsetName union missing knowledge-graph and semantic-layer
- Remove HarnessClient imports from sto/ccm toolsets (use narrow interfaces)
- Replace idp console.error with structured createLogger

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Fix Zod 4 schema chaining in six harness tool handlers so .describe()
comes after .optional()/.default(), preserving LLM-visible parameter
descriptions on the MCP tool surface.

Extend pnpm standards:check and architecture tests to guard Zod describe
ordering and write-handler confirmation wiring (confirm param +
confirmViaElicitation).

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@thisrohangupta

Copy link
Copy Markdown
Collaborator

Closing as stale: merge conflicts with main and work superseded by merged PRs (#447, #446, #449, #469, #440, #398, etc.) or duplicate agent-generated attempts. Reopen from a fresh branch if still needed.

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.

3 participants