Repository navigation
Add and rename sheet columns by offset, so an upgrade changes only the bytes it names - #67
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Column insertion repeatedly rebuilds the sheet, introducing quadratic copying that can delay upgrades.
1 open issue
What changed in this PR
Updates upgrade-time CSV column additions and renames to preserve untouched formatting rather than rewrite entire sheets.
Changes:
- Adds offset-based edits with whole-sheet fallback.
- Shares CSV field scanning and quoting helpers.
- Tests preservation of line endings, quoting, byte order marks, and final newlines.
| File | Description |
|---|---|
| tests/manifest-runner.test.ts | Updates formatting-preservation expectations. |
| tests/manifest-runner-rename-bytes.test.ts | Adds byte-preservation regression tests. |
| tests/csv-mixed-line-endings.test.ts | Checks exact mixed-ending output. |
| app/lib/manifest-runner.server.ts | Implements offset-based column edits. |
| app/lib/csv-records.ts | Exports shared field helpers. |
| app/lib/csv-language-match.server.ts | Reuses shared CSV helpers. |
Review effort: Balanced
Comment on lines
+406
to
+408
| let next = content; | ||
| for (const [at, text] of inserts.reverse()) next = next.slice(0, at) + text + next.slice(at); | ||
| return next; |
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.

An upgrade that adds or renames a sheet column rewrote the whole file: every line ended in LF and every field was quoted afresh, so a site's CSVs showed changes on every line after an upgrade. The two operations now write only the header field they rename, or the fields they insert, and keep the file's line endings, quoting, byte order mark and final newline. A sheet whose records cannot be read back exactly is still written whole, as before. No D1 migrations.