Repository navigation
Conversation
The JSON definitions under data/addons were generated but never read: no
code in GOBL loads them, and the only runtime reads of the embedded FS
are schemas, catalogues and currency.
They also cannot be correct any more. The generator writes one file per
addon compiled into core, so as addons moved to their own modules the
directory became a shrinking subset that still looked authoritative — 13
files for the 25 addon keys GOBL recognises. A consumer reading it gets a
silently partial answer; gobl.dev served 404s for every externally
implemented addon until it switched to the registry.
Nor does the generator prune. data/addons/pl-favat-v2.json shipped in
0.507's predecessors for an addon deleted from the code, and was served
as a live definition for a key that would fail validation in $addons.
Remove the directory, the generator, and its go:generate directive, and
drop addons from the embed set. The registry is the source of truth and
renders the same bytes on demand:
schema.NewObject(tax.AddonForKey(key))
marshalled with a two-space indent, which is exactly what the generator
did. gobl.docs already works this way.
data/regimes/gr.json goes too, for the same reason in the other generated
directory: Greece registers under EL, so gr.json is a leftover from
before that rename. It is unreachable from the registry, was last
regenerated in 2024 while el.json kept moving, and go generate does not
recreate it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #976 +/- ##
=======================================
Coverage 96.88% 96.88%
=======================================
Files 335 335
Lines 15916 15916
=======================================
Hits 15421 15421
Misses 494 494
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Removes
data/addonsand its generator, plus the orphaneddata/regimes/gr.json.Nothing reads the addon data
No code in GOBL loads it. The only runtime reads of the embedded FS are
schemas/,catalogues/andcurrency/— the addon files are write-only artifacts. Outside core:data/schemas→static/draft-0; the addon files were never public assets.tax.AllAddonDefs()plus a bundle import, explicitly because addons left core.They cannot be correct any more
The generator writes one file per addon compiled into core. As addons moved to their own modules the directory became a shrinking subset that still looked authoritative: 13 files for the 25 addon keys GOBL recognises (13 built in, 12 on the approved external list).
That is not a theoretical problem — it is what gobl.dev hit.
GET /v0/addons/mx-cfdi-v4returned 404 for every externally implemented addon while/v0/addonsadvertised all 25, because the handler read this directory.And the generator never prunes
data/addons/pl-favat-v2.jsonshipped for an addon deleted from the code — 0.505 registers onlyV3— and was served as a live definition for a key that would fail validation in$addons.data/regimes/gr.jsonis the same failure in the other generated directory: Greece registers underEL, sogr.jsonis a leftover from before that rename. It is unreachable from the registry, was last regenerated in 2024-07 whileel.jsonkept moving, and/v0/regimes/GRstill serves it today — 16KB of two-year-old data in an older schema shape (carriesextensions/tags/payment_means_keys, missingalt_country_codes/tax_scheme/sources) against 6KB for the realEL.go generatedoes not recreate it.The replacement
The registry is the source of truth and renders the same bytes on demand:
That is exactly what
addons/generate.godid, so output is unchanged — verified byte-for-byte against all 13 files before deleting them. Unlike the files, it covers every addon the binary has loaded.Checks
mage checkpasses: lint, generate, tests, no uncommitted changes.go generate .recreates neitherdata/addonsnorgr.json.Breaking change
datais an exported package in a published module, so an external consumer could be doingdata.Content.ReadFile("addons/…"). Such a consumer is already getting a partial answer, but it is a real break — hence the breaking marker in the change note, and worth a minor release rather than a patch.🤖 Generated with Claude Code