Skip to content

Refactor: extract shared utils, fix logging, async pattern, and missing guards#1

Merged
HiGarfield merged 1 commit intomainfrom
copilot/refactor-code-structure
Mar 25, 2026
Merged

Refactor: extract shared utils, fix logging, async pattern, and missing guards#1
HiGarfield merged 1 commit intomainfrom
copilot/refactor-code-structure

Conversation

Copy link

Copilot AI commented Mar 25, 2026

fetch.js and save.js duplicated boolean parsing and cache key/path building logic, used console.log instead of core logging APIs, mixed async/await with .then()/.catch(), and had several correctness gaps (redundant process.exit(1), no guard against empty paths, save.js ignoring the clean input entirely).

Changes

New utils.js

  • parseBooleanInput — consolidated from both files
  • buildBaseConfig — consolidates prefix chdir, key string construction, and toolchain path building shared by both steps

fetch.js

  • Uses utils.js; removes local duplication
  • console.log(keyString, restoreKeys)core.debug(...) with individual labeled entries
  • Removed redundant process.exit(1) after core.setFailed() (already sets exit code 1)
  • Skips cache.restoreCache when paths is empty

save.js

  • Uses utils.js; removes local duplication
  • Adds early return when clean=true — previously the input was silently ignored, risking an unintended save after a cache-busting run
  • Splits the combined skip condition into three explicit early returns, each with a core.debug message
  • Replaces .then()/.catch() chained onto await with pure async/await
  • console.logcore.info / core.debug
  • Skips cache.saveCache when paths is empty

@HiGarfield HiGarfield marked this pull request as ready for review March 25, 2026 16:14
Copilot AI review requested due to automatic review settings March 25, 2026 16:14
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@HiGarfield HiGarfield merged commit 3216a85 into main Mar 25, 2026
5 checks passed
@HiGarfield HiGarfield deleted the copilot/refactor-code-structure branch March 25, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants