Repository navigation
feat(runner): publish the project catalog before Git enrichment - #1415
Conversation
The first inventory waited for serial Git probes of every saved project, so one slow repository delayed the whole list after each Runner start. The one owned scan worker now publishes the validated catalog first, with Git fields absent to mean unknown, then replaces it once enrichment completes. Each publication records the inventory generation it was read under, so a result from before a Project mutation is never published, and a mutation during enrichment republishes the catalog immediately. Fixes yyjeqhc#1271
swjnxyf
left a comment
There was a problem hiding this comment.
Reviewed PR #1415 on the special main repository at 3ec817986b1b419d4d448b7f80a0ea8b80633e95 without creating a worktree. No blocking issues found (LGTM).
I checked the metadata-first and Git-enriched publications, the generation fencing of stale worker results, mutation-triggered metadata resnapshot, reconnect/reuse of the owned scan worker, shutdown handling, and the acknowledged paged inventory sync. The initial catalog preserves registration authority fields while leaving git_branch, git_head and git_dirty genuinely unknown until enrichment. The fallback for an unavailable enrichment stage keeps the already-published catalog rather than failing the stream.
Validation: GitHub's full CI matrix has passed (Linux, Windows, macOS and native aggregate gates). On special, cargo test --locked -p webcodex-runner --profile dogfood initial_project_scan -- --test-threads=4 passed (7 tests), the initial_inventory test passed, the Transport suite passed (112 tests), the four Git-enrichment tests passed, and the metadata authority test passed. cargo fmt --all -- --check and git diff --check also passed.
Non-blocking limitation: enrichment remains a serial final pass, so a slow repository can still delay the Git details of other projects, as documented in the PR. No follow-up code changes needed.
Fixes #1271
What changed
The first project inventory waited for serial Git probes of every saved project, so one slow repository held back the whole list after each Runner start.
The one owned scan worker now publishes in two stages through the existing acknowledged inventory pages:
git_branch,git_headandgit_dirtyabsent.How it meets the acceptance points
root_fingerprint, revision anddisabledare unchanged. An unresolved root still has no fingerprint.None, includinggit_dirty.ProjectInventorySync.InitialProjectScanState.invalidatedbecomes agenerationcounter.If enrichment ends without a final result after the catalog was published, the session keeps the catalog, with Git details left unknown, instead of failing.
Tests
New in
transport_tests/initial_project_scan.rs, using a held enrichment as the slow repository:initial_inventory_publishes_catalog_before_git_enrichment_then_replaces_itmutation_during_git_enrichment_republishes_catalog_and_discards_stale_resultreconnect_during_git_enrichment_gets_catalog_and_shares_the_one_workershutdown_during_git_enrichment_ends_the_session_without_a_scan_errorproject_metadata_keeps_authority_facts_and_leaves_git_unknown, against a real Git repository and an unresolved rootThe existing initial-scan tests are adapted to the two-stage seam. Their hold now sits in the metadata stage, so they still cover a mutation before first publication.
Removing or breaking each of these made at least one test fail: the metadata publication, the worker's stale check, the stream's generation filter, the immediate correction, worker reuse during enrichment, Git-free metadata, and completion handling.
Run on macOS arm64:
cargo test -p webcodex-runner --bin webcodex-runner: 1230 passed, 1 failed. The failure iscoding_agent::tests::diagnostics::explicit_path_mapping_restores_an_interpreter_outside_default_search_paths, which fails the same way on this machine without this change.cargo clippy --locked -p webcodex-runner --bins --tests -- -D clippy::correctness,cargo fmt --check,cargo check --locked -p webcodex-runner --bins --profile dogfood.python3 scripts/check_markdown_links.py,git diff --check.Limits
docs/RUNNER.mdis updated.docs/RUNNER.zh-CN.mdhas no peer paragraph for this behavior, so I left it alone.