Contributing
Workflow
Section titled “Workflow”- Open the project in the devcontainer.
- Create a branch. With the GitHub CLI extension installed by the devcontainer,
gh workonstarts work on an issue (it wrapsgh tt workon). Plaingit switch -cworks too. - Make a small, focused change, with tests.
- Run
make check. It must pass: zero lint issues and coverage at or above 80%. - Open a pull request. Describe the behaviour change and how you verified it.
gh wrapup and gh deliver are the matching aliases to finish and deliver the
work; they come from the TakT extension (devx-cafe/gh-tt), configured in
.devcontainer/.gh_alias.yml.
Conventions
Section titled “Conventions”- Standard Go:
gofmt/goimports, idiomatic error handling,internal/for everything that is not a command. - Errors: wrap with
%wand compare witherrors.Is. Sentinel errors are exported where callers need to branch on them. - Boundaries are interfaces (
store.Store,mail.Sender); implementations are concrete types. Keep interfaces small and defined next to their consumer’s needs. - No global state. Pass dependencies in through constructors.
- Time is injected (
Now func() time.Time), never read directly in logic that needs testing. - Comments explain why, not what, in one short line.
- Dependencies: prefer the standard library. Add a module only when it earns
its keep, then run
make tidy. - Logging uses
log/slog. Never log tokens, passwords or full email bodies in production paths. (LogSenderlogs bodies, and exists only for local use.)
Adding a feature
Section titled “Adding a feature”New capabilities live in their own package under internal/, next to
newsletter. Reuse store, mail and token. Planned modules:
eventsfor free event signups with capacity, duplicate protection through a hashed document ID, and a waitlistsyndicateto post new content to Bluesky and Mastodon
For each one:
- Write the service with its behaviour tests first, using the in-memory fakes.
- Add an HTTP handler with
Register(mux)as innewsletter. - Wire it in
cmd/server/main.goand add any config tointernal/config, with tests. - Document the endpoints in API reference and variables in Configuration.
Pull request checklist
Section titled “Pull request checklist”-
make checkpasses - New behaviour has tests; fixed bugs have a regression test
- No secrets, tokens or real email addresses in code, tests or docs
-
docs/updated if endpoints, config or workflows changed -
go.mod/go.sumtidy (make tidyleaves no diff)
Security issues
Section titled “Security issues”Do not open a public issue for a vulnerability. Contact the maintainer privately.