Skip to main content

Contributing

Guide for contributing to SCM development.

Prerequisites

Building

CommandDescription
just buildValidate, generate proto, build binary
just validateValidate fragment YAML against JSON schema
just build-scmBuild only main binary
just build-staticBuild static binaries (stripped, no CGO)
just protoGenerate protobuf code

Testing

CommandDescription
just testRun all tests
just test-verboseRun tests with verbose output
just test-coverageRun tests with coverage report
just test-acceptanceRun acceptance tests (requires built binary)
just test-containerRun all tests in Docker (matches CI)

Code Quality

CommandDescription
just fmtFormat code
just lintLint code

Development Guidelines

Fault Tolerance

SCM should be fault tolerant above all else. Even through most misconfigurations, the user should still end up in their defined LLM at the end of startup.

Core Principles

  1. Never block startup - Configuration errors, missing files, network failures should produce warnings but never prevent the LLM from starting.

  2. Degrade gracefully - If a feature fails to initialize, disable that feature and continue.

  3. Log, don't crash - All errors should be logged to stderr with clear "SCM: warning:" prefixes.

  4. Sensible defaults - When configuration is missing or invalid, fall back to reasonable defaults.

  5. Partial success is success - If 9 out of 10 bundles sync successfully, report the failure but continue.

Error Handling Pattern

// Good: warn and continue
result, err := operations.SyncOnStartup(ctx, cfg)
if err != nil {
fmt.Fprintf(os.Stderr, "SCM: warning: sync failed: %v\n", err)
// Continue - don't return error
}

// Bad: fail on error
if err != nil {
return fmt.Errorf("sync failed: %w", err)
}