[jsweep] Clean write_daily_aic_usage_cache.cjs#45036
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[jsweep] Clean write_daily_aic_usage_cache.cjs#45036github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
- Remove unnecessary try/catch around JSON.stringify in logCache (JSON.stringify only throws for circular refs, not expected here) - Use nullish coalescing (??) instead of logical OR (||) for path defaults - Add test for large AIC value (10 → 11 tests total) Co-authored-by: Copilot <223556219+Copilot@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
Cleaned
write_daily_aic_usage_cache.cjsas part of the daily jsweep unbloat workflow.Execution context:
github-scriptChanges
Removed unnecessary try/catch in
logCacheThe
JSON.stringifycall inlogCachewas wrapped in a try/catch, butJSON.stringifyonly throws for circular references — which are impossible with the plainRecord<string, unknown>details object passed to this function. Removed the dead catch block and simplified to a ternary expression.Used nullish coalescing (
??) instead of logical OR (||)Replaced
||with??for thecacheFilePathandusageDirparameters inmainWithPaths. This is more precise:??only falls back fornull/undefined, not for falsy values like empty strings.Test Improvements
writes a large AIC value correctly— verifies that a large AIC value (999.99) is written without warningsValidation ✅
All checks passed:
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓npm run test:js✓ (11/11 passing for this file)Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
traces.example.comSee Network Configuration for more information.