Skip to content

test: cover PR #398 Zod descriptions and entity schema cache keys#409

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/missing-test-coverage-99a5
Draft

test: cover PR #398 Zod descriptions and entity schema cache keys#409
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/missing-test-coverage-99a5

Conversation

@cursor

@cursor cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds regression tests for recently merged production changes where missing coverage carried meaningful business risk.

Risky behavior now covered

PR #398 — Zod 4 input schema descriptions

  • Risk: In Zod 4, calling .describe() before .optional() / .default() strips field descriptions from the MCP tool surface, breaking LLM tool selection for pagination, scope, and filter fields.
  • Coverage: Runtime assertions on all 7 affected tool handlers (harness_list, harness_search, harness_status, harness_describe, harness_diagnose, harness_get, harness_schema) plus static architecture guard in architecture.test.ts.

PR #396 — Live entity schema cache isolation by scope

  • Risk: A shared cache key across org/project scopes could serve the wrong YAML schema for a different org or project.
  • Coverage:
    • buildLiveSchemaCacheKey unit tests for account/org/project differentiation
    • bundledSnapshotMatchesScope rejects mismatched org/project against vendored meta
    • preloadBundledEntitySchemas warms cache with scope-aware keys from vendored meta (not account-only keys)
    • harness_schema integration tests proving separate cache entries for org and project scope identifiers

Test files added/updated

File What it guards
tests/tools/zod-input-schema-descriptions.test.ts MCP field descriptions survive Zod 4 chaining on all 7 tool handlers
tests/tools/entity-schema-cache-keys.test.ts Cache key format, bundled scope matching, preload warming
tests/tools/entity-schema-bundled.test.ts Bundled-first path, project scope validation, cross-org/project rejection
tests/tools/harness-schema-tool.test.ts End-to-end org/project cache isolation via harness_schema
tests/coding-standards/architecture.test.ts Static Zod describe-chain-order enforcement

Why this reduces regression risk

  • LLM tool selection: Description loss is silent at compile time; runtime schema inspection catches it before agents lose field hints.
  • Wrong-schema serving: Scope cache collisions would cause agents to author YAML against the wrong org/project schema — high blast radius for create/update flows.
  • Startup cache warming: preloadBundledEntitySchemas was changed to use scoped keys; without tests, a revert to account-only keys would reintroduce the collision bug at process start.

Validation

pnpm test  # 2204 passed
Open in Web View Automation 

cursoragent and others added 3 commits June 24, 2026 18:01
…ails

- Fix Zod 4 describe chaining in 7 tool handlers so MCP clients receive
  field descriptions (describe must follow optional/default)
- Add architecture tests for Zod chain order and HarnessClient singleton
- Include structural-validation in pnpm standards:check
- Tighten identifierFields rule for body-based get operations
- Update docs/coding-standards.md (confirm param, Zod 4 ordering, exceptions)

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Add behavioral regression tests for Zod 4 describe-after-optional/default
chaining on harness_list, harness_search, harness_status, harness_describe,
harness_diagnose, harness_get, and harness_schema. Add unit tests for
buildLiveSchemaCacheKey scope isolation and bundledSnapshotMatchesScope.

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

- Assert preloadBundledEntitySchemas uses scope-aware cache keys from vendored meta
- Guard against warming cache for mismatched account ids
- Add org-scope cache isolation regression test for harness_schema live entities
- Cover buildBundledSchemaKey key format

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.

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