Fix #29: tree size style, rwx modes, header meta #30

Merged
crueber merged 4 commits from fix/tree-polish into main 2026-09-04 16:23:05 +00:00
Owner

Follow-up polish on the tree (code) page.

1. Size column. fmtSize (web/src/lib/format.js) drops the space and lowercases the byte suffix so the last character is always a letter: 0b, 92b, 1023b; k/MB/GB unchanged. format.test.js expectations updated (it was the only ♦web♦ test asserting the old spelling). Exact-bytes title tooltips (\“48372 bytes\”) untouched. Size column right-aligned (th + td, tabular-nums kept). Blob size spots pick the new spelling up automatically (same helper).

2. Modes as rwx triplets, incl. folders. New headless-testable fmtMode helper in the same module + unit tests: 100644→rw-r--r--, 100755→rwxr-xr-x, 120000→rwxrwxrwx, 040000/40000→rwxr-xr-x, 160000 gitlink→m--------- (decided: m marks a submodule commit pointer, dashes mark “no permission bits”; documented in code + docs/go/12_web_ui.md). Unknown octal falls back to its low 9 permission bits; missing/blank stays blank. Tree mode cell renders fmtMode(e.mode) with raw octal in title; folders show their mode whenever the API provides one (verified: the API returns 040000 for trees), blank otherwise — nothing invented.

3. Meta line moved to the header. Tree‘s <p>{sha12} · {n} entries</p> removed; the repo-header {branch} @ {sha} pill is the single branch@sha source (Repo.jsx untouched). Subpath-sha decision: no crumb-adjacent suffix — the resolve sha is the commit sha (equals the head sha in the normal case) and the breadcrumb already carries ref+path, so a suffix would almost always duplicate the header.

Verification. node --test web/test/unit/*.test.js green (181/181). Rebuilt the standalone stack from this branch and drove a real tree page (repo with subdir + regular + symlink + executable) in headless Chromium, dark + light: mode triplets + raw-octal titles, 29b/9b/18b right-aligned with “N bytes” titles, header pill main @ 0059cebdb3, no meta line, zero console errors. No new deps, no TS. Out of scope (noted): fmtBytes in Repo.jsx (Release/Settings/Wal pages) keeps its KiB style.

Follow-up polish on the tree (code) page. **1. Size column.** `fmtSize` (`web/src/lib/format.js`) drops the space and lowercases the byte suffix so the last character is always a letter: `0b`, `92b`, `1023b`; `k`/`MB`/`GB` unchanged. `format.test.js` expectations updated (it was the only ♦web♦ test asserting the old spelling). Exact-bytes `title` tooltips (\“48372 bytes\”) untouched. Size column right-aligned (th + td, `tabular-nums` kept). Blob size spots pick the new spelling up automatically (same helper). **2. Modes as rwx triplets, incl. folders.** New headless-testable `fmtMode` helper in the same module + unit tests: 100644→`rw-r--r--`, 100755→`rwxr-xr-x`, 120000→`rwxrwxrwx`, 040000/40000→`rwxr-xr-x`, **160000 gitlink→`m---------`** (decided: `m` marks a submodule commit pointer, dashes mark “no permission bits”; documented in code + `docs/go/12_web_ui.md`). Unknown octal falls back to its low 9 permission bits; missing/blank stays blank. Tree mode cell renders `fmtMode(e.mode)` with raw octal in `title`; folders show their mode whenever the API provides one (verified: the API returns `040000` for trees), blank otherwise — nothing invented. **3. Meta line moved to the header.** Tree‘s `<p>{sha12} · {n} entries</p>` removed; the repo-header `{branch} @ {sha}` pill is the single branch@sha source (Repo.jsx untouched). Subpath-sha decision: **no crumb-adjacent suffix** — the resolve sha is the commit sha (equals the head sha in the normal case) and the breadcrumb already carries ref+path, so a suffix would almost always duplicate the header. **Verification.** `node --test web/test/unit/*.test.js` green (181/181). Rebuilt the standalone stack from this branch and drove a real tree page (repo with subdir + regular + symlink + executable) in headless Chromium, dark + light: mode triplets + raw-octal titles, `29b`/`9b`/`18b` right-aligned with “N bytes” titles, header pill `main @ 0059cebdb3`, no meta line, **zero console errors**. No new deps, no TS. Out of scope (noted): `fmtBytes` in Repo.jsx (Release/Settings/Wal pages) keeps its `KiB` style.
fmtSize drops the space and lowercases the byte suffix (0b/92b/1023b;
k/MB/GB unchanged); format.test.js updated to the new spelling.

New headless-testable fmtMode helper: 100644/100755/120000/040000 map
to rwx triplets, 160000 gitlink renders m--------- (no permission bits;
decided + documented in code and docs/go/12_web_ui.md). Tree mode cells
(blobs and folders alike, blank when the API omits the mode) use it with
the raw octal in title; size column right-aligned th+td; tree meta line
removed so the repo-header branch@sha pill is the single source (no
crumb-adjacent sha suffix: the resolve sha equals the head sha and the
breadcrumb already carries ref+path).
The Breadcrumb head link ("main" below the tabs) duplicated the header's
`main @ sha` pill and the Code tab. At repo root no breadcrumb renders at
all; on subpaths only the path segments render. Applied identically to
Blob.jsx, which carried its own copy of the same pattern.
The follow-up dropped the head link entirely, leaving no crumb line at
repo root. Restore the first crumb as a link to /{full} labeled
literally root (never the branch name, so no duplication with the
header main @ sha pill). Root renders just root; subpaths render
root / sub / dir with root+intermediates linked and the final segment
strong. Blob keeps passing rev for subpath hrefs.
Tree/Blob Breadcrumb wraps nav.crumbs in <Show when={parts().length > 0}>:
repo root renders no breadcrumb nav; subpaths keep root-first crumbs.
Sign in to join this conversation.
No description provided.