Define durable index identity and catalog #21

Merged
JayKobe6k merged 2 commits from issue-4-index-catalog into main 2026-09-04 00:49:46 +00:00
Owner

Summary

  • add typed project, index, revision, schema, Git-origin, and resolved-index identities
  • persist immutable catalog revisions under the platform cache with bounded, atomic, cross-process-safe publication
  • resolve directory, Git, name, and explicit database selectors deterministically with structured ambiguity candidates
  • document collision, rename, stale-entry, schema-version, and multiple-worktree behavior

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

Closes #4

## Summary - add typed project, index, revision, schema, Git-origin, and resolved-index identities - persist immutable catalog revisions under the platform cache with bounded, atomic, cross-process-safe publication - resolve directory, Git, name, and explicit database selectors deterministically with structured ambiguity candidates - document collision, rename, stale-entry, schema-version, and multiple-worktree behavior ## 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` Closes #4
Define durable index catalog and selectors
All checks were successful
Validate / Formatting, linting, and tests (push) Successful in 1m40s
Validate / Formatting, linting, and tests (pull_request) Successful in 1m44s
724df2e62b
JayKobe6k left a comment

Found three actionable issues in catalog persistence and project identity handling.

Found three actionable issues in catalog persistence and project identity handling.
@ -0,0 +117,4 @@
return Err(GitOriginError::CredentialsNotAllowed);
}
if !url.username().is_empty() {
url.set_username("").map_err(|()| GitOriginError::Invalid {
Author
Owner

[P1] SSH URL normalization drops the username even though this normalized origin is the only stored fetch location. A valid remote such as ssh://deploy@example.com/repo.git is persisted as ssh://example.com/repo, so reopening the project can authenticate as the wrong account and fail. Please preserve the user information needed to reproduce the fetch URL while keeping identity normalization deterministic.

[P1] SSH URL normalization drops the username even though this normalized origin is the only stored fetch location. A valid remote such as `ssh://deploy@example.com/repo.git` is persisted as `ssh://example.com/repo`, so reopening the project can authenticate as the wrong account and fail. Please preserve the user information needed to reproduce the fetch URL while keeping identity normalization deterministic.
@ -0,0 +972,4 @@
.load()?
.indexes()
.iter()
.any(|existing| existing.id() == index.id())
Author
Owner

[P1] Registration checks only for an existing index ID; it does not reject a different index that reuses the same database_path. Because later lookup opens the database through this mapping, two catalog entries can alias one store and silently expose or overwrite each other's index. Please enforce database-path uniqueness and return a typed conflict before publishing the catalog.

[P1] Registration checks only for an existing index ID; it does not reject a different index that reuses the same `database_path`. Because later lookup opens the database through this mapping, two catalog entries can alias one store and silently expose or overwrite each other's index. Please enforce database-path uniqueness and return a typed conflict before publishing the catalog.
src/index/mod.rs Outdated
@ -0,0 +1126,4 @@
detail: source.to_string(),
});
}
sync_catalog_directory(&self.directory)
Author
Owner

[P1] Once hard_link succeeds, the new catalog file is already visible, but a subsequent directory-sync failure is returned as if the save had not committed. A caller that cleans up the newly built database after this error leaves the durable catalog pointing at missing data, while a retry can also observe the supposedly failed write. Please treat publication as a commit point and surface post-commit durability status separately, or use a protocol that can roll back safely.

[P1] Once `hard_link` succeeds, the new catalog file is already visible, but a subsequent directory-sync failure is returned as if the save had not committed. A caller that cleans up the newly built database after this error leaves the durable catalog pointing at missing data, while a retry can also observe the supposedly failed write. Please treat publication as a commit point and surface post-commit durability status separately, or use a protocol that can roll back safely.
Fix catalog publication invariants
All checks were successful
Validate / Formatting, linting, and tests (push) Successful in 2m3s
Validate / Formatting, linting, and tests (pull_request) Successful in 1m53s
374e5f9d38
Author
Owner

Review comment #925: Fixed in 374e5f9. Registration and activation now reject typed duplicate database-path conflicts across every index and historical revision; catalog construction enforces the same invariant. Validation: focused historical-revision regression and the complete 54-test suite plus zlib E2E passed.

Review comment #925: Fixed in 374e5f9. Registration and activation now reject typed duplicate database-path conflicts across every index and historical revision; catalog construction enforces the same invariant. Validation: focused historical-revision regression and the complete 54-test suite plus zlib E2E passed.
Author
Owner

Review comment #921: Fixed in 374e5f9. Post-hard-link directory-sync failure now returns a committed-but-durability-unconfirmed publication status rather than an uncommitted error; a deterministic injected-sync regression verifies the entry remains visible. Validation: full formatting, lint, 54 unit tests plus zlib E2E, and rustdoc passed.

Review comment #921: Fixed in 374e5f9. Post-hard-link directory-sync failure now returns a committed-but-durability-unconfirmed publication status rather than an uncommitted error; a deterministic injected-sync regression verifies the entry remains visible. Validation: full formatting, lint, 54 unit tests plus zlib E2E, and rustdoc passed.
Author
Owner

Review comment #923: Fixed in 374e5f9. GitProjectSource now carries an exact GitFetchLocation separately from normalized GitOrigin, preserving SSH usernames without making credentials part of project identity; regression coverage checks both values. Validation: full formatting, lint, all-target/all-feature tests, and rustdoc passed.

Review comment #923: Fixed in 374e5f9. `GitProjectSource` now carries an exact `GitFetchLocation` separately from normalized `GitOrigin`, preserving SSH usernames without making credentials part of project identity; regression coverage checks both values. Validation: full formatting, lint, all-target/all-feature tests, and rustdoc passed.
JayKobe6k changed target branch from issue-3-cli-contract to main 2026-09-04 00:49:45 +00:00
Sign in to join this conversation.
No description provided.