Adds the ability to open a second route alongside the current one:
- The secondary route is stored in a `split` query string parameter so
that reloading the page hydrates both panes.
- The secondary pane runs in its own in-memory router kept in sync with
the query parameter, so links followed inside the pane navigate the
pane rather than the primary route.
- Navigation while a split is open preserves the split, is directed to
the focused pane, and routes that cannot render in a pane (such as
settings) close the split.
- The focused pane is shown with an accent outline, updated as panes are
clicked or focused, and keyboard shortcuts only apply to the focused
pane.
- "Open in split view" added to document and collection menus and the
command bar.
* fix: Stale CSRF token sent on request retries and form submissions
The CSRF token cookie is rotated by the server on every safe request, but
ApiClient read the cookie once when a request was prepared and fetch-retry
reused the same headers for every attempt. Any rotation between preparation
and a retry (e.g. a concurrent GET in another tab) caused the double-submit
check to fail with csrf_error.
- ApiClient now re-reads the token cookie immediately before each network
attempt, so retries always carry the current token
- Form now reads the token at render and refreshes the hidden _csrf input
from the cookie during submit, replacing the useCsrfToken 1s polling hook
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fGhLu7zQyLdkRCx5EkYC5
* chore: Remove ApiClient test file
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fGhLu7zQyLdkRCx5EkYC5
* feat: Allow routes to opt out of CSRF token rotation
The CSRF token cookie is rotated on every safe request, which causes
in-flight mutating requests prepared with the previous token to fail the
double-submit check. High-frequency endpoints such as attachments.redirect,
hit for every inline image while reading a document, rotate the token
constantly for no benefit.
attachCSRFToken now sets the cookie after downstream middleware has run,
allowing routes to opt out of rotation via the new suppressCsrfTokenRotation
middleware. Suppressed routes still issue a token when the client does not
already hold a valid one. Applied to the attachments.redirect GET route.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fGhLu7zQyLdkRCx5EkYC5
* feat: Suppress CSRF token rotation on files.get
Like attachments.redirect, files.get is requested for every inline image
stored locally and has no need to rotate the CSRF token cookie.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fGhLu7zQyLdkRCx5EkYC5
* docs: Correct suppressCsrfTokenRotation comment
Requests already dispatched carry the previous cookie and header together
and still pass the double-submit check; rotation only races requests that
read the token before rotation but are sent after it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fGhLu7zQyLdkRCx5EkYC5
* docs: Simplify comments
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fGhLu7zQyLdkRCx5EkYC5
* revert: Remove CSRF token rotation suppression
The api router is mounted before attachCSRFToken in the middleware chain,
so API responses never rotate the token cookie and the suppression on
attachments.redirect and files.get had no effect.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fGhLu7zQyLdkRCx5EkYC5
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat: support presigned PUT uploads for S3-compatible storage
Add `AWS_S3_UPLOAD_METHOD` config ("post" default / "put") so providers
that do not implement presigned POST (e.g. Cloudflare R2) can use
presigned PUT instead.
- BaseStorage.getPresignedPut() returns undefined by default; S3Storage
overrides with PutObjectCommand + getSignedUrl.
- Content-Length is signed into the presigned PUT URL so S3 rejects
uploads that do not match the declared size.
- API route and MCP tool branch on the config: only one upload method
is returned per request.
- Frontend uses existing presignedPutUrl presence check — unchanged.
- When put is configured but unsupported (e.g. LocalStorage), a clear
InvalidRequestError is returned.
Defaults to "post" — zero behavior change for existing deployments.
* refactor: return explicit upload mode instead of inferring from fields
Address review feedback from @tommoor: the client should not need to
infer the upload method from the presence of presigned-PUT-specific
fields. The API now returns an explicit `mode` ("put" | "post"), and the
PUT branch uses generic `url` / `headers` fields so the client has no
special knowledge of "presigned puts".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor: use this.getBucket() in presigned post/put methods
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* fix: Retain location state when clicking on hash links in doc and TOC
* fix: Pass explicit location fields when navigating to hash links
Avoid spreading history.location (which carries internal fields like key)
and preserve the href's query string for absolute same-path links.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Refactor to patchLocation helper
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Bumps dd-trace to ^5.109.0 and @sentry/node + @sentry/react to ^10.58.0,
migrating off APIs removed in the Sentry v8 major: BrowserTracing /
reactRouterV5Instrumentation, Sentry.Handlers.parseRequest, and
Sentry.configureScope.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* refactor: Decouple ApiClient from auth store and document its public surface
Move logout policy out of the transport layer: ApiClient now notifies a
registered handler on unauthenticated responses (401 / suspended 403) instead
of calling stores.auth.logout directly, breaking the AuthStore -> client ->
stores import cycle. AuthStore owns the logout flags and registers the handler.
Also add JSDoc across the public surface (setShareId, fetch, get, post, client).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor: Extend request deduplication to PUT via shared helper
Extract the in-flight dedup logic into a private deduplicate() helper and route
both post() and the new put() through it. The dedup key now includes the HTTP
method so a POST and PUT to the same path can't collide. Multipart uploads
continue to bypass deduplication.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Improve types
* refactor: Improve ApiClient type safety and address review feedback
- Add a Method union ("GET" | "POST" | "PUT") for fetch/deduplicate, replacing
the loose string type. Narrowed to methods whose bodies are actually
serialized, so callers aren't given false support for PATCH/DELETE.
- Type previously implicit-any locals (modifiedPath, urlToFetch, isJson).
- Extract an ApiErrorResponse interface for the parsed error payload.
- Register the unauthorized handler before fetchAuth() so a 401 on the initial
auth request triggers the logout policy.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* wip
* Remove obsolete snapshots
* simplify
* chore(test): Convert mocks to TypeScript and tighten fetch mock types
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Remove unneccessary patches
* Migrate to msw instead of custom fetch mock
* Address PR review comments
- Split chained vi.useFakeTimers().setSystemTime() into separate calls.
- Switch test setup to dynamic imports so EventEmitter.defaultMaxListeners
assignment runs before module init (static imports were hoisted above it).
- Drop redundant NODE_ENV guard in monkeyPatchSequelizeErrorsForJest; its
sole caller already gates on env.isTest.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
* chore: Replace lodash with es-toolkit
Migrate all direct lodash imports to es-toolkit/compat for a smaller,
faster, lodash-compatible utility library. Transitive lodash usage from
other packages remains unchanged.
* fix: Restore isPlainObject semantics in CanCan policy
The lodash migration aliased `isObject` to `lodash/isPlainObject` and
the codemod incorrectly mapped the local name to es-toolkit's `isObject`,
which also returns true for arrays and functions. This caused condition
objects in policy definitions to be skipped, breaking authorization
checks across the codebase.
* fix: Restore unicode-aware length counting in validators
es-toolkit/compat's size() returns string.length, while lodash's _.size()
counts unicode code points. Switch to [...value].length to preserve the
previous behavior so multi-byte characters like emoji count as one.
* chore: clear mechanical lint warnings
Drops 44 oxlint warnings (559 → 515) by fixing easy mechanical rules
across the codebase: no-useless-escape, no-duplicate-type-constituents,
no-redundant-type-constituents, no-unused-expressions,
no-meaningless-void-operator, require-array-sort-compare, await-thenable.
* chore: drop callback parameter from useCallback deps
The `open` argument is a parameter of the callback, not a closed-over
variable, so it doesn't belong in the deps array.
* chore: promote cleared lint rules to errors
Promotes the rules cleared in this PR from warn to error so future
violations fail the lint:
- no-unused-expressions
- typescript/await-thenable
- typescript/no-duplicate-type-constituents
- typescript/no-meaningless-void-operator
- typescript/require-array-sort-compare
Removes the override that suppressed no-useless-escape on source
files (the global rule is already error) and fixes the 21 escape
violations that this exposed in regex character classes and template
literals.
* chore: address PR review feedback
- usePinnedDocuments: simplify UrlId to plain string instead of the
intersection trick.
- PlantUML embed: move - to end of character class so it's a literal
hyphen rather than a range operator.
- checkboxes: type token params as Token | undefined to match the
actual call sites that pass tokens[index - 2] etc.
* chore: Resolve minimatch ReDoS advisories via dep bumps and resolutions
Bump glob (8→11), rimraf (2→6), babel-jest, jest-environment-jsdom (29→30),
and lint-staged (13→16) to drop several vulnerable transitive chains. Pin
remaining minimatch and brace-expansion descriptors via resolutions so all
in-tree copies are on their latest patched release. Removes 9 ignored
advisory IDs from .yarnrc.yml.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* fix: Make routeHelpers.urlify origin testable for jsdom 26
jsdom 26 (jest-environment-jsdom@30) makes window.location and
location.origin non-configurable, breaking the previous test that
redefined them via Object.defineProperty.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* chore: Align jest-cli to ^30.3.0 with other jest packages
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
* First pass
* Remove prop drilling, fix comment layout
* Revert dev:watch to use dev:backend
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
The autotrack npm package is no longer maintained. Vendor the three
plugins we use (eventTracker, outboundLinkTracker, urlChangeTracker)
and their dom-utils dependencies into a single local JS file.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* fix: Flaky i18n test from repeated singleton re-initialization
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: Remove redundant initI18n call, rely on global test setup
initI18n() is already called in app/test/setup.ts for all app tests.
The extra call in beforeAll could re-introduce the same race condition.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* chore: Address code quality findings
* Round 2, quality findings
* fix: Add fallback for MediaQueryList.addEventListener in test env
The jsdom test environment doesn't implement addEventListener on
MediaQueryList. Prefer addEventListener but fall back to the
deprecated addListener when unavailable.
* Add client version header
* Include commit sha in x-client-version header
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* perf: Removes count query for client requests
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>