fix(lexical): carry text artifact across added and removed files - #3073
Open
devin-ai-integration[bot] wants to merge 14 commits into
Open
devin-ai-integration[bot] wants to merge 14 commits into
devin-ai-integration[bot] wants to merge 14 commits into
Conversation
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Extract the path merge-walk into file_replacement_runs and unit-test additions and removals at both roster ends, merged neighbour runs, and full replacement; add first/last roster rounds to the byte-identical carry test. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…carry' into repair/pr-3073-ci-sol
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2906
Fixes #2880
Cause
The earlier carry fixes handled only edits that kept the same file roster.
changed_files_sincereturnedNonewhen the file count or any file key differed, so adding or removing a file caused a full re-encode. Under a 6 GiB cap, a full-clone edit then rebuilt the whole corpus.Changes
VerifiedSealedLexicalPageSourceV1::file_replacements_sincereplaceschanged_files_since. It verifies that both sources cut pages the same way, then calls the purefile_replacement_runsfunction. That function walks both rosters by logical path. Paths strictly ascend in build order. It returnsSealedLexicalFileReplacementV1runs fromparent_filestofiles, and either side of a run can be empty. It returnsNonewhen page-cut inputs differ or paths do not strictly ascend. In those cases, the build remains cold.partitioned_codec: replaces the roster comparison with thefile_keys()andsame_segment()primitives.increment.rs:stage_replaced_filesstages each run's successor files at the cold position and verifies that the runs ascend together.rewrite_page_rowsnow also shiftssource_pages.file_ordinalby the net file growth of earlier runs. Document, page, and clone shifting is unchanged and operates per run.serving.rs: the existing 1/8 cold-fallback threshold now counts replaced files asmax(parent, successor)for each run.Test plan
an_added_or_removed_file_carries_the_parent_text_artifact_byte_identical_to_a_cold_build. It hides every parent segment while the successor builds, so a cold fallback cannot finish. The test then requires the carried bytes to equal a cold build across six rounds: add a file, remove a file, replace a file with its neighbour alongside a body edit, rename a file, add a new first file, and remove the last file.Contract("sealed generation segment is unavailable ..."). With this change,bash scripts/require-exact-test.sh cargo test -p tracedecay-code-index-runtime --lib code_index_scheduler::tests::text_artifact_carry_tests::an_added_or_removed_file_carries_the_parent_text_artifact_byte_identical_to_a_cold_build -- --exactpasses with 1 test passed.file_replacement_runs_align_rosters_by_pathchecks exact runs against literal values. Cases cover no change, a single edit, additions and removals at both ends of the roster, an addition next to a removal as one run, an edit that extends a preceding replacement, every file replaced, and every file removed.bash scripts/require-exact-test.sh cargo test -p tracedecay-code-index --lib production::lexical_page_source::lexical_page_source_tests::file_replacement_runs_align_rosters_by_path -- --exactpassed with 1 test passed.cargo test -p tracedecay-code-index-runtime --lib -- text_artifact(26 passed),cargo test -p tracedecay-query --lib -- lexical::projection::artifact(84 passed),cargo test -p tracedecay-code-index --lib -- lexical(14 passed)cargo fmt --all -- --check;cargo clippy -p tracedecay-code-index -p tracedecay-query -p tracedecay-code-index-runtime --all-targets -- -D warningsis cleancargo nextest run --workspace --no-fail-fast(left to CI)Checklist
CHANGELOG.mdupdated (release-please generates it from the commit).envfiles includedchanged_files_sincewas used only inside the workspace.Link to Devin session: https://app.devin.ai/sessions/b676368291d446d1b33cd48d4dd5afad
Open in Devin Desktop: https://app.devin.ai/desktop/session/b676368291d446d1b33cd48d4dd5afad?variant=devin
Requested by: @ScriptedAlchemy