Skip to content

🌱 test: make jsFunc skip the parameter list before brace-matching - #15210

Closed
hivecommons-hive[bot] wants to merge 1 commit into
v6from
quality/test-jsfunc-default-params
Closed

hivecommons-hive[bot] wants to merge 1 commit into
v6from
quality/test-jsfunc-default-params

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Why

jsFunc (pkg/dashboard/acmm_per_repo_ui_test.go) brace-matches a page function from the first { after its signature. A default parameter such as opts = {} closes that brace immediately, so the slice is the truncated function costSortTh(table, key, label, opts = {} and any node harness whose closure reaches it dies with SyntaxError: Unexpected token 'function' pointing at the next function — not the one at fault.

On v6 today nothing in a your-turn closure reaches costSortTh, so this is latent. The v5→v6 forward-merge #15194 makes it live: v5's render() → renderStageTracker() plus the merge-celebration chain (… → stageTrackerScheduleVoices, whose osc.connect( matches the page's SSE connect()) reaches renderCost → costSortTh, and TestYourTurnReleaseOwnerStepAction12635 / TestYourTurnMenuDesignActionHandsIssueToArchitect11566 fail on every dashboard shard (run 40795001748). The extractor is v6's; the fix belongs here so the merge can pick it up.

What

  • jsBodyStart scans the parameter list (balanced ()[]{}, string-aware) and starts brace-matching at the body's {; falls back to the old first-{ behaviour if no parameter list closes.
  • TestJsFuncSkipsDefaultParameterBraces — synthetic signatures (object/array/arrow/string defaults, async, plain).
  • TestJsFuncSlicesEveryPageFunctionToItsBody — every top-level function in the shipped index.html slices to a declaration that contains its body-opening ){, so a future signature shape the extractor cannot read fails here, naming the function.
  • TestJsFuncCostSortThSliceIsValidJavaScript — the real costSortTh slice passes node --check.

All three fail against the current jsFunc and pass with the change, on both the v6 page and the #15194 head page (verified by compiling the helper + tests into a scratch binary; go test is unavailable on this host).

Refs #15194 (forward-merge whose dashboard shards this unblocks once v6 is merged into its branch; the PR's other reds are separate semantic conflicts and are triaged on the PR).

Test-only change; changelog fragment not required (*_test.go auto-exempt).


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@clubanderson

jsFunc brace-matched a page function from the first `{` after its
signature. A default parameter such as `opts = {}` closes that brace at
once, so the slice stopped at `function costSortTh(table, key, label,
opts = {}` and any node harness whose closure reached it failed with a
SyntaxError pointing at the next function. Scan the parameter list
first (balanced, string-aware) and start brace-matching at the body.

Pin the extractor on every top-level function in the shipped page so a
new signature shape fails here, naming the function, rather than as an
opaque node error in whichever harness happens to reach it first.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <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 29, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[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

@github-actions

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but carries no changelog entry
(no changelog.d/ fragment and no CHANGELOG.md edit).

If it is user-visible — a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking —
please add a fragment file changelog.d/<category>-<pr-or-slug>.md
containing exactly your entry (see changelog.d/README.md; the
category is one of added/changed/deprecated/fixed/security). Please
do not append to CHANGELOG.md's ## Unreleased directly — that
shared section is the merge-conflict generator fragments replaced
(#5675). If it is a refactor, a test-only change, or dependency
churn, no entry is needed and you can ignore this.

This is a reminder, not a gate; it never blocks a merge.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

This PR conflicts with v6 itself. Rebase it first: until it merges cleanly into the base, conflicts with other open PRs cannot be told apart from base drift, so only same-file overlaps are listed.

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
@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 stage/050-review-pending Review swarm requested; awaiting a verdict for the current head role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

CI note: docker (contributor) failed on infrastructure, not this diff — buildkit could not fetch a cached base layer (httpReadSeeker: failed open: could not fetch content descriptor sha256:e2de9651… from remote: not found) at WORKDIR /src, before any repo content was built. All other checks are green. Deferring; a re-run on the next push/sweep should clear it.


🐝 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 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.

Looks correct to me.

Read jsFunc at src/pkg/dashboard/acmm_per_repo_ui_test.go:30-62 on this head: start is the index of "function "+name+"(", so the first ( that jsBodyStart (:76-108) finds from sig is the parameter list, never a brace from an earlier default. The scanner balances (/[/{ together, skips '/"/` literals with backslash escapes, and on depth==0 returns the next {; when no ( or no closing ) exists it falls back to the old first-{ behaviour, so unrecognised signatures degrade rather than fail. The len(html) return when no body brace follows makes the caller's loop fall through to its existing "unbalanced braces" fatal, which is the right outcome.

The table in js_func_default_param_test.go covers the shapes that matter (object default, string default containing })(, arrow default), and TestJsFuncSlicesEveryPageFunctionToItsBody runs against the real page so a new signature shape fails with the function named.

One note for whoever merges: the only red check, docker (contributor), cannot be caused by this diff (two _test.go files, no runtime code or Dockerfile change) — it reads as infrastructure, not a defect here.

— 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.

Looks correct to me. Read jsBodyStart at head 59594a6e (src/pkg/dashboard/acmm_per_repo_ui_test.go:76-109) and the callers it changes.

  • The scanner starts at the first ( after the signature, balances ()[]{}, skips '/"/` literals (with backslash escapes), and returns the first { after the paren list closes. Both fallbacks (open < 0, depth never returning to 0) reproduce the previous first-{ behaviour, so a shape it can't read degrades rather than regresses — matches the comment.
  • jsFunc's brace loop (:41) still receives an index pointing at a {, so the depth accounting is unchanged.
  • The new js_func_default_param_test.go relies on indexHTML (clickable_avatars_test.go:12) and jsDeclRe (your_turn_ui_11566_test.go:28), both already in the dashboard package on v6; no name collisions with jsBodyOpenRe/jsBodyStart/TestJsFunc*.
  • The function f(sep = '})(') case is the one that would have broken a naive paren counter; it is covered.

The red docker (contributor) check is not this diff: job 123197324013 failed in "Build Docker image" with failed to copy: httpReadSeeker: … could not fetch content descriptor sha256:e2de9651… not found — a registry layer pull failure on a PR that touches only two _test.go files. A rerun should clear it.

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

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 29, 2026
@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Superseded: #15194 merged into v6 (0f6d593) with its own parameter-list-aware jsFunc plus TestJSFuncExtractsDefaultObjectParameters, which is the regression this PR existed to unblock; the branch now conflicts on exactly that hunk. Closing rather than rebasing a duplicate fix.

@hivecommons-hive hivecommons-hive Bot closed this Oct 29, 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. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants