Karyo
Documentation/ The project

Contributing to Karyo

Karyo 2.1.1rendered at build time
On this page

Karyo is developed in this repository. The source and the issues are visible to approved readers (README); issues and pull requests are welcome from them. This file states the rules every change is held to and links the document that owns each one, rather than restating it: a second copy is a copy that goes stale.

Before your first change

  1. Get a working checkout: developer onboarding goes from a clone to a running local session and a passing test. A real JDK 21 is required, not only a Java runtime.
  2. Read the architecture guide. It lists the invariants a change must not break, and why each one exists.
  3. Find the module you are changing. Modules and boundaries explains the module graph; docs/README.md maps every document.

Branch model

main is the default branch and the only long-lived one. It is the base for every pull request, and releases are tagged from it.

  • Branch from the current main, using the prefixes feature/, fix/, refactor/ or docs/. The repository is private and forking is not available to readers, so a contribution without write access arrives as a patch attached to an issue, or as a deliberate, per-person promotion that the owner approves at that time.
  • Nobody pushes to main directly, maintainers included. Every change arrives through a pull request.
  • Keep a branch short-lived and rebase it on main rather than merging main into it.

Commits

Use a Conventional Commit subject, per ADR 0024: feat, fix, refactor, perf, test, docs, ci or chore, with the domain or area as the scope (inventory, fulfillment, frontend-web, build). A breaking change to a published contract adds ! after the type or a BREAKING CHANGE: footer.

Before staging, read git diff --check, the changed paths and the staged diff for secrets, generated output, edits to applied migrations and unannounced changes to the licence compatibility bridge or module boundaries (ADR 0006/0029/0030).

Do not add agent or tool attribution lines to commit messages.

The change route

  1. Start from an issue for anything larger than a small fix, so the scope is agreed before the work is done. A proposal describes the warehouse operation, not the implementation you have in mind for it.
  2. For a defect, reproduce it first, through the real user or API journey on an isolated target with synthetic data, before changing any code. Then add a regression test that fails for the right reason on the old behaviour. Never use a live warehouse as a test fixture.
  3. Keep the change bounded to the owning module and its -api contract. Include positive, rejection and owner-boundary tests where they apply.
  4. Change a decision deliberately. If the change contradicts a decision record, rewrite that record in the same pull request and say why.
  5. Update the document that owns the fact in the same pull request that changes the behaviour. docs/README.md says which document that is. When the issue you are fixing names the documents its fix must update, update each one, or say in the pull request why it does not need it.

Engineering rules

The architecture guide owns them: module boundaries, transactions and events, stock invariants, migrations, identity and owner scope, configuration, the front ends, extensions and the engine boundaries. Some edges are worth naming here because getting them wrong is expensive and quiet:

  • Released Flyway migrations are immutable, comments included. A prose edit changes the checksum and stops existing installations from starting. Add a forward migration. Karyo has no release yet, so the pre-release schema may still be edited and a development database rebuilt.
  • Every endpoint, scheduled job and agent tool declares one catalogue action, and stored grants are the only authority for it; a provider role grants nothing (ADR 0048).
  • The actions a principal holds and its OPS/BUSINESS_UNIT_USER principal kind are independent. Configuration key 0 is the Company layer, not a Business Unit or administrator.
  • StockUnit is never cached. Reservation, physical transfer and shipping are distinct operations.
  • Cross-module references are IDs validated through the owning lookup SPI, never new foreign keys between modules, and a -core never depends on another module's -core.
  • Engine modules plug in through SPIs. The engine implementations implement the interfaces declared in the -api modules; no module names another module's implementation classes.

Checks before you open a pull request

A pull request's CI proves only that Karyo still builds and still starts: the backend compiles, the console and the floor app build, both images build, and the images start as a first deployment starts them and answer. The tests, lint and the docs checks run every night on main, so a change that breaks one is found after it merged. Run them yourself for the parts you touched, and read the executed, failed and skipped counts, not only the exit status. One failed Quarkus boot can skip most of the backend suite.

./gradlew compileKotlin compileTestKotlin :libs:karyo-license:compileOperationalTestKotlin
./gradlew test                                 # needs a container runtime for Dev Services
./gradlew :services:karyo-app:realmTest        # a realm, a realm script or the identity code changed
# ./gradlew test -PkaryoTestForks=3            # three test JVMs at once, as the nightly suite does; about 2.4 GB each, up to about 4 GB
./gradlew detekt
./scripts/scan-image.sh                        # image and dependency changes; needs Podman

(cd frontend/web && npm ci && npm run lint && npm test && npm run build)
(cd frontend/mobile && npm ci && npm run lint && npm test && npm run build)
(cd tests/e2e && npm ci && npm run test:helpers && npx playwright test --list)
(cd tests/e2e && npm run diagrams && git diff --exit-code -- ../../docs/diagrams)   # a figure, its palette or the renderer changed: nothing may differ

./gradlew test reports the four Pact provider tests as skipped: they run only against a broker, which the nightly test job provides and its pact-verify job reports on. If you change an API the desktop console calls, contract testing says what that check covers. It also reports the nine Keycloak realm classes as skipped: they run in realmTest, which the nightly realm-test job runs (realm tests). A change to an image build site also runs ./scripts/check-image-reproducibility.sh, which only the release workflow runs.

Building Karyo and the delivery pipeline describe what each check proves. For a documentation change, check that every relative link you added resolves, and that a figure or screenshot follows the style guide: figures are Mermaid sources under docs/diagrams/ rendered into checked-in SVG pairs, never inline fences or hand-edited SVGs.

Do not widen lint, test, security or coverage exemptions to get to green, and do not reset a database, grant access, repair a migration checksum or rotate a key to make a check pass. If you find an unrelated defect, report it as its own issue. State observed failures and what you did not run in the pull request, rather than describing an unrun check as passed.

Pull requests

Open the pull request against main. The pull-request template asks for what a reviewer needs: the problem in the operator's terms, the scope, the boundaries touched, the exact commands you ran and their results, what the change does not prove, and its migration and upgrade impact.

Review and merge

  • CODEOWNERS requests a reviewer automatically. A maintainer merges once the review is done and CI is green. The required checks are Compile, Front-end build, Image build and Karyo starts.
  • A failed nightly run opens the issue labelled ci-nightly, or comments on the open one, with the failed jobs and the run's link.
  • Read the actual checks, not only the summary.
  • Merging releases nothing. A release is a tag on main; releasing owns how one is cut.

The engine modules

The ten engine capabilities ship as ordinary modules in this repository. Their -api modules and the SPI seams they implement take contributions like any other module. No licence guards them (ADR 0030); the engine boundaries explain how they sit in the one distribution, and how slotting hands its analysis to Loci.

Licence of contributions

Karyo is licensed under Apache-2.0. Under section 5 of that licence, a contribution you intentionally submit for inclusion is licensed under the same terms, unless you explicitly state otherwise.