Skip to content

Sync with pyRegTab 0.5.1: anchor attribute moves with its values - #1

Merged
shigarov merged 5 commits into
mainfrom
feature/pyregtab-051-sync
Aug 26, 2026
Merged

Sync with pyRegTab 0.5.1: anchor attribute moves with its values#1
shigarov merged 5 commits into
mainfrom
feature/pyregtab-051-sync

Conversation

@shigarov

Copy link
Copy Markdown
Contributor

Ports the jRegTab 0.5.1 fix for ANCH(n) / REC(n) into the extension by
moving the pinned core to pyRegTab v0.5.1.

What changed upstream

The post-extraction transformation used to apply the permutation only to record
values while returning the schema unchanged. For anonymous attributes that was
invisible; for named ones (produced by AVP) the name-value binding broke —
the column carrying the anchor's name received another attribute's values.
ANCH(n) now moves the attribute itself, name together with its values, so only
the schema order changes.

RTL syntax, the grammar and ATP→RTL serialization are unchanged.

What that means here

The match preview prints the recordset schema verbatim from the core
(preview.rs passes rs.schema.attributes straight through), so patterns
combining AVP with ANCH(n)/REC(n) now render the correct header with no
preview code change.

Nothing in the repository exercised that combination, which is why a wrong
header could ship unnoticed — so this adds a preview test built on pyregtab's
own conformance case semantic/anch_named_attrs rather than invented data.

The test discriminates. Against the v0.5.0 core it fails on the schema
assertion (["Lokaler","Dato","Klasse"] vs ["Dato","Lokaler","Klasse"]) while
the values match on both cores — exactly the binding the fix restores.

Also in this PR

  • Hover dictionary regenerated with tools/gen_hover_data.py (not hand-edited);
    the diff is exactly the ANCH and REC(n) entries.
  • snippets/rtl.json: the "Settings prefix" description said "anchor column",
    which is now plainly wrong — an attribute moves, a column name is not borrowed.
  • grammar/UPSTREAM re-pinned to jRegTab v0.5.1. RTL.g4 is byte-identical at
    v0.5.0 and v0.5.1, so the sha256 line is untouched; the commit sha is
    used rather than the annotated tag object, since the sync check fetches
    raw.githubusercontent.com/.../<commit>/....
  • Two highlighting fixtures copied byte-for-byte from the new semantic cases.
    They close real gaps: no fixture carried a genuine <ANCH(n)> setting (only
    <FOO>), and none carried a delimited specification {','} at all.
  • Release 0.8.9 + plan under plans/, and a new plans/INDEX.md.

Verification

cargo clippy --all-targets -- -D warnings   clean
cargo test                                  26 unit (was 25) + 3 corpus
npm test                                    check:types + grammar + 39 unit + check:sync
npm run test:e2e                            5 passing
npx vsce package                            114.58 KB (CI limit 200 KB)

No baseline was bent: syntaxes/, grammar/RTL.g4 and server/tests/corpus/**
are untouched, all 11 existing snapshots are byte-identical (two new ones added),
and negative_corpus_positions still passes, so conflict_anch_rec.rtl remains
a compile error under 0.5.1.

Known, recorded as backlog (not fixed here)

  • The vendored corpus is stale: 151 positive files vs 304 upstream, and
    server/tests/corpus/VERSION says 2026-07-07 while
    test/grammar/fixtures/CORPUS.md quotes it as 2026-08-26.
  • hover_data.rs has no freshness gate at all, unlike RTL.g4.

🤖 Generated with Claude Code

shigarov and others added 5 commits August 26, 2026 19:06
pyRegTab 0.5.1 fixes ANCH(n)/REC(n): the transformation now moves the anchor
attribute itself -- its name together with its values -- so patterns that name
attributes through AVP keep every record's name-value pairs. The extension is
affected through the match preview, which prints the recordset schema verbatim
from the pinned core.

plans/INDEX.md did not exist; it is added with entries for all three plans,
modelled on pyregtab/plans/INDEX.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0.5.1 fixes ANCH(n)/REC(n): the transformation now moves the anchor attribute
itself -- its name together with its values -- instead of permuting only the
values and returning the schema untouched. With named attributes (produced by
AVP) that bug broke the name-value binding, so the column carrying the anchor's
name received another attribute's values.

preview.rs needs no change: run() passes rs.schema.attributes through verbatim,
so the corrected schema reaches the webview on its own. But nothing in the repo
exercised AVP together with ANCH(n), which is why the wrong header could ship
unnoticed -- hence the test, with its data taken from pyregtab's conformance
case semantic/anch_named_attrs rather than invented here.

The test discriminates: against the v0.5.0 core it fails on the schema
assertion (["Lokaler","Dato","Klasse"] vs ["Dato","Lokaler","Klasse"]) while
the values match on both, which is exactly the binding the fix restores.

Plan: plans/PYREGTAB_051_SYNC.md §3, §6.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tools/gen_hover_data.py harvests the settings and action tables from pyregtab's
docs/rtl-reference.md, and 0.5.1 rewrote exactly the two rows that describe the
anchor transformation: ANCH(n) no longer "uses position n as the attribute name"
but moves the anchor attribute to position n, and REC(n) says the name travels
with its values.

Regenerated with the script, not hand-edited -- the file is @generated. The diff
is the two entries and nothing else: the generator reads only pipe tables, so
0.5.1's new prose in the "Settings prefix" section and its "Inline equivalents"
admonition stay out of the dictionary.

Plan: plans/PYREGTAB_051_SYNC.md §4.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
RTL.g4 is byte-identical at jRegTab v0.5.0 and v0.5.1, so grammar/UPSTREAM keeps
its sha256 line and only the commit and tag move. The commit sha is used rather
than the annotated tag object c126337 that pyregtab recorded, because
check_grammar_sync.py fetches raw.githubusercontent.com/.../<commit>/..., which
resolves a commit but not a tag object.

The "Settings prefix" snippet said the setting picks an "anchor column", which
was already the wrong mental model and is now plainly wrong: an attribute moves,
a column name is not borrowed. Only the description changes; prefix and body are
untouched, and the American spelling used elsewhere in the extension's own text
is kept.

The two fixtures come from the semantic conformance cases added in 0.5.1, copied
byte-for-byte. They close real gaps in the TextMate snapshots: no fixture
carried a genuine <ANCH(n)> setting (only <FOO> in settings_unknown.rtl), and
none carried a delimited specification {','} at all. No existing snapshot moved.

The S_delim references to 0.5.0 in CLAUDE.md and DEVELOPMENT.md are left alone --
they are the historical incident that justifies pinning, not a current version.

Plan: plans/PYREGTAB_051_SYNC.md §5, §7.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Records the plan under plans/, marked done, with the result section listing the
pin changes, the discriminating check on the new preview test, and the two small
deviations the implementation needed.

Publishing (tag v0.8.9 -> Marketplace/Open VSX) is deliberately not part of this
change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@shigarov
shigarov merged commit 896035c into main Aug 26, 2026
2 checks passed
@shigarov
shigarov deleted the feature/pyregtab-051-sync branch August 26, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant