Skip to content

test: add regression coverage for CCM, STO, schema, and knowledge-graph paths#389

Closed
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/missing-test-coverage-20ec
Closed

test: add regression coverage for CCM, STO, schema, and knowledge-graph paths#389
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/missing-test-coverage-20ec

Conversation

@cursor

@cursor cursor Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds focused regression tests for recently merged production code paths where business risk was meaningful but contract coverage was thin.

Risky behavior now covered

CCM (cost_perspective.create preflight)

  • Fetches account-level perspective preference defaults from Settings API
  • Deep-merges viewPreferences (agent values win)
  • Applies viewState / viewType / viewVersion defaults
  • Graceful degradation when settings fetch fails
  • Works with narrow preflight client (account + request only)

STO (security_exemption preflights)

  • Create: required-field validation + auto-derived requester_id
  • Approve: body.scope required, auto-derived approver_id, ACCOUNT scope elevation clears org/project
  • Reject: auto-derived approver_id
  • List: pagination preflight fail-loud validation, _nextPageHint filter preservation, skipCompact projection

Schema (harness_schema)

  • Nested static definition lookup (bare name → dot path, depth cap, wrapper fallback)
  • Project scope validation before live/bundled fetch
  • extractLiveSchema envelope handling

Knowledge Graph / Semantic Layer (new in this iteration)

  • hql_query validate: query_string / queryString / query body aliases; projects only { is_valid, errors }
  • kg_type list: multi-bucket flattening, description truncation, object_kindfilter.objectKind body
  • kg_type get: relationship_type dcs_enrichment join metadata without columnMappingMeta leaks
  • kg_queryable_type_summary list: kinds/annotations filter body, description truncation, annotation tags

Test files added/updated

File Focus
tests/registry/ccm-perspective-create.test.ts CCM perspective create preflight
tests/registry/sto-exemptions.test.ts STO exemption list/create/approve/reject
tests/tools/harness-schema-tool.test.ts Nested schema lookup + scope guard
tests/registry/knowledge-graph.test.ts HQL validate, kg_type list/get, queryable filters
tests/registry/gitops.test.ts GitOps scope validation
tests/resources/scope-check.test.ts Discovery scope guard
tests/utils/compact.test.ts compactFn path
tests/coding-standards/architecture.test.ts Architecture guardrails

Why these tests materially reduce regression risk

  • Preflight hooks mutate request bodies in-place; bugs silently send wrong defaults or drop caller values
  • Response extractors are the public contract boundary — envelope leakage and metadata stripping regressions are common review findings
  • Filter/body builders drive gRPC proxy calls; wrong mapping returns unfiltered or empty results
  • STO pagination hints must preserve active filters or agents paginate into the wrong dataset

Validation

pnpm test tests/registry/ccm-perspective-create.test.ts tests/registry/sto-exemptions.test.ts tests/tools/harness-schema-tool.test.ts tests/registry/knowledge-graph.test.ts
# 70 tests passed

pnpm test tests/registry/ tests/tools/harness-schema-tool.test.ts
# 1053 tests passed
Open in Web View Automation 

cursoragent and others added 3 commits June 23, 2026 07:17
- Add docs/coding-standards.md as the canonical architecture guide
- Add tests/coding-standards/architecture.test.ts with 9 guardrail checks
- 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)

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

Add focused regression tests for recently merged production paths that lacked
contract coverage:

- cost_perspective.create preflight: settings merge, defaults, graceful
  degradation, and narrow CcmPreflightClient compatibility
- security_exemption create/approve/reject preflights: required-field
  validation, PAT-derived IDs, and ACCOUNT scope param clearing
- harness_schema nested lookup: wrapper-definition fallback and depth-cap miss

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Add regression tests for knowledge-graph and semantic-layer paths that
were merged without focused contract coverage:

- hql_query validate: query_string aliases and envelope stripping
- kg_type list: multi-bucket flattening, description truncation, object_kind filter
- kg_type get: relationship_type dcs_enrichment join metadata without columnMappingMeta leaks
- kg_queryable_type_summary: kinds/annotations filter body and tag projection

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