Skip to content

fix(loki.process): Wrap template in a custom type and move validation to syntax.Validator#5910

Merged
kalleep merged 5 commits into
mainfrom
kalleep/stage-template-validation
Mar 31, 2026
Merged

fix(loki.process): Wrap template in a custom type and move validation to syntax.Validator#5910
kalleep merged 5 commits into
mainfrom
kalleep/stage-template-validation

Conversation

@kalleep

@kalleep kalleep commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Pull Request Details

This pr does two things:

  1. Wrap Template in a custom type that implements encoding.TextMarshaler and encoding.TextUnmarshaler. This allows us to catch invalid templates when config is parsed instead of when building the stage.
  2. Implement syntax.Validator for TemplaceConfig.

Issue(s) fixed by this Pull Request

Part of: #5549
Part of: #5913

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

@kalleep kalleep requested a review from a team as a code owner March 27, 2026 09:15
@kalleep kalleep changed the title Fix(loki.process): Wrap template in a custom type and move validation to syntax.Validator fix(loki.process): Wrap template in a custom type and move validation to syntax.Validator Mar 27, 2026
@kalleep

kalleep commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3556d81c2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/component/loki/process/stages/template.go Outdated
@kalleep

kalleep commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ac9a53c73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/converter/internal/promtailconvert/internal/build/stages.go Outdated
@kalleep kalleep merged commit 700dd7d into main Mar 31, 2026
50 checks passed
@kalleep kalleep deleted the kalleep/stage-template-validation branch March 31, 2026 07:41
gaantunes pushed a commit that referenced this pull request Apr 3, 2026
… to syntax.Validator (#5910)

### Pull Request Details
This pr does two things:

1. Wrap Template in a custom type that implements
`encoding.TextMarshaler` and `encoding.TextUnmarshaler`. This allows us
to catch invalid templates when config is parsed instead of when
building the stage.
2. Implement `syntax.Validator` for `TemplaceConfig`.

### Issue(s) fixed by this Pull Request

Part of: #5549
Part of: #5913

### Notes to the Reviewer

<!-- Relevant notes for reviewers/testers. -->

### PR Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [ ] Documentation added
- [x] Tests updated
- [x] Config converters updated
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants