Skip to content

Ability to Compile schema and reuse parser - #1759

Open
hdalsania wants to merge 2 commits into
apache:mainfrom
ctc-oss:1273-ability-to-validate-the-schema
Open

Ability to Compile schema and reuse parser#1759
hdalsania wants to merge 2 commits into
apache:mainfrom
ctc-oss:1273-ability-to-validate-the-schema

Conversation

@hdalsania

@hdalsania hdalsania commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Closes #1273
Closes #615

Description

  • Added Compile Schemacommand, available from:
    • Command Palette
    • DFDL Command Explorer panel
    • Schema file context actions
  • Added/updated launch option Validate Schema Before Debug (launch key validateSchemaBeforeDebug) so debug launch can validate schema before session start
  • Implemented parser cache serialization and reload flow so debug can avoid repeated schema recompilation when inputs are unchanged
  • Added cache key coverage for:
    • Schema path
    • Schema last-modified timestamp and size
    • Root name/root namespace
    • Tunables
    • External variables
    • Build version
  • Added logging
  • Updated user documentation and release notes

Wiki

  • I have determined that no documentation updates are needed for these changes
  • I have added the following documentation for these changes
    - doc/Wiki.md
    - doc/Introduction-to-Daffodil-VS-Code-Extension.md
    - CHANGELOG.md

Review Instructions including Screenshots

  • Open a .dfdl.xsd schema in VS Code.
  • Open the Command Palette and confirm Daffodil Debug: Compile Schema is available.
  • Open the DFDL Command Explorer panel and confirm Compile Schema is available there as well.
  • Open the launch configuration wizard and confirm validateSchemaBeforeDebug is present.
  • Run Compile Schema on the schema and confirm it completes successfully.
  • Start a debug session with validateSchemaBeforeDebug enabled.
  • Start debug again without changing the schema, tunables, variables, or root settings.
  • Confirm the backend reuses the cached parser instead of recompiling.
image
  • Change one cache input, such as a variable or tunable, and run debug again.
  • Confirm the backend recompiles and refreshes the cache.
image
  • Verify the updated docs and changelog entries describe the new compile/debug workflow accurately.

Regression Testing

  • Verify existing debug and run flow works along with data editor and TDML functionality.
  • Confirm no existing command or launch config behavior was removed or broken.

@hdalsania hdalsania changed the title 1273 ability to validate the schema Ability to Compile schema and reuse parser Jul 28, 2026
@hdalsania hdalsania moved this to In Progress in daffodil-vscode v1.6.0 Jul 28, 2026
@hdalsania hdalsania added this to the 1.6.0 milestone Jul 28, 2026
@hdalsania
hdalsania requested a review from stricklandrbls July 28, 2026 01:34
…nfig option

Add schema compile/debug parser cache reuse functionality

update documentaion and changelog
@hdalsania
hdalsania force-pushed the 1273-ability-to-validate-the-schema branch from 7c6f901 to 97f9f5b Compare July 28, 2026 01:37
@hdalsania hdalsania moved this from In Progress to In Review in daffodil-vscode v1.6.0 Jul 28, 2026
@lrbarber

Copy link
Copy Markdown
Collaborator

How are the saved parsers managed? They seem to be accumulating in the folder. Are they EVER deleted?

@lrbarber

Copy link
Copy Markdown
Collaborator

When I compile a schema, then start debugging a different schema the daffodil-debugger.log includes the error message shown below. Have also duplicated the error when switching to from debugging one schema to another. The trigger seems to be that there is no saved parser for the second schema.

2026-07-29 10:21:43,920 [io-compute-blocker-18] WARN o.a.d.d.d.DAPCompiler - Failed to load cached parser from C:\Users\LARRY~1.BAR\AppData\Local\Temp\daffodil-vscode\saved-parsers\20263659ff7ec399d6993741e9a77a4550d460305c431dac4279d211ab4253bd.bin; recompiling
org.apache.daffodil.sapi.InvalidParserException: The saved parser was created with a different version of org.scala-lang.scala-library-2.13.18.jar with incompatible class: scala.collection.immutable.ArraySeq
at org.apache.daffodil.sapi.Compiler.reload(Daffodil.scala:218)
at org.apache.daffodil.debugger.dap.Support$.reloadDataProcessor(Support.scala:70)
at org.apache.daffodil.debugger.dap.Support$.$anonfun$loadCachedDataProcessor$1(Support.scala:39)
at println @ com.monovore.decline.effect.CommandIOApp$.addVersionFlag(CommandIOApp.scala:67)
at flatMap @ org.apache.daffodil.debugger.dap.DAPCompiler$$anon$1.compile(Compiler.scala:62)
at flatMap @ org.apache.daffodil.debugger.dap.Parse$.apply(Parse.scala:85)
at map @ org.apache.daffodil.debugger.dap.Parse$.apply(Parse.scala:83)
at flatMap @ org.apache.daffodil.debugger.dap.Parse$.apply(Parse.scala:83)
at println @ com.monovore.decline.effect.CommandIOApp$.addVersionFlag(CommandIOApp.scala:67)
at map @ org.apache.daffodil.debugger.dap.Parse$Debugee$LaunchArgs$Manual.data(Parse.scala:268)
at flatMap @ org.apache.daffodil.debugger.dap.Parse$.$anonfun$debugee$10(Parse.scala:709)

@hdalsania

Copy link
Copy Markdown
Collaborator Author

How are the saved parsers managed? They seem to be accumulating in the folder. Are they EVER deleted?

In the current flow, the saved parser is removed here if save-parser returns a nonzero exit code and the file was created, otherwise it rely on OS temp directory cleanup.

@hdalsania hdalsania moved this from In Review to In Progress in daffodil-vscode v1.6.0 Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Ability to validate the .dfdl.xsd schema file before starting debug operation Need a way to use pre-compiled DFDL schemas

2 participants