feat(compliance): add explicit status cache strategy - #166
Open
emirykl wants to merge 1 commit into
Open
Conversation
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.
Description
Adds an explicit, consumer-managed compliance status cache strategy for dashboard reads. The SDK remains cache-free by default; consumers get a narrowly scoped freshness helper and adapter types, while the guide documents TTL, invalidation, stale-data, failure, privacy, and authorization boundaries.
Closes: #63
Evidence Checklist
1. Issue Reference
2. Implementation Summary
docs/compliance-status-cache.mdwith dashboard guidance and risk boundaries.src/types/compliance-cache.ts.isComplianceCacheEntryFresh()for exact-scope and expiry validation.The cache stays application-owned so status is never cached invisibly by the SDK. Scope includes network passphrase, contract ID, and address to prevent cross-network, cross-deployment, or cross-account reuse.
3. Tests
4. Commands Run
npm run checkcompleted its build step, then the default Jest invocation tried to access a sandbox-restricted Watchman socket. The same complete test suite passed with the repository worker's macOS-safe--no-watchmanflag.npm run lintcannot start becauseeslintis not present in this repository's declared/installable dependencies (sh: eslint: command not found); no dependency changes were added outside this issue's scope.5. CI Status
6. Acceptance Criteria Coverage — Traceability Table
src/types/compliance-cache.tstests/compliance-cache.test.tsdocs/compliance-status-cache.mdsrc/compliance.tsdocs/compliance-status-cache.mdtrueand stalefalse, forbids stale authorization, and returns false at expiry.ComplianceCacheScope,ComplianceStatusCacheAdapterComplianceCacheScope,ComplianceStatusCacheEntry,ComplianceStatusCacheAdapter,isComplianceCacheEntryFresh()tests/compliance-cache.test.tsREADME.mdReviewer Notes
Please pay particular attention to the deliberately conservative boundary: cached values are display snapshots only, never transaction authorization decisions, and the SDK does not cache automatically.