test: cover entity schema cache isolation by scope (PR #396)#397
Draft
cursor[bot] wants to merge 2 commits into
Draft
test: cover entity schema cache isolation by scope (PR #396)#397cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Add focused regression tests for PR #396 scope-aware cache behavior: - buildLiveSchemaCacheKey unit tests for account/org/project key shapes - bundledSnapshotMatchesScope direct tests against vendored metadata - org-scope bundled fallback rejection and preload cache key isolation - org-level live schema cache isolation in harness_schema tool Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
|
|
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
Adds regression tests for the scope-aware live entity schema cache fix in #396. The production fix changed cache keys and bundled snapshot matching, but several critical paths lacked direct test coverage.
Risky behavior now covered
buildLiveSchemaCacheKey— cache keys must includeorgId/projectIdfor org/project scopes so different tenants do not share cached schemasbundledSnapshotMatchesScope— bundled snapshots tied to a specific org/project must not be served to callers with different scope identifiersharness_schemacalls with differentorg_idvalues must not reuse each other's cached live schemaspreloadBundledEntitySchemasmust warm scope-specific keys so preloaded entries do not leak across org/project boundariesTest files added/updated
tests/tools/entity-schema-cache-keys.test.tsbuildLiveSchemaCacheKey/buildBundledSchemaKeytests/tools/entity-schema-bundled.test.tsbundledSnapshotMatchesScope, org-scope fallback, preload key isolationtests/tools/harness-schema-tool.test.tsWhy these tests reduce regression risk
The original bug caused wrong YAML schemas to be returned when agents queried
harness_schemafor a different org/project than a prior call — a silent data correctness failure with high blast radius across all live entity types (connector, environment, service, etc.). These tests lock the contract at three layers: pure cache-key generation, bundled snapshot gating, and end-to-end tool behavior.Validation