The GitHub Actions workflows in .github/workflows/, what each job checks, which checks fail a pull request and which only report, and how to run the same checks locally.
- Workflows at a glance
- Code quality
- Security scanning
- Dependency updates
- Run the checks locally
- Ratchets
- Report-only checks and their follow-ups
- Releasing a version
Every workflow runs on pull requests, on pushes to main and on manual dispatch; the security workflows also run weekly. All of them check out the code with persist-credentials: false, pin third-party actions to full commit SHAs, and run on ubuntu-24.04 rather than ubuntu-latest, so a runner-image change (ubuntu-latest becomes Ubuntu 26.04 on 2026-10-19) happens when someone moves the pin, not on its own.
The workflows are:
| Workflow | File | Jobs | Schedule |
|---|---|---|---|
| Code Quality | quality.yml |
backend-tests, backend-coverage, backend-lint, migrations, frontend, frontend-coverage |
None |
| CodeQL | codeql.yml |
analyze (Python, JavaScript/TypeScript) |
Mondays 05:30 UTC |
| Secret Scan | secret-scan.yml |
gitleaks |
Mondays 05:00 UTC |
| Dependency Audit | dependency-audit.yml |
lockfile-hygiene, python-cve, npm-cve |
Mondays 06:00 UTC |
Dependabot (.github/dependabot.yml) is configuration, not a workflow; see Dependency updates.
quality.yml runs six independent jobs, so a failing test does not hide lint feedback.
The jobs are:
| Job | What it runs | Gates |
|---|---|---|
backend-tests |
uv sync --frozen, then run_tests.py --parallel 4 --skip-lint on Python 3.11, without coverage (40-minute timeout) |
Yes |
backend-coverage |
The same suite under branch coverage: run_tests.py --parallel 4 --skip-lint --coverage (75-minute timeout). Uploads src/backend/tests/.artifacts/coverage.xml |
Yes: fails below fail_under = 80 in [tool.coverage.report] in src/backend/pyproject.toml (85% measured on 2026-09-27) |
backend-lint |
Step 1, run_tests.py --lint-only: black --check, isort --check-only, ruff check, check_types.py (mypy, no new errors against mypy-baseline.json) and lint-imports (the architecture contracts). The type stubs mypy needs, such as types-psutil, are in the dev dependency group, so uv sync --frozen installs them. Step 2, pytest tests/unit/architecture: the architecture tests and the shrink-only ratchets (file and function size, ruff rule counts, env reads, HTTP exception text). The size ratchet also covers src/frontend/src, so a frontend-only change can fail this backend check |
Yes |
migrations |
On a pgvector/pgvector:pg16 service: exactly one Alembic head; init_db() builds the app schema on an empty PostgreSQL; the self-heal tests (tests/unit/db/self_heal) on that PostgreSQL, including a heal step forced to fail inside create_all's transaction; alembic upgrade head from empty |
The first three gate. The upgrade step is report-only (continue-on-error) |
frontend |
Node 22: npm ci, npm run test:run -- --testTimeout=30000 (Vitest), npm run lint -- --max-warnings <N> (ESLint), npm run build (tsc -b and vite build) |
Yes. ESLint errors fail the job, and so do warnings above the ceiling in quality.yml; lower the ceiling when you fix warnings, never raise it (see ratchets) |
frontend-coverage |
vitest run --coverage with VITEST_COVERAGE_REPORT_ONLY=1, which drops the per-path thresholds in vitest.config.ts. Uploads coverage/ |
No: the job is continue-on-error |
The migrations job exists because the app does not run Alembic at startup. It builds its schema with init_db() (create_all plus the self-heal steps in src/backend/src/db/self_heal/), and the unit tests run on SQLite, so this job is the check that the models build a working schema on PostgreSQL. The self-heal step sets KASAL_TEST_POSTGRES_URL; without it the PostgreSQL cases skip, which is how they run everywhere else. Run them locally against any PostgreSQL with pgvector and a role that may create databases (each test creates and drops its own).
CodeQL runs static analysis for Python and for JavaScript/TypeScript with build-mode: none. Findings appear under Security > Code scanning on GitHub.
Secret Scan runs the gitleaks CLI (a pinned version, verified by SHA-256) with --redact:
- On a pull request or push it scans only the commits the change adds, and a finding fails the job.
- On the weekly schedule or a manual run it scans the whole history. That scan is report-only for now, because the full history still has unreviewed historical hits.
Dependency Audit has three jobs:
lockfile-hygienefails ifsrc/backend/uv.lockorsrc/frontend/package-lock.jsonreferences an internal package proxy. Committed lockfiles must use public registries so the Databricks Apps build can install.python-cverunsuv lock --check(the lock must matchpyproject.toml), thenpip-auditover the exported, locked dependencies. Advisories with no fixed release are ignored by ID in the workflow; their exposure is described in validation and security.npm-cverunsnpm ci(the lock must be consistent) andnpm audit --audit-level=high.
Dependabot proposes updates every Monday for three ecosystems:
- GitHub Actions: all updates grouped into one pull request.
uvinsrc/backend: minor and patch updates grouped into one pull request; majors arrive one per pull request.npminsrc/frontend: the same grouping asuv.
Dependabot proposes fixes; the Dependency Audit workflow detects the vulnerabilities.
Run the backend checks from src/backend:
uv sync --frozen
uv run python run_tests.py --lint-only # what backend-lint runs
uv run pytest -q tests/unit/architecture # architecture tests and ratchets (also in backend-lint)
uv run python run_tests.py --skip-lint # tests only, parallel by default
uv run python run_tests.py --skip-lint --coverage --html-coverage
uv run python run_tests.py # tests, then every lint stepCoverage reports go to src/backend/tests/.artifacts/ (coverage.xml, and coverage_html/ with --html-coverage). That is the only directory where the test run's pollution guard in tests/conftest.py allows new files, so a report written anywhere else fails the run even when every test passes.
run_tests.py runs every lint step even when an earlier one fails, so you see all failures at once. --lint-only and --skip-lint cannot be combined. To fix formatting rather than check it, run uv run black src tests and uv run isort src tests.
Run the frontend checks from src/frontend:
npm ci
npm run test:run
npm run lint # CI adds --max-warnings <cap> from quality.yml
npm run build
npx vitest run --coverage # coverage report in coverage/To reproduce the supply-chain checks, run uv lock --check in src/backend and npm audit --audit-level=high in src/frontend.
A ratchet freezes existing debt so it can shrink but never grow. Each one records today's count in a baseline and fails when a count goes up (or a new file or function appears over the limit). Most also fail when a count goes down until you lower the baseline, so a gain cannot be quietly given back later. The backend ratchets are tests in src/backend/tests/unit/architecture/ and run in both backend-lint and backend-tests.
| Ratchet | What it counts | Baseline |
|---|---|---|
File size (test_size_ratchet.py) |
.py files under src/backend/src and .ts/.tsx files under src/frontend/src over 800 lines. A new file may not pass 800, a baselined one may not pass 1500, and one already over 1500 may not grow |
file_size_baseline.json |
Function size (test_size_ratchet.py) |
Python functions and methods in src/backend/src over 200 lines, keyed path::Qualified.name. Renaming or moving a long function counts as a new one |
function_size_baseline.json |
Ruff (test_ruff_ratchet.py) |
Per-file hits of BLE001, S110, TRY400, G004 and B904 in src/backend/src, which are not in the ruff gate itself. A deliberate exception takes # noqa: <code> — <reason> |
ruff_ratchet_baseline.json |
Environment reads (test_env_reads_stay_in_config.py) |
os.getenv/os.environ reads outside config/settings.py, config/logging.py and core/databricks_app.py, keyed path::VARIABLE; retired settings may not be read at all. See the configuration reference |
env_read_baseline.json |
Exception text in HTTP errors (test_no_exception_text_in_http_errors.py) |
Routers that put an exception's text into an HTTPException detail |
http_exception_text_baseline.json |
When a ratchet test says a count went down, lock the gain in from src/backend:
uv run python tests/unit/architecture/test_size_ratchet.py --update
uv run python tests/unit/architecture/test_ruff_ratchet.py --update
uv run python tests/unit/architecture/test_env_reads_stay_in_config.py --update
uv run python tests/unit/architecture/test_no_exception_text_in_http_errors.py --update--update only lowers a baseline: it keeps the smaller of the recorded and current counts and drops keys that reached zero (_ratchet.py). It never records a new key or a higher count, so it cannot absorb a regression; when a count grows, fix the code. Commit the changed JSON with the change that earned it.
Three more checks work the same way without a JSON file:
- import-linter (
[tool.importlinter]insrc/backend/pyproject.toml, run bylint-imports). Each contract'signore_importslist is a shrink-only baseline of known violations. import-linter errors on an ignore that no longer matches, so fixing an import means deleting its line; never add one. - mypy (
check_types.py). New diagnostics fail againstsrc/backend/mypy-baseline.json. - ESLint warnings (the
frontendjob).--max-warningsinquality.ymlholds the warning count; lower it when you fix warnings, never raise it.
These checks run but cannot fail a pull request yet. Each workflow file records its own follow-up:
- Frontend coverage: set the per-path floors in
vitest.config.tsfrom the first report, removeVITEST_COVERAGE_REPORT_ONLY, then dropcontinue-on-error. alembic upgrade headfrom empty: the migration history has several roots and no baseline revision, so it cannot build a database from nothing. Add a baseline (or squash), then make the step gate and addalembic check.- Full-history secret scan: triage the historical hits, rotate anything real, record the rest in a
.gitleaksignore, then let the weekly scan gate.
Kasal has one version number, VERSION in src/backend/src/config/settings.py. The app reports it as the version on every Databricks User-Agent and in the OpenAPI document. Keep it plain X.Y.Z: the Databricks SDK rejects anything else when it builds the User-Agent, and the app would fail to start.
To release:
- Set the new number in
settings.VERSION, in bothpyproject.tomlfiles (the repository root andsrc/backend), and insrc/frontend/package.jsonandpackage-lock.json. Then runuv lockinsrc/backend.tests/unit/config/test_version.pyfails while any of them disagree. - Merge, then tag the release commit
v<version>. - Run
.github/scripts/create_marketplace_tag.sh <version> <branch>for the Marketplace tag. It refuses a number that differs fromsettings.VERSIONon that branch.
Back to the documentation hub.