Skip to content

feat: prefer authors over uploader in DatasetCard byline - #23

Merged
neuromechanist merged 2 commits into
feature/issue-1-epic-nemar-redesignfrom
feature/issue-22-author-byline
May 18, 2026
Merged

neuromechanist merged 2 commits into
feature/issue-1-epic-nemar-redesignfrom
feature/issue-22-author-byline

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #22

Summary

Discover cards now show the dataset's authors instead of the uploader when the catalog row is enriched. Falls back gracefully when authors are missing.

Behavior

catalog.authors render
"Daniel G. Wakeman, Richard N Henson" by Daniel G. Wakeman et al.
"Arnaud Delorme" by Arnaud Delorme
empty / null by <owner_username>
empty + no owner by NEMAR

Why "FirstAuthor et al." instead of full list

Card footer real estate is small. Compact byline preserves the visual rhythm of the card grid. Full author list still appears in the detail page's right rail.

Tests

4 new tests for formatAuthorByline (nullish, single, multi, degenerate commas). 79/79 passing, typecheck 0 errors.

Live behavior pending backend

The list endpoint currently returns empty authors for source=openneuro rows (separate #512 list-endpoint projection regression). Once your enrichment work backfills, on* cards will flip from "by yahya" to "by Wakeman et al." with no further frontend change.

ds* rows on Discover page 2+ already display the new byline today.

Discover cards previously showed 'by yahya' (the uploader) for every
dataset. When the catalog row is enriched with author names, prefer
those: 'by FirstAuthor' for one, 'by FirstAuthor et al.' for two or
more. Fall back to the uploader, then to 'NEMAR' when neither is known.

Adds formatAuthorByline() helper + 4 unit tests covering nullish,
single, multi, and degenerate-comma input.

Refs #22
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 18, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: a9cc34a
Status:🚫  Build failed.

View logs

- format.ts: replace verbose docstring with one-line invariant comment;
  the previous docstring duplicated the code (WHAT) and only the API
  contract assumption is non-obvious (WHY).
- DatasetCard.astro: drop inline comment over fallback chain; the
  three-term short-circuit is self-evident TypeScript.
- format.test.ts: add whitespace-only first-slot test ("  , Richard N
  Henson" -> "Richard N Henson") covering a previously-untested branch
  where the filter must drop blank entries before counting.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

pr-review-toolkit review (sonnet)

Three reviewers, three findings, all addressed in a9cc34a.

Reviewer Verdict Finding Resolution
code-reviewer REQUEST CHANGES Document the invariant that the catalog ships authors as first-last (a "Last, First" value would silently mis-split into two authors) Added one-line comment above formatAuthorByline stating the assumption
pr-test-analyzer NEEDS MORE COVERAGE Test for " , Richard N Henson" — whitespace first slot, valid second; would catch a regression where filter was inverted Added test asserting return is "Richard N Henson", not " " et al."
comment-analyzer DELETE BOTH The verbose docstring on formatAuthorByline was WHAT-not-WHY (duplicated the three if statements); the inline comment over the fallback chain was self-evident TypeScript Replaced docstring with the one-line invariant from the code-reviewer's ask; deleted the DatasetCard inline comment

Both deletion items from comment-analyzer happen to align with code-reviewer's "explain WHY" ask — the trimmed format keeps only the load-bearing line.

80/80 tests passing, typecheck 0 errors, biome clean.

@neuromechanist
neuromechanist merged commit fbb3a73 into feature/issue-1-epic-nemar-redesign May 18, 2026
1 check failed
@neuromechanist
neuromechanist deleted the feature/issue-22-author-byline branch May 18, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant