Skip to content

refactor: isolate build identity and final-result snapshot retention - #769

Merged
yyjeqhc merged 3 commits into
mainfrom
refactor/build-identity-snapshot-retention
Sep 29, 2026
Merged

yyjeqhc merged 3 commits into
mainfrom
refactor/build-identity-snapshot-retention

Conversation

@Xiiiing

@Xiiiing Xiiiing commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Current PR base: 399fa74420f01aaaee2b7a11e3f78ff0f82527ff (latest main when this review pass started). The original build-invalidation experiment was developed from the earlier 9877de8e audit baseline; the branch is now cleanly based on current main.

Three independently reviewable commits:

  1. dfa56505 — isolate checkout-dependent build identity from core. Move the existing collector from webcodex-core/build.rs to a small webcodex-build-info provider, consumed only by Server, Runner, CLI and Desktop composition. Core retains stable metadata types and pure formatting. Update all consumers, both lockfiles and workspace boundary policy. No new external dependency, duplicated collector, mutable global initialization or runtime Git lookup.
  2. eceb292a — isolate live inspection and sealed result retention. Keep the existing shared snapshot registry, authorization and diff producer, but use explicit internal retention classes. Live browsing can no longer consume the quota of sealed Final Changes.
  3. 55c735da — review documentation follow-up. Add standing canonical tool naming/model-surface guidance to docs/agent/tool-contract-guidelines.md: names describe operations rather than Direct/Gateway policy; naming verbs and gateway suffixes are constrained; category/semantics/model-surface policy stay separate; Direct exposure reasons use the CoreWorkflow / HostIntegration / Presentation / Continuation / Gateway design vocabulary without creating a second taxonomy.

Measured build invalidation

Same local command before/after: cargo check --locked --offline -p webcodex -p webcodex-runner -p webcodex-cli --message-format=json. Each revision has a warm run, identical repeat, then a child-only synthetic commit override with unchanged source/ref state. Count unique workspace packages with any non-fresh compiler artifact.

Case Baseline Candidate
Identical repeat: rechecked packages 0 0
Identical repeat: observed seconds 0.420 0.388
Identity-only change: rechecked packages 15 4
Identity-only change: observed seconds 12.406 6.239

Only webcodex-build-info, webcodex, webcodex-runner, and webcodex-cli change in the candidate identity-only phase; core/domain artifacts remain fresh. These are single local check observations, not controlled multi-run performance or release/link-time claims. Warm/migration runs are not compared as speed evidence. No artifacts with the synthetic identity were deployed.

Preserved boundaries

  • Keep tracked dirty truth, packed-ref/no-reflog handling, worktree-specific identity with shared target directories, archive unknown state, and existing release/environment override precedence.
  • Preserve --version, --build-info-json, runtime/desktop metadata and protocol generation. Internal Rust capture moves to the provider; public wire fields remain unchanged.
  • Sealed snapshots keep 32 per process / 8 per caller. Live inspection gets 8 per process / 2 per caller. Combined hard cap: 40. Eviction operates only within the same class.
  • Existing 24-hour maximum age and replay-without-TTL-extension remain. This is not guaranteed retention under same-class capacity pressure, nor persistence across Server restarts.
  • No MCP tool/schema/direct inventory or App resource URI change; no Host schema refresh is required for this PR.
  • The naming guidance is documentation-only; it does not re-rank, rename, admit, demote, or remove any current tool.

Review follow-up

Independent review of the current origin/main..55c735da range found no production-code blocker in the build-identity split or snapshot-retention isolation.

The review specifically checked:

  • linked-worktree/shared-target identity and tracked dirty-state behavior;
  • provider dependency direction and the stable core build metadata contract;
  • caller/Project/Session authority around frozen snapshots;
  • class-local eviction, per-caller/process bounds, TTL and replay behavior;
  • that live snapshots cannot consume sealed Final Changes retention.

No Rust review-fix commit was needed. The only branch change from this review is the naming/surface design guidance above. The PR description was also updated because its previous commit/final-tree SHAs referred to a pre-rebase branch state.

Validation

Current final HEAD: 55c735daa520c1d02dee9fbc5d12343e3e36462f.

Existing branch validation:

  • Actual-repository before/after composition check experiment: all phases pass; candidate asserts the four-package invalidation boundary.
  • Core build metadata formatting: 1 test passes.
  • Core Desktop/runtime contract: 6 tests pass.
  • Work Result regressions: 35 tests pass, including real Git snapshot/file paging and authority checks.
  • CARGO_BUILD_JOBS=4 cargo check --locked --offline --manifest-path apps/desktop/src-tauri/Cargo.toml --lib: Linux Desktop consumer compiles. It emits 30 warnings in existing Desktop code; this PR does not claim a warning-free Desktop build.
  • cargo fmt --all --check and existing branch git diff --check passed.

Independent review rerun:

  • python3 -B -m unittest scripts.tests.test_build_identity -v: 5 passed.
  • cargo test -p webcodex-build-info: 2 passed.
  • cargo test -p webcodex --lib tool_runtime::changes::tests: 10 passed.
  • bash scripts/workspace_boundary_check.sh: all 21 packages pass.
  • final documentation git diff --check: passed.

No complete root/workspace suite or native Windows/macOS execution was run locally in this review pass; GitHub CI remains independent validation. No deployment, service restart, release or merge was performed.

Details: docs/implementation/build-identity-isolation.md, the retention section of docs/agent/ui-progressive-loading.md, and the canonical naming/model-surface section in docs/agent/tool-contract-guidelines.md.

@yyjeqhc
yyjeqhc force-pushed the refactor/build-identity-snapshot-retention branch from 27b8c6a to eceb292 Compare September 29, 2026 01:40
@yyjeqhc
yyjeqhc merged commit 58bfc0b into main Sep 29, 2026
13 checks passed
@yyjeqhc
yyjeqhc deleted the refactor/build-identity-snapshot-retention branch September 29, 2026 01:52
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.

2 participants