Conversation
…hash Extend the cache hash to cover every workspace package.json (root and member packages) in addition to the lockfile. Each package.json is canonicalized (parsed, top-level "version" stripped, re-encoded with sorted keys) before hashing, so cosmetic or CI-driven version bumps don't invalidate the cache. The hash composition mirrors the byte layout used by terraform-provider-checkly so identical inputs produce identical digests in both codebases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53528a1 to
a38df36
Compare
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
versionfield stripped so CI-driven version bumps don't invalidate the cache.cache-hash.tsmodule exposes a stable JSON encoder (sorted keys, HTML-significant + line/paragraph separators escaped), a package.json canonicalizer, andcomposeCacheHashwhich combines records using length-prefixedlockfile:<basename>andpackage.json:<rel/path>blocks (8-byte BE length + label, 8-byte BE length + content).composeBundleChecksumin terraform-provider-checkly (#364) so identical inputs produce identical SHA-256 digests in both codebases. A hard-coded fixture digest is asserted in tests; mirror it into the TF provider test suite to lock in cross-language parity.Linear: SIM-227
Test plan
npx vitest run src/services/check-parser/).cache-hash.spec.tscovers: stable encoder behavior, version-stripping canonicalization, source key reordering, lockfile change sensitivity, workspace-member addition, input order independence, and a fixed parity fixture digest.4d3072de5db2f0f8a5e29b72013dd7e4dfb25686023931ee98050d58ba4503f8.versionchanges; a dependency edit in any workspace package.json should change the hash.🤖 Generated with Claude Code