Move the anchor attribute in ANCH(n)/REC(n), not just its values; release 0.5.1 - #9
Merged
Merged
Conversation
…ease 0.5.1
apply_anchor_at_position permuted only the record values while the schema kept
its original order. With anonymous $a_i names (position == name) that is
invisible, but with named attributes -- the ones AVP produces from a header row
-- it broke the attribute-value binding: the column carrying the anchor's name
received another attribute's values. The reported case, <ANCH(4)> over a
Dato,Tid,Eksamen,Fagkode,Lokaler,Klasse header, came out as Lokaler,Dato,Tid,...
with every value shifted.
The transformation now moves the anchor attribute itself -- name together with
values -- so every record keeps its pairs and only the schema order changes,
which makes it the special case of apply_schema_reordering it always was. One
rule for named and anonymous attributes alike: an anonymous name is no longer
reassigned positionally, it travels with its attribute, so a schema $a_1..$a_4
under ANCH(2) reads $a_2, $a_3, $a_1, $a_4 while the values stay in the same
positions as before. All ANCH/REC(n) task fixtures are header-less and compare
positionally, so they are unaffected and none was touched.
Port of jRegTab 0.5.1 (a092102, merged in 43c1fa9); the reference implementation
is AnchorAttributeAtPosition.java.
No change was needed in the RTL plumbing: the settings prefix <ANCH(n)>, inline
REC(n) on an atomic content specification and inline REC(n) inside a delimited
one already converge on the same Transformation -- collect_rec_params descends
into delimited specs on the RTL path and actions_of reads d.atom.actions on the
ATP path. That is now pinned by a test rather than left to inspection.
Tests: a #[cfg(test)] module in src/spec.rs (the file had none) covering named,
anonymous, mixed and degenerate schemas, a negative position, and a regression
check that value positions are unchanged; tests/test_rtl_anchor_forms.py, where
the three forms must agree and REC(n) under {','} yields one record per raw
token (" C1.1" keeps its leading space -- the 0.5.0 S_delim rule);
AnchorAttributeAtPosition added to test_api.py's transformation coverage.
Temporarily restoring the old return value fails 4 core tests and 5 Python ones
while the regression check stays green.
Corpus re-pinned to jRegTab v0.5.1 (c126337) and synced byte-for-byte: the two
new semantic cases anch_named_attrs and anch_named_inline_delim. Both set
expectedHasHeader, which is what lets them see the bug at all -- every other
semantic case is header-less and positional.
Docs: the ANCH(n) row in the settings table described an attribute-naming
operation that never existed ("use position n in the first record as the
attribute name"); rtl-reference.md now states what the transformation does,
including the anonymous-name rule and the fact that an inline REC(n) is picked
up anywhere in the pattern, delimited specifications included. Same correction
in the REC(n) operation row, atp.md, itm.md and api.md.
Release 0.5.1: version bumped in Cargo.toml, Cargo.lock, pyproject.toml,
__init__.py, README.md and docs/index.md. The README's differential note still
refers to the v0.5.0 run -- that comparison was not repeated here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Port of the jRegTab 0.5.1 fix (
a092102, merged in43c1fa9) — referenceimplementation
AnchorAttributeAtPosition.java.The bug
apply_anchor_at_position(src/spec.rs) permuted only the recordvalues while the schema kept its original order. With anonymous
$a_inames(position == name) that is invisible, but with named attributes — the ones
AVPproduces from a header row — the attribute-value binding broke: the columncarrying the anchor's name received another attribute's values.
Reported case:
<ANCH(4)>over aDato,Tid,Eksamen,Fagkode,Lokaler,Klasseheader came out as
Lokaler,Dato,Tid,…with every value shifted.The fix
The transformation now moves the anchor attribute — name together with its
values — so every record keeps its pairs and only the schema order changes,
making it the special case of
apply_schema_reorderingit always was.One rule for named and anonymous attributes alike: an anonymous name is no
longer reassigned positionally, it travels with its attribute, so
$a_1..$a_4under
ANCH(2)reads$a_2, $a_3, $a_1, $a_4while the values stay in thesame positions as before. All ANCH/REC(n) task fixtures are header-less and
compare positionally — none was touched.
No change was needed in the RTL plumbing:
<ANCH(n)>, inlineREC(n)on anatomic content specification and inline
REC(n)inside a delimited one alreadyconverge on the same
Transformation. That is now pinned by a test rather thanleft to inspection.
Tests
#[cfg(test)] mod testsinsrc/spec.rs(the file had none): named,anonymous, mixed and degenerate schemas, a negative position, and a regression
check that value positions are unchanged.
tests/test_rtl_anchor_forms.py: the three forms must agree, andREC(n)under
{','}yields one record per raw token (" C1.1"keeps its leadingspace — the 0.5.0
S_delimrule).AnchorAttributeAtPositionadded totest_api.py's transformation coverage.c126337) and synced byte-for-byte: thetwo new semantic cases
anch_named_attrsandanch_named_inline_delim. Bothset
expectedHasHeader, which is what lets them see the bug at all.Discriminating check: temporarily restoring the old return value fails 4 core
tests and 5 Python ones (both conformance cases included) while the regression
check stays green.
Docs and version
The
ANCH(n)row in the settings table described an attribute-naming operationthat never existed;
docs/rtl-reference.mdnow states what the transformationdoes, including the anonymous-name rule and the fact that an inline
REC(n)ispicked up anywhere in the pattern, delimited specifications included. Same
correction in the
REC(n)operation row,atp.md,itm.mdandapi.md.Version bumped to 0.5.1 across
Cargo.toml,Cargo.lock,pyproject.toml,__init__.py,README.mdanddocs/index.md. The README's differential notestill refers to the v0.5.0 run — that comparison was not repeated here.
Plan:
plans/ANCH_MOVES_ATTRIBUTE.md(and a newplans/INDEX.md).🤖 Generated with Claude Code