# Defects found in CDM — collateral scope

Defects in the CDM model, its sample data and its documentation found during the analyses under goal
`goal-data-cdm-taxonomies-specs`. A defect here is something CDM states or does that is wrong or self-contradictory;
modelling gaps (something CDM does not cover) are in [`findings.md`](findings.md).

- **CDM version:** release `7.6.0`, commit `f685b4b45d8faa419425c018a52af66f40e43c0b`. All line numbers refer to
  this commit; the links open the lines on GitHub.
- **Paths** are relative to the CDM repository root. `rosetta/` stands for `rosetta-source/src/main/rosetta/`,
  `functions/` for `rosetta-source/src/main/resources/functions/`.
- **Status** of every defect: not reported to FINOS. Two have open CDM issues (D4, D7).
- **In this repository:** whether this project fixed the defect for its own use; CDM itself is not edited. The
  definitions and the evidence are in [In this repository](#in-this-repository).
- **Earlier IDs:** D1 was F1; D2, D3 were O4; D4, D5, D13 were O5; D6 was O6; D7 was O7; D8 is the function part of
  TX3.

[base]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b

## Summary

| ID | Defect | Severity | Location | In this repository |
|---|---|---|---|---|
| D1 | Additional haircut reads the FX haircut field, so the FX haircut is applied twice and the additional haircut never | calculation error | `rosetta/legaldocumentation-csa-func.rosetta` 24, 27 | fixed |
| D2 | Margin ratio is defined as market value ÷ purchase price but applied as a multiplier, and the haircut branch inverts it | calculation error | `rosetta/product-collateral-type.rosetta` 69; `rosetta/event-common-func.rosetta` 838–842, 854 | fixed |
| D3 | Repo sample and documentation violate the model's own conditions on margin and haircut percentages | sample / docs | `functions/repo-and-bond/repo-execution-func-input.json` 140; `docs/repurchase-agreement-representation.md` 221 | not fixed |
| D4 | Full return and termination qualification accept the same event, so a securities-lending return is not qualified | qualification | `rosetta/event-qualification-func.rosetta` 215–240, 841–861 | fixed |
| D5 | Collateral substitution is qualified as a renegotiation | qualification | `rosetta/event-qualification-func.rosetta` 821–839; `rosetta/event-common-func.rosetta` 1947–1963 | fixed |
| D6 | Repo sample leaves mandatory eligibility fields empty and labels bond collateral as cash | sample | `functions/repo-and-bond/repo-execution-func-input.json` 136–140 | not fixed |
| D7 | Repo product qualification rejects repos with more than one interest payout | qualification | `rosetta/product-qualification-func.rosetta` 1793, 1806 | not fixed, no effect |
| D8 | Rating eligibility check compares notations by text equality and ignores the boundary and mismatch rules | eligibility logic | `rosetta/product-collateral-func.rosetta` 137–155 | not fixed |
| D9 | Enum value misspelt `US_CTFC_PRType10` (CFTC) | naming | `rosetta/base-staticdata-asset-common-enum.rosetta` 539 | not fixed |
| D10 | Enum value misspelt `AgreeinFull` | naming | `rosetta/event-common-enum.rosetta` 95 | not fixed |
| D11 | Attribute misspelt `identifer` | naming | `rosetta/legaldocumentation-master-type.rosetta` 13; `rosetta/event-position-type.rosetta` 77, 83 | not fixed |
| D12 | Descriptions contain a literal `\t` and lost accented characters | text | `rosetta/legaldocumentation-csa-enum.rosetta` 100, 125–128, 220 | not fixed |
| D13 | Several repo and lending event samples produce no event qualifier *(cause not confirmed)* | qualification | `functions/repo-and-bond/*-output.json` | not fixed, no effect |
| D14 | CDM 7.7.0 Python package and `rune.runtime` 2.2.2: types nested in other types keep placeholder (`None`) field types, optional and proxied references are rejected, deep copies follow parent links, dates with metadata cannot be copied, nested objects with an absent metadata field cannot be constructed, importing `Asset` first is a circular import, and CDM's `PriceQuantityTriangulation` condition fails; runtime workarounds for all but the last *(added 2026-10-17, extended the same day)* | Python distribution | `finos-cdm` 7.7.0 on PyPI: `finos/_bundle.py` (generated by github.com/finos/rune-python-generator, packaged in github.com/finos/common-domain-model `python/`); `rune.runtime` 2.2.2 (github.com/finos/rune-python-runtime): `metadata.py`, `base_data_class.py` | not applicable |
| D15 | Rune Python generator 10.15.1.0 produces Python that differs from the Rune semantics in eleven ways (pre-conditions before aliases, nested `set`, list wrapping and flattening, `add` on absent lists, missing imports, closures inside `extract`, `set` writing through to the caller's object, `empty` as `[]`, `if` without `else` returning `True`, bundle class names in standalone modules) *(added 2026-10-17, extended the same day)* | code generator | github.com/finos/rune-python-generator release 10.15.1.0; list in `cdm-ext/README.md` | not applicable |
| D16 | The CDM 7.7.0 Python package and CDM Java write choice-type values (`Asset`, `Instrument`, `Transfer`) differently in Rune JSON; Python reads the Java and documented form as an empty value without an error *(added 2026-10-18)* | Python distribution (serialisation) | `rune.runtime` 2.2.2 (github.com/finos/rune-python-runtime) and the generated choice classes; CDM `docs/serialization.md` and samples for the Java form | not applicable |
| D17 | `haircutPercentage` is described as the IM CSA Valuation Percentage (the share of value that counts) but subtracted as a haircut *(added 2026-11-03)* | calculation / docs | CDM 7.7.0 `rosetta/legaldocumentation-csa-type.rosetta` 148; `rosetta/legaldocumentation-csa-func.rosetta` 20, 27 | fixed (workaround) |
| D18 | `CloneEligibleCollateralWithChangedTreatment` writes the changed criterion and treatment into the first criterion of the schedule, whichever asset it was *(added 2026-11-06)* | function logic | CDM 7.7.0 `rosetta/product-collateral-func.rosetta` 9, 22–24 | fixed |
| D19 | Rune Java generator (rune-maven-plugin 10.15.1): `distinct` on an alias of extracted values generates Java that does not compile *(added 2026-11-06)* | toolchain | `cdm-ext/rosetta/cdmx-collateral-amendment-func.rosetta`, condition `DistinctAssets` | fixed (workaround) |
| D20 | `Qualify_Reprice` cannot be true for a repo whose lot holds both the cash and the security: `ExtractTradePurchasePrice` and `ExtractTradeCollateralQuantity` read the same list of all quantities, and the qualifier requires that list both to differ and to match (`Qualify_Adjustment` has the same contradiction in the opposite direction) *(added 2026-11-08)* | qualification | CDM 7.7.0 `rosetta/event-qualification-func.rosetta` 592; `rosetta/event-common-func.rosetta` | fixed |
| D21 | `Create_AdjustmentPrimitiveInstruction` writes the new securities quantity into every quantity of the lot, so a repo's cash quantity becomes the number of securities *(added 2026-11-08)* | function logic | CDM 7.7.0 `rosetta/event-common-func.rosetta` 1843 | fixed |
| D22 | `Qualify_Substitution` cannot be true during a repo's term, and the quantity change of `Create_SubstitutionPrimitiveInstruction` leaves the old security as the lot's `observable` *(added 2026-11-08)* | qualification, function logic | CDM 7.7.0 `rosetta/event-qualification-func.rosetta` 821; `rosetta/product-common-settlement-func.rosetta` 35 | fixed |
| D23 | `Create_RollPrimitiveInstruction` gives the closing leg of a roll the new termination date instead of the roll date *(added 2026-11-08)* | event | `rosetta/event-common-func.rosetta` 1466; `functions/repo-and-bond/roll-output.json` | not fixed, no effect |
| D24 | `Create_PairOffInstruction` builds instructions with both a `before` trade state and an `execution`, which CDM's `Instruction` condition `NewTrade` forbids, so every pair-off event fails CDM's own validation, CDM's sample output included; it also only tags the trades with a package and settles nothing *(added 2026-11-10)* | event / validation | `rosetta/event-common-func.rosetta` 1656; `rosetta/event-common-type.rosetta` 41; `functions/repo-and-bond/pair-off-output.json` | fixed |
| D25 | CDM's repurchase event from `ResolveRepurchaseTransferInstruction` fails `Qualify_Repurchase`, which requires a transfer primitive the event does not have *(added 2026-11-11)* | qualification | CDM 7.7.0 `rosetta/event-common-func.rosetta` 1430; `rosetta/event-qualification-func.rosetta` 637 | not fixed |
| D26 | CDM's securities lending return settlement workflow (`RunReturnSettlementWorkflow`) builds the return event with no `instruction`, so no event qualification can hold for it; every step of CDM's three lending settlement workflows fails CDM validation on CDM's own samples, and only the execution step qualifies *(added 2026-11-11)* | event / qualification / validation | `cdm.security.lending.functions.SettlementFunctionHelper`; `functions/sec-lending/full-return-settlement-workflow-func-output.json`, `part-return-settlement-workflow-func-output.json`, `new-settlement-workflow-func-output.json` | fixed (workaround) |
| D27 | `ResolveSecurityFinanceBillingAmount` reads the lending fee from an `InterestRatePayout` and the lent security from the collateral path, and CDM's own lending trade has neither, so every billing record of CDM's invoice sample has no amount and the invoice has no `billingSummary`, which is required; `Create_BillingSummary` is a `codeImplementation` function with no implementation, so it returns nothing *(added 2026-11-11)* | function / sample | `rosetta/event-common-func.rosetta` 1254–1345; `functions/sec-lending/create-security-lending-invoice-func-output.json` | fixed |
| D28 | `LegalAgreement`'s condition `AgreementVerification` checks the agreement type for security, credit support, collateral transfer and master agreement schedule elections, but not for `masterAgreementElections`, so a GMSLA (or GMRA or ISDA) election block under a legal agreement of any type validates *(added 2026-11-11)* | validation | `rosetta/legaldocumentation-common-type.rosetta` 78–88 | fixed |
| D29 | `SecurityFinanceCashSettlementAmount` returns a transfer whose payer and receiver are the reverse of the `PayerReceiver` it is given, and it values the loan only at the trade's own price, with no price input *(added 2026-11-11)* | function | `SecurityFinanceCashSettlementAmount` (cdm-java 7.7.0, `cdm.event.common.functions`) | fixed |
| D30 | `CheckCriteria` has no case for an `AssetIdentifier` criterion, which `CollateralCriteria` offers: its switch falls to `default False`, so `CheckEligibilityByDetails` never finds an ISIN-identified asset eligible and a concentration check built on it applies no limit to one *(added 2026-11-12)* | function | `cdm/rosetta/product-collateral-func.rosetta` 80–119 (cdm-java 7.7.0); `product-collateral-type.rosetta` 215–230 | fixed |

## In this repository

CDM is used as published and never edited. A defect counts as **fixed** when the local extension
[`cdm-ext`](../../cdm-ext/) has a corrected function or type, or the prototype works around the defect so that it no
longer affects results. It is **not fixed** when it still affects the prototype or is only documented here; **not
fixed, no effect** means the prototype was checked and does not hit it, but nothing avoids it on purpose. **Not
applicable** marks defects of the Python build, retired on 2026-10-18 (`wp-adr-java-cdm-stack`, gap G39).

Counts (2026-11-13): **16 fixed** (3 of them by a workaround), **11 not fixed** (3 of them with no effect on the
prototype), **3 not applicable**.

| ID | In this repository | How |
|---|---|---|
| D1 | fixed | `CorrectedPostedCreditSupportItemAmount` reads `additionalHaircutPercentage`; the corrected delivery, return and undisputed amounts build on it (`cdmx-collateral-valuation-func.rosetta`, gap G7) |
| D2 | fixed | `RepoPurchasePriceForMarketValue` divides the market value by the Margin Ratio; repo margin maintenance uses it (`cdmx-collateral-repo-margin-func.rosetta`) |
| D3 | not fixed | In CDM's own repo sample and documentation; the prototype does not read them (gap G31) |
| D4 | fixed | `Qualify_GmslaReturn` qualifies a loan return (`cdmx-collateral-gmsla-loan-func.rosetta`) |
| D5 | fixed | `Qualify_CollateralSubstituted` replaces `Qualify_Substitution` for CSA collateral (`cdmx-collateral-substitution-func.rosetta`) |
| D6 | not fixed | In CDM's own repo sample; the prototype's repo booking (`CdmRepo`) fills the fields the sample leaves empty (gap G31) |
| D7 | not fixed, no effect | Every repo the prototype builds has one `InterestRatePayout` and qualifies (checked 2026-11-10 and 2026-11-11, gap G30) |
| D8 | not fixed | No rating check in `cdm-ext`; the prototype's eligibility schedules use ISIN criteria and its ratings stay off-chain (gap G11) |
| D9 | not fixed | Naming; renaming needs a CDM change (gap G32) |
| D10 | not fixed | Naming (gap G32) |
| D11 | not fixed | Naming (gap G32) |
| D12 | not fixed | Text (gap G32) |
| D13 | not fixed, no effect | Concerns CDM's own event samples. The prototype's reprice and adjustment are qualified by `RepoIsReprice` and `RepoIsAdjustment` (D20) and its roll by CDM's `Qualify_Roll` |
| D14 | not applicable | Python build retired |
| D15 | not applicable | Python build retired |
| D16 | not applicable | Python build retired; only the Java form of Rune JSON is used |
| D17 | fixed (workaround) | `cdm-ext` keeps CDM's subtractive formula and its callers pass the haircut, 1 less the Valuation Percentage; CDM's description stays wrong |
| D18 | fixed | `ApplyHaircutChanges` changes the criterion that matches by `AssetIdentifier` (`cdmx-collateral-amendment-func.rosetta`) |
| D19 | fixed (workaround) | The Rune writes the expression out in place of `distinct` on an alias (`cdmx-collateral-amendment-func.rosetta`) |
| D20 | fixed | `RepoIsReprice` and `RepoIsAdjustment`, and for triparty `RepoIsCollateralTopUp` and `RepoIsCollateralRelease` (`cdmx-collateral-repo-margin-func.rosetta`) |
| D21 | fixed | `RepoAdjustmentInstruction` changes only the securities' quantity (`cdmx-collateral-repo-margin-func.rosetta`) |
| D22 | fixed | `RepoIsSubstitution`; the prototype reads the current security from the collateral portfolio (`CdmRepo`, `CdmLoanSubstitution`) |
| D23 | not fixed, no effect | CDM's function is used unchanged; the wrong date on the closing leg does not change the resulting trade states |
| D24 | fixed | `RepoPairOffEvent`, `RepoIsPairOff` and `RepoPairOffNetAmount` (`cdmx-collateral-repo-pairoff-func.rosetta`) |
| D25 | not fixed | No local repurchase qualifier: the repurchase and triparty trade-end events are CDM's, unqualified (`CdmTripartyTradeEndTest` asserts it). Settlement is unaffected |
| D26 | fixed (workaround) | CDM's lending settlement workflows are not used; return events are built with `Create_BusinessEvent` with the instruction set, and qualified by `Qualify_GmslaReturn` |
| D27 | fixed | Lending fee billing and `GmslaInvoiceTotal` (`cdmx-collateral-gmsla-invoice-func.rosetta`); the prototype builds the summary itself (`CdmLoanInvoice`) |
| D28 | fixed | `GmslaTerms` condition `IsGmsla` (`cdmx-collateral-gmsla-type.rosetta`) |
| D29 | fixed | `GmslaLoanRequirement` computes the marked requirement; CDM's function is not used for marking (`cdmx-collateral-gmsla-mark-func.rosetta`) |
| D30 | fixed | `ProfileCriterion`, `TripartyConcentrationBreaches` and `HaircutFor` match criteria by ISIN (`cdmx-collateral-triparty-func.rosetta`) |

## Details

### D1 — Additional haircut reads the FX haircut field

- [`rosetta/legaldocumentation-csa-func.rosetta` line 24][d1a]: in `PostedCreditSupportItemAmount`,
  `alias additionalHaircutPercentage: postedItem -> fxHaircutPercentage`.
- [Line 27][d1b] subtracts `haircutPercentage + fxHaircutPercentage + additionalHaircutPercentage`.
- `PostedCreditSupportItem` has a separate `additionalHaircutPercentage` attribute
  ([`rosetta/legaldocumentation-csa-type.rosetta` line 150][d1c]).
- **Effect:** the FX haircut is subtracted twice; the additional haircut is ignored. Still present on `master`
  `40ce355` (2026-10-15).
- **Fix:** `alias additionalHaircutPercentage: postedItem -> additionalHaircutPercentage`.

[d1a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/legaldocumentation-csa-func.rosetta#L24
[d1b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/legaldocumentation-csa-func.rosetta#L27
[d1c]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/legaldocumentation-csa-type.rosetta#L150

### D2 — Margin ratio direction is inconsistent

- [`rosetta/product-collateral-type.rosetta` lines 69–73][d2a]: `marginPercentage` is GMRA 2(bb) Margin Ratio, market
  value of the securities ÷ purchase price; "a 104% requirement would be represented as … 1.04".
  [Line 82][d2b]: condition `marginPercentage >= 1`.
- [`rosetta/event-common-func.rosetta` lines 838–842][d2c]: in `SecurityFinanceCashSettlementAmount`, when a haircut is
  given, `marginRatio = 1 / (1.0 - haircut)`.
- [Line 854][d2d]: cash = `securityPrice × securityQuantity × marginRatio`. The same multiplication is in the billing
  function at [lines 1314–1322][d2e].
- **Effect (inference):** under the GMRA definition, purchase price = market value ÷ margin ratio. Multiplying by a
  ratio ≥ 1, or by 1/(1 − h), produces cash **above** the market value of the securities.
- **Fix:** divide by the margin ratio, or redefine the attribute; confirm with the ICMA working group.

[d2a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-collateral-type.rosetta#L69-L73
[d2b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-collateral-type.rosetta#L82
[d2c]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-common-func.rosetta#L838-L842
[d2d]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-common-func.rosetta#L854
[d2e]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-common-func.rosetta#L1314-L1322

### D3 — Samples and documentation violate the model's conditions

- [`functions/repo-and-bond/repo-execution-func-input.json` line 140][d3a]: `"marginPercentage" : 0.99`, described in
  the accompanying `.md` as a 1% haircut. This violates `marginPercentage >= 1`
  ([`rosetta/product-collateral-type.rosetta` line 82][d2b]).
- [`docs/repurchase-agreement-representation.md` line 221][d3b]: `"haircutPercentage" : 2`. This violates
  `haircutPercentage < 1` ([`rosetta/product-collateral-type.rosetta` line 79][d3c]).

[d3a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/resources/functions/repo-and-bond/repo-execution-func-input.json#L140
[d3b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/docs/repurchase-agreement-representation.md#L221
[d3c]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-collateral-type.rosetta#L79

### D4 — Full return and termination qualifications collide

- [`Qualify_FullReturn`, `rosetta/event-qualification-func.rosetta` lines 215–240][d4a] and
  [`Qualify_Termination`, lines 841–861][d4b] both accept an event with no intent, a single quantity-change primitive,
  remaining quantity zero and state `Terminated`.
- **Effect:** the expected outputs `functions/sec-lending/full-return-settlement-workflow-func-output.json` and
  `part-return-settlement-workflow-func-output.json` carry no `eventQualifier`.
- **CDM issue:** [#5109](https://github.com/finos/common-domain-model/issues/5109), open; fixed on the 8.x line in
  PR #5241 (2026-10-01) and reopened for backport to 6.x and 7.x. The maintainers add that `Qualify_FullReturn`
  looks for the `AssetPayout` on the collateral path, which is wrong for securities lending.
- Observed 2026-11-11 on loans in the prototype's shape (task-gmsla-loan-delivery-return), each return built with
  `Create_BusinessEvent` over a quantity-change instruction:
  - Against non-cash collateral, whose position carries an `AssetPayout`, a full return qualifies as both `FullReturn`
    and `Termination`. This is the collision itself.
  - Against cash collateral it qualifies only as `Termination`. `AssetPayoutUnderlierNotCash` forbids cash as an
    `AssetPayout` underlier, so the collateral path never holds an `AssetPayout` and `Qualify_FullReturn` cannot hold.
  - A partial return qualifies as `PartialTermination` against either kind.

[d4a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta#L215-L240
[d4b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta#L841-L861

### D5 — Collateral substitution is qualified as renegotiation

- [`Qualify_Substitution`, `rosetta/event-qualification-func.rosetta` lines 821–839][d5a] requires a changed `payout`
  and the new trade's effective date to equal the old termination date.
- [`Create_SubstitutionInstruction`, `rosetta/event-common-func.rosetta` lines 1947–1963][d5b] changes only
  `collateralPortfolio` and the effective date; the event built by `Create_SubstitutionPrimitiveInstruction`
  ([line 1919][d5c]: terms change + quantity change) matches
  [`Qualify_Renegotiation`, lines 573–591][d5d].
- **Effect:** [`functions/repo-and-bond/repo-substitution-output.json` line 419][d5e]:
  `"eventQualifier" : "Renegotiation"`.

[d5a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta#L821-L839
[d5b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-common-func.rosetta#L1947-L1963
[d5c]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-common-func.rosetta#L1919
[d5d]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta#L573-L591
[d5e]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/resources/functions/repo-and-bond/repo-substitution-output.json#L419

### D6 — Repo sample leaves mandatory eligibility fields empty

- [`functions/repo-and-bond/repo-execution-func-input.json` lines 136–140][d6a]: `eligibleCollateral` holds only
  `treatment.valuationTreatment.marginPercentage`.
- Missing: `collateralCriteria` (1..1, [`rosetta/product-collateral-type.rosetta` line 113][d6b]) and
  `treatment.isIncluded` (1..1, [line 151][d6c]).
- Line 136 sets `"collateralType" : "Cash"` for a repo collateralised by a bond.
- Whether model validation reports the missing attributes in the test run was not checked.

[d6a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/resources/functions/repo-and-bond/repo-execution-func-input.json#L136-L140
[d6b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-collateral-type.rosetta#L113
[d6c]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-collateral-type.rosetta#L151

### D7 — Repo qualification accepts only one interest payout

- [`rosetta/product-qualification-func.rosetta` line 1793][d7a] (`Qualify_RepurchaseAgreement`) and
  [line 1806][d7b] (`Qualify_BuySellBack`): `economicTerms -> payout only-element as InterestRatePayout exists`.
- **Effect:** repos with coupon, dividend or ad-hoc interest legs are not qualified. *(Inference)*
  `Create_OnDemandInterestPaymentPrimitiveInstruction` adds a payout leg, so its after-trade may fail qualification.
- **CDM issue:** [#4692](https://github.com/finos/common-domain-model/issues/4692), open (ICMA, 2026-05-07), proposes
  removing `only-element`.
- **Checked against the prototype (2026-11-10, gap G30):** a temporary test over the collateral service's repo events
  (`services/collateral` `CdmRepo`: book, interim interest once and twice, reprice, adjust, substitute, roll, interim
  interest then roll) found one payout, an `InterestRatePayout`, on every resulting trade, and
  `Qualify_RepurchaseAgreement` true for each. `Create_OnDemandInterestPaymentPrimitiveInstruction` records the payment
  in the trade's transfer history and adds no payout leg, so the inference above does not hold for it. Repos with
  coupon, dividend or other payout legs were not tested; the prototype books none.

[d7a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-qualification-func.rosetta#L1793
[d7b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-qualification-func.rosetta#L1806

### D8 — Rating check is text equality

- [`CheckAgencyRating`, `rosetta/product-collateral-func.rosetta` lines 137–155][d8a] keeps a criterion when
  `creditNotation -> notation = query -> agencyRating -> creditNotation -> notation` and the reference agency matches.
- It does not use `AgencyRatingCriteria.boundary` (minimum / maximum) or `mismatchResolution`
  ([`rosetta/product-collateral-type.rosetta` line 51][d8b]).
- **Effect:** a criterion "minimum A-" matches an asset rated `A-` but not one rated `AA`. Related modelling gap:
  ratings have no scale or order (finding TX3).

[d8a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-collateral-func.rosetta#L137-L155
[d8b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/product-collateral-type.rosetta#L51

### D9–D12 — Naming and text

- **D9** [`rosetta/base-staticdata-asset-common-enum.rosetta` line 539][d9]: `US_CTFC_PRType10` (gold); the other 12
  values of `US_CFTC_PR_EligibleCollateralEnum` are spelt `US_CFTC_PR…`.
- **D10** [`rosetta/event-common-enum.rosetta` line 95][d10]: `MarginCallResponseTypeEnum.AgreeinFull`.
- **D11** attribute `identifer`: [`rosetta/legaldocumentation-master-type.rosetta` line 13][d11a]
  (`MasterAgreementClause`, mandatory), [`rosetta/event-position-type.rosetta` lines 77][d11b] and [83][d11c].
- **D12** [`rosetta/legaldocumentation-csa-enum.rosetta`][d12]: literal `\t` in the descriptions of `DE_MUNI`
  (line 100, "Kommunalschuldverschreib\tungen") and `US_DOW_TRAN` (line 220); "Trésor" appears as "Trsor" in
  `FR_BDT`, `FR_BTAN`, `FR_BTF`, `FR_OAT` (lines 125–128).

Renaming D9–D11 is a breaking change for serialised data.

[d9]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/base-staticdata-asset-common-enum.rosetta#L539
[d10]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-common-enum.rosetta#L95
[d11a]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/legaldocumentation-master-type.rosetta#L13
[d11b]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-position-type.rosetta#L77
[d11c]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/event-position-type.rosetta#L83
[d12]: https://github.com/finos/common-domain-model/blob/f685b4b45d8faa419425c018a52af66f40e43c0b/rosetta-source/src/main/rosetta/legaldocumentation-csa-enum.rosetta#L100

### D13 — Event samples without a qualifier *(cause not confirmed)*

The expected outputs `repo-reprice-output.json`, `repo-adjustment-output.json`, `roll-output.json`,
`partial-delivery-output.json`, `shaping-output.json`, `on-demand-interest-payment-output.json` and
`clearing-via-novation-output.json` in `functions/repo-and-bond/` carry no `eventQualifier`, although qualification
functions exist for these events (`Qualify_Reprice`, `Qualify_Adjustment`, `Qualify_Roll`, `Qualify_PartialDelivery`,
`Qualify_Shaping`, `Qualify_ClearedTrade`). The cause was not investigated; the outputs are what the test harness
expects at 7.6.0.

### D14 — CDM 7.7.0 Python package: asset types and nested construction *(added 2026-10-17)*

*Since 2026-10-18 the project runs CDM on Java (`wp-adr-java-cdm-stack`); D14–D16 no longer affect it. The
workaround module and the Python tests named below are at commit `e1a2e6f` (`cdm-ext/tests/`, `cdm-ext/build.sh`).*

Found while testing the local extension (`cdm-ext/`, `task-cdm-gap-closure`). Package `finos-cdm` 7.7.0 from PyPI
with `rune.runtime` 2.2.2 and pydantic 2.14.1; each case reproduced in a clean environment without the extension.
Workarounds are in the extension's runtime module `cdm-ext/tests/cdm_runtime.py` (decision
`nw-cdm-python-workarounds`); they work on the published package unchanged. Repositories: generator
github.com/finos/rune-python-generator (produces `_bundle.py`), runtime github.com/finos/rune-python-runtime
(`rune.runtime`), packaging github.com/finos/common-domain-model `python/`. Whether newer releases fix any case was
not checked. Gap G39.

| Case | Cause (observed) | Workaround |
|---|---|---|
| `from finos.cdm.base.staticdata.asset.common.Asset import Asset` as the first CDM import: "cannot import name 'Asset' from partially initialized module" | Circular import inside the package | Import `finos._bundle` first |
| Deserialising a type that contains another fails with "Input should be None": `Instrument.Security.identifier` inside `Asset`, `callIdentifier.assignedIdentifier` inside `MarginCallIssuance`, the asset inside `CollateralPosition` and `TransferState`. The inner type alone loads | `_bundle.py` defines classes with placeholder field types (`None`), sets the real types afterwards and rebuilds classes one by one. Pydantic reuses the cached schema of a nested class and the definitions it carries; CDM's types are recursive, so definitions built from the placeholders survive in the enclosing schemas. Rebuilding classes in any order does not remove them | Discard the cached schemas of all 690 classes, then rebuild them all (`rebuild_all`, about 5 s at start-up) |
| `Cash` inside `Asset`: `NameError: name 'CurrencyCodeEnum' is not defined` | Same placeholder mechanism | Fixed by the same rebuild |
| An absent optional reference (`PartyReferencePayerReceiver.payerAccountReference`) fails `validate_model`: "Expected either ... Account or dict but got NoneType" | `validate_model` revalidates every field (`revalidate_instances='always'`); the reference validator in `rune.runtime` (`ComplexTypeMetaDataMixin.deserialize`) does not accept `None` | Validator wrapped to pass `None` through |
| A reference set inside a generated function (`payerPartyReference: payer`) fails: "got ... _COWObject" | The same validator does not unwrap the copy-on-write proxies that generated functions pass | Validator wrapped to unwrap proxies |
| Applying a step to a state held inside an event took 114 s, then 236 s, then failed with `RecursionError` | `rune.runtime` keeps each object's parent in its `__dict__`; `copy.deepcopy` of a child (copy-on-write, `rune_unwrap`) copies the parent and the whole enclosing tree, and through an event's `before` state every earlier event | `BaseDataClass.__deepcopy__` replaced: copies the object and its children, keeps the parent link to the original parent. A step now takes 0.1 s or less |
| `copy.deepcopy` of a date with metadata (`AdjustableOrAdjustedOrRelativeDate.adjustedDate`): "DateWithMeta can be instantiated only with ... date, str ... however the value is of type bytes" | `datetime.date` pickles its value as bytes | `__deepcopy__` for `DateWithMeta`, `DateTimeWithMeta`, `TimeWithMeta` that rebuilds from ISO text |
| Constructing a `NonNegativeQuantitySchedule` whose unit is not a currency fails in the metadata validator (`'NoneType' object has no attribute '_init_meta'`), also inside generated functions; `model_dump_json` fails the same way | `rune.runtime`'s metadata check receives `None` for absent metadata fields; it re-enables itself after every `validate_model` | Check switched off for the process |
| `rune_deserialize` of a dict removes its `@data` entries from the caller's dict | The validators for values with metadata (`BasicTypeMetaDataMixin.deserialize`, `EnumWithMetaMixin.deserialize` in `rune.runtime`'s `metadata.py`) pop `@data` from their input | Test data passed as JSON text |
| `rune_serialize` of a `CollateralEvent` with transfers fails: `PydanticSerializationError ... 'index_key' is expected to be an integer or a string, got 'SerializationInfo(...)'` | Not investigated | None yet; tests compare objects instead of serialising (found 2026-10-18) |
| CDM's `Now()` cannot be called | `Now` is declared `[codeImplementation]` (native); the Python package registers no implementation | Timestamps are inputs to the extension's functions (the ledger's block time) |
| CDM's own condition `PriceQuantity.PriceQuantityTriangulation` fails with "'_COWObject' object is not iterable" for any price quantity with a quantity, so CDM's full validation of any `CollateralPosition` fails | The generated call passes the single `quantity` (0..1) to a function input that is a list, without wrapping it (the D15 list-wrapping case, in CDM's own generated code) | None yet. Tests run CDM's full validation where no `PriceQuantity` occurs (transfers, issued call) and the extension's own conditions elsewhere |

With these workarounds a `CollateralPosition` carries its asset and a margin call settlement produces CDM
`TransferState` objects that pass all of CDM's conditions. Not reported to FINOS (project owner's instruction). The
repository's Python test (`python/test/test_import_trade_state.py`) only checks that `TradeState` imports.

### D15 — Rune Python generator 10.15.1.0: generated Python differs from Rune semantics *(added 2026-10-17)*

Found while generating the local extension's margin call lifecycle and events (`cdm-ext/`). Each case and the way
the Rune is written around it is listed in [`../../cdm-ext/README.md`](../../cdm-ext/README.md) § Rune Python
generator. The cases that change results silently (pre-conditions evaluated before aliases are assigned; `set x: y`
followed by `set x -> attribute` writing through to the caller's `y`; `if` without `else` returning `True`) are
covered by tests. Repository: github.com/finos/rune-python-generator; whether a newer release fixes any case was not
checked. Gap G39. Not reported (project owner's instruction).

### D16 — Choice types: Python and Java Rune JSON differ *(added 2026-10-18)*

Found in the Java spike (`cdm-ext/java/`, `cdm-ext/README.md` § Java build). CDM 7.7.0's Java mapper
(`RuneJsonObjectMapper`) and CDM's own samples (for example
`rosetta-source/src/main/resources/functions/business-event/contract-formation/contract-formation-swaption-func-input.json`)
write a choice value as the chosen option with its `@type`:

```json
"asset": { "@type": "cdm.base.staticdata.asset.common.Security", "identifier": [ ... ], "assetType": "Security", "securityType": "Debt" }
```

The Python package (`finos-cdm` 7.7.0, `rune.runtime` 2.2.2) writes and expects one key per choice level:

```json
"asset": { "Instrument": { "Security": { "identifier": [ ... ], "assetType": "Security", "securityType": "Debt" } } }
```

Observed: Java rejects the Python form ("Missing required '@type' metadata property"); Python accepts the Java form
and builds an `Asset` (or `Transfer`) with every option empty, without an error, and serialises it as `{}`. A
settled `CollateralEvent` written by Java and read by Python therefore loses its transfers' content and the assets
of its positions. Not reported (project owner's instruction); listed for the maintainers.

### D17 — Valuation Percentage is subtracted as a haircut *(added 2026-11-03)*

Found while closing gap G7 (`cdm-ext/rosetta/cdmx-collateral-valuation-func.rosetta`). Lines refer to the Rune
sources in the CDM 7.7.0 Java jar (`cdm-java-7.7.0.jar`, `cdm/rosetta/`).

- `rosetta/legaldocumentation-csa-type.rosetta` line 148: `PostedCreditSupportItem -> haircutPercentage` is described
  as "Valuation Percentage means, for any item of Eligible Collateral (IM), the percentage specified in accordance
  with Paragraph 13". The type's own description (line 146) also names it the Valuation Percentage.
- `rosetta/legaldocumentation-csa-func.rosetta` lines 20 and 27: `PostedCreditSupportItemAmount` computes
  `cashOrSecurityValue * (1.00 - (haircutPercentage + fxHaircutPercentage + additionalHaircutPercentage))`, so the
  field is used as a haircut.
- Under the 2018 ISDA IM CSA, the Value of an item is its price multiplied by its Valuation Percentage: a Valuation
  Percentage is the share of the value that counts, for example 98% for a 2% haircut.
- **Effect:** a caller who passes the Valuation Percentage as described (0.98) gets 2% of the value. Callers get the
  right result only by passing 1 − Valuation Percentage, contrary to the description. `additionalHaircutPercentage`
  (line 150) is described as a haircut, so the three fields are summed with different meanings.
- **Fix:** either describe and name the field as a haircut (`1 − Valuation Percentage`), or keep the description and
  compute `cashOrSecurityValue * (haircutPercentage - fxHaircutPercentage - additionalHaircutPercentage)`. The second
  changes the results of existing callers.
- **Local extension:** `CorrectedPostedCreditSupportItemAmount` keeps CDM's subtractive formula; its callers pass the
  haircut. Gap G7. Not reported (project owner's instruction).

### D18 — Changing one criterion's treatment overwrites the first criterion *(added 2026-11-06)*

Found while building the amendment of agreement terms (`task-csa-amendment`). Lines refer to the Rune sources in the
CDM 7.7.0 Java jar (`cdm-java-7.7.0.jar`, `cdm/rosetta/`).

- `rosetta/product-collateral-func.rosetta` line 9: `CloneEligibleCollateralWithChangedTreatment` is described as
  creating "a new Eligible Collateral Specification based on an input specification but with one changed criteria and
  with one changed treatment".
- Lines 22–24: `set outputSpecification: inputSpecification`, then `set outputSpecification -> criteria -> treatment`
  and `set outputSpecification -> criteria -> collateralCriteria`. Nothing selects which criterion changes.
- Observed with CDM 7.7.0 Java (`AmendmentTest.cdmsCloneEligibleCollateralWithChangedTreatmentOverwritesTheFirstCriterion`):
  a schedule of tUST 2%, tMMF 4% and tUSD 0%, asked to change tMMF to 10%, comes back as tMMF 10%, tMMF 4%, tUSD 0%.
  The first criterion (tUST) is overwritten and tUST is no longer eligible.
- **Effect:** the function can be used safely only on a schedule with one criterion. An amendment of one haircut in a
  longer schedule removes another asset from the eligible collateral.
- **Fix:** select the criterion to change (for example the one whose `collateralCriteria` equals the given criteria) and
  replace only its treatment, or add the criterion when none matches.
- **Local extension:** `ApplyHaircutChanges` (`cdmx.collateral.amendment`) replaces the criterion whose
  `AssetIdentifier` matches and keeps its concentration limits. Not reported (project owner's instruction).

### D19 — `distinct` on an alias generates Java that does not compile *(added 2026-11-06)*

- In `ApplyHaircutChanges` the condition `(changedAssets then distinct then count) = changes count`, where
  `changedAssets` is the alias `changes extract asset`, generates
  `MapperC<AssetIdentifier> thenArg1 = distinctIgnoringPrecision(thenArg0)` with `thenArg0` of type
  `MapperC<? extends AssetIdentifier>`; javac rejects it ("inference variable T has incompatible equality
  constraints").
- Writing the expression out (`changes extract asset then distinct then count`) compiles.
- **Effect:** valid Rune that the validator accepts fails at Java compile time. Not reported (project owner's
  instruction).

### D20 — `Qualify_Reprice` cannot be true for a repo *(added 2026-11-08)*

- `Qualify_Reprice` requires `afterTradePurchasePrice <> beforeTradePurchasePrice` and
  `beforeTradeCollateralQuantity = afterTradeCollateralQuantity`.
- `ExtractTradePurchasePrice` and `ExtractTradeCollateralQuantity` have the same body: every `quantity` of the trade
  lot's `priceQuantity`, cash and security together. The two conditions therefore compare one list and contradict
  each other when the cash quantity changes.
- Observed: the event from `Create_RepricePrimitiveInstruction` over the prototype's repo, with a changed cash quantity
  and an unchanged security quantity, gives `Qualify_Reprice` = false.
- **Effect:** a reprice built with CDM's own instruction function is not qualified as a reprice. `cdm-ext`
  `RepoIsReprice` separates the cash and security quantities by price type (`wp-adr-repo-reprice`). It leaves out the
  check that the security price changed, because a repo repriced at its booking price can still change Purchase Price
  through the rounding up of the quantity. Not reported (project owner's instruction).
- `Qualify_Adjustment` requires `afterTradePurchasePrice = beforeTradePurchasePrice` and
  `beforeTradeCollateralQuantity <> afterTradeCollateralQuantity` over the same two extracts, so it has the same
  contradiction when the security quantity changes. `cdm-ext` `RepoIsAdjustment` is used instead (`wp-adr-repo-adjustment`).

### D21 — `Create_AdjustmentPrimitiveInstruction` overwrites the cash quantity *(added 2026-11-08)*

- The alias `changeQuantity` is every `quantity` of the lot's `priceQuantity`, with its value set to `newAssetQuantity`.
  `Create_RepricePrimitiveInstruction` filters to the interest-rate price quantity; this function has no filter.
- Observed: over the prototype's repo with Purchase Price 1,000,000, the function's replacement trade has Purchase Price
  10,737, the new number of securities.
- **Effect:** the function cannot adjust a repo whose lot holds both the cash and the security. `cdm-ext`
  `RepoAdjustmentInstruction` has the same shape, limited to the securities' price quantity (`wp-adr-repo-adjustment`).
  Not reported (project owner's instruction).

### D22 — Repo substitution: qualification and the lot's observable *(added 2026-11-08)*

- `Qualify_Substitution` requires the new effective date to equal the old termination date, and the new termination date
  to equal the old termination date, so the replacement trade would have no term. It also requires a changed payout, and
  `Create_SubstitutionInstruction` changes only the collateral portfolio.
- `Create_QuantityChange` copies `observable` unchanged through `UpdateAmountForEachMatchingQuantity`, so after a
  substitution the trade lot still names the old security.
- Observed: over the prototype's repo, `Qualify_Substitution` is false for the event `Create_SubstitutionPrimitiveInstruction`
  produces, and the lot keeps the old ISIN (`CdmRepoTest.cdmQualifySubstitutionIsFalseDuringTheTermDefectD22`).
- **Effect:** `cdm-ext` `RepoIsSubstitution` qualifies the event, and the prototype reads the current security from the
  collateral portfolio (`wp-adr-repo-substitution`). `Create_SubstitutionPrimitiveInstruction` itself is used unchanged.
  Not reported (project owner's instruction).

### D23 — Repo roll: the closing leg carries the new termination date *(added 2026-11-08)*

- `Create_RollPrimitiveInstruction` passes its `terminationDate` input, the new termination date, to
  `Create_TerminationInstruction` as the date of the termination of the existing trade. The existing trade closes on the
  effective roll date.
- Observed: CDM's sample `functions/repo-and-bond/roll-output.json` has `effectiveDate` 2021-03-25 on the closing leg of an
  event dated 2021-03-22. Over the prototype's repo the closing leg carries the new Repurchase Date
  (`CdmRepoTest.cdmClosingLegCarriesTheNewTerminationDateDefectD23`).
- **Effect:** none on the resulting trade states: changing that date in a document leaves the rebuilt trades unchanged. The
  prototype uses the function unchanged (`wp-adr-repo-roll`). Not reported (project owner's instruction).

### D24 — `Create_PairOffInstruction` fails CDM's own `Instruction` condition *(added 2026-11-10)*

- `Create_PairOffInstruction` (`event-common-func.rosetta` line 1656) sets `before` to each trade and an `execution`
  primitive that re-executes it with a package reference. `Instruction` condition `NewTrade` (`event-common-type.rosetta`
  line 41) requires `before` to be absent when an `execution` exists.
- `Qualify_PairOff` (`event-qualification-func.rosetta` line 417) compares the after trades with each instruction's
  `before`, so the instruction cannot drop `before` either.
- The function only adds the package reference: its description says the existing trades are not terminated, and no
  transfer or settlement follows. CDM's sample (`functions/repo-and-bond/pair-off.md`) pairs off one trade executed twice
  in the same direction.
- Observed 2026-11-10 with a temporary test: over two offsetting repos built by the collateral service (`CdmRepo`), and
  over CDM's own `pair-off-output.json`, CDM validation fails `NewTrade` on both instructions; `Qualify_PairOff` is true;
  both trades stay `Executed` with no transfers; each trade keeps one `InterestRatePayout` and qualifies as a repo (G30).
- **Effect:** the pair-off is built by a `cdm-ext` replacement instruction and qualified by its own qualifier
  (`wp-adr-repo-pair-off`). Not reported (project owner's instruction).

### D25 — CDM's repurchase event fails `Qualify_Repurchase` *(added 2026-11-11)*

- `ResolveRepurchaseTransferInstruction` (`event-common-func.rosetta` line 1430) gives the `Repurchase` intent and one
  `quantityChange` primitive that replaces every quantity with zero. It adds no `transfer` primitive.
- `Qualify_Repurchase` (`event-qualification-func.rosetta` line 637) requires
  `(primitiveInstruction -> quantityChange, primitiveInstruction -> transfer) only exists`: both a quantity change and a
  transfer on the one instruction.
- Observed 2026-11-11 with a temporary test over a repo and a buy/sell-back built by the collateral service (`CdmRepo`):
  the repurchase event from `ResolveRepurchaseTransferInstruction`, on the Repurchase Date and on an earlier date, passes
  CDM validation and closes the trade as `Terminated`, and `Qualify_Repurchase` is false. No CDM issue mentions
  `ResolveRepurchaseTransferInstruction`.
- **Effect:** every repurchase the prototype settles since `wp-adr-repo-purchase-repurchase` carries an event CDM does not
  qualify as a repurchase. The settlement is unaffected: the cash and securities are the prototype's own transfers.

### D26 — CDM's lending return event has no instruction *(added 2026-11-11)*

- `RunReturnSettlementWorkflow` (Java, `cdm.security.lending.functions`) gives the return step an event with only
  `eventDate` and `after`: no `instruction`. CDM's expected outputs `full-return-settlement-workflow-func-output.json` and
  `part-return-settlement-workflow-func-output.json` have the same shape.
- `Qualify_FullReturn` requires a `quantityChange` instruction, so it cannot hold for this event (D4 is a second reason:
  it looks for the `AssetPayout` on the collateral path). CDM has no partial return qualification, and
  `Qualify_PartialTermination` is false.
- Observed 2026-11-11 with a temporary test that ran CDM's three lending settlement workflows on CDM's own samples
  (`RunNewSettlementWorkflow`, `RunReturnSettlementWorkflow` full and part): every step fails CDM validation (for
  example `AssetPayoutSettlementCentreRequired`, `Security` without `assetType`, `ScheduledTransfer` without `asset` and
  `transferType`, `StateClosedStateExists` on the full return); the execution step qualifies as `Execution`; the return
  and the settlement steps qualify as no event (`FullReturn`, `Termination`, `PartialTermination`, `SecurityTransfer`,
  `Substitution` and `Reprice` all false). `Qualify_SecurityLending` holds for the trade. The workflows also need a
  `PostProcessor` binding that CDM's runtime module does not provide. No CDM issue mentions these functions.
- The cause is `Create_Return` itself (`event-common-func.rosetta` line 1392): it sets only the `after` trade state
  (through `Create_QuantityChange`) and the event date. On a loan that passes CDM validation (2026-11-11, task
  `task-gmsla-loan-delivery-return`) its partial return is valid and still qualifies as no event; the same quantity
  change as an instruction to `Create_BusinessEvent` qualifies as `PartialTermination`.

### D27 — CDM's lending invoice has no amounts *(added 2026-11-11)*

- `Create_BillingRecord` (`event-common-func.rosetta` line 1254) sets the record's transfer from
  `ResolveSecurityFinanceBillingAmount` (line 1280). That function reads the lending fee from
  `payout as InterestRatePayout only-element` and the securities from
  `collateral -> collateralPortfolio -> collateralPosition -> product ->> economicTerms -> payout as AssetPayout`.
- CDM's lending trade (the invoice sample input, and the trade `RunNewSettlementWorkflow` books) has one payout, the
  `AssetPayout` of the lent security, and cash collateral in the collateral portfolio: no `InterestRatePayout` and no
  `AssetPayout` on the collateral path.
- **Effect:** observed 2026-11-11 with the same temporary test: `Create_SecurityLendingInvoice` on CDM's sample gives
  three billing records whose transfer carries only a settlement date (no quantity, no payer or receiver), and no
  `billingSummary`, which `SecurityLendingInvoice` requires. CDM's expected output
  `create-security-lending-invoice-func-output.json` is the same. CDM issues #3640 and #3871 (closed) change lending fee
  and rebate rate types; neither covers this.
- **`Create_BillingSummary`** (added 2026-11-11, task-gmsla-rebate): it is a `codeImplementation` function, and CDM
  7.7.0's Java distribution has no implementation of it: called on the prototype's billing records, it returns
  nothing. Its comment describes the summary as the records' total. The prototype builds the summary itself, as a
  `ParentTotal` (`CdmLoanInvoice`, wp-adr-gmsla-rebate).

### D28 — A GMSLA election block validates under any agreement type *(added 2026-11-11)*

- `AgreementVerification` (`legaldocumentation-common-type.rosetta` lines 78–88) ties four of `Agreement`'s election
  blocks to an agreement type. `masterAgreementElections` (GMSLA, GMRA, ISDA Master Agreement) is not among them.
- Observed 2026-11-11 with a temporary test: a `LegalAgreement` with GMSLA elections and agreement type
  `SecurityAgreement` passes CDM validation; with type `MasterAgreement` and master agreement type `GMSLA` it passes
  too, as it should.
- **Effect:** none on the prototype, which builds the agreement type itself; a check in `cdm-ext` covers it.

### D29 — CDM's security finance settlement amount reverses payer and receiver *(added 2026-11-11)*

- `SecurityFinanceCashSettlementAmount(tradeState, date, quantity, payerReceiver)` returns a transfer of the
  quantity × the trade's price × its `marginPercentage`.
- Observed 2026-11-11 with a temporary test on loans in the prototype's shape (task-gmsla-marking):
  - Given payer Party2 (the borrower) and receiver Party1, the transfer's payer is BANK-A (Party1) and its receiver
    BANK-B. Given payer Party1, it is the reverse. The roles are swapped either way.
  - On a loan of 100,000 tMMF at 1.00 and margin 1.02, the amount is USD 102,000, against cash or tUST collateral
    alike; 40,000 shares give USD 40,800.
  - The function has no price input: it values the loan at the price booked in the trade, so it cannot mark a loan to
    a later price.
- **Effect:** the prototype does not use it for marking; `cdm-ext` computes the marked requirement.

### D30 — CDM's criteria check does not match an asset identified by ISIN *(added 2026-11-12)*

- `CollateralCriteria` (`product-collateral-type.rosetta` lines 215–230 in the cdm-java 7.7.0 jar) offers
  `AssetIdentifier`, "a specifically identified asset", as one of its criteria.
- `CheckCriteria` (`product-collateral-func.rosetta` lines 80–119) switches on the criterion type and has no case for
  `AssetIdentifier`; it falls to `default False`. `EligibilityQuery` has no asset identifier to compare with either.
- Observed 2026-11-12 with CDM 7.7.0 Java (`TripartyTermsTest.cdmsCriteriaCheckDoesNotMatchTheProfilesIsinCriteria`,
  task-triparty-terms-profile): a triparty profile of tUST at 2% and tAGY at 3% with a 50% limit on tAGY, both by ISIN;
  `cdm-ext`'s `ConcentrationLimitBreaches`, which checks each criterion with `CheckCriteria`, finds no breach for an
  allocation of 60% tAGY.
- **Effect:** a schedule or profile that names its assets by identifier (as the prototype's CSA schedule and triparty
  profile do) cannot be checked for eligibility or concentration with CDM's functions. `cdm-ext`'s `HaircutFor`
  matches the same criteria by identifier.
- **Fix:** add an `AssetIdentifier` case to `CheckCriteria` and an asset identifier to `EligibilityQuery`.
- **Local extension:** a per-ISIN concentration check in `cdm-ext` (task-triparty-trade-start, the project owner's choice
  of 2026-11-12): `cdmx.collateral.triparty` `ProfileCriterion` finds an asset's criterion by its ISIN, as `HaircutFor`
  does; `TripartyConcentrationBreaches` checks an allocation against the profile's limits and `AllocateTriparty` caps
  each limited asset at its limit (`TripartyAllocationTest.thePerIsinCheckFindsTheBreachCdmsCheckMisses` finds the 60%
  tAGY breach). Not reported (project owner's instruction).
