Skip to content

🐛 fix(parser): recognise {{&name}} ampersand tags as blanks - #333

Merged
hivecommons-hive[bot] merged 2 commits into
mainfrom
scanner/fix-332
Oct 24, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
mainfrom
scanner/fix-332

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #332

VAR_PATTERN and DOTTED_PATTERN now accept an optional & sigil, so {{&name}}, {{& name }} and {{&name=default}} are the same blank as {{name}} (as the UI cheatsheet promises). expand() keeps the & when normalizing. Dotted {{&a.b}} is rejected like {{a.b}}. Tests and changelog fragment added.

dist/ was hand-synced (parser.js, parser.test.js, cli.test.js) without running tsc; source maps not regenerated.

Validation: not run locally per hive policy; CI is the verdict.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Closes #332

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 24, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 24, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 24, 2026
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 24, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read this against the tree at 1e7fbbe, not just the diff. Looks correct to me.

What I verified:

  • src/parser.ts:34,40 — the optional (?:&\s*)? group sits before the name capture in both VAR_PATTERN and DOTTED_PATTERN, so {{&name}}, {{& name }} and {{&name=dflt}} produce the same TemplateVar as the bare forms, and {{&a.b}} hits the existing dotted rejection at src/parser.ts:47-52. Sigil tags ({{#x}}, {{!c}}) still don't match because & is the only sigil admitted.
  • src/parser.ts:92-94 — expand() keeps the & when normalizing, so Mustache still sees a variable tag; with escaping disabled per-call the output is identical to {{name}}. An unfilled {{&name}} is preserved as {{name}} (drops the &) — the test at src/parser.test.ts:169 asserts that explicitly, so it's intended.
  • Every consumer named in #332 goes through the shared pattern: src/commands.ts:124 (show highlighting) and src/ui.html:663,821-822 (builder table and preview) import VAR_PATTERN/parseVars from ./parser.js, so no second regex copy was missed.
  • Ran the built CLI: "A: {{&word}} B: {{& word }} C: {{&other=dft}}" --word=hi → A: hi B: hi C: dft; {{&a.b}} → Unsupported variable name "a.b".
  • On the body's caveat ("dist/ was hand-synced … source maps not regenerated"): I ran npm ci && npm run build on this head and git status --porcelain -- dist/ is empty, so dist/ — maps included — matches what tsc emits. The CI dist-sync gate agrees (all six build-and-test legs green).

No findings from me; the remaining tide check is the only thing pending.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed — no findings from this perspective.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 7f0d968 into main Oct 24, 2026
11 of 12 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-332 branch October 24, 2026 21:51
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#3331e7fbbe` sha256:48e99969c236c87e821ac2cab36edfd7d81aafc8b0063fcee2238104dac022bf — download from the dashboard or `hivectl review evidence #333`.

@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] UI cheatsheet advertises {{&name}} as unescaped output, but the parser never recognizes it — the blank silently renders empty

0 participants