fix(sdk): harden live discovery and static scan resilience - #67
Merged
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.
Summary
hydrateAwsCloudWatchLogMetricFilterCoverageissued oneDescribeMetricFilterscall per discovered log group in a single unboundedPromise.all. It now batches viachunkItemswith a shared per-file concurrency of 10, matching the sibling stream-activity hydrator.retryMode: 'adaptive', explicitmaxAttempts: 3, and request handler timeouts (5s connection / 30s request). Adaptive mode makes the SDK proactively rate-limit itself when AWS throttles; the timeouts prevent a hung socket from stalling a discovery run indefinitely (Node sockets have no default timeout). A generic test asserts these defaults on everycreate*factory export so future factories cannot silently miss them.parseHclfailures were uncaught, so a single.tffile with a syntax error crashed the entire static scan. Parse failures are now treated as "not a valid Terraform file" and skipped, matching the CloudFormation parser's existing behavior for malformed templates.scanrun.Diagram
flowchart TB subgraph Discovery["Live discovery hardening"] A[Discovered log groups] -->|before: unbounded Promise.all| B[DescribeMetricFilters] A -->|after: chunkItems, max 10 in flight| B C[baseAwsClientConfig] -->|adaptive retryMode / maxAttempts 3 / 5s connect + 30s request timeouts| D[All AWS client factories + STS] end subgraph Static["Static scan hardening"] E[.tf file] --> F{parseHcl} F -->|valid| G[IaCResource entries] F -->|throws - before: aborts entire scan| H[crash] F -->|throws - after: skip file, keep scanning| I[empty result for file] end style H stroke:#f66,stroke-dasharray: 5 5Scope
cloudburn(cli)@cloudburn/sdk@cloudburn/rulesRelease Notes
.changeset/*.mdfile for published package changesVerification
pnpm lintpnpm typecheckpnpm testpnpm buildpnpm verifyBoundary Checks
@cloudburn/rulesRelated Issues
None found (
gh issue listshows only #64, unrelated).