You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(shares, resources): close what the review pass turned up
Nine findings, four of them mine from earlier in this branch.
**The R6 guarantee was not enforced.** `check-resource-views.ts` reported
`R6 … 0 (at baseline)` while a real violation sat in the tree:
`useParams<{ workspaceId: string }>()` in `add-connector-modal.tsx`. The pattern
demanded `(` immediately after the hook name, so the generic form — the dominant
idiom in this repo, quoted in two of the rule's own TSDoc blocks — was invisible.
Widened the pattern, watched it go 0 → 1, threaded `workspaceId` in as a prop
exactly as its sibling modal already documents, confirmed 0.
**An inline-image fan-out charged against a whole-file budget.** Every embedded
image spent a `content` token — 60/min, sized for downloading a file. A
thirty-image shared document spent half a reader's minute on one page view and
the second view inside that minute returned 429, which renders as broken images
with no stated reason. Added an `inline` scope denominated in what actually
happens (`INLINE_IMAGES_PER_VIEW * INLINE_VIEWS_PER_MINUTE`).
**The per-share ceiling equalled the per-IP budget it backstops.** Both 60/min
for `content`, so one visitor at full rate saturated the link and the aggregate
bound before the bucket it exists to protect. Now derived from the per-IP config
rather than written out, so `aggregate > per-IP` holds by construction. Dropped
the `execute` tier — no caller, no consumer of its type.
**My `.webm` fix reasoned from a false premise.** Routing `getContentType`
through `resolveEffectiveMimeType` was a no-op: `contentTypeMap` was consulted
first, so `DUAL_CONTAINER_MIME` never ran. The real defect was that
`contentTypeMap` duplicated 38 of `EXTENSION_TO_MIME`'s entries — drift between
two hand-maintained tables is what left `.mkv`/`.flac`/`.aac`/`.opus`/`.avi` at
`application/octet-stream`, unseekable. Collapsed to the three Google
pseudo-extensions no MIME table knows. Verified empirically before collapsing:
exactly five resolutions change, three are those pseudo-types, and `js`/`ts`
move to the WHATWG spellings while staying attachments either way. The TSDoc's
`.mp4` example was also false — staging already had that entry.
Also: one home for `REVALIDATE_CACHE_CONTROL` (four copies, three files);
`getContentType` no longer computed twice per serve branch; a dead default
parameter, a dead `binaryExtensions` export, and two TSDoc blocks that had
drifted above the wrong function; `toError` in place of the banned
`instanceof Error ? … : new Error(…)` in the three routes this branch touches.
New tests for `lib/public-shares`, which had none — 12 pinning the
aggregate-exceeds-per-IP invariant, the inline fan-out budget, bucket
separation and the 429 shape. Verified they fail against the original bug:
setting the multiple back to 1 turns two of them red.
Suite: 21113 passed. R6/R3c 0, 23 audits, lint and type-check clean.
0 commit comments