Skip to content

Bill status and support passthrough for unregistered schemas in schema.Object#796

Merged
samlown merged 16 commits intomainfrom
bill-status-schemas
Apr 16, 2026
Merged

Bill status and support passthrough for unregistered schemas in schema.Object#796
samlown merged 16 commits intomainfrom
bill-status-schemas

Conversation

@samlown
Copy link
Copy Markdown
Collaborator

@samlown samlown commented Apr 9, 2026

  • Working on support for the bill.Status model.
  • Allow schema.Object to preserve raw JSON for schemas not registered in the GOBL registry, enabling external complement types to round-trip without requiring registration
  • Add HasPayload() method to distinguish resolved objects from passthrough
  • Add envelope validation rule (ENVELOPE-04) ensuring the doc field always has a known/registered schema

Pre-Review Checklist

  • Opened this PR as a draft
  • Read the CONTRIBUTING.md guide.
  • Performed a self-review of my code.
  • Added thorough tests with at least 90% code coverage.
  • Modified or created example GOBL documents to show my changes in use, if appropriate.
  • Added links to the source of the changes in tax regimes or addons, either structured or in the comments.
  • Run go generate . to ensure that the Schemas and Regime data are up to date.
  • Reviewed and fixed all linter warnings.
  • Been obsessive with pointer nil checks to avoid panics.
  • Updated the CHANGELOG.md with an overview of my changes.
  • Marked this PR as ready for review.

And if you are part of the org:

  • Requested a review from Copilot and fixed or dismissed (with a reason) all the feedback raised.
  • Requested a review from @samlown.

cavalle and others added 2 commits April 9, 2026 21:22
Allow schema.Object to preserve raw JSON for schemas not registered in the
GOBL registry, enabling external complement types to round-trip through
GOBL documents without requiring registration. The Envelope doc field
remains strict via a new validation rule (ENVELOPE-04) that requires a
known schema.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@samlown samlown changed the base branch from main to rules April 9, 2026 21:38
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 97.20000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.20%. Comparing base (72beee4) to head (4192797).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
cal/timestamp.go 93.67% 3 Missing and 2 partials ⚠️
bill/status.go 98.62% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #796      +/-   ##
==========================================
+ Coverage   93.09%   93.20%   +0.11%     
==========================================
  Files         368      370       +2     
  Lines       19624    19870     +246     
==========================================
+ Hits        18269    18520     +251     
+ Misses        919      913       -6     
- Partials      436      437       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@samlown samlown marked this pull request as draft April 9, 2026 21:53
Base automatically changed from rules to main April 13, 2026 16:27
Comment thread bill/status.go Outdated
@samlown samlown marked this pull request as ready for review April 16, 2026 09:26
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

This PR expands GOBL’s document/model support by introducing bill.Status and cal.Timestamp, and updates schema.Object to allow round-trip passthrough of unregistered $schema payloads while tightening envelope validation to require a registered schema for Envelope.doc.

Changes:

  • Update schema.Object to preserve raw JSON for unregistered schemas and add HasPayload() to distinguish resolved vs passthrough objects.
  • Add bill.Status model (schema + rules + tests) and new ES status examples/output fixtures.
  • Add cal.Timestamp model (schema + rules + tests) and extend CLI/envelope validation expectations (ENVELOPE-04).

Reviewed changes

Copilot reviewed 32 out of 37 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
schema/object.go Adds raw passthrough storage, HasPayload(), and marshaling/unmarshaling behavior changes.
schema/object_test.go Updates/extends tests to cover unknown-schema passthrough, round-trip, clone, calculate, and payload detection.
envelope.go Adds ENVELOPE-04 assertion requiring doc to have a known/registered schema (payload present).
envelope_test.go Adds validation case for passthrough doc failing ENVELOPE-04.
internal/cli/validate_test.go Updates expected error output now that unknown schemas passthrough and are rejected by envelope validation.
internal/cli/build_test.go Updates expected error output for unknown-schema docs to reflect ENVELOPE-04.
cmd/gobl/validate_test.go Updates expected multi-fault ordering to include ENVELOPE-04.
internal/cli/bulk_test.go Updates the schema listing fixture to include new bill/status and cal/timestamp schemas.
bill/status.go Introduces the bill.Status model, normalization, calculation, schema extension, and rules.
bill/status_test.go Adds comprehensive tests for status calculation, validation, definitions, and schema extension.
bill/bill.go Registers bill.Status schema/rules and adds ShortSchemaStatus.
data/schemas/bill/status.json Adds generated JSON Schema for bill.Status and related defs.
data/rules/bill.json Adds generated rules for bill.Status, StatusLine, Reason, Action, Condition.
examples/es/status-update.yaml Adds ES example input for status “update”.
examples/es/status-system.yaml Adds ES example input for status “system”.
examples/es/status-system-shutdown.yaml Adds ES example input for a system shutdown status.
examples/es/status-system-anomaly.yaml Adds ES example input including an external complement passthrough object.
examples/es/status-response.yaml Adds ES example input for status “response”.
examples/es/out/status-update.json Adds generated envelope output for the status-update example.
examples/es/out/status-system.json Adds generated envelope output for the status-system example.
examples/es/out/status-system-shutdown.json Adds generated envelope output for the shutdown example.
examples/es/out/status-system-anomaly.json Adds generated envelope output for the anomaly example (includes complement passthrough).
examples/es/out/status-response.json Adds generated envelope output for the status-response example.
cal/timestamp.go Introduces cal.Timestamp type with JSON (un)marshal, parsing, schema, and rule scaffolding.
cal/timestamp_test.go Adds tests for timestamp parsing, JSON behavior, string/clone helpers, and validation interactions.
cal/cal.go Registers cal.Timestamp schema and rules.
data/schemas/cal/timestamp.json Adds generated JSON Schema for cal.Timestamp.
data/rules/cal.json Adds generated rules entry for cal.Timestamp.
cal/time.go Adds Time.IsZero() to support ,omitzero JSON tag behavior.
cal/time_test.go Adds tests for Time.IsZero() and ,omitzero marshaling.
data/rules/gobl.json Adds generated envelope rule subset for ENVELOPE-04.
data/schemas/schema/object.json Updates schema.Object description formatting for $schema.
bill/ordering.go Updates comments to refer to “document” rather than “invoice” in shared ordering context.
data/schemas/bill/ordering.json Updates generated ordering schema descriptions accordingly.
bill/invoice.go Makes Invoice.CanSign() nil-safe.
bill/invoice_test.go Adds tests for top-level inversion paths, Invoice.Empty(), Invoice.UnmarshalJSON edge cases, and Invoice.CanSign().
CHANGELOG.md Adds unreleased changelog entries for schema.Object passthrough, bill.Status, and cal.Timestamp.

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

Comment thread schema/object.go
Comment thread schema/object.go
Comment thread cal/timestamp.go
Comment thread bill/status.go
Copy link
Copy Markdown
Contributor

@cavalle cavalle left a comment

Choose a reason for hiding this comment

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

LGTM!

@samlown samlown merged commit a38dfe4 into main Apr 16, 2026
8 checks passed
@samlown samlown deleted the bill-status-schemas branch April 16, 2026 11:30
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