Skip to content

Scope scenarios per category and surface filters in a table#44

Open
methodofaction wants to merge 2 commits intomainfrom
scoped-scenarios
Open

Scope scenarios per category and surface filters in a table#44
methodofaction wants to merge 2 commits intomainfrom
scoped-scenarios

Conversation

@methodofaction
Copy link
Copy Markdown
Contributor

@methodofaction methodofaction commented Apr 26, 2026

Before:

image

After:

image

Summary

  • Investigation kicked off because Spain's regimes/es.mdx rendered the reverse-charge scenario (and several others) twice. Root cause: GOBL declares distinct VAT- and IGIC-scoped scenarios, but the generator template never surfaced the Categories filter that distinguished them, so the two collapsed visually.
  • Reworked the Scenarios section in every regime/addon page. Each schema now sits inside an <Accordion> (mirroring Validation Rules) and is rendered as a single table. Columns are computed per table from the filters that are actually populated — empty filter columns are dropped so each country/standard shows only the dimensions that matter to it.
  • The Output column shows the JSON GOBL emits (note/codes/ext) using the real wire shape — including Note.Category, Note.Key, etc. — instead of a flattened summary. Indented JSON is rendered via <code class="code-block"> with <br/> + &nbsp; so it lays out neatly inside table cells. The matching display rule lives in style.css.
  • Custom Filter functions can't be introspected, but tax.Scenario already exposes Name / Desc (i18n strings) for documentation. The new customFilterLabel helper renders Desc when set, then Name, and otherwise emits a bare [custom](URL) link to the function's source on GitHub at the gobl version pinned in go.mod — using runtime.FuncForPC to resolve the file:line.
  • Added an overview article at overview/scenarios.mdx explaining how scenarios match documents, what each filter checks, and where outputs land (notes → tax.notes, ext → tax.ext, codes → summary). Both the Scenarios and Validation Rules section headers in regime/addon pages now link to their respective overview articles instead of repeating the explanation inline.

Test plan

  • go build ./cmd/generate && ./generate runs cleanly.
  • mint dev — visit regimes/es and confirm the two reverse-charge rows are now disambiguated by the Categories column.
  • Visit addons/es-verifactu-v1 and confirm the Categories column is hidden (none of its scenarios use it).
  • Visit addons/pt-saft-v1 and addons/mx-cfdi-v4; the custom-filter rows render as a custom link to GitHub at v0.401.0 (or whatever version go.mod pins).
  • Visit overview/scenarios from the sidebar (Overview group).
  • Confirm the Output column is monospace-styled with each line on its own row (CSS .code-block { display: block } rule).

🤖 Generated with Claude Code

The Spain reverse-charge scenario rendered twice in the docs because GOBL
defines distinct VAT- and IGIC-scoped scenarios, but the generator's
template stripped the Categories filter that distinguished them. Add a
new Scenarios overview article and rework the per-regime/addon Scenarios
section so each schema lives inside an Accordion and is rendered as a
single table whose columns adapt to the filters actually in use. The
Output column shows the JSON GOBL emits (note/codes/ext) and custom
Filter functions get a deep link to their source on GitHub when the
scenario doesn't carry a Desc/Name. The Validation Rules section gains a
matching short blurb that links to the existing overview article.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Apr 26, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gobl 🟢 Ready View Preview Apr 26, 2026, 1:19 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the generated documentation for tax regime/addon scenarios to prevent visually-collapsed rows (e.g., VAT vs IGIC) by surfacing relevant filters as table columns, and adds a dedicated Scenarios overview page.

Changes:

  • Reworks Scenarios sections to render per-schema scenario sets as a single table with only populated filter columns (Tags/Type/Categories).
  • Renders scenario outputs as indented JSON in a monospace <code class="code-block">…</code> block and adds CSS to display it cleanly in table cells.
  • Adds overview/scenarios.mdx and links regime/addon pages to the overview pages for Scenarios and Validation.

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
style.css Styles table-cell code blocks as block-level for multi-line JSON output.
docs.json Adds overview/scenarios to the documentation navigation.
overview/scenarios.mdx New overview article explaining scenario filters/outputs and matching behavior.
cmd/generate/utils.go Adds scenario table + output rendering helpers and custom-filter GitHub source linking.
cmd/generate/regimes.go Switches scenario rendering to per-schema accordion + computed table; links to scenarios overview.
cmd/generate/addons.go Same scenario rendering changes for addons.
cmd/generate/generator.go Adds shared Validation Rules intro text + link to validation overview.
regimes/ae.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/at.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/be.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/br.mdx Adds Validation Rules intro link.
regimes/ch.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/co.mdx Adds Validation Rules intro link.
regimes/de.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/dk.mdx Adds Validation Rules intro link.
regimes/el.mdx Updates Scenarios section to table format.
regimes/es.mdx Updates Scenarios section to disambiguate by Categories (VAT vs IGIC) in table format; adds Validation Rules intro link.
regimes/fr.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/gb.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/ie.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/in.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/it.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/mx.mdx Adds Validation Rules intro link.
regimes/nl.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/pl.mdx Adds Validation Rules intro link.
regimes/pt.mdx Adds Validation Rules intro link.
regimes/se.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
regimes/sg.mdx Adds Validation Rules intro link.
regimes/ar.mdx Adds Validation Rules intro link.
addons/ar-arca-v4.mdx Adds Validation Rules intro link.
addons/br-nfe-v4.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/br-nfse-v1.mdx Adds Validation Rules intro link.
addons/co-dian-v2.mdx Adds Validation Rules intro link.
addons/de-xrechnung-v3.mdx Adds Validation Rules intro link.
addons/es-facturae-v3.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/es-sii-v1.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/es-tbai-v1.mdx Adds Validation Rules intro link.
addons/es-verifactu-v1.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/eu-en16931-v2017.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/fr-choruspro-v1.mdx Adds Validation Rules intro link.
addons/fr-ctc-flow2-v1.mdx Adds Validation Rules intro link.
addons/gr-mydata-v1.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/it-sdi-v1.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/it-ticket-v1.mdx Adds Validation Rules intro link.
addons/mx-cfdi-v4.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/pl-favat-v3.mdx Updates Scenarios section to table format; adds Validation Rules intro link.
addons/pt-saft-v1.mdx Updates Scenarios section to table format; adds Validation Rules intro link.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/generate/utils.go
Comment thread cmd/generate/utils.go
Comment thread cmd/generate/utils.go Outdated
Agent-Logs-Url: https://github.com/invopop/gobl.docs/sessions/a9c71b41-3581-41da-9bfc-7a6ebcc69af0

Co-authored-by: methodofaction <51445+methodofaction@users.noreply.github.com>
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.

3 participants