Skip to content

Contributing

root edited this page Dec 4, 2026 · 2 revisions

Contributing

🌐 English · 简体中文

Thank you for your interest in contributing to Trizano. This page covers how to file issues, build and test locally, edit API contracts, follow the project's engineering and commit conventions, and keep documentation in sync. For toolchain details, Makefile internals, and release workflows, see Development Guide.


Filing Issues

Before opening an issue, check FAQ & Troubleshooting, Project Status & Roadmap, and existing GitHub issues to see if the topic is already covered.

  • Bug reports: Include the Trizano version (Hub, Node, and client), OS and CPU architecture, which client you used (Web, Desktop, or Android), the agent CLI and version if applicable, steps to reproduce, and relevant logs (~/.trizano/node/node.log, Hub launchd/systemd output, or browser console errors). Redact private domains, hostnames, and tokens before posting.
  • Feature proposals and larger changes: Open an issue to discuss the design and scope before writing a large pull request—especially if your change modifies proto/, event synchronization, or multiple clients.
  • Security vulnerabilities: Do not open a public issue. Report vulnerabilities privately via GitHub Private Vulnerability Reporting as described in SECURITY.md in the repository root. See also Security Model.

Local Build and Test

Make sure Go (1.27.4), Node.js (24), pnpm (12.23.0), buf (v2), protoc-gen-go, and protoc-gen-connect-go are installed and on your PATH (Android builds also require JDK 17 and the Android SDK). Full toolchain and Makefile details live in Development Guide.

# Install frontend workspace dependencies (web and packages/proto-ts)
pnpm install

# Run Hub + local Node (terminal 1) and Vite dev server on http://localhost:5733 (terminal 2)
make dev
make dev-web

When opening the dev UI in a browser, use http://localhost:5733 (not 127.0.0.1) so WebAuthn passkeys work.

Running Tests

All automated tests run locally against fake agent CLIs and simulators under server/hub/testdata/—no real agent accounts or API keys are needed.

# Core test suite: go vet, GOOS=windows go vet, go test -race (with temporary sshd), and web typecheck
make test

make test does not include Web unit tests (vitest), MyGo desktop tests, or Android tests. Run the relevant suite whenever you touch those modules:

# Web unit tests
pnpm --filter @trizano/web test

# MyGo desktop client (vet across Linux, Windows, macOS + race tests)
cd desktop-go && go vet ./... && GOOS=windows go vet ./... && GOOS=darwin go vet ./... && go test -race ./...

# Android unit tests (or `make android-test` to run HubContractTest against bin/trizano-carbon)
cd android && ./gradlew :app:testDebugUnitTest

Two cross-platform details to keep in mind:

  • make test runs GOOS=windows go vet ./.... Place Unix-only test code in *_unix_test.go with //go:build !windows.
  • If you modify Node code (server/node/ or server/cmd/trizano-h3) and test automatic build replacement locally, rebuild bin/dist/* with make dist (or make build).

Changing API Contracts (proto/ + make gen)

Protobuf under proto/ (trizano.hub.v1, trizano.node.v1, trizano.roster.v1) is the single source of truth for Hub, Node, and all three clients.

  1. Edit .proto files under proto/ only—never hand-edit generated code.
  2. Run make gen, which executes buf lint and buf generate to regenerate server/gen/ (Go + Connect) and packages/proto-ts/src/gen/ (TypeScript). Android generates Kotlin/Java-lite directly from proto/ at Gradle build time.
  3. Commit both the .proto edits and the regenerated files in server/gen/ and packages/proto-ts/src/gen/.
  4. Changes must satisfy buf.yaml (STANDARD lint rules and FILE-level breaking-change checks).

Notes on contracts and compatibility:

  • Because the Hub transparently proxies /nodes/{node}/<procedure> without decoding payloads, adding a new RPC to trizano.node.v1 normally requires no Hub routing changes.
  • Legacy molchuan wire and storage identifiers—proto package names (molchuan.*.v1), HTTP headers (X-Trizano-*), cookie (trizano_session), signature domain strings (trizano-pair-v1, etc.), Android package ID (top.onemolchuan.code), and Desktop identifier (top.onemolchuan.code.desktop)—are intentionally preserved so existing clients and pairings keep working. Do not rename them.

Engineering Principles

Reviews and pull requests follow a concise set of engineering conventions (also summarized in CLAUDE.md and docs/tech-route.md §11, a Chinese design document):

  • No defensive coding:
    • Validate once at trust boundaries: Check inputs at network entrypoints, authentication, resource-name parsing, and proto field constraints. Internal code trusts strong types and call contracts—avoid redundant nil checks and "just in case" fallback branches.
    • Bubble errors explicitly: Return errors with appropriate Connect error codes all the way to the UI. Do not swallow errors, silently degrade, or mask missing state with fallback defaults.
    • Single owner per mutable state: Each piece of mutable state has one owner (such as a session actor goroutine or node connection supervisor) mutated via messages rather than scattered locks.
    • Keep retries in the connection layer: SSH reconnects, Reverse Node backoff, and event-stream resumption live in the connection layer with visible status—never hide implicit retries inside business RPCs.
  • Sanitize external bytes to valid UTF-8: Before placing output from external processes (SSH, agent CLIs, Git, terminal OSC sequences) into proto3 string fields, clean it with strings.ToValidUTF8(s, "\uFFFD") and truncate only on UTF-8 character boundaries so invalid bytes cannot break the event stream.
  • Probe agent capabilities at runtime: Models, reasoning effort, fast mode, and permission modes are probed from each CLI and cached by CLI version. Do not hardcode model or mode lists.
  • Preserve extension boundaries: When simplifying or refactoring, keep core interfaces such as driver.Driver and nodes.Dialer intact.
  • Keep Web and Android sync aligned: web/src/state/sync.ts / timeline.ts and Android's state/Store implement the same event-synchronization state machine. When changing sync semantics, update both clients.

Commit, Language, and Documentation Conventions

  • Commit messages: Use English Conventional Commits, such as feat(approval): ..., fix(sync): ..., or docs(wiki): ....
  • Code comments: Write code comments in English.
  • UI copy and user-facing errors: Currently written in Chinese (until UI internationalization lands; see Project Status & Roadmap). Design documents under docs/ are also written in Chinese.
  • Keep bilingual public documentation in sync:
    • README.md (English) and README.zh-CN.md (Simplified Chinese) mirror each other section by section—update both together.
    • Wiki source files live in docs/wiki/: English pages use the base filename (Page-Name.md) and Chinese pages add the -zh suffix (Page-Name-zh.md). When changing architecture, adding features, or modifying user-visible behavior, update both language versions of the affected pages.
    • Keep internal links within the same language (English pages link to Page.md; Chinese pages link to Page-zh.md) and use ../assets/<file> for images under docs/assets/.

Licensing

Trizano is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) (see LICENSE in the repository root).

  • Inbound = Outbound: By submitting a pull request or patch, you agree to license your contribution under AGPL-3.0 under the same terms as the project. No Contributor License Agreement (CLA) is required.
  • Third-party notices: web/ includes MIT-licensed code originally forked from t3code (web/LICENSE-t3code), and bundled fonts under web/public/fonts/ retain their respective licenses. Keep all existing license notices intact.

Clone this wiki locally