Skip to content

fix(schematron): un-shadow Option/Future underlying rules; add underlyings to canonical sample - #23

Merged
karlkauc merged 1 commit into
mainfrom
fix/schematron-underlying-shadowing
Aug 29, 2026
Merged

fix(schematron): un-shadow Option/Future underlying rules; add underlyings to canonical sample#23
karlkauc merged 1 commit into
mainfrom
fix/schematron-underlying-shadowing

Conversation

@karlkauc

Copy link
Copy Markdown
Contributor

Summary

  • Bug: in asset-validations the Derivative Exposure warning rule (OP or FU or FX or SW) matched every Option/Future first, so the Option Underlying / Future Underlying ERROR rules never fired (svrl:suppressed-rule) — same shadowing class as the earlier percentage-sum fix. They now live in their own pattern asset-underlying-validations (11 patterns total; README updated, "Known ruleset fix" section extended).
  • Sample: Mixed-Fund_Positions.xml had 4 options/futures without Underlyings, which the bug had masked. Added an XSD-valid Underlyings/Underlying to each (Allianz SE, Volkswagen AG, EURO STOXX 50 index, EUR/USD currency) so the canonical sample keeps its 0 ERROR / 12 warnings property honestly. Both tests/fixtures/invalid/* regenerated with the README sed recipes (Schematron fixture still fails with exactly 1 error).
  • Tolerance alignment: Basic XSLT share-class price check now uses the same bands as Schematron (OK < 0.01 / ROUNDING 0.01–0.1 / ERROR ≥ 0.1) instead of ERROR ≥ 1.0. XSLT README table updated and cross-referenced.

Verification (local)

check result
xmllint --schema 4.2.9 on sample validates
Java Schematron, sample 0 errors / 12 warnings, exit 0
Java Schematron, fixture 1 error (percentage 120 %), exit 1
Java Schematron, sample with one Underlyings removed ERROR: Option "Call Option on Allianz SE" must have at least one underlying asset, exit 1 ← rule now live
Basic XSLT DQ report 2× ✓ OK
positions CSV / TPT / top-holdings / data binding 21 rows / 42 rows / 5 holdings / 21 positions (unchanged)
DB import+export of sample export XSD-valid
Santuario sign → verify → tamper 0 / 0 / 1

🤖 Generated with Claude Code

https://claude.ai/code/session_01YXZWhwE5EbHSybt55K6oUZ

…yings to sample

ISO Schematron fires only the first matching rule per pattern. In
asset-validations the derivative-exposure warning rule (OP or FU or FX or
SW) claimed every Option and Future, so the two "must have underlying"
ERROR rules were dead code (SVRL: svrl:suppressed-rule). Same bug class as
the earlier percentage-sum fix. Move them into their own pattern
asset-underlying-validations (ruleset now has 11 patterns).

The canonical sample had four options/futures without Underlyings, so
un-shadowing would have turned "0 errors" into 4. Add an XSD-valid
Underlyings/Underlying (Type, Name, Identifiers) to each: Allianz SE and
Volkswagen AG (Security/ISIN), EURO STOXX 50 (Index/ISIN), EUR/USD
(Currency/OtherID). Regenerate both negative fixtures from the new sample
with the sed recipes in tests/fixtures/invalid/README.md; the Schematron
fixture still fails with exactly 1 error (percentage sum).

Align the Basic XSLT share-class price check with the Schematron bands
(OK < 0.01, ROUNDING 0.01-0.1, ERROR >= 0.1); it previously only flagged
ERROR from 1.0, contradicting the documented "matching tolerances".

Verified: sample XSD-valid; Java Schematron 0 errors / 12 warnings on the
sample, 1 error on the fixture, 1 error when an Underlyings block is
removed; XSLT DQ report 2x OK; CSV 21 rows, TPT 42 rows, top-holdings 5,
data binding 21 positions, DB import/export XSD-valid, Santuario
sign/verify/tamper roundtrip unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YXZWhwE5EbHSybt55K6oUZ
@karlkauc
karlkauc merged commit 672f6ea into main Aug 29, 2026
4 checks passed
@karlkauc
karlkauc deleted the fix/schematron-underlying-shadowing branch August 29, 2026 17:21
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.

1 participant