Resolve project sources and C compilation plans #23

Merged
JayKobe6k merged 2 commits from issue-6-project-sources into main 2026-09-04 00:50:05 +00:00
Owner

Summary

  • resolve canonical local projects and acquire normalized Git sources into locked managed checkouts with refresh/reuse policies
  • load or generate typed compilation databases with deterministic path normalization, ordering, deduplication, and SHA-256 fingerprints
  • preserve executable, arguments, output, source identity, environment overrides, and resolved Git provenance without shell interpolation
  • migrate Ladybug command metadata to schema v2 and add CLI translation, policy documentation, and local-only Git integration coverage

Tests

  • nix develop --command cargo fmt --all -- --check
  • nix develop --command cargo lint
  • nix develop --command cargo test --all-targets --all-features
  • nix develop --command cargo doc --no-deps --all-features
  • nix develop --command cargo check --target x86_64-pc-windows-gnu --all-targets --all-features
  • nix develop --command nixfmt --check flake.nix
  • nix flake check

Closes #6

## Summary - resolve canonical local projects and acquire normalized Git sources into locked managed checkouts with refresh/reuse policies - load or generate typed compilation databases with deterministic path normalization, ordering, deduplication, and SHA-256 fingerprints - preserve executable, arguments, output, source identity, environment overrides, and resolved Git provenance without shell interpolation - migrate Ladybug command metadata to schema v2 and add CLI translation, policy documentation, and local-only Git integration coverage ## Tests - `nix develop --command cargo fmt --all -- --check` - `nix develop --command cargo lint` - `nix develop --command cargo test --all-targets --all-features` - `nix develop --command cargo doc --no-deps --all-features` - `nix develop --command cargo check --target x86_64-pc-windows-gnu --all-targets --all-features` - `nix develop --command nixfmt --check flake.nix` - `nix flake check` Closes #6
Resolve project sources and compilation plans
All checks were successful
Validate / Formatting, linting, and tests (push) Successful in 2m33s
Validate / Formatting, linting, and tests (pull_request) Successful in 2m32s
4e9b4a0622
JayKobe6k left a comment

Found three actionable issues in source checkout and environment handling.

Found three actionable issues in source checkout and environment handling.
src/cli/mod.rs Outdated
@ -99,0 +153,4 @@
#[arg(long, requires = "build_program")]
build_cwd: Option<PathBuf>,
/// Set a portable ASCII build variable as NAME=VALUE; repeatable.
#[arg(long, requires = "build_program", value_parser = parse_environment_set)]
Author
Owner

[P2] This &str value parser requires every --build-env-set argument to be valid Unicode, while the documented compilation contract says environment values retain arbitrary native encoding and the domain model uses OsString. A non-UTF-8 value is therefore rejected before it can reach the lossless model. Please parse this option from OsStr and preserve the value as OsString, or narrow the documented contract explicitly.

[P2] This `&str` value parser requires every `--build-env-set` argument to be valid Unicode, while the documented compilation contract says environment values retain arbitrary native encoding and the domain model uses `OsString`. A non-UTF-8 value is therefore rejected before it can reach the lossless model. Please parse this option from `OsStr` and preserve the value as `OsString`, or narrow the documented contract explicitly.
@ -0,0 +116,4 @@
} else {
self.clone_checkout(&cache_root, &checkout, source)
};
let unlock_result = FileExt::unlock(&lock).map_err(|error| ProjectSourceError::Cache {
Author
Owner

[P1] Every request for an origin mutates the same cached checkout, but the per-origin lock is released as soon as prepare() returns. Concurrent indexing jobs can then replace the checkout revision while an earlier job is still reading it, producing a compilation plan and indexed facts from mixed revisions. Please keep a lease/lock alive for the full consumer operation or materialize immutable revision-specific worktrees.

[P1] Every request for an origin mutates the same cached checkout, but the per-origin lock is released as soon as `prepare()` returns. Concurrent indexing jobs can then replace the checkout revision while an earlier job is still reading it, producing a compilation plan and indexed facts from mixed revisions. Please keep a lease/lock alive for the full consumer operation or materialize immutable revision-specific worktrees.
@ -0,0 +202,4 @@
[
OsString::from("fetch"),
OsString::from("--prune"),
OsString::from("--tags"),
Author
Owner

[P2] git fetch --prune --tags prunes remote-tracking branches but does not delete local tags removed from the remote. A deleted tag can therefore continue to resolve from this cache indefinitely, causing refreshes to index an obsolete revision. Please explicitly synchronize/prune tags against the remote before resolving a tag reference.

[P2] `git fetch --prune --tags` prunes remote-tracking branches but does not delete local tags removed from the remote. A deleted tag can therefore continue to resolve from this cache indefinitely, causing refreshes to index an obsolete revision. Please explicitly synchronize/prune tags against the remote before resolving a tag reference.
Merge branch 'issue-5-ladybug-adapter' into issue-6-project-sources
All checks were successful
Validate / Formatting, linting, and tests (push) Successful in 2m34s
Validate / Formatting, linting, and tests (pull_request) Successful in 2m6s
99c0702284
# Conflicts:
#	src/application/mod.rs
#	src/cli/mod.rs
#	src/persistence/ladybug.rs
#	tests/ladybug_repository.rs
Author
Owner

Review comment #927: Fixed in 99c0702. ProjectSourcePort now returns an owned lease, and managed Git leases retain the exclusive checkout lock through application planning, parsing, analysis, persistence, and activation. Integration coverage proves contention while leased and release on drop. Full tests and the Windows GNU cross-check passed.

Review comment #927: Fixed in 99c0702. `ProjectSourcePort` now returns an owned lease, and managed Git leases retain the exclusive checkout lock through application planning, parsing, analysis, persistence, and activation. Integration coverage proves contention while leased and release on drop. Full tests and the Windows GNU cross-check passed.
Author
Owner

Review comment #928: Fixed in 99c0702. Refresh now uses git fetch --prune --prune-tags origin; the local bare-repository regression deletes a remote tag and verifies it no longer resolves. nix develop --command cargo test --test project_sources and the complete all-target/all-feature suite passed.

Review comment #928: Fixed in 99c0702. Refresh now uses `git fetch --prune --prune-tags origin`; the local bare-repository regression deletes a remote tag and verifies it no longer resolves. `nix develop --command cargo test --test project_sources` and the complete all-target/all-feature suite passed.
Author
Owner

Review comment #930: Fixed in 99c0702. --build-env-set now uses an OsStr typed parser with lossless Unix-byte and Windows-wide splitting at the first =, preserving native values as OsString. CLI boundary coverage and the Windows GNU all-target/all-feature check passed.

Review comment #930: Fixed in 99c0702. `--build-env-set` now uses an `OsStr` typed parser with lossless Unix-byte and Windows-wide splitting at the first `=`, preserving native values as `OsString`. CLI boundary coverage and the Windows GNU all-target/all-feature check passed.
JayKobe6k changed target branch from issue-5-ladybug-adapter to main 2026-09-04 00:50:04 +00:00
Sign in to join this conversation.
No description provided.