joinery / docs
Developer portal: bugs, duplication and weak code
Closed
docs/audits/2026-09-25-developer-portal.md · read at 61b6f7f
- Open
- 0
- Fixed
- 7
- Won't fix
- 33
🔎 Developer portal: bugs, duplication and weak code
Context
A static read of apps/developer-portal: every non-spec source file under shared/, server/,
tools/ and app/. A finding marked Confirmed was checked against .report/ or the prerendered
.output/; Likely was reasoned from the code and not reproduced; the rest were read only. Each
fix comes with a spec that names the failure it pins (writing-tests skill). Line numbers are as
of commit.
Bugs
| ID | Where | What goes wrong | Fix | Status |
|---|---|---|---|---|
| B1 | scorecards.vue:13-15 | Confirmed. idOf(review.path) keeps .md, because ReviewScorecard.path is a repo path. Every link from Scorecards goes to /reviews/2026-09-15-bfd6da2.md (in the built scorecards/index.html), which queries /docs/reviews/…md and lands on "No such review". The spec's fixture uses …-abc.md and never checks the href. | Strip the extension (toCollectionPath(path).split("/").at(-1)), and assert the href in scorecards.spec.ts | fixed |
| B2 | StatusPill.vue:17 | Likely. :is="to ? 'NuxtLink' : 'span'" compiles to resolveDynamicComponent("NuxtLink"). Nuxt's loader only rewrites literal resolveComponent(...), and NuxtLink is not registered globally, so this renders as an unknown <nuxtlink> element. The spec passes only because it stubs NuxtLink globally. It's latent today because no decision is superseded. | Import NuxtLink from #components, as StatTile.vue:2 already does | fixed |
| B3 | changelog.vue:41-42 | The "Never released" alert needs unreleasedCommits > 0. But metrics.ts:31 returns null when a project has no <name>@* tag, which is exactly the never-released case. So the alert can't fire for the projects it describes. | Count commits since the root commit when there's no tag, or key the alert on currentVersion/tag absence plus commits > 0 | fixed |
| B4 | docs.ts:48 | checkLink resolves a root-absolute href (/docs/x.md) against the filesystem root, not the workspace, so it's reported broken and resolved comes out as a garbage slice. resolveDocLink treats the same href as workspace-rooted, so the two checkers disagree. | Reuse resolveDocLink's resolution in the collector (see D1) | wont-fix — no doc here uses a root-absolute href; every repo link in the corpus is relative |
| B5 | docs.ts:48 | decodeURIComponent throws URIError on a stray %. The throw escapes collectDocs, and tryRun then marks the whole docs artifact failed because of one link. | Wrap it and treat an undecodable href as broken | wont-fix — the only % in any href is a valid %5B escape |
| B6 | docs.ts:10 | The LINK regex also matches [x](y) inside fenced or inline code, so a code sample showing link syntax shows up as a broken link. The remark plugin only sees real links. | Strip fences and inline code before matching (as issues.ts:3 does), or collect links from the mdast | fixed |
| B7 | [artifact].get.ts:36 | artifact in readers is true for inherited keys. /api/snapshot/constructor calls Object() and returns { constructor: {} }. | Object.hasOwn(readers, artifact) | wont-fix — the only caller is useSnapshot, typed to the reader keys, and the deployed site is static |
| B8 | collect/index.ts | When a collector fails, the previous run's <name>.json stays in .report/. The server serves it as if it were current, and only SnapshotAge on that page says it failed. The Overview and badges have no status check. | Delete the stale file on failure, or have readArtifact consult manifest.artifacts[name].ok | wont-fix — the deploy collects on a fresh runner, so there is no stale file; locally the terminal and the artifact's own page both report the failure |
| B9 | collect/index.ts:32-40 | A graph failure returns early and skips deps, docs and scorecards, which don't depend on the graph (collectDocs ignores _projectRoots). | Run the three independent collectors regardless | wont-fix — collect runs as an Nx target, so a graph Nx cannot build stops the run before any collector starts |
| B10 | Not-found states in docs/...slug.vue:74, decisions/id.vue:68, reviews/[[id]].vue:121 | "No such page/report/review" is served with HTTP 200, so the prerender crawler and link checkers can't tell it's a dead link. That's how B1 went unnoticed. | setResponseStatus(404) (or createError) when page is null | fixed |
| B11 | format.ts:91 | relativeTime uses Date.now() and the default locale. In a prerendered site, the HTML says "just now" as of build time, and the client rehydrates with a different string and locale, which is a hydration mismatch on every page that shows an age. | Render relative times client-only (<ClientOnly> or onMounted ref), keeping the absolute ISO date for SSR | wont-fix — Vue's production hydration rewrites the text to the client value and logs once, so the reader sees the right age |
| B12 | useIssues.ts:24 | Only one page of per_page=100 is read, and PRs count toward those 100 before toIssues drops them. Once there are more than 100 open issues+PRs, both the count and the sidebar badge are silently low. | Read the Link header and say "100+" (a full fetch costs rate limit), or use /search/issues?q=is:issue to get total_count | wont-fix — 17 open issues and PRs against a 100-row page |
| B13 | useDeployments.ts:18 | The default per_page is 30. An environment whose newest deployment isn't among the latest 30 disappears, and its "Open site" button goes with it. | Pass environment= per configured environment, or raise per_page | wont-fix — huella-legal records a deployment on every push to master, the portal's own trigger, so its newest is always near the top |
| B14 | invariants.ts:71-73 | compareLayoutBlock compares only the last path segment, so apps/foo and packages/foo hide each other. | Compare area/name pairs | wont-fix — no two project roots share a directory name |
Duplication
| ID | Copies | Consolidate into | Status |
|---|---|---|---|
| D1 | Link resolution is written twice, with different regexes: docs.ts:20-56 (isRepoRelative uses [a-z]+:, plus its own line-range strip) vs docLinks.ts:9-12,46-50 (ABSOLUTE, LINE_RANGE, isPlaceholder). B4 is the result. | Export the classify/strip step from shared/docLinks.ts and have checkLink call it | wont-fix — the copies disagree only on root-absolute hrefs and scheme characters, neither of which occurs here (see B4) |
| D2 | Two kindOfs: docs.ts:58 (repo path) and wiki.ts:115 (collection path), with different rules. .claude/agents/*.md comes out as readme in the wiki. | One kindOf in shared/, fed toCollectionPath(path) from the collector | wont-fix — the one file affected is .claude/agents/repo-review-card.md, and the cost is its nav icon |
| D3 | segmentsOf is in both wiki.ts:106 and docLinks.ts:14 | One export | wont-fix — a one-line helper is not worth a shared export |
| D4 | The vocab check (DECISION_STATUSES as readonly string[]).includes(...) is cast four times, in decisions.ts:54,58 and docs.ts:90-91 | isDecisionStatus/isDecisionOutcome type guards in shared/decisions.ts | wont-fix — four casts over two vocabularies; a guard adds no behaviour |
| D5 | Repo URL → owner/repo parsing is in github.ts and again inline in projects.vue:29-38. The inline copy doesn't strip .git. The ${repoUrl}/… concatenations in ProseA.vue:16 and projects.vue:24,28 break on a trailing / or .git, and produce relative /actions/… links when it's unset. | parseRepo(repoUrl) → { origin, owner, repo } | null in shared/github.ts, used for API URLs, blob links, Actions links and the Pages URL | wont-fix — the deploy sets NUXT_PUBLIC_REPO_URL from server_url/repository, never with a trailing / or .git |
| D6 | The "first deployment per environment" dedupe is done in useDeployments.ts:19-23 and again in latestDeployments | Export a newestPerEnvironment from shared/deployments.ts, and let the composable only fetch | wont-fix — the composable dedupes to save status requests, and the second pass is then a no-op |
| D7 | The GitHub error message is shaped in useIssues.ts:9 (messageOf reads data.message) but not in useDeployments.ts:33, so rate-limit messages differ | Move messageOf to shared/github.ts | fixed |
| D8 | git rev-parse for commit and branch runs in both collect/index.ts:23 and metrics.ts:112. MetricsArtifact.commit/branch duplicate the manifest. | Pass them in, or drop them from MetricsArtifact | wont-fix — two extra rev-parse calls per collect, and nothing reads the copies differently |
| D9 | The five try/write/status/log blocks in collect/index.ts:46-113 are copy-paste | step(name, task, summarise) helper, which also gives B8/B9 one place to live | wont-fix — refactor only, and B8 and B9, which it would have housed, are wont-fix |
| D10 | REVIEWS_DIR is in invariants.ts:9 and scorecards.ts:8. Each review file is read and parseScoresTabled twice (invariants and scorecards). The filename regexes differ (.+ vs [0-9a-f]+), so a review can be checked but not shown. | One reviews module that returns { file, date, commit, markdown, parsed } once | wont-fix — repo-review always names a review <date>-<short sha>, which both regexes accept |
| D11 | The same queryCollection("docs").select("path","title","description").all() runs under two keys: index.vue:29 and projects.vue:9. Both then build readmeFor(project) with a hand-rolled .toLowerCase() instead of toCollectionPath. The whole collection rides in the Overview payload just to find ~9 READMEs. | useProjectReadmes() composable: one key, .where("path","LIKE","%/readme"), toCollectionPath | wont-fix — the Overview payload is 85 KB, so the extra rows cost little |
| D12 | Project area classification appears three ways: graph.vue:7-20 groups, projects.vue:43,62-70 areaOrder + categoryFor, index.vue:34 featuredProjects. The labels already agree, so it's one table. | shared/projects.ts → areaOf(root) with label and order | wont-fix — the three copies agree for every area that exists, so no page places a project differently |
| D13 | The "Uses / Used by / No relationships" block is in graph.vue twice (L114-127, L193-211) and in projects.vue (L128-139) | <ProjectEdges :project> component | wont-fix — template duplication with no divergence; extracting it changes no behaviour |
| D14 | The prev/next card pair is identical in docs/[...slug].vue:100-138 and decisions/id.vue:84-122. The TOC <aside> is also repeated. | <PrevNext :previous :next :to> and <PageToc :page> | wont-fix — template duplication with no divergence; extracting it changes no behaviour |
| D15 | The empty state (big icon, muted line, dimmed hint) is copy-pasted in changelog, decisions, issues, reviews and scorecards. The last two carry the same text. | <EmptyState icon title hint> | wont-fix — template duplication with no divergence; extracting it changes no behaviour |
| D16 | The UDashboardPanel → UDashboardNavbar → #leading <UDashboardSidebarCollapse/> header is repeated verbatim in all 12 pages | <PortalPage :title> with a #right slot | wont-fix — Nuxt UI's standard dashboard header, identical by design |
Quality
| ID | Where | Issue | Fix | Status |
|---|---|---|---|---|
| Q1 | format.ts:32-44, docs.ts:100, default.vue:72 | Dead code: categoryIcon/CATEGORY_ICONS are used only by their own spec (left over from the old local todo list); _projectRoots is unused; .replace(/^\//, "/") does nothing | Delete all three | fixed |
| Q2 | kindIcon, severityTone, wiki.ts:185 | Loose types: kindIcon(kind: string) should take DocKind; severityTone's union should be VulnerabilityAdvisory["severity"]; place() casts segments[0] as SectionId, so a .md under a new top-level directory (e.g. .github/) is silently dropped from the nav | Tighten the two signatures; guard place() or give it an "Other" section | wont-fix — every tracked .md sits under a section place() knows, and the loose signatures are compile-time only |
| Q3 | ProseA.vue:16, projects.vue:21-41, index.vue | Hard-coded values: blob/master; the project → workflow file / environment table lives in a page; hand-typed wiki routes (/docs/docs/guides/first-hour, /docs/docs/decisions/readme, /docs/docs/reviews/…) skip the known check docs/index.vue:43 does | Derive the branch; move the table to shared/; route the links through known | wont-fix — master is the only default branch, and every hand-typed route resolves today |
| Q4 | changelog.vue:8 | LIKE "%/CHANGELOG" only works because SQLite's LIKE ignores ASCII case, against shared/wiki.ts's rule that nothing compares against a capitalised path | Lower-case it | wont-fix — SQLite's LIKE ignores ASCII case, so the query matches |
| Q5 | tools/collect/docs.ts, tools/collect/metrics.ts | Collector performance: docs spawns git log -1 once per file, serially (~110 spawns); metrics spawns about 5 per project, serially | One git log --name-only --format=%cI pass, plus Promise.all over projects | wont-fix — a whole collect takes about 7 s |
| Q6 | run.ts:17 | tag is on the git allowlist, but git tag <name> writes | Enforce --list, or narrow the allowlist's claim to reads only | wont-fix — the allowlist keeps credential-printing subcommands out, and the one tag call passes --list |
| Q7 | coverage.ts:32, coverage.ts:132 | An empty metric is 100 in metric() but 0 in weighted(), and Coverage.vue renders —% for a missing pct. When a report is absent, copyMergedReport leaves the old public/embed/coverage/ in place and the build bakes it in | One rule for an empty metric; clear the embed when there is no report | wont-fix — the deploy runs pnpm test:coverage on a fresh runner first, so the report is always present |
| Q8 | scorecards.ts:39, scorecards page | A latest review with parseError still shows a "0/5" Total tile toned bad; the !line.includes("---") row filter also drops a card whose verdict contains --- | Render the parse error instead of the tile; match the separator row exactly | wont-fix — compareScorecardShape already flags an unparseable review on the Overview, and none fail today |
| Q9 | projects.vue, index.vue, graph.vue, docs/index.vue, changelog.vue:89, decisions/index.vue:128 | Formatting drift: projects.vue packs attributes onto one line; several pages put text at column 0; two are mis-indented | pnpm exec eslint --fix — if it doesn't flag projects.vue, the Vue style rules aren't active for this app | wont-fix — lint passes; turning on Vue template style rules is a @joinery/configs change, outside this app |
| Q10 | useSnapshot("docs") in the decisions pages | The decisions pages pull the whole docs.json (every page plus its broken links) to show ~20 rows | A decisions projection in the snapshot endpoint | wont-fix — the decisions list payload is 41 KB |
Order
- B1, B2, B10: user-visible broken links, plus the 404 that would have caught them.
- B3–B9: collector correctness. D1, D9 and D10 fall out of these fixes.
- B11–B14.
- D2–D8 (
shared/andtools/consolidation), then D11–D16 (app components and composables). - The Quality findings.
Checks once the first two steps land: pnpm exec nx collect @joinery/developer-portal && pnpm exec nx build-static @joinery/developer-portal, then grep -o 'href="/reviews/[^"]*"' .output/public/scorecards/index.html shows no .md (B1), and no .output/public/reviews/<id>/index.html
contains "No such review".