Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Contributing

Bug reports, fixes and translations are welcome. For a new feature or a larger change, open an issue first so we can
agree on the approach before you write the code. Issues and pull requests can be written in English or Russian.
agree on the approach before you write the code. Issues and pull request descriptions can be written in English or
Russian.

Security issues go through a private report, never a public issue: see [SECURITY.md](SECURITY.md).

## Build and test

Go 1.27, bun 1.4, a Linux host.
A Linux host with Go 1.27, bun 1.4 and a C compiler (tests run with the race detector). `make lint` also needs
golangci-lint 2.15 and sqlc 1.31. Browser tests need Chromium for Playwright:
`cd web && bunx playwright install chromium`.

```sh
make web build # bin/ingrest with the UI embedded
make test # Go and web unit tests; do not run `go test ./...`, it walks web/node_modules
make lint # generated files, golangci-lint, web lint
```

After API or SQL query changes run `make generate` (needs sqlc 1.31) and commit the generated files.
After API or SQL query changes run `make generate` and commit the generated files.
Scenario tests (`test/vm`) need disposable VMs; maintainers run them before a release.

## Code
Expand All @@ -28,14 +31,15 @@ Scenario tests (`test/vm`) need disposable VMs; maintainers run them before a re
## Commits and pull requests

- One topic per pull request. Pull requests are squash-merged with their title as the commit message.
- Title format: `type(scope): subject`, for example `fix(backups): keep the last snapshot`; subject under 50 characters.
- Title in English, format `type(scope): subject`, for example `fix(backups): keep the last snapshot`; subject under
50 characters.
Types: `feat`, `fix`, `refactor`, `perf`, `test`, `docs`, `build`, `ci`, `chore`.
- CI runs the tests and linters on every pull request.

## Translations

English is the source. Keys and placeholders (`{{name}}`, `{seconds}`, `%s`, `%d`) stay as they are; translate only
the text around them.
English is the source. Keys and placeholders (`{{name}}`, `{seconds}`, `%s`, `%d`, `%q`) stay as they are; translate
only the text around them.

To fix a translation, edit the file of that language:

Expand All @@ -53,7 +57,12 @@ To add a language:
the test fails on any missing key.
3. Copy `internal/edge/stubs/en.json` to `<code>.json` and translate it; the panel picks the file up by its name.
4. Alert settings offer every interface language: add a `"<code>"` block to `catalog` in `internal/alerts/messages.go`
(missing keys fall back to English) and the code to the language check in `normalize` in `internal/alerts/model.go`.
(missing keys fall back to English); in `internal/alerts/model.go` add the code to the `enum` tag of
`AlertSettings.Language` and to the check in `normalize`, then run `make generate`.
5. A few places still choose between English and Russian by hand; add the new code there: `currentLocale` in
`web/src/i18n.ts`, the locale in `web/src/components/settings/SettingsProfile.tsx`, date formats in
`web/src/composables/datetime.ts`, the decimal comma in `web/src/pages/DashboardPage.tsx` and `MetricsPage.tsx`,
`langNames` in `internal/aievents/service.go` and time units in `human` in `internal/alerts/eval.go`.

Check with `make web build` and `make test`.

Expand Down