Skip to content

feat(app): add variables to header component#3

Open
franciscobalmaceda wants to merge 6 commits intorendis:mainfrom
franciscobalmaceda:feat/HEADER_VARIABLES
Open

feat(app): add variables to header component#3
franciscobalmaceda wants to merge 6 commits intorendis:mainfrom
franciscobalmaceda:feat/HEADER_VARIABLES

Conversation

@franciscobalmaceda
Copy link
Copy Markdown

@franciscobalmaceda franciscobalmaceda commented Apr 2, 2026

Description

Brief description of what this PR does.

Fixes #(issue number)

Type of Change

  • [ ✅] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Changes Made

  • Change 1
    Add variable support for headers
  • Change 2
    Add drag and drop for variables into header
  • Change 3
    Fix preview variables values to scan for variables inside the header

Testing Done

Describe the tests you ran to verify your changes:

  • Unit tests
  • Integration tests
  • [ ✅] Manual testing

Test Configuration:

  • OS: MacOS 26
  • Go version:
  • PostgreSQL version:

Checklist

  • [ ✅] My code follows the project's code style guidelines
  • [ ✅] I have run make lint and fixed all issues
  • [ ✅] I have run make test and all tests pass
  • [ ✅] I have run make build and it succeeds
  • I have updated API documentation (make swagger) if API changed
  • I have added tests that prove my fix/feature works
  • I have updated documentation (README, docs/) if needed
  • My changes are in core/internal/ (NOT core/extensions/)
  • I have used conventional commit format (feat/fix/docs/refactor)
  • I have added the ⚡ emoji to my commit messages

Screenshots (if applicable)

Add screenshots for UI changes.

Additional Notes

Any additional information reviewers should know.

Copy link
Copy Markdown
Owner

@rendis rendis left a comment

Choose a reason for hiding this comment

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

Good direction overall — enabling header variables in the editor is a useful improvement.

That said, I don’t think this is merge-ready yet because the PR only completes the UI/export part of the feature, while the rest of the contract is still out of sync.

What this PR does well:

  • it enables generic injectors on the header surface,
  • it routes variable insertion to the active header/body editor,
  • and it exports variableIds referenced from header.content.

What is still missing:

  • frontend semantic validation still does not traverse header.content for generic injectors,
  • backend publish validation still focuses on body injector nodes,
  • the current capability/docs still describe generic header text injectors as unsupported / not safe-by-default,
  • and there is no regression coverage for this new workflow.

So the issue is not that the feature is fake — it clearly adds real behavior — but that it introduces a new supported-looking workflow without aligning validation, documentation, and test coverage.

Before merging, I think this needs to be completed end-to-end:

  1. add frontend semantic validation for injectors inside header.content,
  2. add equivalent backend validation for header injectors during publish/render validation,
  3. add regression coverage for header injector export/import/publish flows,
  4. update the capability matrix/docs to reflect that header text injectors are now supported.

Backend note: validation still appears to validate generic injector nodes through the body document traversal only (core/internal/core/service/template/contentvalidator/variables.go). If header injectors are now an officially supported feature, backend validation should also inspect header.content for injector references — not just variableIds and header image injectables. Otherwise the UI/export contract moves ahead of publish validation.

Good feature direction, but I’d like to see the contract aligned before this goes in.

StoredMarksPersistenceExtension,
LineSpacingExtension,
HeaderEnterAsBreakExtension,
InjectorExtension,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This exposes a new product capability on the header surface, but the surrounding contract is not aligned yet. The current capability docs still classify generic header injector placeholders as unsupported / not safe-by-default, and neither frontend nor backend validation has been updated accordingly. I think this needs to land together with the validation/docs changes; otherwise we’re shipping a UI feature that the rest of the system does not fully recognize yet.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated docs to reflect new capability

if (headerState.imageInjectableId) {
variableIds.add(headerState.imageInjectableId)
}
if (Array.isArray(headerState.content?.content)) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Good catch including variable IDs coming from header.content, but this is incomplete unless the rest of the semantic pipeline also understands header injectors. Right now document-validator.ts / getUsedVariableIds() still only traverse body content for generic injector references, so export and semantic validation become inconsistent. I’d strongly prefer to update both sides in the same PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Add validation traverse over header nodes for injectors

const handleVariableClick = useCallback(
(data: VariableDragData) => {
insertVariable(data)
const targetEditor =
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This makes the editor flow work for header insertion, but I don’t see coverage proving that the resulting document survives the full lifecycle consistently. Since this is now a new editing surface for injectors, I think we need regression coverage for at least click insertion into header, drag/drop into header, export/import roundtrip, and publish/validation without inconsistent warnings or errors.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added tests going over validation of header insertion, inluding full lifecycle of export/import and publish

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.

2 participants