Skip to content

Instruction Composition Framework#4759

Open
SuperMonanana wants to merge 2 commits into
finos:masterfrom
TokenovateLtd:feature/instruction-composition-framework
Open

Instruction Composition Framework#4759
SuperMonanana wants to merge 2 commits into
finos:masterfrom
TokenovateLtd:feature/instruction-composition-framework

Conversation

@SuperMonanana
Copy link
Copy Markdown

Instruction Composition Framework

Background

The CDM Smart Contract Taskforce is introducing the Instruction Composition Model within the Common Domain Model (CDM). While the CDM has traditionally been declarative, defining what a lifecycle event is, it has not always defined how that event is operationally executed. This gap often forces institutions to implement their own procedural logic externally, increasing reconciliation risks and inconsistent interpretations. This release bridges that gap by establishing a modular, stateful, and deterministic framework to execute the sequential steps and intermediate computations of contractual workflows directly within the model. For further information, see issue #4165.

What is being released?

This release introduces the core architectural types, enums, and structural foundations for the Instruction Composition Framework within the new cdm.event.instructionComposition namespace.

Types

Changes that can be found in the cdm.event.instructionComposition namespace:

  • InstructionComposition: The root orchestrator representing a specific business process (e.g., an Interest Rate Reset). It maintains the ordered sequence of steps, tracks unique identifiers, links back to the underlying Trade, and hosts the final output
  • CompositionStep: Represents a single, atomic, and deterministic operational step within the workflow, capturing exactly when and how it was executed
  • CompositionStepInstruction & CompositionStepInstructions: Reusable containers that define the specific instructions and logic passed into each step
  • CompositionState: A persistent, cumulative state choice object that aggregates intermediate outputs across steps. This ensures complete traceability, auditability, and deterministic replay capabilities
  • InstructionCompositionOutput: Holds the definitive outcome of the completed process (e.g., the canonical CDM ResetInstruction) once all sequential steps have successfully executed

Enumerations

Changes that can be found in the cdm.event.instructionComposition namespace:

  • InstructionCompositionTypeEnum: Establishes the types of orchestrations supported. This release seeds the ResetInstruction type, which maps out the blueprint for the 8-step Interest Rate Reset process

Verification and Testing

As these represent foundational, new architectural data structures and namespaces, there are zero backward compatibility impacts on existing model logic or legacy lifecycle event processes.
Validation has focused on:

  • Rosetta compilation syntax verification for the new cdm.event.smartcontract namespace
  • Structural integrity of the InstructionComposition type conditional constraints

Review Directions

Navigate to the following paths to inspect the new models:

  • rosetta-source/src/main/rosetta/instructionComposition-type.rosetta to review the core types: InstructionComposition, CompositionStep, and CompositionState
  • rosetta-source/src/main/rosetta/instructionComposition-enum.rosetta to inspect the InstructionCompositionTypeEnum process mappings

@SuperMonanana SuperMonanana requested a review from a team as a code owner May 26, 2026 13:27
@netlify
Copy link
Copy Markdown

netlify Bot commented May 26, 2026

Deploy Preview for finos-cdm ready!

Name Link
🔨 Latest commit 932aa2e
🔍 Latest deploy log https://app.netlify.com/projects/finos-cdm/deploys/6a15a000a9770500082316f9
😎 Deploy Preview https://deploy-preview-4759--finos-cdm.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 26, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: SuperMonanana / name: Mengyan Li (932aa2e)
  • ✅ login: SuperMonanana / name: mengyan.li (5adb061)

@ReleaseManagement-BP
Copy link
Copy Markdown
Contributor

Hi @chrisisla @tomhealey-icma @llynhiavu, this is ready for review when you are able

Copy link
Copy Markdown
Contributor

@chrisisla chrisisla left a comment

Choose a reason for hiding this comment

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

Some comments and questions to get the ball rolling 🙂

compositionStep CompositionStep (1..*) <"Ordered sequence of CompositionSteps that drive the instruction composition process (atomic actions, calculations, validations).">
compositionState CompositionState (0..1) <"Shared state accumulated across executed steps, capturing intermediate and final outputs of the instruction composition process.">
instructionCompositionType InstructionCompositionTypeEnum (1..1) <"Type of Instruction Composition being orchestrated (e.g. ResetInstruction).">
instructionCompositionIdentifier string (1..1) <"Unique identifier of this InstructionComposition instance.">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this just be identifier?

