Item identity scopes for EN 16931 (BT-155/156/157/158)#882
Draft
alvarolivie wants to merge 1 commit into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #882 +/- ##
==========================================
+ Coverage 94.75% 94.77% +0.01%
==========================================
Files 343 343
Lines 18815 18869 +54
==========================================
+ Hits 17829 17883 +54
Misses 600 600
Partials 386 386 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alvarolivie
force-pushed
the
items-identities
branch
from
June 30, 2026 09:47
d53ee08 to
de97613
Compare
alvarolivie
force-pushed
the
items-identities
branch
2 times, most recently
from
June 30, 2026 10:15
f029d9b to
6d95cfe
Compare
…ity rules org.Identity gains four item-identification scopes mapping to the EN 16931 item identification family, each documented with when to use it: - seller (BT-155): the seller's own article number / SKU - buyer (BT-156): the buyer's own catalogue code - legal (BT-157): a registered scheme identifier such as the GS1 GTIN - class (BT-158): a classification-scheme category (UNSPSC, CPV, HS) Also: - catalogues/untdid: new untdid-item-type-version extension (BT-158-2). - eu-en16931: class identities require untdid-item-type (BT-158); items allow at most one legal identity (BT-157); legal identities require iso-scheme-id (BR-64), enforced at item level since party legal identities need no scheme. - Regenerates eu-en16931 rules data, dropping the stale BR-E-10 assertion removed in Go in v0.501.0 (pre-existing data drift). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
alvarolivie
force-pushed
the
items-identities
branch
from
June 30, 2026 10:28
6d95cfe to
d729816
Compare
alvarolivie
marked this pull request as ready for review
June 30, 2026 10:39
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands org.Identity.Scope to cover the EN 16931 item identification family (BT-155/156/157/158) and adds EN 16931 addon validation to constrain item identities (including required extensions), alongside regenerated schemas/rules data and a GB example demonstrating usage.
Changes:
- Add new identity scopes
class,seller, andbuyer(and clarifylegalscope usage for items) inorg.Identity, including validation + JSON Schema enum updates. - Add EN 16931 addon rules: (1) at most one
legalidentity per item, (2)legalitem identities requireiso-scheme-id, (3)classidentities requireuntdid-item-type. - Add UNTDID extension key
untdid-item-type-versionand add example invoice exercising all four item identity scopes.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
org/identity.go |
Adds new identity scope constants, documents scope intent, and expands scope validation + JSON Schema enum. |
org/identity_test.go |
Updates rule error assertion text and JSON Schema scope enum expectations. |
addons/eu/en16931/en16931.go |
Registers new EN 16931 identity-level ruleset. |
addons/eu/en16931/org.go |
Adds EN 16931 item identity constraints and class-scope extension requirement. |
addons/eu/en16931/org_test.go |
Adds tests for new scope/extension requirements and item-level legal identity constraints. |
addons/eu/en16931/org_internal_test.go |
Adds white-box tests for defensive guards in helper predicates. |
catalogues/untdid/untdid.go |
Introduces untdid-item-type-version extension key constant. |
data/rules/org.json |
Regenerates org rules JSON to reflect expanded identity scope set. |
data/rules/eu-en16931.json |
Regenerates EN 16931 rules JSON to include new identity/item identity assertions and remove stale assertion. |
data/schemas/org/identity.json |
Regenerates identity JSON Schema to include the new scope enum values. |
examples/gb/invoice-item-identities.yaml |
Adds GB YAML example showing all four item identity scopes and required extensions. |
examples/gb/out/invoice-item-identities.json |
Adds generated JSON output for the new GB item identities example. |
CHANGELOG.md |
Documents the new scopes, EN 16931 identity rules, new UNTDID extension, and the regenerated-data drift fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
samlown
marked this pull request as draft
July 2, 2026 14:09
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.
Adds item identity scopes covering the EN 16931 item identification family.
Changes
org: identity scopes —org.Identity.Scopegains four scopes for item identification, each documented inline with when to use it:seller(BT-155) — the seller's own article number / SKU for the item.buyer(BT-156) — the buyer's own catalogue code for the item.legal(BT-157) — a registered-scheme identifier such as the GS1 GTIN (also used by parties for company registration numbers).class(BT-158) — a classification-scheme category such as UNSPSC, CPV, or HS, rather than a unique identifier.eu-en16931: identity rules —classidentities require theuntdid-item-typeextension (BT-158); items allow at most onelegalidentity (BT-157);legalitem identities requireiso-scheme-id(BR-64), enforced at the item level since partylegalidentities need no scheme.data/catalogues/untdid— newuntdid-item-type-versionextension (BT-158-2).examples/gb/invoice-item-identities.yaml) with all four item-identity scopes.The buyer's item reference (BT-156) is now modelled as a
buyer-scoped item identity rather than aLine.BuyerItemReffield — consistent with the UBLItemidentification family (Sellers/Buyers/Standard/CommodityClassification).Note
This branch regenerates
data/rules/eu-en16931.json, which also drops the staleGOBL-EU-EN16931-TAX-COMBO-06(BR-E-10) assertion. That Go rule was already removed in v0.501.0 but the generated data onmainwas never regenerated — a pre-existing drift fix, not a behaviour change here.Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: