Skip to content

feat(runtime): validate logic payloads against Concerto models#164

Merged
mttrbrts merged 2 commits into
accordproject:mainfrom
23harshitkumar:feat/us07-runtime-validation
Jul 11, 2026
Merged

feat(runtime): validate logic payloads against Concerto models#164
mttrbrts merged 2 commits into
accordproject:mainfrom
23harshitkumar:feat/us07-runtime-validation

Conversation

@23harshitkumar

Copy link
Copy Markdown
Contributor

Description

This PR addresses the upstream engine requirements for US-07: Runtime Payload Validation Against Concerto Models. It ensures that any logic executed by the TemplateArchiveProcessor strictly adheres to the underlying Concerto models, both before and after execution.

Changes Made

  • Input Validation: Added Concerto Serializer to init() and trigger(). Payloads (data, request, state) are rigorously validated via serializer.fromJSON() before they are passed to the JavaScriptEvaluator.

  • Output Validation: Extracted result, state, and events from the evaluated response and validated them after execution to ensure the logic layer did not mutate them into an invalid schema.

  • Type Checking: Because we use serializer.fromJSON(), this guarantees that the $class discriminators strictly match the declared models in the ModelManager.

  • Testing: Added unit tests to TemplateArchiveProcessor.test.ts to verify that invalid payloads (e.g. missing required fields or having wrong data types) throw immediate, descriptive validation errors.

Note on cicero-core typing

I had to add a quick // @ts-ignore over the Script import in TemplateArchiveProcessor.ts. Recent version of cicero-core seems to have stopped publicly exporting the internal types/src/script path, so TypeScript couldn't find the type definition. I can open a small PR in cicero-core to export it from the root index so we can remove this ignore soon.

Related Issues

Related to template-playground #903

@23harshitkumar 23harshitkumar requested review from a team and Copilot July 10, 2026 20:24

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@23harshitkumar 23harshitkumar force-pushed the feat/us07-runtime-validation branch 3 times, most recently from bdf5ca6 to 587f007 Compare July 10, 2026 20:34
- Instantiates Concerto Serializer in init and trigger pipelines
- Validates data, request, and state inputs before logic execution
- Validates result, state, and events outputs after logic execution
- Adds unit tests to ensure invalid inputs are properly rejected

Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
@23harshitkumar 23harshitkumar force-pushed the feat/us07-runtime-validation branch from 587f007 to 1a99ce6 Compare July 10, 2026 20:38
Comment thread src/TemplateArchiveProcessor.ts
Comment thread test/TemplateArchiveProcessor.test.ts Outdated
…ailures

Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
@mttrbrts mttrbrts merged commit 4957b69 into accordproject:main Jul 11, 2026
9 checks passed
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