Skip to content

fix: validate template data model in init and trigger - #223

Open
Dnyanesh-29 wants to merge 1 commit into
accordproject:mainfrom
Dnyanesh-29:codex/validate-template-data-d9a7499
Open

Dnyanesh-29 wants to merge 1 commit into
accordproject:mainfrom
Dnyanesh-29:codex/validate-template-data-d9a7499

Conversation

@Dnyanesh-29

Copy link
Copy Markdown
Contributor

Problem

Concerto validates the resource passed to TemplateArchiveProcessor.init() and trigger() against its declared $class. The processor also needs to check that this class is compatible with the archive's selected template model. Passing a valid GreetingRequest as template data previously let trigger() return Hello undefined. The same input is rejected by draft().

Changes

  • Check the deserialized resource's type against the archive's selected model before TypeScript execution or LLM dispatch.
  • Report the expected and actual model types on mismatch. Preserve Concerto's existing errors for malformed resources.
  • Cover directory loading, CTA reload, rejection before execution, valid subtypes, and absent data using the existing greeting fixture.

This extends the processor input validation introduced in #164 and follows the nominal type checks in #166.

Validation

  • npm test -- --maxWorkers=3 — 202 tests across 19 suites and 46 snapshots. The license check and TypeScript build passed. Full ESLint reported zero errors and eight warnings in generated files.
  • npm run test:e2e — all six Chromium tests passed.
  • Changed-file ESLint and git diff --check passed.

An earlier Jest run overlapped with a browser build that removed the worker artifact during testing. The complete suite passed after the worker was rebuilt. Jest reported a worker teardown warning in that rerun.

Compatibility

Valid template-model subtypes, null, and undefined retain their previous behavior. Supplied false, 0, and '' now receive Concerto's missing-$class error. When both template data and the request are invalid, the template-data error may surface first.

AI assistance

OpenAI Codex assisted with repository investigation, implementation, and testing.

Signed-off-by: Dnyanesh-29 <dnyaneshbharambe2006@gmail.com>
@Dnyanesh-29
Dnyanesh-29 requested review from a team and a balanced review from Copilot November 13, 2026 11:51

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 insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@mira-accord-project

Copy link
Copy Markdown
Contributor

Thank you for this, Dnyanesh. Validating the template data model in init and trigger is a useful safety check, and the change is small enough to review quickly. The requested reviewer, dselman, maintains this repository and will look at the PR in the usual way. Nothing else is needed from you for now.


Posted automatically by Mira, an Accord Project agent. A maintainer will follow up; they make the decisions on this.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants