Skip to content

Conversation

@reivilibre
Copy link
Contributor

Currently the template engine is lax about undefined variables, meaning typos become silent rendering issues.

By switching to the strict undefined variable behaviour, we can make these issues noisier and easier to notice.

This also makes the templates check command more useful.

We shouldn't have any reason to use undefined variables in MAS, so
silently printing as empty strings (etc) seems undesirable.

This will also be helpful for operators with custom templates, since
then they will notice their templates being broken.
@reivilibre reivilibre requested a review from sandhose October 24, 2025 13:30
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 24, 2025

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: eeeec35
Status: ✅  Deploy successful!
Preview URL: https://abacde21.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://rei-templatecheck-stricter.matrix-authentication-service-docs.pages.dev

View logs

@reivilibre reivilibre marked this pull request as ready for review October 24, 2025 13:35
{%- endif -%}

{%- if branding.tos_uri -%}
{%- if branding.tos_uri is defined -%}
Copy link
Member

Choose a reason for hiding this comment

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

This scares me a little bit, we don't have 100% coverage of templates with the samples, so we might have missed some spots. What about using SemiStrict instead, which allows for if undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed my mind on this: how about using is none instead? So we never make fields undefined, just none/nullable. I think this would offer even more typo resistance than is_defined

Copy link
Member

Choose a reason for hiding this comment

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

Agreed on using none instead of undefined, but the point that this PR might break other stuff still stands

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah OK, this is going to be gnarly, I've downgraded in 20a13f4

@reivilibre reivilibre requested a review from a team as a code owner October 28, 2025 17:02
@reivilibre reivilibre force-pushed the rei/templatecheck_stricter branch from 20a13f4 to eeeec35 Compare October 28, 2025 17:20
@reivilibre reivilibre requested a review from sandhose October 28, 2025 17:21
@reivilibre reivilibre merged commit d2309bf into main Oct 30, 2025
20 checks passed
@reivilibre reivilibre deleted the rei/templatecheck_stricter branch October 30, 2025 12:24
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.

3 participants