Skip to content

Conversation

@rockaxorb13
Copy link

Description

This PR fixes two regression issues in TemplateMarkInterpreter where missing or undefined data caused the engine to crash during generation. These issues were preventing the main branch from passing tests.

Issues Addressed

  1. Clause Crash: Previously, if a clause's source data was missing, the interpreter would delete the children but leave the Clause node itself in an invalid state (missing the required nodes array), causing a ValidationException.
  2. Variable Crash: If a variable's data was missing (e.g., No values found for path...), the interpreter would explicitly throw an Error, halting execution.

Changes

  • Updated TemplateMarkInterpreter.ts:
    • Modified generateAgreement to safely remove Clause, Conditional, and Optional nodes entirely if their required data is missing.
    • Modified generateAgreement to default missing Variable values to string 'null' instead of throwing a hard error.
  • Updated Snapshots: Updated the snapshots for TemplateArchiveProcessor and TemplateMarkInterpreter to reflect that missing data now results in empty output or placeholder text rather than a crash.

Verification

I have verified locally that npm test now passes all suites, including the regression tests that were failing on main.

PASS  test/TemplateMarkInterpreter.test.ts
PASS  test/TemplateArchiveProcessor.test.ts
...
Test Suites: 10 passed, 10 total
Tests:       50 passed, 50 total

Signed-off-by: Aadityavardhan Singh <singhrashmi018@gmail.com>
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.

1 participant