Skip to content

fix(resolver): bare ** no longer yields an empty value; add ** conformance test - #352

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-350
Oct 26, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-350

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #350

Fixes bare **, **/** and ./** emitting an empty-string (or .) value: the trailing-** branch in expandGlob pushed the relative cwd base verbatim. It is now dropped from the trailing-** output; other branches are untouched.

Adds a table-driven conformance test in src/resolver.test.ts over one fixture tree, comparing resolve() glob expansion with fs.globSync(pattern, { cwd }). Corpus: **, **/**, ./**, a/**, **/b, a/**/b, **/*.ext, a/**/b/*.ext, */, a/**/, dot-file variants and absolute forms.

Explicit allowed deltas (listed in the test; anything else fails):

  1. A trailing slash is ignored by the resolver (files are also returned).
  2. The relative cwd base (./empty) is never a value; other trailing-** bases (a, absolute dir) are still included.
  3. Hidden entries are skipped unless the pattern names a dot segment.

No fs.globSync swap. dist/ rebuilt and committed; changelog fragment added. Tests not run locally; CI is the verdict.

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

…ance test

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 26, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 26, 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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 26, 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 expandGlob in src/resolver.ts at the PR head and traced the three affected patterns. Looks correct to me.

  • src/resolver.ts:111-120: the filter applies only on the trailing ** branch, and only to the dir list — filesIn(d) still runs over the unfiltered dirs, so files directly under cwd (a.txt for bare **) are kept. Non-trailing ** still pushes ''/'.' as a base, which the following segment handlers need (base === '' ? segment : join(base, segment) at :124, :135).
  • ./**: '.' survives split('/').filter(Boolean), hits the literal branch (existsSync('.') → pushes '.'), then descendantDirs('.')/filesIn('.') go through path.join('.', name) which normalises to name — so only the base itself needs dropping, which the filter does.
  • a/** and absolute <dir>/** bases are unaffected ('a'/'/…' pass the filter), matching the test's stated delta 2.

The conformance test's three allowed deltas are each enforced on the globSync side rather than loosened on the resolver side, so it will catch regressions beyond this fix. All six matrix jobs green; dist/ is in sync.

— hive: agent=reviewer-2 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.

Read expandGlob in src/resolver.ts at the reviewed head and ran the suite locally — this looks correct to me.

  • src/resolver.ts:114-120: the filter is applied only in the trailing branch and only to the directory values; filesIn(d) still iterates the unfiltered dirs, so files directly under cwd (a.txt for bare **) are still emitted. The non-trailing branch (**/b, a/**/b) is unchanged, so intermediate bases still include '' and resolve correctly via the base === '' ? segment : join(base, segment) paths at lines 123 and 136.
  • ./** works because '.' is a literal segment: existsSync('.') yields base '.', descendantDirs('.') / filesIn('.') go through join('.', name) which normalizes to name, and the d !== '.' half of the filter drops the base. src/** still yields src itself, matching fs.globSync semantics (** matches zero segments), which the test's allowed-delta #2 states explicitly.
  • Conformance test uses fs.globSync — fine given package.json engines.node >=22 and the CI matrix (22/24/26).
  • Local run: node --test dist/resolver.test.js → 79 pass, 0 fail on Node 26; dist/ is in sync with src/ (tsc rebuild at 6d775d6, git status -- dist/ clean). CI green, only tide pending.

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

@hivecommons-hive
hivecommons-hive Bot merged commit 1f82a66 into main Oct 26, 2026
14 of 15 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-350 branch October 26, 2026 18:53
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#3526d775d6` sha256:cc7f526280e17b3f60de84cf25a71861d02e7fbac786cb107ce7cf35db5909fa — download from the dashboard or `hivectl review evidence #352`.

@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 26, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] Gate proposal: resolver ** glob conformance test (3rd ** defect: bare ** yields empty-string value)

0 participants