Skip to content

fix(dashboard): don't activate local source from hidden/vendor subdirs (fixes indefinite 'Loading services…')#178

Merged
edu-diaz merged 1 commit into
mainfrom
fix/dashboard-local-scan-hidden-dir-hang
Jun 11, 2026
Merged

fix(dashboard): don't activate local source from hidden/vendor subdirs (fixes indefinite 'Loading services…')#178
edu-diaz merged 1 commit into
mainfrom
fix/dashboard-local-scan-hidden-dir-hang

Conversation

@edu-diaz

@edu-diaz edu-diaz commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

pacto dashboard oci://… could hang forever on "Loading services…" (blank skeleton, never populates) depending on the directory it was launched from. The page shell rendered fine, but /api/services never returned — so the frontend's initial load never resolved.

Root cause: a pacto.yaml inside a hidden directory (e.g. ~/.Trash/pacto.yaml) activated the local source rooted at the working directory. Launched from a large root such as $HOME, LocalSource.ListServices then recursively walked the entire tree (depth 5: Library, cloud-synced folders, …) and never returned. Since resolver.ListServices waits for all sources, /api/services blocked indefinitely.

The recursive walk (collectBundleDirs) already skipped hidden/node_modules/vendor directories — but detectLocal did not, so detection rooted the local source at a directory the walk would then grind through. This is a regression from #177 (which introduced recursive local discovery; before it, the local source scanned only one level).

Proof (exact demo command, run from $HOME)

Build /api/services
Parent caa3de4 200 in 1.4s
Feature e6e6444 (#177) hang — HTTP 000 at 60s
This PR 200 in 1.7s, local correctly disabled

Changes

  • Extract a shared skipScanDir(name) helper (hidden / node_modules / vendor) in source_local.go.
  • Use it in both collectBundleDirs (the recursive walk) and detectLocal's immediate-subdir scan, so a pacto.yaml under such a directory neither activates nor is scanned. The local source can no longer root at $HOME off ~/.Trash.
  • Unit test (detect_test.go): detectLocal ignores .Trash / .git / node_modules / vendor subdirs.
  • E2E regression test (dashboard_test.go): running dashboard from a dir whose only pacto.yaml is in a hidden subdir activates no source (guards against the hang).

Related Issues

Regression introduced by #177.

Checklist

  • Code compiles without errors
  • All tests pass (make test && make e2e)
  • Linter passes (make lint)
  • Tests added/updated for new functionality or bug fixes
  • Documentation updated (if applicable) — N/A (internal behavior fix)
  • Commit messages follow the <type>: <description> convention

Testing

  • New unit test verified RED → GREEN (failed before the fix for the right reason).
  • New e2e test verified RED → GREEN (temporarily reverted the detectLocal change to confirm it catches the regression).
  • pkg/dashboard coverage holds at 100.0%; skipScanDir / detectLocal / collectBundleDirs all 100%.
  • make lint, make test, and the e2e dashboard suite all pass.
  • Manually reproduced from $HOME: /api/services went from a 60s hang to 200 in 1.7s.

A pacto.yaml inside a hidden directory (e.g. ~/.Trash) activated the local
source rooted at the working directory. Run from a large root such as $HOME,
LocalSource.ListServices then recursively walked the entire tree (depth 5),
never returning. resolver.ListServices waits for all sources, so /api/services
blocked indefinitely and the dashboard sat on "Loading services…".

The recursive walk (collectBundleDirs) already skipped hidden/node_modules/
vendor directories, but detectLocal did not — so detection rooted the local
source at a directory the walk would then grind through. Extract a shared
skipScanDir helper used by BOTH detection and the walk so a pacto.yaml under
such a directory neither activates nor is scanned.

Regression introduced by #177 (recursive local discovery). Adds a detect unit
test and a dashboard e2e regression test; pkg/dashboard stays at 100% coverage.
@edu-diaz edu-diaz merged commit 9f88de4 into main Jun 11, 2026
15 checks passed
@edu-diaz edu-diaz deleted the fix/dashboard-local-scan-hidden-dir-hang branch June 11, 2026 07:56
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.

1 participant