Skip to content

feat: indices E2E integration - auto-clone, install routing, workspace inheritance#41

Merged
Sunrisepeak merged 1 commit into
mainfrom
feat/indices-e2e-integration
May 15, 2026
Merged

feat: indices E2E integration - auto-clone, install routing, workspace inheritance#41
Sunrisepeak merged 1 commit into
mainfrom
feat/indices-e2e-integration

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

Closes the 6 gaps that prevented the [indices] feature from being end-to-end usable.

Builds on #39 (IndexSpec + parsing) and #40 (lockfile v2 + CLI + routing scaffolding).

Gaps fixed

# Gap Fix
1 First build doesn't auto-clone index prepare_build checks if .mcpp/data/ has index repos; if empty, calls xlings::update_index(projEnv) before dep resolution
2 Custom index package install not wired loadVersionDep uses project-level xlings env (XLINGS_PROJECT_DIR) for install, formats target as indexName:shortName@version
3 Local path index can't install packages Clarified: local PATH index is for discovery only; artifacts come from URLs in xpkg.lua, installed via normal global flow
4 Workspace doesn't inherit [indices] Added indices inheritance in both workspace paths (from-root and from-member), matching toolchain/targetOverrides pattern
5 Lockfile writes placeholder hashes Replaced "sha:<from-xlings>" with "index+<ns>@<version>" source and "fnv1a:<hash>" deterministic hash
6 Lock skip not wired for custom indices Verified: existing install_path + install_path_from_project_data checks already skip re-download. No code change needed

Changes

File Lines What
src/cli.cppm +107/-16 All 6 gap fixes in prepare_build and loadVersionDep
tests/e2e/44_indices_e2e_integration.sh +174 (new) 5-part E2E: local index visibility, workspace inheritance, pin/unpin, lockfile hash format, persistence

End-to-end flow (after all 3 PRs)

mcpp.toml:
  [indices]
  acme = "[email protected]:platform/index.git"
  local = { path = "my-packages" }
  
  [dependencies.acme]
  internal-lib = "2.0.0"

mcpp build:
  1. Parse [indices] → IndexSpec map                          (PR #39)
  2. Create .mcpp/.xlings.json with acme entry                (PR #39)
  3. Auto-clone: xlings update with XLINGS_PROJECT_DIR        (this PR)
  4. Resolve deps: route acme→.mcpp/data/, local→path/pkgs/   (PR #40 + this PR)
  5. Install: xlings install with project env → .mcpp/data/xpkgs/  (this PR)
  6. Build with resolved deps                                  (unchanged)
  7. Write lockfile v2 with indices + namespace + hash          (PR #40 + this PR)

Test plan

  • mcpp build compiles successfully
  • E2E 44_indices_e2e_integration.sh passes (5 tests)
  • E2E 42_custom_local_index.sh passes (no regression)
  • E2E 43_indices_lockfile.sh passes (no regression)
  • E2E 01_help_and_version.sh passes (no regression)

@Sunrisepeak Sunrisepeak force-pushed the feat/indices-lockfile-routing branch from 9a2d372 to 2e91734 Compare May 15, 2026 21:24
@Sunrisepeak Sunrisepeak force-pushed the feat/indices-e2e-integration branch from 2fe10e4 to 0dec526 Compare May 15, 2026 21:25
@Sunrisepeak Sunrisepeak changed the base branch from feat/indices-lockfile-routing to main May 15, 2026 21:25
…e inheritance

Fix 6 gaps that prevented end-to-end usability of the [indices] feature:

1. Auto-clone custom git indices on first build: after ensure_project_index_dir()
   seeds .mcpp/.xlings.json, check if .mcpp/data/ is empty and trigger
   xlings update to actually clone the repos before dependency resolution.

2. Custom git index install routing: use project-level xlings env
   (XLINGS_PROJECT_DIR) when installing packages from custom git indices,
   so they land in .mcpp/data/xpkgs/ and the custom index clone is visible.

3. Local path index install flow: remove the dead-end fall-through for local
   path indices. Local indices are for DISCOVERY only (finding xpkg.lua);
   actual artifacts come from URLs in the lua via normal install flow.

4. Workspace [indices] inheritance: members without their own [indices]
   section now inherit from the workspace root, matching the existing
   pattern for toolchain and target overrides.

5. Deterministic lockfile hashes: replace placeholder "sha:<from-xlings>"
   with fnv1a hash of namespace:name@version. Honest about what we have.

6. Lock skip for custom indices: verified that the existing install_path
   check already prevents re-download on subsequent builds when packages
   are installed, so no additional wiring needed.
@Sunrisepeak Sunrisepeak force-pushed the feat/indices-e2e-integration branch from 0dec526 to 046811b Compare May 15, 2026 21:42
@Sunrisepeak Sunrisepeak merged commit 128be31 into main May 15, 2026
1 check passed
@Sunrisepeak Sunrisepeak mentioned this pull request May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant