Repository navigation
docs(claude): refresh stale internal docs and small hygiene batch - #111
Merged
Merged
Conversation
The architecture doc still documented the axios client that PR #41 replaced with `@payloadcms/sdk`, and CLAUDE.md's overview table named Vite 5 (actual: 8, per #45). Verified every other claim in both while there and corrected the ones that were demonstrably false against the source: - architecture.md: axios client -> the shared `PayloadSDK<Config>`; "request interceptor" -> the wrapped `fetch` (`interceptFetch` / `applyRequestContext`); `RootView` (never existed) -> `CountriesView`; the "search" zustand store (gone - filters live in the URL) -> the six real stores; Radix listed as a provider (it is headless) -> BrandTheme; Widget.tsx no longer sets the locale; the view list and the conventions index were both missing entries. - CLAUDE.md: Vite 8 and the two build entries; the SDK in the Data row; and in the file-layout block `config/site.ts` and `lib/ics` (neither exists), `molecules/Toolbar/` (it is `ListToolbar/`), the four `EventTime|Share|Images| Soon/` folders (none exist), and "theme providers" in providers.tsx. - conventions.md: the `api` scope's axios client, the `ui` scope's NextUI, and the `map` scope's pre-reorg `src/components/mapbox/` path. Closes #100 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`isExternal` / `target="_blank"` sat in the same boolean as the scheme test, so either flag short-circuited it: a `javascript:` href passed alongside one classified as "external" and skipped the refusal branch entirely, reaching the plain <a> where a click runs in the HOST page's realm. Safety is now decided by the href alone, before any flag is read. The flags go back to deciding rendering only, which is what they describe - so forcing the new-tab treatment on a site-relative path still works, and the three allowed schemes render exactly as before. Unreachable today (every caller passes a route, an `https:`/`mailto:`/`tel:` URL, or something already through `safePath`), but this atom is the last gate before a data-driven string becomes an `<a href>`, so the guard has to hold on its own terms rather than on its callers' discipline. Adds a co-located node-lane spec pinning the refusal under every flag combination, the allowed schemes and their safe `rel`, and the internal route. Closes #100 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`LEFT_DRAWER_PX = 352` is the map's left camera padding, and it silently duplicated the `22rem` fallback in the drawer's `w-[var(--sy-drawer-w,22rem)]` classes - which carried no comment back, so either side could move alone and the map would keep framing around a width the panel no longer has. Nothing fails when they diverge; the framing is just wrong by the difference. A Tailwind class string can't read a TS constant (the JIT scanner needs a literal), so the two genuinely cannot share one source. Instead the px is now derived from a named `DRAWER_W_REM = 22` (same 352, no behaviour change at the default width) and all three width sites cross-reference each other. Resolving the CSS variable at runtime would also cover a host that overrides it, and was rejected: it puts a DOM read in the map's hot path to serve an override that isn't a supported feature yet. Recorded in the comment as the thing to do if that changes. Closes #100 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Quality pass over the branch diff. Two of the findings were claims I had just written that do not survive checking - the exact drift this ticket exists to remove: - Link.tsx called itself "the last gate before a data-driven string becomes an `<a href>`". False: `Button` (href form) and `ActionRow`/`ActionCircle` render their own raw `<a>` and never reach this guard. Reworded to claim only what it covers, and to name what actually keeps those two safe (SafeUrlSchema, a directionsUrl we build, a literal mailto:/tel: prefix). Lifting one predicate into src/lib/shape/ for all three anchors is noted as the deeper follow-up. - The new spec justified its site-relative + isExternal case as something "the recovery ladder's country-site rung relies on". It doesn't - every isExternal caller passes an absolute URL. Worse, the markup it pinned is a plain `<a href="/gb" target="_blank">`, which under the embedded HashRouter resolves against the HOST page. The case now pins only the no-regression property and flags the pairing as a separate ticket rather than blessing it. The drawer-width pairing had the same problem in miniature: the comments named two files and covered three of the FIVE `22rem` literals, missing both in the SettingsMenu offset. Rather than write a fourth paragraph, `use-map-controller. test.ts` now scans the source and fails if any fallback stops matching DRAWER_W_REM - verified red by desyncing the constant. The prose shrinks to one canonical block plus pointers. Also: fold the thrice-spelled external-treatment predicate into `wantsNewTab`, drop three duplicate re-tellings of the guard rationale, and tighten the spec (it.each over bare loops for per-case failures, redundant assertions removed). Closes #100 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ew found
Two independent reviews converged on the same three, two of which were
regressions this branch introduced:
- **`//evil.com` walked through the guard.** `href.startsWith('/')` calls it
site-relative, but react-router's own ABSOLUTE_URL_REGEX matches a `//` prefix,
so it renders the string verbatim AND drops its click interception - a plain
left-click navigates the HOST page off-origin, under HashRouter as well as
standalone. `/\evil.com` and the TAB/LF/CR forms the WHATWG parser rewrites
into `//evil.com` got through too. The guard now reuses `safePath`, which
already rejects all of them and is the repo's one definition of "same-origin
route" - so this atom stops carrying a second, weaker copy of that rule.
Open redirect, not script execution, and unreachable today (every caller is
already safePath-guarded) - but the comment above it claimed such an href
"never reaches the DOM", which was simply untrue.
- **The case-sensitive scheme test broke a valid link.** `SafeUrlSchema` and
`validateWebUrl` both use `/^https?:/i`, and EventSummary feeds a
SafeUrlSchema-parsed `event.webUrl` straight into `<Link isExternal>`. A
`HTTPS://` URL those two passed would degrade to a span. Now `/i`, which
cannot loosen the deny surface - no casing of https/mailto/tel is dangerous.
- **A non-string href threw** where it used to render, inside the one component
that must never throw. `safePath` takes null/undefined safely, so this is
fixed by the same change.
Also from review: the pairing spec now DISCOVERS `--sy-drawer-w` fallbacks by
scanning src/ instead of a hardcoded two-file list (a hardcoded list is the
failure mode it replaced), pins the `* 16` derivation, and names the offending
file on failure - verified red by desyncing only the SettingsMenu literal, the
site the comments had missed. Plus the architecture.md box was a column out.
Closes #100
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The rule's backstop paragraph described the pre-change guard. Records the two properties the branch restored - the href decides safety before the flags, and "site-relative" means `safePath` rather than a leading slash - plus the honest caveat that Button and ActionRow render their own anchors and this atom does not cover them. Closes #100 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying sahajatlas-design with
|
| Latest commit: |
b8bb3ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e4b44aa3.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://docs-refresh-internal-docs.sahajatlas-design.pages.dev |
Deploying sahajatlas with
|
| Latest commit: |
b8bb3ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f912beb3.sahajatlas.pages.dev |
| Branch Preview URL: | https://docs-refresh-internal-docs.sahajatlas.pages.dev |
Ardnived
added a commit
that referenced
this pull request
Aug 7, 2026
Two conflicts, both keep-both: - CLAUDE.md — this branch rewrote the Routing row for the two-router mount, main rewrote Build tool + Data in the same table. Kept all three. - src/Widget.tsx — this branch restructured the wrapper (lang, role, the hash/memory branch), #113 added WIDGET_SCOPE_CLASS to its className. Kept the restructure and carried the scope class onto it: without that class the embed renders entirely unstyled. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Aug 7, 2026
Ardnived
added a commit
that referenced
this pull request
Aug 11, 2026
* chore(claude): widen the security-review trigger paths The path grep in /finalize-pr did not match #100's branch — the one whose entire point was hardening the Link atom's href guard. A security review ran anyway, on judgement, and that is the only reason the protocol-relative-URL gap (//evil.com walking through href.startsWith('/')) was caught before merge. A gate that depends on someone overriding it is not a gate. Adds the client-side surfaces that have since become security-relevant: the same-origin/scheme guard (shape/path.ts, shape/href.ts, atoms/Link/), the host-page CSS isolation that #91/#104 built (styles/globals.css, lib/scope.ts, the PostCSS scoping script + config), the app root, the privacy opt-outs and the reporting seam Sentry hangs off, and the lockfile for a transitive bump that never touches package.json. Deliberately, not maximally: over the last 82 commits on main the widened list fires 54 times against the old 51, and two of those three additions are #111 and #136 — the href-guard branches this exists to catch. Verified to still not fire on a locale-only or stories-only diff. Closes #117 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(claude): re-sync the lean-gate row from SahajCloud Pre-existing drift, found while checking this ticket's byte-identical criterion: SahajCloud's #607 (3be34cc0, 2026-07-31) corrected its own cell of the "Lean gate contents" row to `lint + typecheck + typecheck:tests + test:unit` and did not port that edit to the other two copies, so all three have disagreed on line 79 since. Adopting SahajCloud's text here — it is strictly the accurate one — leaves ONE patch to carry to each sibling and lets all three converge. Refs #117 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(claude): close the gaps /code-review found in the widened list Three findings, all accepted. Cost: ONE extra firing across the last 84 commits (54 → 55), measured before accepting. - Unanchor the five module entries so a SPEC travels with its module. The `\.ts` suffixes excluded href.test.ts, path.test.ts, privacy.test.ts and the two report specs — so deleting an assertion triggered nothing, which hollowed out the very paragraph telling readers to prefer an assertion over a path. The pre-existing entries (src/config/api/, src/types/event, shape/lexical, EventDetails/) already behaved this way; the new ones were the inconsistent ones. - Add src/lib/shape/hash — .claude/agents/security-reviewer.md names it beside Widget.tsx as the host trust boundary, "an untrusted input picking a branch, so audit both" (#92). Widget.tsx was listed and hash.ts was not: the same asymmetry as lexical-vs-path that this ticket exists to fix. - Broaden to src/styles/ (vaul.css is the other half of the injected sheet) and add patches/ — a patch is arbitrary code applied to a dependency, and patches/[email protected] exists precisely because vaul leaked a bare @Keyframes into host pages. Also rewrites the "what does not belong here" paragraph, which cited href.test.ts as an example of an excluded surface while href.ts sat in the list two lines above. It now names the genuinely-absent i18n-options.ts and explains the unanchoring rule instead. The deltas-table cell follows the list, so the sibling ports were refreshed. Refs #117 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
architecture.mdstill documented the axios client PR refactor(api): migrate data layer from axios+qs to @payloadcms/sdk #41 replaced with@payloadcms/sdk, and CLAUDE.md's overview table named Vite 5 (actual: 8). Every other claim in both was checked against the source in the same pass, which turned up several more that were simply false —RootView(never existed), a "search" zustand store (gone; filters live in the URL), Radix listed as a provider (it is headless),config/site.tsandlib/ics(neither exists),molecules/Toolbar/(it isListToolbar/).Linkatom's scheme guard is now unconditional.isExternal/target="_blank"used to short-circuit the scheme test, so ajavascript:href passed alongside either flag reached a plain<a>and would execute in the host page's realm on click. Review then found the leading-slash half was porous too (//evil.comrenders verbatim and loses react-router's click interception). Both closed, pinned by a new co-located spec.LEFT_DRAWER_PX = 352silently duplicated the22remCSS default; a test now fails if they drift.Changes
src/components/atoms/Link/Link.tsx— safety is decided by the href alone, before any flag is read; "site-relative" issafePath(the repo's existing predicate) rather thanstartsWith('/'); the scheme test is case-insensitive, to agree with theSafeUrlSchema/validateWebUrlguards upstream of it.src/hooks/use-map-controller.tsx—LEFT_DRAWER_PXderives from a namedDRAWER_W_REM = 22(still 352, no behaviour change at the default width), with reciprocal comments at every--sy-drawer-wsite.src/hooks/use-map-controller.test.ts(new) — discovers every--sy-drawer-wfallback undersrc/and fails if any stops matching the constant. Comments alone demonstrably did not hold here: the first version of this pairing named two files and missed two of the five literals.Verification
pnpm lint)pnpm typecheck)pnpm test:run) — 601 tests, 24 newBoth new tests were verified to actually fail: the drawer spec by desyncing only the
SettingsMenuliteral (the site the old comments missed), the Link spec by thejavascript:///evil.comcases.Notes for reviewer
Two of the fixes here are regressions this branch introduced and then caught — worth knowing the guard was reviewed hard rather than assumed:
HTTPS://URL thatSafeUrlSchemaalready passed, degradingEventSummary's backlink to plain text. Now/i, which cannot loosen the deny surface.href.startsWith(...)ran unconditionally where it previously short-circuited, so a non-string href would throw — inside the error fallback, which must never throw.safePathtakesnull/undefinedsafely.Deliberately NOT done (each verified, each wants its own ticket):
Button(href form) andActionRow/ActionCirclerender their own raw<a>and never reach this atom. Every href reaching them today is safe by provenance (SafeUrlSchema, adirectionsUrlwe build, literalmailto:/tel:prefixes) — audited, no live hole — but the safety is asserted per call site rather than at the sink. Lifting oneisSafeHrefintosrc/lib/shape/for all three is the real fix.<Link isExternal href="/gb">renders<a href="/gb" target="_blank">, which under the embedded HashRouter resolves against the host page. No caller does this, and the new spec explicitly declines to bless it.352pxrather than22rem(the repo's Tailwind config is otherwise px-based precisely because the widget can't control a host's root font size), and declaring--sy-drawer-wonce so the five fallbacks disappear. Both have visual-regression surface.src/config/responsive.tsis untouched, per the ticket's non-goal.Stale references found in files this ticket does not own (listed in the implementation report so they can be ticketed):
.claude/rules/tests.md("mockaxios", "the api interceptor"),.claude/rules/i18n-and-state.md(src/components/mapbox/map.tsx),.claude/rules/code-style.md(EventShare/, nowShareContent/),.claude/docs/environment.md("shared axios client, whose interceptor…"), and thesrc/components/mapbox/example path in two skill templates.Closes #100
🤖 Generated with Claude Code