Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[architect] Four scripts.mjs compute repo root via URL.pathname instead of the repo's own fileURLToPath convention

Closed
#1,599 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #1600 by @hivecommons-hive — merged

Assessment

Difficulty
2/5
Estimated time
Half a day
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, nodejs
Domain
tooling

Research direction

Start by comparing the four listed scripts/*.mjs files with the established fileURLToPath(new URL('..', import.meta.url)) pattern in the other scripts. Check each script's imports and node:path usage, then run the relevant scripts or their existing tests, if present. Done means all four root calculations use the shared encoding-safe convention and their JSON reads and writes continue to work.

Written by the indexing model from the issue text.

Description

agent/architect architecture hive/hosted-available-lke648397-260827-5n31 stage/040-covered-by-pr tech-debt

Architecture Finding

Type: coupling / incomplete-abstraction (duplicated, inconsistent path-resolution pattern)
Affected area: scripts/check-community-group-links.mjs, scripts/collect-case-studies.mjs, scripts/collect-launch-metrics.mjs, scripts/collect-radar-reports.mjs

Nine scripts under scripts/ compute the repo root from import.meta.url the
correct, cross-platform way:

const root = fileURLToPath(new URL('..', import.meta.url));

(scripts/collect-enduser-members.mjs:19, scripts/collect-metrics.mjs:18,
scripts/fetch-community-people.mjs:18, scripts/generate-changelog.mjs:11,
scripts/generate-members.mjs:11, scripts/import-architecture-issue.mjs:37,
scripts/validate-architecture-assets.mjs:20,
scripts/validate-architectures.mjs:14, plus the staticRoot variants in
scripts/validate-awards.mjs:14, scripts/validate-enduser-members.mjs:16,
scripts/validate-members.mjs:33.)

Four scripts instead carry an independent, drift-prone copy that reads the raw
.pathname of the file:// URL:

const root = new URL('..', import.meta.url).pathname;
  • scripts/check-community-group-links.mjs:14
  • scripts/collect-case-studies.mjs:16
  • scripts/collect-launch-metrics.mjs:25
  • scripts/collect-radar-reports.mjs:16

URL.pathname is not the same value fileURLToPath() returns: on Windows it
keeps the leading / before a drive letter (/C:/repo/..., not C:\repo\...),
and on any platform it leaves percent-escapes undecoded (a checkout path
containing a space or other reserved character stays as %20 instead of
decoding back to a literal space). Node's own docs call fileURLToPath() out
specifically as the correct, encoding-aware conversion; .pathname is a
browser-URL accessor that was never meant to produce a filesystem path. Each of
the four scripts then feeds this value straight into node:path's join() to
build a read/write path (data/community-groups.json,
data/case-studies.json, data/launch-metrics.json,
data/radar-reports.json), so a wrong root there is a wrong path on disk,
not just a cosmetic string.

Impact

The correct, encoding-safe conversion already exists and is already the
majority pattern in this directory (9 call sites) with one straggler file
join(root, ...) is used eleven more times for the output/input JSON a
collector reads or writes. Four of fifteen total call sites skip it with no
comment explaining why, so a reviewer cannot tell whether the difference is
deliberate or an oversight, and the next new collector script is as likely to
copy the wrong one as the right one.

Recommendation

Replace new URL('..', import.meta.url).pathname with
fileURLToPath(new URL('..', import.meta.url)) (adding the fileURLToPath
import from node:url where not already imported) in all four files, matching
the convention already used by the other nine scripts in the directory. This
is one mechanical pattern at four call sites, not four separate changes.


Filed by architect agent (ACMM L5 — hold-gated mode)


🐝 Hive Agent: architect | Instance: hosted-available-lke648397-260827-5n31 | SHA: 9e0a746

— hive: agent=architect backend=copilot model=claude-opus-4-6 copilot=1.0.88

Dominant language
JavaScript
Stars
0
Forks
3
Avg merge
7h 20m
Merged PRs (30d)
641

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cncf/endusers

All issues in cncf/endusers

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.