Testing & Contribution Guidelines
Relevant source files
The following files were used as context for generating this wiki page:
Testing and contribution guidelines establish the technical standards for developing, validating, and maintaining the superglue platform. These guidelines ensure code quality through consistent testing patterns, standardized development environments, and structured contribution workflows for both core and enterprise features.
Quick Start Development
Superglue uses a monorepo structure with specific command patterns for local development and quality assurance.
| Task | Command | Description |
|---|---|---|
| Start Development | npm run dev | Starts all services using Turbo. |
| Run Tests | npm run test | Executes the Vitest suite. |
| Fix Linting | npm run lint:fix | Formats code using Prettier. |
| Type Check | npm run type-check | Performs TypeScript validation. |
Sources: CLAUDE.md:3-10
The project operates on three primary ports during development:
- 3000: GraphQL
- 3001: Web Interface
- 3002: REST API
Sources: CLAUDE.md:12
Testing Standards
The project utilizes Vitest for unit and integration testing. Test files must follow the naming convention feature.test.ts and reside in the same directory as the source file being tested.
Sources: CLAUDE.md:104-106
Test Structure and Mocking
Tests follow the "should [behavior] when [condition]" description pattern. Developers must use vi.mock to isolate external dependencies, such as Playwright browsers or network requests via Axios.
A sentence explaining the diagram: This flow illustrates the standard lifecycle of a test execution within the superglue environment, from initial setup to final assertion.
Sources: CLAUDE.md:110-135, packages/core/documentation/documentation.test.ts:40-70
Key Testing Areas
The test suite covers critical system logic including:
- Documentation Fetching: Validates HTML to Markdown conversion and Playwright crawling strategies. Sources: packages/core/documentation/documentation.test.ts:72-100
- API Helpers: Ensures correct mapping of pagination types and failure behaviors. Sources: packages/core/api/tools.test.ts:13-35
- Tool Validation: Rejects malformed tool configurations (e.g., missing IDs or URLs). Sources: packages/core/api/tools.test.ts:50-100
Contribution Workflow
Contributions must adhere to the project's architectural conventions and error-handling patterns.
Development Conventions
- Imports: Place all imports at the top of the file; do not use inline imports.
- File Extensions: Always use the
.jsextension for local imports (e.g.,import { x } from "./file.js"). - Types: Define all shared types in
packages/shared/types.tsand export them viapackages/shared/index.ts. - API Development: Prefer REST over GraphQL. New endpoints must use the
registerApiModulepattern inpackages/core/api/.
Sources: CLAUDE.md:21-30
Feature Completion Checklist
Before submitting a pull request, you must complete the following steps:
- Format code:
npm run lint:fix. - Catch type errors:
npm run type-check. - Verify logic:
npm run test.
Sources: CLAUDE.md:36-39
Architectural Modules
Contributors should reuse existing utilities and patterns to maintain consistency across the codebase.
REST API Implementation
API handlers must use the AuthenticatedFastifyRequest type, which provides access to the datastore, worker pools, and trace IDs. Error responses should always use the sendError(reply, code, message) helper rather than throwing exceptions.
A sentence explaining the diagram: This sequence diagram details the standard processing of a REST API request, highlighting the use of orgId context and standardized error helpers.
Sources: CLAUDE.md:43-75
Agent and Skill System
The AI agent relies on "skills" (reference documentation) loaded via load_skill. Contribution to agent logic requires updating the TOOL_REGISTRY and associated prompts.
| Tool Group | Tools Included | Usage Context |
|---|---|---|
| Base Tools | load_skill, find_tool, run_tool, call_system | General interaction and debugging. |
| Tool Building | build_tool, save_tool | Workflow creation. |
| Systems Handling | create_system, edit_system, authenticate_oauth | Integration management. |
Sources: packages/web/src/lib/agent/registries/tool-registry.ts:1210-1235, packages/web/src/lib/agent/agent-prompts.ts:145-155
Enterprise vs Open Source
Contributors must identify if code belongs in the Open Source (OSS) or Enterprise Edition (EE). EE-specific code is located within ee/ subdirectories, covering features like cron scheduling, Slack notifications, and advanced metrics.
Sources: CLAUDE.md:14-19
Summary
The Testing & Contribution Guidelines ensure that the superglue platform remains deterministic and high-quality. By following the standardized Vitest patterns, adhering to monorepo conventions, and utilizing the provided API and Agent registries, contributors can effectively extend the system's integration capabilities.