Skip to content

Validate template execution results - #144

Open
Rishabh060105 wants to merge 2 commits into
accordproject:mainfrom
Rishabh060105:Rishabh060105/validate-execution-result
Open

Validate template execution results#144
Rishabh060105 wants to merge 2 commits into
accordproject:mainfrom
Rishabh060105:Rishabh060105/validate-execution-result

Conversation

@Rishabh060105

@Rishabh060105 Rishabh060105 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Validate TemplateArchiveProcessor execution results

This PR adds the runtime validation requested in #135 so TypeScript template logic fails fast when it returns malformed execution output.

Changes

  • Validates the resolved TypeScript trigger() result before returning it:
    • result must be an object
    • state must be an object
    • events must be an array
  • Validates that the resolved TypeScript init() result contains a state object
  • Adds regression coverage for missing result, missing state, and non-array events
  • Merges the latest main and resolves the previous conflicts

Related issue

Validation

  • Targeted processor suite: 15 tests passed
  • Full npm test: 84 tests and 40 snapshots passed

Author checklist

  • DCO sign-off included
  • Tests added for the changed behavior
  • Commit messages follow the Accord Project format
  • No documentation update required

Signed-off-by: Rishabh Jain <rishabhj2005@email.com>
@Rishabh060105
Rishabh060105 requested a review from a team May 14, 2026 17:45
@Rishabh060105

Copy link
Copy Markdown
Contributor Author

Hi @mttrbrts , I reviewed the changes against the pointers provided in the original issue and updated the branch accordingly.

What changed

  • Added runtime validation in TemplateArchiveProcessor.trigger() so malformed execution output now fails fast instead of being returned unchecked
  • Added matching runtime validation in TemplateArchiveProcessor.init()
  • Covered the new behavior in the real TemplateArchiveProcessor test suite for:
    • missing result
    • missing state
    • non-array events

Validation

  • Ran the targeted processor suite:
    • node --experimental-vm-modules node_modules/jest-cli/bin/jest.js test/TemplateArchiveProcessor.test.ts --runInBand
  • Ran the full repo test command:
    • npm test

@devanshi00

devanshi00 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Hey @Rishabh060105 , I think this is already covered in pr by @mttrbrts .
You can check this out here: f5fbfc2
If I miss something let me know. Otherwise I will close this pr.

Signed-off-by: Rishabh Jain <rishabhj2005@email.com>
@Rishabh060105

Rishabh060105 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Hey @devanshi00,. The PR(PR #166) validates the runtime class hierarchy, while this PR #144 validates the returned execution structure itself.

I’ve resolved all the conflicts, keeping only the missing TypeScript result-shape checks and their tests.It ensures required fields like result, state, and events are present and correctly shaped.

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.

2 participants