instructionCompositionType InstructionCompositionTypeEnum (1..1) <"Type of Instruction Composition being orchestrated (e.g. ResetInstruction).">
instructionCompositionIdentifier string (1..1) <"Unique identifier of this InstructionComposition instance.">
tradeId TradeIdentifier (0..1) <"Identifier of the underlying trade to which this InstructionComposition relates.">
instructionCompositionOutput InstructionCompositionOutput (0..1) <"Outputs of each Instruction Composition process. The recording of this information will be done in a single step at the end of the process for each Instruction Composition.">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And this just output?

We're under InstructionComposition so we probably don't need to prefix these items with instructionComposition?

Copy link
Copy Markdown
Contributor

@lagarciath lagarciath May 29, 2026

Choose a reason for hiding this comment

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

I think that it is not allowed to set "output" as the name of an element. Should we leave it as it is then? @chrisisla

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah yes of course... shame but okay, lets leave as it is


import cdm.event.common.*

type InstructionComposition: <"Represents a instruction composition orchestration, holding data, shared history, and an ordered sequence of InstructionCompositionSteps.">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"...an instruction..."

Should it also read "CompositionSteps" and not "InstructionCompositionSteps"?

[rootType]
compositionStep CompositionStep (1..*) <"Ordered sequence of CompositionSteps that drive the instruction composition process (atomic actions, calculations, validations).">
compositionState CompositionState (0..1) <"Shared state accumulated across executed steps, capturing intermediate and final outputs of the instruction composition process.">
instructionCompositionType InstructionCompositionTypeEnum (1..1) <"Type of Instruction Composition being orchestrated (e.g. ResetInstruction).">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe rename this to compositionType to match the other elements e.g. compositionStep? Happy either way with this one, it's quite good to keep the full name on this enum... hmmm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In this case, I think that makes sense to keep it as it is because the type is liked to the "Instruction Composition"

type InstructionCompositionOutput: <"Records the relevant output of each Instruction Composition. Will be updated while executing the relevant steps of the Instruction Composition so at the end of the process the output should be completed and ready to use in other parts of the system.">
resetInstruction ResetInstruction (0..1) <"Defines the reset value or fixing value produced in cashflow calculations, during the life-cycle of a financial instrument. The reset process defined in Create_Reset function joins product definition details with observations to compute the reset value.">

choice CompositionState: <"A container that holds the cumulative state of a Instruction Composition. It selects the specific history/state schema (e.g., ResetInstructionState) based on the lifecycle process being executed."> No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"... an Instruction..."

So under here we'll have new xxxState types for each event that can be handled using the InstructionComposition? So for now it will just be ResetInstructionState but in the future we could have TransferInstructionState for example?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correct!

timestamp zonedDateTime (0..1) <"Date and time of the execution of the Instruction Composition step after being executed.">
compositionStepInstruction CompositionStepInstruction (1..1) <"Set of instructions defining the steps of each Instruction Composition process.">

type CompositionStepInstruction: <"Set of instructions defining the steps of each Instruction Composition process.">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I still struggling with this naming 😅 For me, this is a single instruction step as the name is singular and the contents of the type are all cardinality 1..1 and thus can only appear once.
But the descriptions all imply multiple instances of something "Set of instructions" and "List of all... compositionSteps..."
I would have expected CompositionStepInstructions to be a list of CompositionStepInstruction items, but it looks to be the other way around?

Copy link
Copy Markdown
Contributor

@lagarciath lagarciath May 29, 2026

Choose a reason for hiding this comment

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

The logic behind is:

  • Each InstructionComposition will have 1 or more CompositionSteps (to build the Reset we will follow an 8-step process)
  • Each CompositionStep is defined by an identifier, a timestamp and an (1) Instruction (CompositionStepInstruction)
  • The CompositionStepInstruction is defined by the InstructionCompoisitionType (we can have the same instruction for different Instruction Composition types) and the selection of one of the list of CompositionStepInstruction**s** (where we actually hold the info for the executing the step)
  • This CompositionStepInstruction**s** is the list of all the instruction steps

Does it make sense? @chrisisla

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay so CompositionStepInstructions will end up holding a list of the different instruction steps, which again I'm guessing will start to be added in the next PR?

What you have described above I think will be good to add to the documentation. I did think that maybe we could add an abbreviated version to the comments in the model but that may not be necessary.

Copy link
Copy Markdown
Contributor

@chrisisla chrisisla left a comment

Choose a reason for hiding this comment

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

I think this covers the initial framework and is pretty straightforward. The only things outstanding really are whether to change instructionCompositionIdentifier to just identifier (which it may not be worth doing as the other items are prefixed with the type/scope so why not keep them all this way for consistency), and then we need to make sure the use of InstructionComposition and it's associated types in this PR are well documented for the release notes and the documentation site 🙂

Happy to approve now and potentially revisit once the second PR is contributed, which will add some meat to the bones of the framework.

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.

Instruction Composition Framework Functions

4 participants