Skip to content

Commit 74431bc

Browse files
authored
Merge pull request #912 from karrioapi/release-2025.5
Release 2025.5
2 parents 11b318d + 8e97463 commit 74431bc

File tree

140 files changed

+15447
-10371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+15447
-10371
lines changed

AGENTS.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,40 @@
1111
- Front-end builds flow through Turbo: `npm run build` executes `turbo run build`, and `npm run lint` fans out ESLint across all workspaces.
1212

1313
## Coding Style & Naming Conventions
14+
- **Write code as if the same person authored the entire codebase**—consistency is paramount.
15+
- **Favor functional, declarative style**: use `map`, `reduce`, `filter`, and list comprehensions in Python; avoid nested `if` statements and `for` loops when a functional alternative is cleaner.
16+
- **Concise but readable**: code should be terse yet easily maintainable by a human developer—no unnecessary verbosity, but no cryptic one-liners either.
1417
- Python follows PEP 8 with 4-space indentation—format via `black` and keep typing clean with `mypy` (both listed in `requirements.dev.txt`).
1518
- Use snake_case for modules/functions (e.g., `modules/pricing/rate.py`) and PascalCase for classes; mirror existing mapper naming in `modules/connectors`.
1619
- TypeScript and React code are formatted with Prettier (`npm run format`) and linted through `packages/eslint-config-custom`; prefer 2-space indentation and explicit exports.
20+
- **Frontend**: don't reinvent the wheel—follow existing separation of concerns: `lib/` for logic, `types/` for types (use regenerate scripts), reusable components in `ui/`, same concise functional style.
1721

1822
## Testing Guidelines
1923
- Activate the environment with `source bin/activate-env` before invoking tests.
20-
- Run `./bin/run-server-tests` for the API suites; carrier adapters must stay on Python's `unittest` with canonical files like `test_rate.py` and classes shaped as `Test<Carrier><Feature>`.
21-
- Validate connectors via `python -m unittest discover -v -f modules/connectors/<carrier>/tests`, and guard SDK changes with `./bin/run-sdk-tests`; include the debug prints and tuple assertions mandated in `CARRIER_INTEGRATION_GUIDE.md`.
24+
- **Always run tests from the repository root**.
25+
- **Always take inspiration from existing tests**—match the coding style of the project.
26+
- **We do NOT use pytest anywhere in the stack**:
27+
- Carrier integrations: native Python `unittest`
28+
- Server/Django: Django tests via `karrio` (manage.py wrapper)
29+
- **Carrier integration tests**: follow the style in `./bin/run-sdk-tests`—run from root:
30+
```bash
31+
./bin/run-sdk-tests # runs all SDK and connector tests
32+
python -m unittest discover -v -f modules/connectors/<carrier>/tests # single carrier
33+
```
34+
- **Server/Django module tests**: follow the style in `./bin/run-server-tests`—run from root:
35+
```bash
36+
./bin/run-server-tests # runs all server tests
37+
karrio test --failfast karrio.server.<module>.tests # single module
38+
```
39+
- Carrier adapters must stay on Python's `unittest` with canonical files like `test_rate.py` and classes shaped as `Test<Carrier><Feature>`.
40+
- Follow carrier testing templates and style in `CARRIER_INTEGRATION_GUIDE.md`.
41+
42+
### Test Writing Style
43+
- **Avoid multiple single-field assertions**—prefer comprehensive comparisons.
44+
- **Use `assertNoErrors` utility** where it makes sense to validate clean responses.
45+
- **Single `assertDictEqual` or `assertListEqual`** with full API response data comparison:
46+
- Use `mock.ANY` for dynamic fields like `id`, `dates`, `timestamps`.
47+
- **Carrier tests**: follow the same principles using templates in `CARRIER_INTEGRATION_GUIDE.md`.
2248

2349
## Commit & Pull Request Guidelines
2450
- Keep commits focused and follow the short `type: summary` style already used (`fix:`, `feat:`, `chore:`); reference issues with `refs #123` or `fixes #123`.
@@ -28,3 +54,7 @@
2854
## Configuration Tips
2955
- Workspace-specific `.env` files drive local overrides; duplicate provided templates and never commit secrets.
3056
- Use `./bin/create-new-env` when you need a fresh sample configuration, and load additional variables through Docker compose overrides or CI secrets to keep builds reproducible.
57+
58+
## Carrier Integration Reference
59+
60+
- **Always consult `CARRIER_INTEGRATION_GUIDE.md`** when working with carrier integrations—it contains the canonical patterns, file structures, and testing requirements for all connector work.

0 commit comments

Comments
 (0)