Repository navigation
refactor(core): Link domain newtype (refs #1163 — AST complete) - #1173
Merged
Merged
Conversation
Fourth and final newtype slice. Wraps Transaction.links and Document.links behind the Link newtype — same shape as the Tag migration in #1172. Changes: - AST: Transaction.links and Document.links switch to Vec<Link> - with_link constructors take impl Into<Link> - Parser parse_link returns Link - Loader dedup pass uses intern_typed_vec(Link::as_interned_mut) - Dropped the now-unused intern_vec helper (all four Vec<InternedStr> fields are typed); intern_typed_vec docs updated to cover all four newtypes - Dropped the now-unused AsVecInternedStr import Issue #1163 AST coverage is now complete (Currency/Account/Tag/Link). MetaValue::{Account,Currency,Tag,Link} variants still carry String — that crossing-the-typed-boundary question is a separate decision and remains deferred. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Completes issue #1163’s AST newtype migration by wiring the existing Link domain newtype through the core AST, parser, and loader dedup pass so link identifiers are type-distinguished from other interned strings.
Changes:
- Core AST:
Transaction.linksandDocument.linksmigrated fromVec<InternedStr>toVec<Link>, andwith_linkconstructors now acceptimpl Into<Link>. - Parser:
parse_linknow returnsLink, and transaction/document parsing now accumulatesVec<Link>. - Loader: cross-file dedup now interns transaction/document link slices via
intern_typed_vec(..., Link::as_interned_mut)and removes the now-unusedintern_vechelper; docs updated accordingly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/rustledger-parser/src/parser.rs | Returns/threads Link from parse_link and stores parsed links in typed vectors. |
| crates/rustledger-loader/src/dedup.rs | Uses typed interning helper for link slices and removes obsolete Vec<InternedStr> helper. |
| crates/rustledger-core/src/identifiers.rs | Updates identifier-module docs to reflect Link being fully plumbed through the AST. |
| crates/rustledger-core/src/directive.rs | Migrates Transaction.links / Document.links to Vec<Link> and updates with_link APIs; removes unused rkyv wrapper import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
📊 Benchmark Results
vs main branch (2026-05-20)
What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
3 of 4 tasks
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
Fourth and final newtype slice for #1163. Wraps the `links: Vec` fields on `Transaction` and `Document` behind the existing `Link` newtype.
Issue #1163 AST coverage is now complete (Currency in #1169, Account in #1171, Tag in #1172, Link here). The remaining `MetaValue::{Account, Currency, Tag, Link}` String variants are a separate design call and stay deferred.
What changed
AST fields:
Parser:
Loader dedup:
Cleanup:
Performance
#1163 status after this PR
The architectural goal of #1163 (compiler distinguishes the four identifier kinds at AST positions) is now met.
Test plan
🤖 Generated with Claude Code