Skip to content

test: add coverage for agents, schema cache isolation, and Zod 4 list/get descriptions#413

Draft
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/missing-test-coverage-ec9c
Draft

test: add coverage for agents, schema cache isolation, and Zod 4 list/get descriptions#413
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/missing-test-coverage-ec9c

Conversation

@cursor

@cursor cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Risky behavior now covered

  • Agent create uid generationgenerateAgentUid and the create bodyBuilder auto-fill uid from name, trim edge-case punctuation, and reject bodies missing both fields. CRUD dispatch paths (list/get/create/update/delete) are verified against /gateway/agents/api/v1/agents.
  • Entity schema cache isolation (Fix live entity schema cache isolation by scope #396)buildLiveSchemaCacheKey now has unit tests proving org/project identifiers partition the cache. Live fetcher tests confirm cache hits for identical scope and that vendored project snapshots are rejected when org/project don't match bundled meta.
  • Zod 4 MCP field descriptions (Enforce coding standards: Zod schema descriptions and architecture guardrails #398) — Post-registration behavioral tests for harness_list and harness_get mirror the existing harness_execute guard, catching .describe()-before-.optional() regressions that strip LLM-facing field docs.
  • create-agent prompt — Registration, required args, scope interpolation, and tool references (harness_list/harness_get/harness_update) are covered.

Test files added/updated

File Change
tests/registry/agents.test.ts New — bodyBuilder + dispatch
tests/tools/entity-schema-cache-keys.test.ts New — cache key scope isolation
tests/prompts/create-agent.test.ts New — prompt contract
tests/tools/entity-schema-bundled.test.ts Extended — bundledSnapshotMatchesScope, cache hit
tests/tools/tool-handlers.test.ts Extended — Zod 4 description regression for list/get

Why these tests materially reduce regression risk

  • Agent creation is a new write path with custom validation logic; a uid-generation bug would cause duplicate-ID API failures or silent wrong identifiers.
  • Schema cache pollution was a real cross-scope bug fixed in Fix live entity schema cache isolation by scope #396; these tests lock the cache-key contract and bundled-scope guard.
  • Zod 4 description chaining is a recurring review finding; static regex guards exist but behavioral post-registration tests catch SDK-level description loss on the two highest-traffic read tools.

Validation: pnpm test — 2221 tests passed.

Open in Web View Automation 

thisrohangupta and others added 5 commits June 23, 2026 00:42
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>
…apperKey scope injection

Add regression tests for high-blast-radius utilities and registry paths
that lacked focused coverage after recent merges:

- formatBodyPreview redacts content/content_base64 before write elicitation
- parseZipCsv and dashboardDataExtract handle store and deflate ZIP CSVs
- connector create injects org/project scope inside bodyWrapperKey wrapper
  and validates bodySchema fields against the wrapped payload

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
…list/get descriptions

- Add registry tests for agent create bodyBuilder uid auto-generation and CRUD dispatch
- Add cache key unit tests and live fetcher cache-hit / bundledSnapshotMatchesScope coverage
- Add create-agent prompt registration and workflow contract tests
- Extend harness_list/harness_get with post-registration Zod 4 description regression tests

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 all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ thisrohangupta
❌ cursoragent
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.

3 participants