From a36193e54b4c82b1a8565925017ee9f7f102fcb7 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 8 Oct 2026 17:33:40 +0000 Subject: [PATCH] :bug: Pass team-id in binfile v3 import tests `resolve-and-link-libraries` asserts `::bfc/team-id`, and `enable-backend-asserts` is now enabled in `scripts/ci` and `tests-backend.yml`. Without a team-id, the v3 import tests error instead of passing. Production always provides the team (RPC import, management and debug routes); mirror that in the tests. Update `mem:backend/testing` and `mem:scripts/ci` with the `enable-backend-asserts` behavior. Verified with `./scripts/ci backend`: 1235 tests, 6384 assertions, 0 failures. AI-assisted-by: deepseek-v4.1-flash --- .serena/memories/backend/testing.md | 1 + .serena/memories/scripts/ci.md | 3 +++ backend/test/backend_tests/binfile_svg_test.clj | 1 + backend/test/backend_tests/binfile_test.clj | 6 ++++++ 4 files changed, 11 insertions(+) diff --git a/.serena/memories/backend/testing.md b/.serena/memories/backend/testing.md index 23ae25c31c..256a330fa1 100644 --- a/.serena/memories/backend/testing.md +++ b/.serena/memories/backend/testing.md @@ -5,6 +5,7 @@ JVM `clojure.test` (kaocha runner) under `backend/test/backend_tests/`. - READ `mem:testing` FIRST — it defines the execution discipline (no piping, tee to file, preferred commands) that applies to all JVM test runs. - All CLI commands must be executed from the `backend/` subdirectory. - Tests are invoked directly via `clojure -M:dev:test` (kaocha) — there is no pnpm wrapper. Kaocha auto-discovers test namespaces, so no runner registration is needed. +- `clojure.core/assert` is elided at compile time unless `PENPOT_FLAGS` contains `enable-backend-asserts` (`app.config` sets `*assert*` from it). `scripts/ci` and `tests-backend.yml` export the flag; a bare `clojure -M:dev:test` (or `--focus` run) without it silently skips every precondition assert. - Coverage: if code is added or modified in `src/`, corresponding tests in `test/backend_tests/` must be added or updated. - Isolated run: `clojure -M:dev:test --focus backend-tests.my-ns-test` for a specific test namespace, or `clojure -M:dev:test --focus backend-tests.my-ns-test/my-test-var` for a specific test var. - Regression run: `clojure -M:dev:test` to ensure no regressions in related functional areas. diff --git a/.serena/memories/scripts/ci.md b/.serena/memories/scripts/ci.md index 69d3fa6968..e3ee25c614 100644 --- a/.serena/memories/scripts/ci.md +++ b/.serena/memories/scripts/ci.md @@ -55,6 +55,9 @@ Flags: - `mcp` has no lint task (shows as skipped). `render-wasm` uses `./lint`, `./test`, and `cargo fmt`. +- Exports `PENPOT_FLAGS` with `enable-backend-asserts` appended to any + existing value, so backend test runs compile in and exercise + precondition asserts; see `mem:backend/testing`. - Test tasks are long-running (backend: `clojure -M:dev:test`); use a generous timeout when calling it from an agent shell. - Skill entry point: `.agents/skills/local-ci/SKILL.md`. diff --git a/backend/test/backend_tests/binfile_svg_test.clj b/backend/test/backend_tests/binfile_svg_test.clj index 500c497df1..a12d30e895 100644 --- a/backend/test/backend_tests/binfile_svg_test.clj +++ b/backend/test/backend_tests/binfile_svg_test.clj @@ -256,6 +256,7 @@ result (-> th/*system* (assoc ::bfc/project-id (:default-project-id profile)) (assoc ::bfc/profile-id (:id profile)) + (assoc ::bfc/team-id (:default-team-id profile)) (assoc ::bfc/input evil) (v3/import-files!))] (t/is (= 1 (count (:file-ids result)))) diff --git a/backend/test/backend_tests/binfile_test.clj b/backend/test/backend_tests/binfile_test.clj index df12541d16..b29b2fcf29 100644 --- a/backend/test/backend_tests/binfile_test.clj +++ b/backend/test/backend_tests/binfile_test.clj @@ -180,6 +180,7 @@ (let [result (-> th/*system* (assoc ::bfc/project-id (:default-project-id profile)) (assoc ::bfc/profile-id (:id profile)) + (assoc ::bfc/team-id (:default-team-id profile)) (assoc ::bfc/input output) (v3/import-files!)) file-id (first (:file-ids result)) @@ -213,6 +214,7 @@ result (-> th/*system* (assoc ::bfc/project-id (:default-project-id profile)) (assoc ::bfc/profile-id (:id profile)) + (assoc ::bfc/team-id (:default-team-id profile)) (assoc ::bfc/input input) (v3/import-files!))] (bfc/get-file th/*system* (first (:file-ids result))))) @@ -267,6 +269,7 @@ (let [result (-> th/*system* (assoc ::bfc/project-id (:default-project-id profile)) (assoc ::bfc/profile-id (:id profile)) + (assoc ::bfc/team-id (:default-team-id profile)) (assoc ::bfc/input output) (v3/import-files!))] (t/is (map? result)) @@ -300,6 +303,7 @@ (let [result (-> th/*system* (assoc ::bfc/project-id (:default-project-id profile)) (assoc ::bfc/profile-id (:id profile)) + (assoc ::bfc/team-id (:default-team-id profile)) (assoc ::bfc/input output) (v3/import-files!)) imported (bfc/get-file th/*system* (first (:file-ids result)))] @@ -2388,6 +2392,7 @@ (let [result (:file-ids (-> th/*system* (assoc ::bfc/project-id (:default-project-id profile)) (assoc ::bfc/profile-id (:id profile)) + (assoc ::bfc/team-id (:default-team-id profile)) (assoc ::bfc/input output) (v3/import-files!))) files (map #(bfc/get-file th/*system* %) result) @@ -2466,6 +2471,7 @@ (let [result (:file-ids (-> th/*system* (assoc ::bfc/project-id (:default-project-id profile)) (assoc ::bfc/profile-id (:id profile)) + (assoc ::bfc/team-id (:default-team-id profile)) (assoc ::bfc/input output) (v3/import-files!))) mobjs (db/query th/*system* :file-media-object