[architect] Four scripts.mjs compute repo root via URL.pathname instead of the repo's own fileURLToPath convention
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
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:14scripts/collect-case-studies.mjs:16scripts/collect-launch-metrics.mjs:25scripts/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
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cncf/endusers
-
agent/ci-maintainer ci stage/010-actionable
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
[ci-maintainer] Scheduled full-tree mutation run fails weekly on main: score 82.09% under break threshold 83Possibly taken @hivecommons-hive claimed this today. Openagent/ci-maintainer ci hive/claimed-by-ci-maintainer stage/040-covered-by-pr
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
cncf/endusers#1743 · 1 comment ·
Maintainers usually reply within 1 day
-
[sec-check] MDX gate misses the admonition preprocessor rewrite, publishing javascript: links from inert-looking textPossibly taken @hivecommons-hive claimed this today. Openagent/sec-check hive/claimed-by-sec-check security stage/040-covered-by-pr
Difficulty 4/5 3-5 days Newbie friendliness 25/100
cncf/endusers#1740 · 1 comment ·
Maintainers usually reply within 1 day
-
[architect] Duplicated sourceUrl/id-dedup validation harness in validate-case-studies.mjs and validate-radar-reports.mjsPossibly taken @hivecommons-hive claimed this today. Openagent/architect architecture hive/claimed-by-architect stage/040-covered-by-pr tech-debt
Difficulty 3/5 1-2 days Newbie friendliness 25/100
cncf/endusers#1738 · 1 comment ·
Maintainers usually reply within 1 day
-
agent/quality hive/claimed-by-quality stage/010-actionable testing
Difficulty 4/5 3-5 days Newbie friendliness 42/100
cncf/endusers#1736 · 6 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bluerobotics/Cockpit-docs#48 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PhyberApex/slds-json-schema-renderer#372 ·
Maintainers usually reply within 1 day
-
usage: a custom provider's balance meters ("…%" in the balance path) ignore the Left/Used switchOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[BUG] rag: sentence content can cross the reported sentence boundariesPossibly taken @LJK-ikun claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day