Skip to content

Fix gitignore cache#1453

Merged
josephjclark merged 5 commits into
release/nextfrom
lamine-2
Jun 9, 2026
Merged

Fix gitignore cache#1453
josephjclark merged 5 commits into
release/nextfrom
lamine-2

Conversation

@josephjclark

Copy link
Copy Markdown
Collaborator

merge branch for #1444

…low name (#1444)

* fix(cli): fix cache .gitignore written to fs root and undefined workflow name

- Replace ensureGitIgnore path-walking logic with a direct getCacheRoot
  helper. The old loop used endsWith('.cli-cache') to find the cache
  root, but if the path never contained that segment (custom cachePath)
  it would walk all the way to '/' and write /.gitignore
- Fall back to 'workflow' when plan.workflow.name is undefined, avoiding
  .cli-cache/undefined directories
- Add cachePath to saveToCache/clearCache options types so custom cache
  paths set by workspace projects are correctly forwarded to getCachePath
- Remove spurious await on the now-synchronous getCachePath call
- Add regression tests covering expressionPath + cacheSteps (the exact
  scenario reported in #669, which had no test coverage)

Fixes #669

* fix test: use correct cache subdir name derived from filename

* refactor(cli): address review feedback on cache fix

- Eliminate getCacheRoot helper: getCachePath(options) with no
  workflowName/stepId already returns the CACHE_DIR root naturally
- Use .filter(Boolean) spread into path.resolve so undefined workflowName
  does not cause ERR_INVALID_ARG_TYPE (path.resolve throws on undefined)
- Keep cachePath in saveToCache/clearCache Pick types so custom paths work
- Rename gitignore test name to be more accurate

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* style(cli): fix prettier formatting

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* Revert "style(cli): fix prettier formatting"

This reverts commit 1e47fad.

* style(cli): fix prettier v2 formatting

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor(cli): simplify workflowName fallback per review

Use workflowName ?? '' instead of .filter(Boolean) spread.
path.resolve treats '' as a no-op so undefined workflowName
still resolves to the bare CACHE_DIR root.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
@github-project-automation github-project-automation Bot moved this to New Issues in Core Jun 9, 2026
@josephjclark

Copy link
Copy Markdown
Collaborator Author

made a tweak to log output while testing because some of the logging isn't actually super clear.

But the fix looks great. The gitignores themselves get ignored so creating new ones doesn't create lots of clutter

@josephjclark josephjclark merged commit 83b81eb into release/next Jun 9, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from New Issues to Done in Core Jun 9, 2026
@josephjclark josephjclark deleted the lamine-2 branch June 9, 2026 16:23
josephjclark added a commit that referenced this pull request Jun 9, 2026
* fix(cli): fix cache .gitignore written to fs root and undefined workflow name (#1444)

* fix(cli): fix cache .gitignore written to fs root and undefined workflow name

- Replace ensureGitIgnore path-walking logic with a direct getCacheRoot
  helper. The old loop used endsWith('.cli-cache') to find the cache
  root, but if the path never contained that segment (custom cachePath)
  it would walk all the way to '/' and write /.gitignore
- Fall back to 'workflow' when plan.workflow.name is undefined, avoiding
  .cli-cache/undefined directories
- Add cachePath to saveToCache/clearCache options types so custom cache
  paths set by workspace projects are correctly forwarded to getCachePath
- Remove spurious await on the now-synchronous getCachePath call
- Add regression tests covering expressionPath + cacheSteps (the exact
  scenario reported in #669, which had no test coverage)

Fixes #669

* fix test: use correct cache subdir name derived from filename

* refactor(cli): address review feedback on cache fix

- Eliminate getCacheRoot helper: getCachePath(options) with no
  workflowName/stepId already returns the CACHE_DIR root naturally
- Use .filter(Boolean) spread into path.resolve so undefined workflowName
  does not cause ERR_INVALID_ARG_TYPE (path.resolve throws on undefined)
- Keep cachePath in saveToCache/clearCache Pick types so custom paths work
- Rename gitignore test name to be more accurate

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* style(cli): fix prettier formatting

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* Revert "style(cli): fix prettier formatting"

This reverts commit 1e47fad.

* style(cli): fix prettier v2 formatting

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor(cli): simplify workflowName fallback per review

Use workflowName ?? '' instead of .filter(Boolean) spread.
path.resolve treats '' as a no-op so undefined workflowName
still resolves to the bare CACHE_DIR root.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>

* clean up test

* changeset

* tidying up

* typing

---------

Co-authored-by: Lamine Gueye <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
josephjclark added a commit that referenced this pull request Jun 9, 2026
* create output directory if it doesn't exist (#1452)

* fix(cli): create output directory if it doesn't exist (#1445)

The compile and collections commands threw ENOENT when --output-path
pointed to a directory that hadn't been created yet. Add
mkdir({ recursive: true }) before writeFile in both handlers, matching
the pattern already used in the execute command's serialize-output.ts.

Fixes #859

* changeset

---------

Co-authored-by: Lamine Gueye <[email protected]>

* Fix gitignore cache (#1453)

* fix(cli): fix cache .gitignore written to fs root and undefined workflow name (#1444)

* fix(cli): fix cache .gitignore written to fs root and undefined workflow name

- Replace ensureGitIgnore path-walking logic with a direct getCacheRoot
  helper. The old loop used endsWith('.cli-cache') to find the cache
  root, but if the path never contained that segment (custom cachePath)
  it would walk all the way to '/' and write /.gitignore
- Fall back to 'workflow' when plan.workflow.name is undefined, avoiding
  .cli-cache/undefined directories
- Add cachePath to saveToCache/clearCache options types so custom cache
  paths set by workspace projects are correctly forwarded to getCachePath
- Remove spurious await on the now-synchronous getCachePath call
- Add regression tests covering expressionPath + cacheSteps (the exact
  scenario reported in #669, which had no test coverage)

Fixes #669

* fix test: use correct cache subdir name derived from filename

* refactor(cli): address review feedback on cache fix

- Eliminate getCacheRoot helper: getCachePath(options) with no
  workflowName/stepId already returns the CACHE_DIR root naturally
- Use .filter(Boolean) spread into path.resolve so undefined workflowName
  does not cause ERR_INVALID_ARG_TYPE (path.resolve throws on undefined)
- Keep cachePath in saveToCache/clearCache Pick types so custom paths work
- Rename gitignore test name to be more accurate

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* style(cli): fix prettier formatting

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* Revert "style(cli): fix prettier formatting"

This reverts commit 1e47fad.

* style(cli): fix prettier v2 formatting

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor(cli): simplify workflowName fallback per review

Use workflowName ?? '' instead of .filter(Boolean) spread.
path.resolve treats '' as a no-op so undefined workflowName
still resolves to the bare CACHE_DIR root.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>

* clean up test

* changeset

* tidying up

* typing

---------

Co-authored-by: Lamine Gueye <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>

* Merge & Sync improvements (#1450)

* CLI: add --workflows flag to merge and deploy (#1437)

* add --workflows flag

* rename --workflows to --workflow and alias

* changelog

* update tests

* format

* mock: fix an issue where project obejts can get scribbed on

* fix tests

* update integration tests

* improve error messages for invalid workspace

* better diverence message

* Fix incorrect divergence warnings on checkout (#1446)

* improve error messages for invalid workspace

* better diverence message

* add failing test and notes

* project: set the alias on a checked out project

* fix divergence on checkout

* fixes for tests

* fix tests and enable project alias to be null

* update tests

* update more tests

* relax alias lookup to fix tests

* when merging, force-checkout the result

* remove comment

* types

* fix one more test

* update test

* hide merge command

* chore: ignore sentry errors by regexp (#1440)

* feat: ignore sentry errors by regexp

* chore: remove debug

* feat: add severity override to ignored errors

* changeset

---------

Co-authored-by: Joe Clark <[email protected]>

* versions

---------

Co-authored-by: Lamine Gueye <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Farhan Y. <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants