Skip to content

dev: make plugin development and test harnesses reproducible - #10826

Open
iansherr wants to merge 2 commits into
TriliumNext:mainfrom
iansherr:agent/plugin-dev
Open

dev: make plugin development and test harnesses reproducible#10826
iansherr wants to merge 2 commits into
TriliumNext:mainfrom
iansherr:agent/plugin-dev

Conversation

@iansherr

@iansherr iansherr commented Aug 2, 2026

Copy link
Copy Markdown

Why this PR exists

Plugin development required isolated Trilium instances with configurable data directories, ports, and script sources. The existing script-deployer workflow used fixed local paths and did not initialize the complete server core before deployment testing.

Those defaults were reasonable for the original single-instance development workflow. Plugin development exposed the need for a more configurable and faithful local test harness without changing production defaults.

What changed

  • Adds environment overrides for the development data directory, port, and script source directory.
  • Initializes the complete server core before database and script-deployment setup.
  • Keeps backend scripting explicitly enabled for this trusted local-only harness.
  • Adds the missing @stylistic/eslint-plugin dev dependency required by the repository's existing ESLint configurations, allowing clean installs to run lint.
  • Adds the minimal Split.js TypeScript configuration required by the repository typecheck.
  • Gives intentionally expensive cold-import and image-processing tests explicit per-test timeouts instead of changing the global timeout.
  • Handles asynchronous script-watch updates without leaving untracked promises.

Validation

  • pnpm typecheck
  • Script-deployer tests: 22 passed
  • Split.js tests: 12 passed
  • Focused plugin-manager tests: 9 passed
  • Scoped ESLint checks for changed client/server/script-deployer files
  • Isolated script-deployer smoke test with a fresh database and port 39842
  • git diff --check

Manual verification

  • Set TRILIUM_DEV_DATA_DIR, TRILIUM_DEV_PORT, and TRILIUM_SCRIPT_SOURCE_DIR.
  • Start the script-deployer harness.
  • Confirm a new database is created in the configured directory.
  • Confirm the configured port is used and scripts are deployed.
  • Stop the process and verify that the normal Trilium data directory was not touched.

Scope

This PR is limited to development and test-harness reliability. Production plugin behavior and Docker artifact composition are submitted separately.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves reproducibility for plugin development and test harnesses.

  • Adds configurable data-directory, port, and script-source overrides to the script-deployer harness.
  • Initializes the server core before database and deployment setup.
  • Adds targeted timeouts for expensive test cases and a Split.js TypeScript configuration.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/script-deployer/src/dev.ts Adds environment-driven harness configuration, complete core initialization, explicit scripting settings, and asynchronous watcher invocation.
apps/client/src/widgets/attribute_widgets/attribute_detail.spec.ts Gives cold module-import positioning tests explicit per-test timeouts.
apps/client/src/widgets/type_widgets/spreadsheet/locales.spec.ts Gives the intentionally expensive locale import test an explicit timeout.
apps/server/src/services/image_provider.spec.ts Gives the JPEG quality-clamping test additional time under worker contention.
packages/splitjs/tsconfig.json Adds a no-emit JavaScript-aware TypeScript project configuration for Split.js.

Sequence Diagram

sequenceDiagram
    participant E as Environment
    participant D as Script Deployer
    participant C as Trilium Core
    participant DB as SQLite
    participant S as HTTP Server
    E->>D: Data directory, port, script directory
    D->>C: initializeCoreForDev()
    C->>DB: Open configured database
    D->>DB: Create initial database if missing
    D->>S: Start Trilium server
    D->>DB: Create token and scripts folder
    D->>D: Deploy scripts and watch changes
Loading

Reviews (2): Last reviewed commit: "Merge branch 'main' into agent/plugin-de..." | Re-trigger Greptile

@iansherr
iansherr marked this pull request as ready for review August 6, 2026 23:00
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants