Skip to content

docs(claude): refresh stale internal docs and small hygiene batch #100

Closed

Description

@Ardnived

Summary

The release-readiness review (.claude/reports/RELEASE_READINESS.md §4, Appendix B + D) found the internal docs have drifted from the code they describe — the architecture doc still documents a client that was removed, and CLAUDE.md's overview table names the wrong build-tool major — plus two tiny code-hygiene items with no other home: a silently duplicated drawer-width constant, and a residual gap in the Link atom's scheme guard. This ticket batches them: docs refreshed to match reality, the constant linked to its CSS twin, the Link guard completed and pinned by a test.

Proposed changes

1. .claude/docs/architecture.md — remove the axios ghost. Three spots still describe the replaced axios client (verified today):

  • line 30: React Query → axios client (src/config/api)
  • line 58: | Data | src/config/api/ | axios client, zod-validated fetchers, mutations |
  • line 77: "Every axios request carries Authorization: clients API-Key <apiKey> …"

The data layer moved to @payloadcms/sdk (PayloadSDK<Config> in src/config/api/client.ts, with applyRequestContext on a custom fetch — see .claude/rules/data-layer.md, which documents the replacement including the axios→SDK swap in PR #41). Rewrite those sections to describe the SDK client; sweep the rest of the doc for further drift while there.

2. CLAUDE.md — fix the overview table. Verified drifted rows:

Scan the remaining table rows and nearby prose for other drift in the same pass — the readiness report calls the table out generically (§4: "Minor drift: architecture.md still describes the replaced axios client; CLAUDE.md says 'Vite 5' (actual: 8)").

3. .claude/skills/draft-ticket/conventions.md — same ghost. The api scope row still reads "api — data layer, axios client, fetchers (src/config/api/)" (verified). Also note the map scope row points at src/components/mapbox/ (actual: src/components/organisms/Mapbox/) and the ui row says "NextUI/Tailwind" (NextUI was removed per .claude/rules/components.md) — fix these sibling drifts in the same file.

4. Link LEFT_DRAWER_PX to --sy-drawer-w. src/hooks/use-map-controller.tsx:62-66 hard-codes LEFT_DRAWER_PX = 352 with a comment "(matches --sy-drawer-w in the Drawer atom)" — but the CSS side (w-[var(--sy-drawer-w,22rem)] in src/components/atoms/Drawer/Drawer.tsx:65,69 and src/views/DrawerStack/DrawerStack.tsx:135) carries no reciprocal comment, so a host overriding the --sy-drawer-w variable (or anyone editing the 22rem default) silently desyncs map camera padding (readiness report §5 "Minor", Appendix C). Either derive one from the other (e.g. a single shared constant feeding both, or reading the resolved CSS var), or — the minimum bar — a paired comment on BOTH sides naming the other location, so neither can move alone. No behavior change at the default width.

5. Complete the Link atom's scheme guard + co-located test. The readiness report (§3.2 residual, Appendix B) flagged that the atom had no scheme allowlist of its own; the feat/classify-errors branch has since added a refusal branch (src/components/atoms/Link/Link.tsx:95-99 — a non-external, non-site-relative href renders a <span> + reportInternalError). The residual gap today is line 85:

const external = isExternal || target === '_blank' || /^https?:|^mailto:|^tel:/.test(href)

isExternal / target="_blank" short-circuit the scheme test — a javascript: href passed alongside either flag classifies as external and renders verbatim on the plain <a> (lines 101-114), executing in the HOST page's realm on click. Unreachable today (every caller passes a route, an https:/mailto:/tel: URL, or something through safePath), but the atom is the last gate before a data-driven string becomes an <a href> — derive the external rendering from the scheme itself, and route a flag-carrying-but-unsafe href into the existing refusal branch. Add a co-located Link.test.tsx (node lane, renderToStaticMarkup per .claude/rules/tests.md) pinning: javascript: href refused under every flag combination (bare, isExternal, target="_blank"), the three allowed schemes render an <a> with the safe rel, and a site-relative href routes internally.

6. Explicit non-goal: do NOT touch src/config/responsive.ts — its dead-breakpoint cleanup moved into the container-responsiveness ticket, which rewrites that file.

Acceptance criteria

  • grep -in axios .claude/docs/architecture.md returns zero hits; the doc describes the @payloadcms/sdk client consistently with .claude/rules/data-layer.md
  • CLAUDE.md overview table matches package.json: Vite 8, no axios in the Data row; any other drifted rows found in the scan are fixed in the same commit
  • .claude/skills/draft-ticket/conventions.md scope list no longer references axios, NextUI, or the pre-reorg src/components/mapbox/ path
  • LEFT_DRAWER_PX and the --sy-drawer-w 22rem default are linked — one derived from the other, or paired comments on BOTH sides naming each other; map padding at the default drawer width is unchanged
  • The Link atom refuses a javascript: href on every path, including with isExternal and/or target="_blank"; https:/mailto:/tel: and site-relative hrefs render exactly as before
  • Co-located src/components/atoms/Link/Link.test.tsx exists in the node unit lane and covers the refused + allowed cases above
  • src/config/responsive.ts is untouched
  • pnpm lint && pnpm typecheck && pnpm test:run pass
  • Write an implementation report to .claude/reports/<issue-number>-<short-slug>.md — in the MAIN checkout at /Users/devindra/Documents/Projects/SahajAtlasWeb even when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved.

Files affected

  • .claude/docs/architecture.md
  • CLAUDE.md
  • .claude/skills/draft-ticket/conventions.md
  • src/hooks/use-map-controller.tsx (comment/const linkage only)
  • src/components/atoms/Drawer/Drawer.tsx (reciprocal comment only, if the paired-comment route is taken)
  • src/components/atoms/Link/Link.tsx + src/components/atoms/Link/Link.test.tsx (new)

Parallel implementation: this ticket OWNS the files listed above; sibling release-hardening tickets run concurrently — avoid edits outside owned files except strictly additive ones. In particular src/config/responsive.ts belongs to the container-responsiveness ticket, and .github/workflows/* / tests/smoke/* belong to the CI-hardening ticket.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions