Skip to content

fix: align frontmatter parsing across runtimes - #603

Open
KSAGlory wants to merge 1 commit into
google:mainfrom
KSAGlory:ksaglory-fix-frontmatter-parsing
Open

KSAGlory wants to merge 1 commit into
google:mainfrom
KSAGlory:ksaglory-fix-frontmatter-parsing

Conversation

@KSAGlory

@KSAGlory KSAGlory commented Sep 6, 2026 •

Copy link
Copy Markdown

Summary

  • Return the full source as the body when a document has no frontmatter block.
  • Discard empty frontmatter delimiters in JavaScript and Go, including when the template body is empty.
  • Use Python's current frontmatter identification logic and preserve its validation behavior.
  • Document the optional frontmatter contract and add regression tests.

Testing

  • JavaScript: 317 tests passed with coverage; TypeScript checking passed on Node.js 24.
  • Python: 496 tests and 512 subtests passed on Python 3.12, including the parser validation tests.
  • Go: both dotprompt packages passed; go vet passed.
  • Formatting, import ordering, license headers, and git diff --check passed for the changed files.
  • ty passed for dotpromptz source and tests. Pyrefly passed for the changed files.

Testing limitations

The broader dotpromptz Pyrefly check reports three errors in unchanged upstream _dotprompt.py and _typing.py. The full CI platform/version matrix and complete scripts/lint pipeline were not run locally. The existing failed CLA result still needs a fresh check.

Fixes #495

@google-cla

google-cla Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added documentation Improvements or additions to documentation python dotpromptz js fix go labels Sep 6, 2026
@KSAGlory

KSAGlory commented Sep 9, 2026

Copy link
Copy Markdown
Author

@googlebot rescan

Preserve source text when frontmatter is absent and discard empty delimiters in JavaScript and Go. Adapt Python extraction to the current identify_frontmatter implementation while retaining its validation behavior.

Fixes google#495
@KSAGlory
KSAGlory force-pushed the ksaglory-fix-frontmatter-parsing branch from c3aa204 to b7b33b7 Compare October 12, 2026 09:06
@KSAGlory

Copy link
Copy Markdown
Author

@googlebot rescan

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

Labels

documentation Improvements or additions to documentation dotpromptz fix go js python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify empty response body behavior in parse tests

1 participant