📚 Refine guidance across backend and frontend

Correct session, upload and validation boundaries and consolidate
related testing and frontend recovery guidance by task.

AI-assisted-by: gpt-6.1-terra
This commit is contained in:
Andrey Antukh 2026-11-24 10:20:54 +00:00
parent 87a15a7d33
commit 8d781fa5b0
16 changed files with 22 additions and 24 deletions

View File

@ -3,6 +3,6 @@
- Start at `app.rpc/resolve-methods` for command discovery and `wrap` / `wrap-management` for request order. A new command namespace must be registered. `GET` and `HEAD` require a `get-` name; auth is on unless explicitly disabled. Metrics wraps concurrency, so RPC timing includes time spent waiting for a permit. Transaction handling sits inside the wrappers and is controlled by `::db/transaction`.
- Strip qualified client params before merging server auth context; only the server supplies the profile, auth type and token permissions. Malli map schemas are open by default. Keep public creation schemas closed to reject client IDs while allowing internal creation helpers to accept IDs for imports or duplication. See `wrap-params-validation` for JSON coercion and legacy spec fallback.
- A malformed body is a client error classified at the parse boundary, not by exception class. Preserve 400 `:malformed-json` for malformed input and 413 for oversized bodies. See `app.http.middleware` for parsing and `Accept`/`_fmt` response negotiation, and `mem:backend/metrics` for pre-dispatch counters.
- Upload schemas validate shape, not path ownership. Declare file params in `::rpc/multipart-only-params` so the wrapper requires server-confirmed multipart input, and run `media.v/check-upload-path` before reading the file. The binfile job creation RPC instead takes a chunked upload ID; see `mem:backend/binfile`.
- Session auth selects the cookie before the `Authorization` header. Only current `kid=1`/`ver=1` tokens enter the session decoder. Plain HTTP on a host other than `localhost` changes the secure-cookie default via `app.config/parse-flags`; SameSite is `None` for CORS and otherwise follows the strict-cookie flag. See `mem:backend/session-expiration` for renewal and cleanup.
- Upload schemas validate shape, not path ownership. Declare `::sm/params` as well as file keys in `::rpc/multipart-only-params`: the multipart guard runs inside `wrap-params-validation` and is skipped without a schema. Run `media.v/check-upload-path` before reading the file; see `mem:backend/media` for processing and storage. The binfile job creation RPC instead takes a chunked upload ID; see `mem:backend/binfile`.
- Session auth selects the cookie before the `Authorization` header. Only current `kid=1`/`ver=1` tokens enter the session decoder. The `:secure-session-cookies` flag controls the cookie's secure attribute; `app.config/parse-flags` adds `:disable-secure-session-cookies` for non-localhost HTTP. SameSite is `None` for CORS and otherwise follows `:strict-session-cookies`. See `mem:backend/session-expiration` for renewal and cleanup.
- Management shared-key authorization is outermost: a disallowed key must not validate params or open a transaction. `::rpc/allowed-shared-keys` omitted accepts any configured valid key; an empty set accepts none. See `mem:backend/permissions` for the product permission boundary.

View File

@ -21,4 +21,4 @@
- Do not infer the owner, resource or expiry from business params. A public job belongs to its profile; an absent job and another profile's job both answer `not-found`. Registry metadata such as job family and routing is interpreted by consumers, not the substrate. Family quotas count live jobs from registered definitions, not a fixed list of names.
- Internal retention and user expiry are separate. Job GC must retire a row and arrange cleanup of its resource together; a bare delete would cascade events without touching the resource. Use the bucket's owner and lifetime rules in `mem:backend/storage`.
- Metric definitions live in `app.jobs.metrics`. Keep labels bounded (no IDs, payloads or exception text). A histogram's `_count` is the counter for that event; dispatch and claim measure different events. Claim wait includes the dispatcher gap, not just time in Redis. Use SQL for backlog rather than adding a gauge to the write path; debounce does not reset `created_at`.
- Record SQL-backed metrics inside the writing transaction; see `mem:backend/metrics`. Wire a metrics instance into the cfg before writing: a missing dependency discovered only in a callback may be swallowed. Profile-job events require a message bus before insertion so they do not lose their notification. Jobs resolve it from the cfg; `app.msgbus` operations take the instance itself.
- Follow `mem:backend/metrics` for SQL-backed metric recording and wiring. Profile-job events require a message bus before insertion so they do not lose their notification. Jobs resolve it from the cfg; `app.msgbus` operations take the instance itself.

