Definition of Done Definition of Done Project: Bilko Version: 1.1 Date: 2026-05-21 Author: Ops Architect / ALAI Documentation Team Status: Active Reviewers: Tech Lead, Alem Bašić Document History Version Date Author Changes 0.1 2026-02-23 Ops Architect Initial draft 1.0 2026-02-25 ALAI Documentation Team Finalized — approved for production use 1.1 2026-05-21 ALAI Documentation Team Clarified deploy/demo testing gates and updated stale Prisma/SQL wording 1. Overview A feature, bug fix, or task is Done only when it meets ALL criteria in the applicable checklist below. "Done" means deployed to production and working — not just "code written" or "PR merged". Financial features have additional criteria due to accounting correctness requirements (NUMERIC precision, double-entry validation, VAT accuracy). 2. Definition of Done — Story / Feature Code Quality Code reviewed by at least 1 other engineer (PR approved) No TypeScript errors ( pnpm run type-check passes) No ESLint errors ( pnpm run lint passes) No Prettier violations No console.log left in production code No any types without justification comment No hardcoded secrets, URLs, or magic numbers without constants Testing Unit tests written for all new business logic Integration tests written for all new API endpoints All existing tests still pass ( pnpm run test ) Overall coverage did not decrease below 80% Financial logic coverage ≥ 95% (if feature includes VAT, double-entry, currency) Edge cases tested (empty input, null, boundary values) Multi-tenant isolation tested (org A cannot access org B's data) Financial Logic (Required if feature touches accounting) All monetary values use Decimal (never JavaScript number for money) NUMERIC(19,4) precision maintained throughout (no float drift) Double-entry balance verified (debit = credit in every transaction) VAT calculation tested for all applicable countries (RS/BA/HR) Exchange rate locked at transaction date (not current rate) Unit tests explicitly assert .toString() equality on Decimal values (not .toNumber() ) Documentation JSDoc added for public functions with non-obvious behavior API endpoint documented in docs/backend/openapi.yaml (or existing docs updated) Frontend API usage covered by the OpenAPI frontend contract; intentional legacy gaps are recorded in docs/backend/openapi-frontend-known-gaps.json Generated API types are fresh ( npm run openapi:types-check ) Any schema change reflected in packages/database/CLAUDE.md Breaking changes documented in release notes PR & Review PR description explains what changed and why PR links to GitHub issue or Mission Control task PR is < 400 lines diff (split larger changes) All review comments resolved or explicitly deferred with reason CI pipeline green (all status checks pass) Security No new secrets committed to git User input validated with Zod before processing Authorization checked before data access (RBAC middleware applied) No SQL injection vectors (use parameterized Exposed/JDBC queries or approved query builders; no unsafe string interpolation) CORS not weakened 3. Definition of Done — Bug Fix Root cause identified and documented in PR description Test added that would have caught the bug (regression test) All existing tests still pass Fix does not introduce new test failures If financial bug: post-mortem created and corrective data migration planned if needed Code reviewed and approved 4. Definition of Done — Database Migration Migration tested on staging with production-sized data Migration is backward-compatible (or downtime planned and communicated) Down migration tested (rollback works) Migration is idempotent (safe to run twice) Migration script takes < 5 minutes on 1M rows (benchmark result documented) No existing data corrupted by migration Flyway migration and Exposed table/model mapping updated after schema change Migration reviewed by Tech Lead (financial schema changes require Alem sign-off) 5. Definition of Done — Sprint A sprint is Done when: All committed stories meet their individual DoD No P0 open defects No P1 open defects (or explicitly deferred with product owner approval) Sprint demo delivered to stakeholders Sprint retrospective held Technical debt items identified this sprint added to backlog All deployed features monitored for 24h post-deploy with no regressions 6. Definition of Done — Production Deploy All CI checks green (lint, type-check, unit tests, integration tests, OpenAPI contract, build) Critical E2E gate passes on staging/resettable environment Real-demo smoke passes post-deploy ( npm run test:real-demo-smoke ) with machine evidence; video evidence required for user-facing demo readiness Full-demo rehearsal passes before stakeholder/sales demo if the release changes demo-critical flows Deployment checklist completed ( deployment-checklist.md ) Database migrations applied successfully to staging first Health check endpoint returns {"status":"ok","db":"ok"} post-deploy No Sentry error spike in first 15 minutes post-deploy Rollback procedure verified and ready 7. "Not Done" Examples These do NOT count as Done: "Works on my machine" — must be deployed and tested on staging "Tests are skipped" — no test skips in production code "I'll add tests later" — tests are written in the same PR as the feature "Coverage went from 82% to 79% but it's fine" — coverage thresholds are enforced "The float is close enough" — NUMERIC(19,4) is not negotiable for financial values "It's just UI" — UI changes still need lint + type-check to pass 8. Responsibility Role DoD Responsibility Developer Write tests, meet code quality criteria, fill checklist before PR PR Reviewer Verify DoD criteria in review, reject PRs that don't meet criteria Tech Lead Enforce DoD at sprint level, escalate persistent non-compliance Alem Bašić Final sign-off on financial schema changes and production deploys Related Documents Test Strategy Coding Standards Deployment Checklist CI/CD Pipeline Demo Testing Plan Approval Role Name Date Signature Author Ops Architect 2026-02-23 Reviewer Tech Lead Approver Alem Bašić