Repository navigation
perf(code-index): reuse staged read and durability handles - #4792
ScriptedAlchemy wants to merge 22 commits into
Conversation
|
|
#4533 owner / sweep coordination (partial PR, |
|
#4533 owner / maintenance coordination — repair published at 262e340 on this existing PR, using an expected-head, non-force update from concurrent formatting head 21827ea. No duplicate PR, merge, or issue closure. The repair retains original metadata for each pinned staged file and compares both path and descriptor against it before and after reads. It clears failed output even for cold/pre-open and aborted-reader failures, drops cached descriptors on poison, and evicts before opening to keep the eight-handle bound. The moved-PathBuf regression error is corrected in the rehomed test. The dedicated test module preserves prior open-count/range/replacement assertions and adds true interleaving, same-inode mutation, byte-restoration/commit refusal, cold refusals and escaped-reader cleanup using the real writer/reader. Validation blocker remains: no passing Rust or formatting result is claimed. Current CI: https://github.com/ScriptedAlchemy/tracedecay/actions/runs/42435471813 . Change-scope execution has started; Repository gates, Clippy and Test Linux (fleet) are queued. Test macOS is skipped, not passed. Native coverage needs the existing workflow_dispatch; the available connector exposes reads/reruns but no dispatch action, and local Bazel is absent. The PR body records exact focused Bazel commands and native inputs. No Cargo/direct Rust invocation, infrastructure edit or external delegation was used. The old PR-body statement that replacement returns new bytes after eleven opens was incorrect and is removed: replacement must refuse with the count still ten. These counts remain regression assertions, not executed measurements. Do not merge/auto-merge on green summary gates alone. Obtain nonzero regression and broader correctness results, relevant native checks, and independent review. This author repair/review is not independent approval. The full packed-storage and large-repository endpoint-security acceptance remains unfinished; keep #4533 open. #4796 continues to own the separate graph-pass work. No release or Kev/decision-model changes. |
Keep the concurrent formatting commit in the branch history. Rehome and extend its production-reader regression to cover in-place mutation, transaction poisoning, failed reads, and escaped-reader cleanup. Refs #4533
Keep the first-open file identity for the preparation even after its bounded read cache evicts the descriptor. Refuse a replaced pathname before another open, including across the cache's eviction boundary. Prove the refusal with a real nine-segment regression. Refs #4533
Exercise a real staged generation's whole and repeated range reads, verify the content digest and exact bytes, then publish and cold-decode its durable snapshot without changing the production storage format. Refs #4533
|
#4533 owner review update — published, still NO MERGE: Exact-head, non-force commits |
Quote the pathname API in documentation and retain exact empty-buffer regressions using equality assertions required by the pinned Clippy policy. Refs #4533
|
#4533 owner repair published — do not merge yet. Reviewed the latest hosted Bazel run at previous head |
|
#4533 owner — production fix published at 3286852 on this PR. Appended with Changed Added seven real-filesystem regressions in Verified generated targets: Validation remains a merge blocker. Hosted run https://github.com/ScriptedAlchemy/tracedecay/actions/runs/42442181017 is queued; its native macOS job is skipped, not passed. No passing Rust/rustfmt/Clippy result is claimed for this head. Local Bazel is absent and checkout network resolution fails; the connector has no workflow-dispatch action. No Cargo/direct Rust execution, external delegation, or infrastructure changes were used. This removes a redundant Linux durability reopen path, not O(segments) file creation/verification. Early-flush wall time and added O(segments) metadata still require measurement. Keep #4533 open and the no-merge/auto-merge hold until nonzero Bazel results, broader correctness/native checks, independent review, and full issue acceptance are established. No release or Kev/decision-model work. |
Reuse duplicated writer descriptors for Linux durability windows instead of reopening every segment. Preserve concurrent member fsyncs and refuse missing, replaced, or mutated members, including earlier flushed windows. Add kernel-observed open-count, barrier, ownership, and failure regressions. Refs #4533
|
Published the direct GitHub source repair at 4d0ad18, appended with The full-cache bug is fixed in source: validate request ranges/addressability and named extents before evicting or promoting staged read handles. Carry the admitted pathname metadata into the verified opener instead of repeating the pre-open stat. Original identity, post-open/post-read checks, poisoning and the eight-handle bound remain. Actual OS open failures after admission may still require an eviction; malformed/pre-open-refused requests do not. Added Validation is pending, not passed. Latest exact-head CI: https://github.com/ScriptedAlchemy/tracedecay/actions/runs/42443415493 . Last inspection: run queued, Test macOS skipped. There is no local Bazel checkout/tool, and this connector has workflow inspection/reruns but no native workflow dispatch. No Cargo or direct Rust compiler/formatter was invoked. The final diff was reviewed, but that is not execution or independent approval. The PR description now records this fix alongside the preserved durability work. Existing sweeps must keep the no-merge/auto-merge hold until nonzero Bazel regressions, applicable broader/native checks and independent review are established. Keep #4533 open: packed generation storage, the full open-count audit and endpoint-scanned large-repository acceptance remain incomplete. #4796 graph ownership is unchanged. Refs #4533. |
Validate ranges and named extents before changing staged-reader LRU state. Reuse admitted metadata across the open, retaining replacement checks. Add a real full-cache regression for cold refusals and eviction order. Refs #4533
Apply the exact rustfmt change reported by hosted Repository gates to the same-inode durability regression without changing its assertions. Refs #4533
|
#4533 owner — hosted gate repaired on the existing PR (no merge). At |
Publish missing canonical names with atomic no-replace semantics. If another publisher wins, verify byte identity before deduplicating and preserve any conflicting immutable content. Exercise the production path for conflicting, identical and absent destinations. Refs #4533
On Unix use the directory device/inode identity directly when preparing and validating a publication. Preserve existing Windows handle identity checks and reject substituted directories before commit. Add a real prepared publication regression for changed and restored directory identities. Refs #4533
|
Refs #4533 — direct engineering on existing PR #4792, no duplicate branch/PR. Two expected-head, nonforce commits published:
Source-level delta: 6 directory opens -> 0 for that prepare/commit identity route; still no measured macOS endpoint-security wall time or full O(segments) first-open reduction. Both tests are published but not yet executed. Latest exact-head hosted CI: https://github.com/ScriptedAlchemy/tracedecay/actions/runs/42449904068 (pending when inspected); native macOS is skipped by the default run. Independent review and nonzero Bazel results remain missing. No Cargo, Kody/Copilot, infrastructure, protected release #4763, or Kev work. Maintenance sweeps: do not merge/auto-merge #4792 solely because summary CI turns green. Issue #4533 remains open until the packed/offset storage cutover or equivalent verified first-open reduction, full audit, cold snapshot/restore/corruption/retention proof, native validation and same-repository endpoint-scanned measurements land on master. PR #4796 owns related graph-pass work; avoid overlapping it. |
Refuse late concurrent generation-name collisions without replacing the competing immutable file, while deduplicating identical content. Hash the fsynced manifest using its existing writer handle instead of reopening its pathname, and assert the readback matches serialized bytes. Exercise real named temporary collision, dedupe and successful publication. Refs #4533
|
Refs #4533 — two commits published to existing PR #4792: Not yet validated: Hosted CI https://github.com/ScriptedAlchemy/tracedecay/actions/runs/42453075773 is queued for |
Reuse the canonical no-replace rename for both staged segments and sealed generations. Close the named temporary handle before renaming, avoiding a possible hard-link residue from tempfile no-clobber persistence and keeping the same byte-exact collision/deduplication contract on every platform. Refs #4533
Apply exact hosted Rust 2024 formatting diagnostics to reader identity checks and publication regressions. Preserve all assertions. Refs #4533
Clear stale output on pre-I/O refusal and recheck cancellation and request deadlines after endpoint-scanned segment I/O. Assert exact bytes on success and typed pre/post-I/O failures on a real generation. Refs #4533
|
#4533 owner update — published |
Refs #4533
Scope: reduce redundant opens, not issue completion
This PR addresses two production reopen paths. It does not complete the packed-storage cutover: cold indexing still creates and verifies one immutable
segment-<sha256>.jsonper distinct segment. No large-repository endpoint-security improvement or full #4533 acceptance is claimed. Related graph-pass work remains in #4796.Staged reads (Unix/macOS)
The preparation reader retains an eight-entry handle LRU instead of reopening the same segment for every Whole/Range request. Actual staged
File::openattempts are counted immediately before the call. The original metadata identity is preserved across eviction and checked against the pathname and descriptor before/after reads. Detected replacement or mutation clears output, releases cached handles and permanently invalidates reads, writes and commit. Cold/pre-open and aborted-reader refusals also clear output. The separate sealed evidence-pack reader replaces its additional Unix pathname open with metadata rechecks; non-Unix handle-ID checking remains.Existing regression coverage includes exact overlapping/interleaved ranges, counters 1/2/9/10, bounded eviction, pathname replacement before/after eviction, same-inode mutation, refusal after restoring bytes, poisoned commit rejection, cleanup with escaped readers, and a real generation committed and cold-reloaded with the same snapshot identity. The intended sixteen-reads/one-open assertion is not an executed measurement. Replacement is refused without another open, not silently reread.
Rejected-read cache admission —
4d0ad18d0d8cba52a24e29c31536dbe73ae51b5eThe follow-up review found that cold invalid ranges, wrong-size requests and missing files evicted a valid handle from a full cache before being rejected. Invalid cache-hit requests also promoted recency before validation, changing the next eviction victim and causing extra opens on later valid reads.
The reader now validates range arithmetic/addressability and the requested extent before changing LRU state. Cold path metadata is admitted before eviction and passed into the verified opener, avoiding the duplicate pre-open stat on previously observed paths. The descriptor bound, original-identity checks across opening, and post-read validation remain intact. A real OS open failure after admission can still require dropping an old descriptor to respect the bound; this repair specifically prevents pre-open request/path refusals from disturbing valid cached handles.
staged_segment_rejected_reads_preserve_full_cache_and_recencyfills all eight slots with real staged files, then rejects overflowing/out-of-bounds ranges, wrong sizes and a missing cold path. Each refusal must clear prefilled output, preserve all eight cached handles and leave actual open attempts at eight. Subsequent valid reads require exact bytes and counts 9/9/10, proving the correct LRU victim rather than merely asserting that invalid reads return errors. All five pre-existing staged-reader regressions are unchanged. These are assertions awaiting execution, not measured passing results.Linux durability batches —
32868523be33a85fb091feebc1d2b11c1b346143The direct production caller is
StagedGenerationSegmentsV1::publishin the code-index publication store. PreviouslyDurableFileBatch::syncreopened every recorded pathname throughsync_file_at, paying an additional open per segment and potentially flushing a substituted inode rather than the originally written file.Tradeoffs: Linux staging now performs bounded early flushes instead of deferring all barriers to the end. The batch owns at most 32 duplicated writer descriptors (in addition to the caller's handle), and retains O(segments) metadata. This is not O(1) generation storage. Wall-time and memory effects still require measurement; no budget or concurrency limit was increased.
New falsifiable durability regressions
crates/tracedecay-private-fs/src/framed_log_batch_tests.rsis wired into the existing unit-test source glob. Seven tests cover:IN_OPENevents across 67 real written files and multiple flush windows. A positive probe must first observe one actual open. The assertion then permits exactly the 67 writer opens and zero extra opens on a repeated sync, plus exact byte readback and the descriptor bound. This is designed to distinguish the former create+reopen path from descriptor reuse; it has not yet been run.test-helpers), so merely skipping flushes cannot satisfy the open-count test.The existing member-only and concurrent slow-fsync integration tests remain intact. These tests are not crash/power-loss proof or a substitute for the full index/snapshot/retention journey.
Hosted Bazel repair —
688f3a64a6ed5cdf7885b1a8ccced6fcd69c99b6At previous head
4d0ad18, Repository gates on run 42443415493 failed specifically at//crates/tracedecay-private-fs:rustfmt_check_2024: rustfmt demanded the one-lineFile::options().write(true).open(&path).expect("same inode")expression in the nonzero same-inode mutation regression. The exact source-formatting correction is now committed; no assertion or implementation behavior was changed in this follow-up.CI for
688f3a6is the required new-head evidence, not yet proved passing. Native macOS is skipped by the default workflow; independent review and nonzero focused Bazel Rust verification remain required. Do not merge or close #4533.Immutable publication and directory-open follow-ups —
70188c5,7184d12rename_noreplaceauthority. An identical concurrently published file is deduplicated by exact byte comparison; a conflicting name is refused without replacing either file. The production-path regression checks same-length differing bytes, identical collision and absent destination, including both paths' remaining contents.Handle::from_pathfor each of three directories twice per generation (six endpoint-authorized pathname opens in this source path). They now use directory device/inode metadata checks without opening those directories, preserving substitution refusal and keeping the Windows handle path unchanged. A real staged-publication test substitutes and restores the segments directory and asserts a fail-closed compare-and-swap refusal followed by acceptance of the original inode.Latest hosted CI: https://github.com/ScriptedAlchemy/tracedecay/actions/runs/42449904068 . New head
7184d12awaits Bazel nonzero test execution, formatting and independent review; default native macOS remains skipped. Do not merge or close #4533 on summary-green alone.Validation / no-merge hold
The cache-admission repair
4d0ad18was appended withforce=falseand expected head32868523be33a85fb091feebc1d2b11c1b346143, preserving both the concurrent durability work and earlier Clippy fixes. Its diff touches only the staged reader and appends one regression; durability source/tests are unchanged by this follow-up. No Cargo or direct Rust compiler/formatter invocation was used.No passing Rust or formatting result is claimed for the current
7184d12head. This environment has no Bazel checkout/tool and cannot resolve GitHub for a checkout. Hosted standard CI was triggered: https://github.com/ScriptedAlchemy/tracedecay/actions/runs/42449904068 . At the last inspection the run was queued and Test macOS was skipped, not passed. The connector exposes workflow inspection/reruns, but no dispatch action for native macOS/Windows.Bazel validation to inspect for actual nonzero results:
Verify target names against the current generated BUILD before execution. Also require applicable broader Bazel tests, Clippy, native platform coverage and independent review. The original Linux run reported a separate remote-execution
UNAVAILABLE: io exception; no infrastructure change or source claim is made for that failure.Do not merge/auto-merge based solely on summary greens. This author review is not independent approval. Keep #4533 open until all acceptance is proven on master: a proper packed-storage/offset-index cutover or equivalent first-open reduction, the broader daemon open-count audit, snapshot/read/corruption/retirement proofs, and before/after open counts and wall time on the same endpoint-scanned large repository.
No release, tag, production, credentials, infrastructure or Kev/decision-model changes.
Generation manifest publication correctness and open count —
df3986a,b3bc9ecReviewed the final immutable generation-manifest publication path. It still used
NamedTempFile::persistafter a missing-path probe, which can replace a generation filename installed by a concurrent writer. It also reopened the just-fsynced temporary by pathname to SHA-256 its bytes.rename_noreplacefilesystem authority, after closing the staging file handle. If another publisher wins, compare exact staged/canonical bytes: accept identical content and remove staging, or refuse conflicting content without overwriting the canonical file. The follow-upb3bc9ecreplaces the initialtempfile::persist_noclobberattempt because that API can leave an extra hard link after interrupted publication on some platforms; the existing canonical rename avoids this.File::open; assert that the result equals the original serialized manifest digest before publication. This removes one pathname open per attempted generation manifest from this code path, a source-level count, not a measured endpoint-security speedup.generation_manifest_publication_preserves_concurrent_canonical_bytes: real named-temp files, equal-length conflicting bytes, identical-content deduplication, fresh immutable publication, canonical byte preservation and staging cleanup. The existing real staged-generation commit/cold-reload regression remains, unweakened.Both commits were published to this same PR by exact-head, non-force updates from
7184d12anddf3986a. Bazel tests have not yet run successfully forb3bc9ec; latest hosted CI is run 42453075773, queued at inspection. Native macOS is not enabled in the default run; independent review is still absent. No Cargo, infrastructure, external delegation, releases or protected Kev changes. Do not merge/auto-merge or close #4533.The core #4533 work is still incomplete: packed/offset-based generation storage or equivalent O(1) first-open behavior, full daemon open-count audit, correctness/retention/restore proofs and before/after measurements on the same endpoint-scanned large repository are outstanding.
Refs #4533remains partial; #4796 owns the separate graph pass.Retained snapshot read interruption correctness —
1d021a5The retained-generation reader used by lexical serving checked cancellation/deadline before acquiring the generation read lock, but not after a potentially slow endpoint-authorized segment
open()and read. It also returned early before clearing a reused buffer. This could expose bytes from a previous read on an early refusal, or report a late success after the request deadline.retained_generation_read_refuses_pre_and_post_io_interruptions_without_leaking_byteson a real committed generation: verify the SHA-256 of a retained segment, force cancellation/deadline at the pre-I/O and post-I/O checkpoints, assert typed errors and empty stale buffers, then show an uninterrupted read still returns identical bytes.Commit appended from exact head
bcb039e, withforce=false; no other branch, CI configuration or existing assertions changed. The new regression has not been proven passing yet. Hosted Bazel CI for this head was queued at inspection; default native macOS remains skipped and an independent correctness review is still required. No Cargo execution. This is a correctness repair, not a claim that cold first-opens are O(1); #4533 remains open and this PR must not auto-merge.