View File

@ -1,7 +1,7 @@
# Backend media
- Start at `app.media/run`: ImageMagick and FontForge belong to the local path; `:remote-media-processing` sends supported operations through `app.media.remote`. Check the active flag before diagnosing a tool or output difference. The HTTP service contract lives in `mem:media-processor/core`; object lifecycle and buckets live in `mem:backend/storage`.
- Validate the upload path before MIME sniffing or size checks: those checks read the file. Keep unreadable paths distinct from files that exceed a size limit. For the outer multipart boundary see `mem:backend/http-rpc`.
- Upload RPCs enter through the multipart and schema boundary in `mem:backend/http-rpc`. Validate the upload path before MIME sniffing or size checks: those checks read the file. Keep unreadable paths distinct from files that exceed a size limit. File media uploads then create storage objects and domain references; for independent upload transactions and orphan cleanup see `mem:backend/storage`.
- Keep SVG sanitization at final storage boundaries. Uploads, URL downloads, thumbnails and organization logos that store SVG use `app.media.svg/sanitize-svg-upload`; binfile imports use `app.binfile.common/sanitize-imported-svg`. Backend sanitization is a blocklist with namespace checks and escaped serialization. Check size before calling helpers that load the whole file; the upload limit does not bound the size of the sanitized output. Profile picture imports do not accept SVG.
- `app.media/download-image` checks status, declared length and MIME before writing a temp file, and checks the actual byte count afterward. This download path is separate from processing via the remote service.
- The per-team media byte quota is disabled on `upload-file-media-object` because summing storage objects on every upload was too costly. Do not restore the per-upload sum; keep the team lookup for audit attribution. The upload-session quota is separate.

View File

@ -16,7 +16,7 @@
- Tokens issued before `:exp` existed carry no `:exp`; they are still bounded by the GC's `created_at` condition and acquire `:exp` on their next renewal (self-healing, no operator action).
- `wrap-authz` resolves the session by `(:sid claims)` only; there is no fallback to reading a session by the raw token string.
- `middleware/wrap-auth` attaches `::http/auth-data` only for `kid=1`/`ver=1` tokens with a configured decoder; anything else stays unauthenticated.
- Renewal fires when `modified-at` is older than 6h (`default-renewal-max-age`, not configurable). It `UPDATE`s the same row (`modified-at` only) and issues a new token that keeps the original `:exp`.
- Cookie authentication renews a valid session when `modified-at` is older than 6h (`default-renewal-max-age`, not configurable): it updates the session and issues a new token with the original `:exp`. The bearer authentication branch does not renew the session or issue a renewal cookie.
- `read-session` does not check age. Idle expiration is enforced on every request by `wrap-authz` (sessions past the idle window authenticate like missing ones and are never renewed); the GC only deletes the rows afterwards.
## Revocation paths
@ -25,18 +25,17 @@
- Authenticated password change → `session/invalidate-others` (every session except the caller's dies).
- Password recovery (`recover-profile`, GHSA-3j2p-qr45-q365) → `session/invalidate-all` inside the same transaction as the password `UPDATE`; there is no current session to preserve, and a captured session must not survive recovery. Sibling of GHSA-mj9f-5cwq-7p3q (logout deletes the current session row).
## GC (`::tasks/gc`, cron `session-gc`, daily)
## GC (`::job-def`, job `:session-gc`, daily)
- Deletes from `http_session_v2` where `modified_at < now - :auth-token-cookie-max-age` **or** `created_at < now - :auth-token-cookie-max-age-absolute`.
- The two thresholds are separate task params (`::tasks/max-age`, `::tasks/max-age-absolute`) built in `ig/expand-key`; both must be durations.
- The absolute max-age must be at least the idle max-age; `ig/assert-key` enforces this even when Clojure assertions are disabled. The job has no business params; its thresholds come from the job definition config.
- Do not collapse the two conditions: `modified_at` alone never collects active sessions; `created_at` alone logs out active users at the idle window.
## Related lifetimes
- Organization SSO entries in session `:props` (`:sso {org-id exp}`) last 4h, hardcoded in `app.auth.oidc`.
- Access tokens (`app.rpc.commands.access-token`) have a user-chosen `:expires-at` (Never/30/60/90/180d), independent from HTTP sessions.
- Cookie `SameSite`/`secure` depend on `:cors`, `:strict-session-cookies`, `:secure-session-cookies`; `parse-flags` auto-adds `:disable-secure-session-cookies` for non-localhost HTTP `public-uri`.
- Without `PENPOT_SECRET_KEY`, derived subsystem keys change on restart and all sessions/invitations are invalidated.
- Read-only DB pool: sessions fall back to `inmemory-manager`, lost on restart, no GC.
- HTTP middleware and cookie/header precedence details: `mem:backend/http-rpc`.
- Session management falls back to an in-memory manager on a read-only DB pool; see `app.http.session`.

View File

@ -6,7 +6,7 @@
- Preserve redo and undo order when compacting: merge `:reg-objects` per container and place registrations after changes that resize children. Never compact across commit boundaries; the backend can reject individual commits by `commit-id`. Client save ordering is in `mem:frontend/workspace-persistence`.
- Do not send a deleted component's entire object map for a metadata-only edit. Scope shape edits to `:component-id` using the builder's container context. Omitted `:objects` preserves stored shapes; explicit nil clears them. Reserve `:objects? true` for repairs that intentionally move or clear the whole map.
- Apply fixture edits through `app.common.test-helpers.files/apply-changes`; disable its validation only for intentionally invalid intermediate states. See `mem:common/testing`.
- For fixture edits and validation controls see `mem:common/testing`.
## Application and schema validation

View File

@ -8,7 +8,7 @@ Start at `app.common.types.component`, `app.common.types.container`, `app.common
- `:shape-ref` chains can cross files. `find-ref-shape` and `get-ref-chain-until-target-ref` follow them; the nearest component head and the outermost instance root are not interchangeable.
- `:touched` stores override groups from `sync-attrs`. `set-shape-attr` marks copies through `set-touched-group`, subject to ignore flags; `:position-data` is derived and never touched. Geometry and content-path comparisons use approximate equality, but width and height are excluded from the `is-geometry?` branch.
- Main shapes can acquire touched flags through cloning. `add-touched-from-ref-chain` can propagate upstream flags during variant switch, so a locally untouched shape can still act touched. `make-component-instance` cleans attrs including `:touched`, `:variant-id` and `:variant-name`; duplicating a component master does not have identical clean-copy semantics. Identify the creation path before diagnosing touched.
- Library sync compares exactly first, then tolerates drift in `:x`, `:y`, `:width`, `:height`, `:selrect`, `:points`, path/bool `:content` and numeric fields in text `:position-data`. Other fields remain exact. `close-attrs?` truncates zipped sequences, so `attr-equal?` checks point counts and position-data uses a separate length-aware comparison. See `mem:common/geometry`.
- Library sync compares exactly first, then tolerates drift in `:x`, `:y`, `:width`, `:height`, `:selrect`, `:points`, path/bool `:content` and numeric fields in text `:position-data`. Other fields remain exact. Unlike `gsh/close-attrs?`, sync checks point counts and uses a length-aware position-data comparator that checks nonnumeric fields exactly; see `mem:common/geometry` for comparator limits.
- Swap slots are touched groups `swap-slot-<uuid>` on swapped copy sub-heads. Sync matches those by slot; other children match by `shape-ref`, not index. Child order converges through async sync. `:mov-objects` and `:reorder-children` guard copy structure unless a sync or swap sets `allow-altering-copies`; new structural changes need the same guard.
- Deleting inside a component main propagates to referencing copies transitively across pages to prevent dangling refs. `generate-delete-shapes` skips propagation for the main root itself and for `allow-altering-copies` flows. Adding a shape to a copy parent clears its `:remote-synced` unless `ignore-touched`.
@ -20,14 +20,14 @@ Start at `app.common.types.component`, `app.common.types.container`, `app.common
## Referential integrity and repair
- Referential and semantic validation in `app.common.files.validate` runs for files with `"components/v2"`; it visits the root, orphan shapes and component records. `validate-file!` raises `:validation` / `:referential-integrity` with details. `update-file` uses change-scoped validation of affected pages and components; schema validation is separate in `mem:common/changes`.
- Referential and semantic validation in `app.common.files.validate` runs for files with `"components/v2"`. Full `validate-file` visits page roots, orphan shapes and component records, and checks that a present tokens library has a `:tokens-status`. Incremental `validate-file-affected` checks affected pages and components but omits that token check. `validate-file!` raises `:validation` / `:referential-integrity` with details. `update-file` uses change-scoped validation; schema validation is separate in `mem:common/changes`.
- `repair-file` produces redo changes that callers must apply or persist. `repair-file-until-valid` stops on no errors, unchanged data, a stable error fingerprint without `:shape`, or its iteration limit. Check the fingerprint before another pass; backend `PointerMap` equality is pointer identity. Multiple `:set` repairs on one shape can need multiple passes because each repair starts from the original file data.
- For `:ref-shape-not-found`, repair can restore a local component's `:main-instance-id` when the recorded main is missing but its matching main exists on the recorded page. Otherwise it tries a near-main reassignment or detaches the copy subtree.
- `:missing-slot` is a real swap only when the copy sub-head's `:shape-ref` is no longer a child of the near main parent. A sibling at a different position is a reorder, not a swap; assigning a slot blocks normal sync. `find-near-match` is a repair heuristic, not a positional validity rule. Migration 0019 uses the same membership rule; see `mem:common/file-migrations`.
## Diagnosis and tests
- For production-path swap tests use `app.common.test-helpers.compositions/swap-component-in-shape` with `:keep-touched?`; see `common/test/common_tests/logic/variants_switch_test.cljc` and `mem:common/testing`. `thf/dump-file` prints shape trees. Use production change helpers for fixture mutations.
- For fixture mutations and swap helpers see `mem:common/testing` and `common/test/common_tests/logic/variants_switch_test.cljc`. `thf/dump-file` prints shape trees.
- To inspect recent changes in a live workspace, examine `[:workspace-undo :items]`, including each item's `:tags`, `:redo-changes` and `:operations` for `:mod-obj`. See `mem:frontend/cljs-repl` for runtime selection and temporary instrumentation. Restore patched vars and remove source traces after debugging.
- To trace `update-attrs-on-switch` during a UI swap, save the original var, wrap it to capture current, previous and origin shapes, then restore it:

View File

@ -3,7 +3,7 @@
## Attribute conventions
- Prefer optional page/shape attrs with default behavior when absent. Reverting to default should usually remove the attr instead of storing nil.
- Do not treat nil as a distinct persisted state from absence. Import/export and cleanup paths may filter nil attrs away.
- Do not design nil as a distinct persisted state from absence: import/export and cleanup paths may filter nil attrs away. Change records can nevertheless distinguish omission from explicit nil; see `mem:common/changes` for `:mod-component`.
- Avoid Clojure-special naming in exported object attrs, especially boolean names ending in `?`; exported/imported data must survive JSON/SVG/Transit and external tooling.
- Normal shape attrs that participate in component sync belong in `app.common.types.component/sync-attrs` with the correct touched group. `:applied-tokens` participates through a separate route, not `sync-attrs`. See `mem:common/components` for synchronization and touched semantics.
- Store SVG attribute keys in kebab-case (`fill-rule`, not `fillRule`) and convert to React spelling only at render boundaries. Use `app.common.svg/attrs->kebab-props` for shape and defs-node attrs; for svg-raw `:content`, normalize spelling without filtering unknown keys (the sidebar reads `:stroke-style`). Don't normalize tags, attribute values or outer defs IDs as though they were attribute keys; defs IDs can decode as keywords or strings. Normalize when constructing the shape; legacy data goes through the SVG repair in `app.common.files.migrations`, not the binfile cleaner.

View File

@ -4,4 +4,4 @@
- Use `gsh/move`, `gsh/absolute-move` or `gsh/transform-shape` for geometric edits and `cts/setup-shape` for initialization. An isolated `assoc` or test helper update of `:x` or `:y` can leave `:selrect` and `:points` stale. Prefer production-path change helpers in tests; see `mem:common/testing`.
- Sub-pixel drift can arise from WASM modifiers and composed transforms, even when JVM fixture setup produces clean values. Include drift in regression tests when the bug depends on it; do not assume exact equality after transformation.
- Use the appropriate tolerance helper: scalar `app.common.math/close?` defaults to `0.001` and includes the tolerance boundary (`<=`); `gsh/close-attrs?` uses a strict boundary (`<`), while point and matrix namespaces have their own `close?`. Its zipped `:points` and `:position-data` comparisons truncate to the shorter sequence and can treat nil as equal to a vector. For each `:position-data` entry it checks only `:x` and `:y`, not text, fonts or fills. Check lengths and use a suitable comparator for variable-length data.
- For copy geometry and touched state, move with geometry-preserving helpers first, then assert or set touched as appropriate. Component sync applies tolerance selectively, not to every attribute; see `mem:common/components`.
- For copy geometry and touched state, move with geometry-preserving helpers first, then assert or set touched as appropriate. Component sync uses a different selective comparison; see `mem:common/components`.

View File

@ -5,6 +5,6 @@
- JS tests compile before running. Register new namespaces in `common_tests/runner.cljc`; new vars in registered namespaces need no runner change. Direct `node target/tests/test.js` runs the existing build and does not rebuild after edits.
- JVM coverage uses `clojure -M:dev:test:coverage`; it instruments all configured namespaces, even for a focused run, and is slower. Its lcov, HTML and EMMA form counts go under `target/coverage/`; see `tests.edn` for exclusions.
- Helpers live under `common/src/app/common/test_helpers/`. Tests using label-to-UUID helpers need `(t/use-fixtures :each thi/test-fixture)` to reset labels between tests. Inspect the builders there rather than recreating common file, component or variant setup.
- Prefer production-path mutations such as `cls/generate-update-shapes` with `thf/apply-changes`; the latter validates by default. Disable validation only for intentionally malformed intermediate state. For swaps that keep touched state use `tho/swap-component-in-shape` with `{:keep-touched? true}`. `add-variant-with-copy` does not take child position params; move them after creation. For geometry-sensitive setup see `mem:common/geometry`.
- Prefer production-path mutations such as `cls/generate-update-shapes` with `thf/apply-changes`; the latter validates the resulting file by default. Use `:validate? false` only for intentionally malformed intermediate state: it skips file validation, not change-vector validation. For swaps that keep touched state use `tho/swap-component-in-shape` with `{:keep-touched? true}`. `add-variant-with-copy` does not take child position params; move them after creation. For geometry-sensitive setup see `mem:common/geometry`.
- `sg/sample` is unseeded by default. If a test filters for a subtype, fix the seed and verify the subtype exists; otherwise `first` can yield nil and later produce a typeless shape.
- For component and referential-integrity debugging see `mem:common/components`.

View File

@ -2,5 +2,5 @@
- Diagnose the `:main` shadow-cljs build before restarting the app or treating stale behavior as a runtime bug. Read the watch output or use Penpot MCP `cljs_compiler_output` if available. `common/` CLJC changes normally recompile through the same watch.
- A delimiter error can point to a later form or EOF. Repair the affected file before linting with `bb scripts/paren-repair <file>` from the repo root. Penpot MCP `clj_check_parentheses`, if available, can help locate the mismatch.
- From `frontend/`, `clojure -M:dev:shadow-cljs compile test` reports analyzer warnings only for namespaces it recompiles. A warm incremental run with no warnings is not evidence that old warnings are gone; use a fresh test build cache to verify the whole target. Treat `:fn-arity` as a defect; see `mem:frontend/testing-unit`.
- From `frontend/`, `clojure -M:dev:shadow-cljs compile test` reports analyzer warnings only for namespaces it recompiles. A warm incremental run with no warnings is not evidence that old warnings are gone; use a fresh test build cache to verify the whole target. For `:fn-arity` consequences see `mem:frontend/testing-unit`.
- If the build succeeds but the browser still fails, use `mem:frontend/cljs-repl` or `mem:frontend/handling-crashes`. For minified stacks, consult the release targets and source-map settings in `frontend/shadow-cljs.edn` and the build commands in `frontend/package.json`.

View File

@ -4,4 +4,4 @@
- A React error boundary can display an error without setting the store's `:exception`; a nil value alone does not prove the UI recovered. See `mem:frontend/error-reporting`.
- If the live REPL is available, `(.reload js/location)` reloads the browser; otherwise select and reload the workspace tab. Confirm both that the workspace renders and that the store exception is clear. For runtime selection see `mem:frontend/cljs-repl`.
- Before reloading, account for unsaved edits and partial saves: an earlier commit from a rejected batch can already be durable. Review `mem:frontend/workspace-persistence` before retrying edits.
- `execute_code` waits for save and fails on errors or rollback detected during that wait, but later failures can still occur. Plugin availability and rollback notice persistence have separate limits; see `mem:mcp/save-and-rollback` and `mem:frontend/plugin-save-events`.
- In a workspace, `execute_code` waits for save and fails on errors or rollback detected during that wait, but later failures can still occur. Dashboard calls skip the wait when `penpotMgmt` identifies that context; workspace readiness, plugin availability and rollback notice persistence have separate limits: see `mem:mcp/save-and-rollback` and `mem:frontend/plugin-save-events`.

View File

@ -2,7 +2,7 @@
- Start at `app.plugins.persist` for `penpot.waitForSave` and `app.plugins.events` for `contentsave` and `contentrollback`. The runtime forwarder requires `content:read` for `waitForSave`; new event names must also be added to runtime `validEvents`, and a stale runtime build can reject them.
- `waitForSave(timeout?)` observes the shared persistence queue, not only the plugin's commits. Its default timeout is 60 seconds. It waits briefly for incoming commits, capped by the timeout; if work is pending it forces persistence and races settlement against rollback start or completion. A rollback must reject even if the status later becomes `:saved`. See `mem:frontend/workspace-persistence`.
- An earlier `:error` rejects even when no work is pending: a slow retry produces `save-retrying`, while a terminal failure keeps rejecting while the error remains. Reopening a file or a role change can trigger recovery; see `mem:frontend/workspace-persistence` for its conditions. Other error codes include `save-timeout`, `rolled-back` and the stored failure code (default `save-failed`). Timeout validation accepts a positive finite number up to `u/max-timeout`; rejection must be an `Error`, not a string.
- An earlier `:error` rejects even when no work is pending: a slow retry produces `save-retrying`; terminal failures use the stored failure code (default `save-failed`). Other error codes include `save-timeout` and `rolled-back`. Timeout validation accepts a positive finite number up to `u/max-timeout`; rejection must be an `Error`, not a string. For queue halts and recovery conditions see `mem:frontend/workspace-persistence`.
- `contentsave` is a debounced state watch for transitions to `:saved` and passes no value. It does not prove the buffer is empty.
- `contentrollback` subscribes to `::dps/rolled-back`, not the state watch. It is not debounced and is delivered asynchronously after reverted or reloaded data is in state. Its `{fileIds, pageIds, shapeIds}` payload comes from page-shape redo changes in reverted commits. Remove the stream subscription when the listener is removed.
- MCP forwards rollback notices with task responses and retains unsent notices in per-file plugin local storage when available. Delivery is not an end-to-end acknowledgment; for its storage permissions, handoff and failure limits see `mem:mcp/save-and-rollback`.

View File

@ -1,6 +1,6 @@
# Frontend CLJS unit tests
- Start in `frontend/test/frontend_tests/`; add new namespaces to `frontend_tests/runner.cljs`. From `frontend/`, use `pnpm run test:quiet -- --focus <namespace-or-var>` to compile and run a narrow test; the compiled runner alone does not rebuild after edits.
- Start in `frontend/test/frontend_tests/`; add new namespaces to `frontend_tests/runner.cljs`. LLMs must use `test:quiet` for frontend tests. From `frontend/`, use `pnpm run test:quiet -- --focus <namespace-or-var>` to compile and run a narrow test; the compiled runner alone does not rebuild after edits.
- Reproduce async behavior in async tests. `^:async` needs map-style fixtures, and promises from async helpers, fixtures and nested mock scopes must be awaited. Legacy `t/async` terminates through `done`, not the body promise. Missing awaits can leave a passing test with no assertions.
- Prefer `mock/with-mocks*` with an awaited body; use scoped mutable stubs so mocks survive `await`. Dynamic bindings do not. Close mocks and subscriptions after the terminal continuation, not just after sending the first event. Use `frontend-tests.helpers.async` and `frontend-tests.helpers.mock` for the available helpers.
- Subscribe before pushing to a hot stream. Use `await-response` for subscribe→push→await and observe terminal completion when asserting a sequence. When a state change can precede the last RPC, wait for the RPC through the mock; otherwise an in-flight call may hit real HTTP after teardown. Use a signal for a state-dependent wait when available; use explicit settling for ordering that has no signal.

View File

@ -3,4 +3,4 @@
- Start with `mem:testing` for test design and output discipline. For lint, unit tests and format together, run `./scripts/ci frontend` from the repo root; see `mem:scripts/ci`.
- Testing CLJS events, helpers or UI logic against mocks: `mem:frontend/testing-unit`. Testing component behavior through composable commands: `mem:frontend/composable-component-tests`.
- Running or editing integration specs with a release bundle: `mem:frontend/testing-playwright` (only on explicit request). For CI jobs that consume that bundle, see `mem:frontend/e2e-ci-workflow`.
- JVM tests alone do not exercise frontend state, the WASM bridge or browser gestures. For a live check use `mem:frontend/cljs-repl` or `mem:frontend/playwright-gestures`. For failed compile or hot reload use `mem:frontend/compile-diagnostics`; a runtime crash is `mem:frontend/handling-crashes`.
- JVM tests alone do not exercise frontend state, the WASM bridge or browser gestures. For live inspection use `mem:frontend/cljs-repl`; for real input use `mem:frontend/playwright-gestures`. For failed compile or hot reload use `mem:frontend/compile-diagnostics`; for a runtime crash use `mem:frontend/handling-crashes`.

View File

@ -1,6 +1,6 @@
# Frontend UI styles
- Start with `docs/technical-guide/developer/ui.md` and the owning component. Prefer co-located SCSS modules, `app.main.style/stl`, and Design System tokens and mixins over legacy global selectors or deprecated `resources/styles/common/refactor/spacing.scss`. Keep specificity low and style only DOM the component owns.
- Start with `docs/technical-guide/developer/ui.md` and the owning component. Prefer co-located SCSS modules, `app.main.style/stl`, and Design System tokens and mixins over legacy global selectors or deprecated `resources/styles/common/refactor/spacing.scss`. Keep specificity low; for component DOM ownership see `mem:frontend/ui-cljs`.
- Use named tokens for colors, spacing, fixed sizes, borders and typography; prefer Design System typography components and mixins. Component-local CSS custom properties can express variants and theme states.
- Prefer logical properties for directional layout, but avoid logical and physical declarations that compete for the same dimension. For a dynamically sized element keep the stylesheet and inline declaration consistent; the import progress bar illustrates the conflict. Dynamic inline styles on native CLJS UI elements must be JS objects; see `mem:frontend/ui-cljs`.
- For package-generated CSS and a stale shared stylesheet see `mem:frontend/ui-package`. For text editor styles and runtime boundaries see `mem:frontend/text-editor`.

View File

@ -983,9 +983,8 @@
(defn validate-file-affected
"Validate only the pages and components touched by `changes`.
Semantics are identical to `validate-file` but the work is bounded
to the entities that were actually mutated, making it safe and cheap
to call on every incremental file update.
Unlike `validate-file`, this does not check for a missing tokens-status.
Both validations run only for files with the components/v2 feature.
Returns a list of errors or `nil`."
[{:keys [data features] :as file} libraries changes]