fix(dashboard): don't activate local source from hidden/vendor subdirs (fixes indefinite 'Loading services…')#178
Merged
Conversation
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.
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
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/servicesnever returned — so the frontend's initial load never resolved.Root cause: a
pacto.yamlinside 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.ListServicesthen recursively walked the entire tree (depth 5: Library, cloud-synced folders, …) and never returned. Sinceresolver.ListServiceswaits for all sources,/api/servicesblocked indefinitely.The recursive walk (
collectBundleDirs) already skipped hidden/node_modules/vendordirectories — butdetectLocaldid 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)/api/servicescaa3de4200 in 1.4se6e6444(#177)200 in 1.7s, local correctly disabledChanges
skipScanDir(name)helper (hidden /node_modules/vendor) insource_local.go.collectBundleDirs(the recursive walk) anddetectLocal's immediate-subdir scan, so apacto.yamlunder such a directory neither activates nor is scanned. The local source can no longer root at$HOMEoff~/.Trash.detect_test.go):detectLocalignores.Trash/.git/node_modules/vendorsubdirs.dashboard_test.go): runningdashboardfrom a dir whose onlypacto.yamlis in a hidden subdir activates no source (guards against the hang).Related Issues
Regression introduced by #177.
Checklist
make test && make e2e)make lint)<type>: <description>conventionTesting
detectLocalchange to confirm it catches the regression).pkg/dashboardcoverage holds at 100.0%;skipScanDir/detectLocal/collectBundleDirsall 100%.make lint,make test, and the e2e dashboard suite all pass.$HOME:/api/serviceswent from a 60s hang to200 in 1.7s.