Repository navigation
fix(ui): reject reserved blank names in builder preview - #349
Conversation
Hive-Run: hivecommons#347 Hive-Plan: reserved-blank-validation Hive-Spec: issue-347#expected-preview-error Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
|
Welcome to the Hive Commons community! Thanks for opening your first PR here! We're excited to have you contributing. Before merge, please ensure:
A maintainer will review your PR soon. Hope you have a great time here! |
|
Overlap note: #348 (hive, opened 05:21Z) fixes the same issue #347 and touches the same files ( 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read the diff against main and the test harnesses it touches — this looks correct to me, and it is the one of the two #347 PRs that should land.
- Production change is the minimal one:
src/ui.html:662importsassertNoReservedVarsfrom the shared./flags.js,src/ui.html:861callsassertNoReservedVars(parseVars(text))insideupdate()'s existing try block (so a reserved blank falls through to the samepreview-emptyerror path as a parse error), andsrc/ui.ts:82adds/flags.jsto the static-route table. - Because the builder script is compiled in tests via
compileInlineScript(...)with an explicit parameter list, every harness has to pass the new name. This PR updates all four —src/ui-bootstrap.test.ts:270-272,src/ui-builder.test.ts:95-98,src/ui-command-quoting.test.ts:53-55,src/ui-interactions.test.ts:256-268. #348 (same fix, hive-authored) updates onlyui-builderand is failing CI withassertNoReservedVars is not definedin the other three; I've flagged it there as a duplicate of this one. - Tests cover all five reserved names with and without a default, empty values, and recovery after renaming (
src/ui-builder.test.ts:238-261).
Not verified: CI has not run on this fork head yet, so the committed dist/ sync is unchecked by me — the dist-sync job will settle that.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me. Read the diff against main and the callers; verified locally.
src/ui.html:862callsassertNoReservedVars(parseVars(text))insideupdate()'s existingtry, which is the same call the CLI makes atsrc/cli.ts:140andsrc/commands.ts:114, so the preview and the CLI now reject the same names with the same message.assertNoReservedVars(src/flags.ts:19) only reads.name, whichparseVars'TemplateVar[]provides.src/ui.ts:82adds/flags.jstoSTATIC_JS_ROUTES;src/ui.test.ts:288-291asserts it is served with atext/javascriptcontent-type.- All four
compileInlineScriptharnesses (ui-bootstrap.test.ts:270,ui-builder.test.ts:95,ui-command-quoting.test.ts:52,ui-interactions.test.ts:256) inject the new identifier. This is the part #348 — which makes the identical production change — missed, and why that PR fails 23 tests withassertNoReservedVars is not defined. - Built
pr349from a freshnpm ci:npm test→ 486 pass, 0 fail, coverage gates pass;git status --porcelain -- dist/is clean, so the dist-sync gate will pass.
Note for the maintainer: #348 is a duplicate of this one (same fix for #347); I've recommended closing it in favour of this PR.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Ready for a human merge: verdict approved @aeb9be9, 3/3 checks green, DCO yes, soak 30m0s elapsed. Blocked only by The hive never approves on your behalf: |
|
CI triage: the 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
clubanderson
left a comment
There was a problem hiding this comment.
Hive verdict approved, soak done; releasing. Thanks @thatguywob.
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: 6aa2c1ae024a98a264232b3f4ed6bd928c9bca87 |
1 similar comment
|
LGTM label has been added. DetailsGit tree hash: 6aa2c1ae024a98a264232b3f4ed6bd928c9bca87 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clubanderson The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
The builder now validates template blanks with the CLI's shared reserved-name rule. Names such as
jsonandhelpshow the canonical error in the preview and reset the generated command until the blank is renamed. Serve the shared flags module to the browser and include the rebuilt distribution and changelog fragment.Fixes #347
Validation
npm run lintnpm run buildnpm test(full suite and coverage gates pass)/flags.jsis served as JavaScript.Checklist
dist/is committed— hive: backend=codex model=gpt-6.1-sol
🐝 Hive Agent:
contributor| SHA:aeb9be9