This doc describes how to contribute changes safely to the Lesser repository.
Build the repo CLI (the only “build step” we document explicitly):
go build -o lesser ./cmd/lesserInitialize local .env (one-time):
./lesser dev initRun the API:
./lesser devRun the same guardrails we expect to stay green:
./lesser fmt
./lesser lint
./lesser sec-scan
./lesser vuln-check
./lesser test unit
./lesser verifyNotes:
./lesser verifyincludes drift checks (docs, schema, OpenAPI, GraphQL coverage, inventory) plusgo test -short ./...../lesser testruns the full unit test sweep (all packages).
The project aims for “secure by default” and predictable contributor workflows. New work should preserve these properties:
- One-shot CI verification:
./lesser verify ci(runslint, security scans, supply chain verification, andverify allwithout mutating tracked files). - Audit gates:
./lesser verify audit(run as part of./lesser verify ci) prevents common regressions while security/maintainability work is in flight. Baselines live intools/audit_gates/baseline.ymland should be updated in the same PR that removes the underlying issue. - GraphQL abuse limits: depth/complexity/token/timeout limits must remain enabled in non-debug deployments (tunable via env vars; see
docs/configuration.md). - SSRF/URL validation: untrusted outbound URLs must pass the shared URL/SSRF validator and use hardened dialing paths (no bespoke validators).
- No secrets in logs: sensitive values must be scrubbed/redacted; add tests when touching auth/logging.
✅ CORRECT: document and automate repo workflows via ./lesser ….
❌ INCORRECT: document contributor workflows via make … targets.
The Makefile remains for CI/back-compat, but should be treated as internal (contributors should use the CLI).
- Use
gofmt(via./lesser fmt) and keep imports in one group. - Document exported APIs sparingly; add comments when the “why” or contract isn’t obvious.
- Thread
context.Contextfirst in function signatures. - Prefer small functions to stay within
gocognitthresholds.
- Prefer deterministic unit tests next to the code they cover (
*_test.go). - Use table-driven tests and
stretchr/testify(require/assert). - Avoid real AWS calls in unit tests (use fakes/mocks).
See docs/testing.md for more details.
Schema sources live in graph/*.graphql. After changes:
./lesser schema
./lesser verify schemaOpenAPI is generated and published as docs/contracts/openapi.yaml.
./lesser generate openapi
./lesser verify openapi --strictEnable debug logging:
export DEBUG=true
export LOG_LEVEL=debugEnable X-Ray tracing in local runs (if needed):
export XRAY_TRACING_ENABLED=trueUse GitHub issues for bugs and feature requests. Include:
- Clear reproduction steps
- Expected vs actual behavior
- Go version and OS
- AWS region/stage (if deployed)
Do not open public issues for security reports. Use the project’s preferred security reporting channel (see the repo’s security policy, if present) or contact maintainers privately.