head be77177439f2b52ef0cf70d54514fcd867f46966 · queued 2026-03-27 14:00:44 · 0 lane(s)
queued 0s
No lanes were selected for this branch head.
Summary
This branch migrates the forge CI lane definitions from a runtime-parsed TOML manifest (ci/forge-lanes.toml) into compiled Rust code owned by the pikaci crate (crates/pikaci/src/forge_lanes.rs). The TOML file is deleted, and all lane configurations—branch pre-merge lanes, nightly lanes, path globs, staged-linux targets, and concurrency groups—are now expressed as Rust data structures built at compile time by the compiled_forge_ci_manifest() function. The pika-git forge service, which previously read the manifest from git refs at runtime, now depends on the pikaci crate and calls the compiled function directly, eliminating the read_file_at_ref machinery entirely. Supporting changes update the globset dependency ownership (moved from pika-git to pikaci), remove the toml dependency from pikaci, update all path-string references across stores, tests, documentation, and invariant manifests, and add new tests that verify the compiled manifest's structural correctness.
Tutorial Steps
Delete the TOML lane manifest and create compiled Rust lane definitions in pikaci
Intent: Replace the runtime-parsed ci/forge-lanes.toml with a compiled Rust function in the pikaci crate that returns the identical ForgeCiManifest. This makes lane definitions type-checked at compile time and eliminates runtime TOML parsing and git-show lookups.
The core of this branch is the new crates/pikaci/src/forge_lanes.rs module, which defines:
FORGE_LANE_DEFINITION_PATH — a const pointing to the source file itself (crates/pikaci/src/forge_lanes.rs), used as a self-referential glob path so that any change to the lane definitions triggers all branch lanes.
ForgeCiManifest and ForgeLane structs — identical to the former TOML-derived types, now living in pikaci.
compiled_forge_ci_manifest() — constructs the full manifest (10 branch lanes, 5 nightly lanes) as Rust literals. Branch lanes use the staged_linux_lane() helper which validates the target against PikaStagedLinuxTarget::parse() at construction time and automatically prepends the self-path to each lane's glob list.
select_branch_lanes() — the glob-matching logic (previously in pika-git's ci_manifest.rs) moved here unchanged, using globset.
The globset dependency moves from pika-git to pikaci, and the toml dependency is removed from pikaci since there is no longer any TOML to parse.
The deleted ci/forge-lanes.toml contained the same 10 branch lanes and 5 nightly lanes, just expressed in TOML with [[branch.lanes]] and [[nightly.lanes]] table arrays.
The module includes comprehensive unit tests:
Every branch lane contains FORGE_LANE_DEFINITION_PATH in its paths.
All staged linux targets parse correctly against the catalog enum.
Lane IDs are unique within their category.
Authoritative linux lanes have the expected remote commands.
Rewire pika-git ci_manifest.rs as a thin re-export layer
Intent: Convert the pika-git ci_manifest module from a 178-line TOML parser into a 4-line re-export of pikaci's forge_lanes module, preserving the existing import paths used throughout pika-git.
All of this is replaced by a single pub use re-export from pikaci::forge_lanes. The globset dependency is dropped from pika-git's Cargo.toml and the pikaci crate dependency is added instead.
The remaining tests in ci_manifest.rs are updated to call compiled_forge_ci_manifest() instead of parse_manifest(include_str!(...)). Several tests that validated TOML parsing mechanics (staged target synthesis, version checking) are removed since those concerns are now covered by pikaci's own test suite. The test canonical_manifest_change_selects_branch_lanes is replaced by lane_definition_change_selects_all_branch_lanes which uses the new FORGE_LANE_DEFINITION_PATH constant.
Eliminate runtime git-show manifest loading in ci.rs
Intent: Remove the runtime code path that read the TOML manifest from git refs via git-show, replacing it with direct calls to the compiled manifest function. This removes a failure mode where a branch could ship a broken TOML manifest.
FORGE_LANE_MANIFEST_PATH → FORGE_LANE_DEFINITION_PATH: The constant is renamed and now delegates to ci_manifest::FORGE_LANE_DEFINITION_PATH (which is "crates/pikaci/src/forge_lanes.rs").
load_manifest_from_default_branch() and load_manifest_for_head(): Both functions previously called load_manifest_at_ref(), which ran git show <ref>:ci/forge-lanes.toml and parsed the TOML. Now they simply return Ok(ci_manifest::compiled_forge_ci_manifest()). The _forge_repo and _head_sha parameters are prefixed with underscores since they are no longer used, but the function signatures are kept to avoid cascading call-site changes.
The private load_manifest_at_ref() function is deleted entirely.
In forge.rs, the read_file_at_ref() helper (which ran git show <ref>:<path>) is removed since it was only used by the manifest loading code path. Other forge functions like changed_paths() and merge_branch() remain untouched.
This eliminates a class of CI failures where a branch could introduce a syntactically invalid TOML manifest and cause the forge to record a failed suite before any lane even ran.
Update the poller to use compiled lanes and rewrite integration tests
Intent: Adapt the branch-push polling logic and its integration tests to work with the compiled manifest instead of per-branch TOML files.
The poller's poll_once_limited_with_updates() function stores the CI entrypoint path with each branch record and checks whether the lane definition file itself was among the changed paths (to trigger all lanes). Both references are updated from FORGE_LANE_MANIFEST_PATH to FORGE_LANE_DEFINITION_PATH.
The test suite is substantially rewritten:
branch_push_queues_lanes_from_branch_head_manifest → branch_push_queues_compiled_lanes_for_changed_paths: The old test created a seed repo with a custom TOML manifest on the branch and verified that the branch's manifest was used (not master's). The new test creates a branch that touches rust/src/lib.rs and verifies the compiled manifest's path-based selection produces the expected lanes (pika_rust, pika_followup, pikachat, apple_host_sanity). It no longer writes any manifest file.
invalid_branch_manifest_records_failed_suite_for_head → branch_push_of_lane_definition_file_queues_all_branch_lanes: The old test verified that a broken TOML manifest on a branch resulted in a failed suite. Since broken manifests are impossible with compiled code, the new test verifies that pushing a change to FORGE_LANE_DEFINITION_PATH itself triggers all branch lanes (the self-referential glob behavior).
Update path string literals across stores and web server
Intent: Replace all hardcoded 'ci/forge-lanes.toml' string references with the new path 'crates/pikaci/src/forge_lanes.rs' in database operations and server logging.
ci_store.rs: Two SQL INSERT statements that record the CI entrypoint path in branch_ci_runs rows are updated. One handles the normal lane-queuing path, the other handles the failed-suite-insertion path.
mirror_store.rs: The ensure_repo_metadata call that bootstraps forge repo records is updated.
branch_store.rs: Eight test call sites that pass the CI entrypoint path to ensure_repo_metadata are updated. These are spread across branch listing, pagination, and feed tests.
web.rs: The server startup log line that reports the lane manifest path now references the FORGE_LANE_DEFINITION_PATH constant instead of the old FORGE_LANE_MANIFEST_PATH.
Update CI test fixtures across ci.rs and web test suites
Intent: Align all CI integration test seed repositories and assertions with the new lane definition path and compiled manifest semantics.
is updated. This covers the nightly scheduling test, parallel cap test, unbounded lanes test, heartbeat test, nightly priority test, and several others.
The web test suites (api.rs, live.rs, render.rs) have similar mechanical updates in their ensure_repo_metadata calls, changing the CI entrypoint string from the old TOML path to the new Rust source path. These tests construct ForgeLane structs directly and don't parse TOML, so only the metadata path string changes.
Add forge-manifest CLI subcommand and update pikaci main
Intent: Expose the compiled target catalog as a JSON manifest via a new pikaci CLI subcommand, enabling orchestration tooling to discover Incus base images from the same source of truth.
A new forge_manifest.rs module provides ForgeManifest::from_catalog(), which iterates over all PikaStagedLinuxTarget variants and produces a serializable struct containing each target's name and Incus base image.
The main.rs CLI gains a forge-manifest subcommand that prints this manifest as pretty-printed JSON. This allows external orchestration tools (e.g., Incus container provisioning) to query pikaci for the authoritative target-to-image mapping without duplicating the catalog.
The existing targets.rs module and its Targets subcommand remain for backward compatibility, providing a similar JSON output.
Update documentation and add structural invariants
Intent: Ensure all documentation references point to the new lane definition location and add invariant guardrails that prevent the file structure from silently drifting.
@@ -34,7 +34,7 @@ (README.md) -- `ci/forge-lanes.toml`: checked-in source of truth
+- `crates/pikaci/src/forge_lanes.rs`: checked-in source of truth
@@ -48,7 +48,7 @@ (README.md) -- Branch-push pre-merge CI is now orchestrated by the forge from `ci/forge-lanes.toml`.
+- Branch-push pre-merge CI is now orchestrated by the forge from `crates/pikaci/src/forge_lanes.rs`.
@@ +1,30 @@ (invariants.toml) +[[invariants]]
+id = "forge-lane-definitions"
+description = "Forge CI lane definitions live in pikaci as compiled Rust code"
+required_files = ["crates/pikaci/src/forge_lanes.rs"]
Documentation updates:
crates/pika-git/README.md: Two references to ci/forge-lanes.toml as the "source of truth" are updated to point to crates/pikaci/src/forge_lanes.rs.
docs/agent-ci.md: Notes that lane definitions are now compiled Rust code (previously TOML) and points to compiled_forge_ci_manifest() as the authoritative function.
docs/rmp-ci.md: States that the rmp branch lane is defined in the new location.
docs/compatibility-testing-spec.md: Clarifies that lanes are compiled Rust, not TOML.
Structural invariants:
invariants/invariants.toml defines three invariant entries:
forge-lane-definitions: requires crates/pikaci/src/forge_lanes.rs to exist.
forge-ci-orchestration: requires ci.rs, ci_manifest.rs, and poller.rs to exist.
pikaci-staged-linux-targets: requires targets.rs and forge_manifest.rs to exist.
crates/pikahut/tests/guardrails.rs contains a test that parses invariants.toml and verifies every required_files entry exists on disk, preventing the invariants from silently going stale if files are moved or deleted.