Fix API tests that require local-only registry fixture and slow CI hooks #280

Closed
opened 2026-06-04 22:01:47 +00:00 by steve · 0 comments
Owner

Problem

Forgejo checks fail @lapis-notes/api#test in CI because:

  1. official-registry-fixture.test.ts expects a sibling lapis-plugin-registry
    checkout that CI does not have.
  2. plugin-manager.test.ts beforeAll dynamically imports workspace/deps and
    workspace-plugin-dependency-resolver, pulling a large UI/plugin-host graph
    through Vite in the linux/amd64 container (hook timeouts, 100s+ suite locally
    in Docker).

Interim mitigation (landed)

  • official-registry-fixture.test.ts: describe.skipIf when local generated
    registry is absent.
  • plugin-manager.test.ts: describe.skipIf(process.env.CI) with hooks moved
    inside the suite so CI does not compile workspace deps.

Acceptance Criteria (proper fix via stubbing)

  • Add Vitest stubs/aliases so plugin-manager.test.ts runs in CI without
    importing real workspace/deps or generated plugin-host-cjs-provider-values
    (empty provider map is enough for canResolve / install-bundle paths).
  • Replace sibling-registry dependency with a checked-in minimal fixture under
    packages/api/test/fixtures/ (or fetch in CI) so
    official-registry-fixture.test.ts runs everywhere.
  • Remove describe.skipIf(process.env.CI) from plugin-manager.test.ts once
    stubs are in place.
  • pnpm docker:ci-check --skip-smoke passes with both suites enabled.

Stubbing approach

  1. Legacy workspace deps — Vite alias workspace/src/lib/deps to a test
    module exporting {} values for keys the resolver reads in install-bundle tests.
  2. Plugin-host providers — alias generated plugin-host-cjs-provider-values
    to a stub keyed from plugin-host-cjs-providers.generated with {} entries.
  3. Registry fixture — commit minimal index.json + one signed plugin entry
    under packages/api/test/fixtures/official-registry/ and point the test at it.

Validation Commands

  • pnpm exec turbo run test --filter=@lapis-notes/api --force
  • pnpm docker:ci-check --skip-smoke --pull

Implementation Summary

Vitest aliases plugin-host-cjs-provider-values to a lightweight stub; PluginManager keeps lazy workspace/deps import with 120s hook budget and ResizeObserver in vitest.setup. Checked-in signed registry fixture under packages/api/test/fixtures/official-registry/v1/ replaces sibling lapis-plugin-registry. Removed CI skipIf gates. Validated: CI=true pnpm exec turbo run test --filter=@lapis-notes/api --force; check:format/types/lint for @lapis-notes/api.

## Problem Forgejo checks fail `@lapis-notes/api#test` in CI because: 1. `official-registry-fixture.test.ts` expects a sibling `lapis-plugin-registry` checkout that CI does not have. 2. `plugin-manager.test.ts` `beforeAll` dynamically imports `workspace/deps` and `workspace-plugin-dependency-resolver`, pulling a large UI/plugin-host graph through Vite in the linux/amd64 container (hook timeouts, 100s+ suite locally in Docker). ## Interim mitigation (landed) - `official-registry-fixture.test.ts`: `describe.skipIf` when local generated registry is absent. - `plugin-manager.test.ts`: `describe.skipIf(process.env.CI)` with hooks moved inside the suite so CI does not compile workspace deps. ## Acceptance Criteria (proper fix via stubbing) - [ ] Add Vitest stubs/aliases so `plugin-manager.test.ts` runs in CI without importing real `workspace/deps` or generated `plugin-host-cjs-provider-values` (empty provider map is enough for `canResolve` / install-bundle paths). - [ ] Replace sibling-registry dependency with a checked-in minimal fixture under `packages/api/test/fixtures/` (or fetch in CI) so `official-registry-fixture.test.ts` runs everywhere. - [ ] Remove `describe.skipIf(process.env.CI)` from `plugin-manager.test.ts` once stubs are in place. - [ ] `pnpm docker:ci-check --skip-smoke` passes with both suites enabled. ## Stubbing approach 1. **Legacy workspace deps** — Vite alias `workspace/src/lib/deps` to a test module exporting `{}` values for keys the resolver reads in install-bundle tests. 2. **Plugin-host providers** — alias generated `plugin-host-cjs-provider-values` to a stub keyed from `plugin-host-cjs-providers.generated` with `{}` entries. 3. **Registry fixture** — commit minimal `index.json` + one signed plugin entry under `packages/api/test/fixtures/official-registry/` and point the test at it. ## Validation Commands - `pnpm exec turbo run test --filter=@lapis-notes/api --force` - `pnpm docker:ci-check --skip-smoke --pull` ## Implementation Summary Vitest aliases plugin-host-cjs-provider-values to a lightweight stub; PluginManager keeps lazy workspace/deps import with 120s hook budget and ResizeObserver in vitest.setup. Checked-in signed registry fixture under packages/api/test/fixtures/official-registry/v1/ replaces sibling lapis-plugin-registry. Removed CI skipIf gates. Validated: CI=true pnpm exec turbo run test --filter=@lapis-notes/api --force; check:format/types/lint for @lapis-notes/api. <!-- backlog:task_id=TASK-fix-api-ci-only-test-failures source_spec=spec/src/80-maintenance/monorepo-scripts.md related_issue=279 -->
steve 2026-06-04 23:00:22 +00:00
  • closed this issue
  • added
    done
    and removed
    open
    labels
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lapis-notes/lapis#280
No description provided.