You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Write the weight index as the physical 8-byte slot (3.2.1) - #33
Writer::writeDataset() took header weightIndex from VariableMetadata::$dictionaryIndex or the logical position. SPSS expects the 1-based 8-byte slot, so a weight placed after a string wider than 8 bytes was lost on reading. The writer now counts slots (Utils::widthToOcts for strings) from the written dictionary.
Tests: a 20-byte string, a number and a 300-byte very long string before the weight with a stale dictionaryIndex (slot 43), and a weight variable missing from the dictionary.
Summary by CodeRabbit
Bug Fixes
Corrected weight-variable placement when writing datasets containing string fields, preventing the weight from being assigned to the wrong slot.
No actionable comments were generated in the recent review.
Walkthrough
The writer now calculates the weight variable’s slot from the written dictionary, counting string-variable slots by octet width. Tests cover the calculated index in a typed dataset round-trip and the error raised when the weight variable is absent. The changelog records the fix.
Changes: Weight index calculation
Layer / File(s)
Summary
Calculate and verify the weight slot src/Sav/Writer.php, tests/DatasetRoundTripTest.php, CHANGELOG.md
The writer counts dictionary slots to locate the weight variable. Tests verify the round-trip index and the missing-variable error. The changelog records the fix and states that there are no runtime API changes.
This fixes the weight index written for datasets with wide string variables before the weight variable. No outstanding merge-blocking risk is identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: the writer now emits the weight index as the 1-based physical 8-byte slot, counted from the written dictionary. The changelog, Writer.php summary, and PR objectives al…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the writer now emits the weight index as the 1-based physical 8-byte slot, counted from the written dictionary. The changelog, Writer.php summary, and PR objectives all describe this same fix. The title is specific and concise, and it does not use vague terms. The '(3.2.1)' version tag is extra detail but does not make the title misleading.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: eeeaf0f1-ff74-4f3d-a1c2-44366f65d82a
Commits
Reviewing files that changed from the base of the PR and between a8a6d74 and e5e3889.
Files selected for processing: 3
CHANGELOG.md
src/Sav/Writer.php
tests/DatasetRoundTripTest.php
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
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
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.
Writer::writeDataset() took header weightIndex from VariableMetadata::$dictionaryIndex or the logical position. SPSS expects the 1-based 8-byte slot, so a weight placed after a string wider than 8 bytes was lost on reading. The writer now counts slots (Utils::widthToOcts for strings) from the written dictionary.
Tests: a 20-byte string, a number and a 300-byte very long string before the weight with a stale dictionaryIndex (slot 43), and a weight variable missing from the dictionary.
Summary by CodeRabbit