Welcome! We are excited that you want to contribute to the Servverse ecosystem. This document outlines the guidelines, code style standards, and processes for contributing to all repositories within the Servverse ecosystem.
- Formatting: Always format your Go code using
gofmtorgoimportsbefore committing. - Linting: Ensure your code compiles cleanly and passes all standard Go linters (
golangci-lint). - Comment Integrity: Preserve all existing comments and documentation that are unrelated to your edits. Document public functions, types, and packages following idiomatic Go standards.
All REST endpoints inside Servverse services must adhere to the following API rules:
- Prefix: Every endpoint must be versioned and start with the
/api/v1/prefix. - Standardized Error Format: JSON error responses must include both
"error"(internal code) and"message"(human-readable explanation) fields:{ "error": "resource_not_found", "message": "The requested service record was not found." } - Deprecation: If an API route is deprecated, annotate the handler with a
@deprecatedtag and ensure it sets a deprecation header (X-Deprecated: trueorDeprecated: true).
- Coverage: Every repository enforces a test coverage threshold (baseline-ratcheted or 60.0% default) verified by the coverage checker on pull requests. Make sure to write unit and integration tests for new features.
- Backward Compatibility: Pre-merge checks will analyze specs for breaking API changes. Avoid removing fields or breaking JSON structure compatibility.
- Performance SLA: Merges are blocked if latency runs exceed SLA p99 benchmarks.
- Branch Naming:
- Use descriptive branch prefixes:
feature/for new functionality,bugfix/for fixes,docs/for documentation updates, andtest/for test suite additions.
- Use descriptive branch prefixes:
- Local Validation:
- Before opening a PR, run tests locally for your component:
go test -v ./... - Run the local CI checkers inside the
servverse-repodirectory if applicable:- Coverage:
go run scripts/check_coverage.go - API Consistency:
go run scripts/check_api_consistency.go
- Coverage:
- Before opening a PR, run tests locally for your component:
- Submitting:
- Target the
mainbranch. - Provide a clear PR summary detailing what was changed, why, and how you verified it.
- Target the
The Serv-lang standard library provides built-in functions accessible across services.
To add a new built-in function or package:
- Define the signature: Open the semantic analyzer in the compiler and register the new module/function name, return types, and parameter bounds.
- Implement the runtime: Add the underlying Go logic execution code in the interpreter/runtime engine.
- Verify Domain Boundaries: Make sure helper methods or internal namespaces are properly restricted and cannot be invoked from outside their domains.
- Write Tests: Add table-driven semantic analysis and compiler execution tests verifying parameter limits.
Servverse supports running serverless functions compiled to WebAssembly (WASM). To write a custom WASM plugin:
- Compilation: Compile your Go, Rust, or C code into a WASM module targeting the WebAssembly System Interface (WASI).
- Deployment: Annotate your service definition header comments with runtime details:
// runtime: wasm - API Contracts: WASM modules communicate via stdin/stdout stream pipelines or standard POSIX file descriptors managed by the
ServCloudcontainer isolation layer. Ensure your entrypoints handle input arguments and output results correctly.