feat(track): add --wait to block until the repo is indexed#170
Merged
Conversation
gortex track hands the repo to the daemon and returns immediately, so a following gortex analyze / query can race ahead of indexing. --wait blocks until the daemon reports the repo present with a stable, non-zero node count and a resolved (Ready) graph, with --wait-timeout (default 10m, 0 = forever) as a CI guard. It errors instead of the soft offline success when no daemon is available to satisfy the wait. This collapses the CI one-shot recipe to `gortex track --wait .` followed by `gortex analyze`, replacing an inline poll-until-nodes shell loop. The settle check — per-repo node count stable across two polls plus a global Ready floor — is a heuristic that holds on warm multi-repo daemons where the global Ready flag alone would be insufficient. Tests stub the status seam and shrink the poll interval so they run without a daemon.
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.
What
Adds
--wait(and--wait-timeout) togortex track:gortex trackhands the repo to the daemon and returns immediately — indexing runs asynchronously — so a followinggortex analyze/ query can race ahead of the graph being ready.--waitblocks until indexing settles, then returns.Why
The one-shot / CI pattern ("index this path, then analyze it, in one job") currently needs an inline poll loop in every workflow:
With this flag that collapses to:
gortex track --wait . gortex analyze --kind synthesizers --format jsonSettle semantics
--waitpolls the daemon (reusing the sameControlStatusthestatuscommand uses) until the tracked repo is present with a non-zero node count that has stopped moving (stable across two consecutive polls) and the daemon reports a resolved, queryable graph (Ready). The per-repo stable-count check is what makes this hold on a warm multi-repo daemon, where the daemon-globalReadyflag alone wouldn't tell you this repo finished.--wait-timeout(default10m,0= wait forever) bounds it so CI can't hang.--wait, a missing/unavailable daemon is an error (the flag promised a queryable graph it can't deliver) rather than the normal offline-safe soft success.The classifier and poll loop are pure/seam-injected, so the tests exercise them without a running daemon (stubbed status fn + sub-ms poll interval).
Scope
cmd/gortex/track.goonly (+ tests). No protocol/daemon change —Readyand per-repo node counts already ride onStatusResponse.go build ./...,go vet,golangci-lintclean;go test ./cmd/gortex/passes (531).🤖 Generated with Claude Code