fix(topology): read block dependencies from local pipeline YAML#52
Open
loadez wants to merge 1 commit into
Open
fix(topology): read block dependencies from local pipeline YAML#52loadez wants to merge 1 commit into
loadez wants to merge 1 commit into
Conversation
critical-path and pipeline topology returned every block with empty dependencies, so the critical path was always a single block (depth 1). fetchTopology only tried to fetch the pipeline YAML as a workflow artifact, but the pipeline definition isn't a job artifact — that fetch always misses, and the v1alpha pipeline API doesn't carry per-block dependencies. Add a local fallback: when the artifact fetch comes up empty, read the pipeline YAML from the working tree (.semaphore/semaphore.yml) — where the block dependencies actually live — and parse them. Surface which source was used via the result's "source" field. Adds a regression test.
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.
Problem
sem-ai critical-pathandsem-ai pipeline topologyreported every block with no dependencies, so the critical path was always a single block (depth 1) regardless of the real DAG.Root cause is in
fetchTopology: it only tries to obtain the pipeline YAML by fetching it as a workflow artifact (.semaphore/semaphore.yml). But the pipeline definition isn't a job artifact, so that fetch always misses — and the v1alpha pipeline-describe response carries blockname/state/resultbut no dependency info. With no YAML, every block fell back todependencies: [].Fix
cmd/topology_commands.go— add a local fallback (localPipelineDeps): when the artifact fetch yields nothing, read the pipeline YAML from the working tree (<working_dir>/<yaml_file>, default.semaphore/semaphore.yml) and parse block dependencies. This is the common case — you runcritical-pathfrom the repo, where the YAML lives. The result'ssourcefield now reportsv1alpha+artifact/v1alpha+local/v1alpha+nonefor transparency.cmd/topology_test.go— regression test (TestLocalPipelineDeps): writes a.semaphore/semaphore.ymlwith a Build→Test→Deploy chain, asserts deps parse andcomputeCriticalPathreturns the full 3-block chain; missing file → nil.The existing
parseYAMLDependencies/computeCriticalPathunits were already correct and tested — the gap was purely that the YAML was never read.Verification
Against a real 6-block pipeline (
Build → {Unit, Race, Vet} → Integration → Package):go test ./...,go vet ./...pass.Tracking
renderedtext/project-tasks#3414