# Definition Of Done

A chunk is done only when all applicable items are true. Passing validation is required, but it is not sufficient by itself.

## Required Checks

- Scope satisfied: the implementation matches the chunk goal, scope, and acceptance criteria.
- Out-of-scope preserved: excluded features, files, dependencies, schemas, UI, and archived experiments were not changed.
- Static validation passed: requested lint, format, build, unit, e2e, and package checks pass, or an environment-limited failure is documented with a successful approved rerun when possible.
- Generated files in sync: GraphQL schema/codegen, Prisma Client, or other generated artifacts are refreshed when their inputs change.
- Runtime smoke passed when applicable: behavior, UI, integration, auth, database, configuration, or dev-server changes are exercised in a realistic runtime path.
- Test impact reviewed: behavior, UI, auth, backend/API, database, integration, Telegram, workflow tooling, and developer/operator command changes include `## Test Impact` with appropriate tests, a documented accepted follow-up, or a concrete not-applicable rationale.
- Human-verifiable delivery reviewed: human-facing, operator-facing, setup, environment, UI, backend/API, Telegram, workflow-command, and auth changes can be observed, configured, accessed, and verified by a human, or include a concrete not-applicable rationale.
- Environment configuration documented: required environment variables and setup expectations are present in the appropriate `.env.example` with safe placeholders and brief comments, and setup docs explain required local values without exposing secrets.
- Test/dev artifacts cleaned up: test records, smoke users, temp files, running servers, and other generated local artifacts are removed or explicitly documented when cleanup cannot be verified.
- Documentation updated when behavior changes: setup, environment, operations, or user-facing workflow docs reflect the new behavior.
- Regression risk reviewed: existing smoke paths and adjacent workflows still work or have explicit coverage.
- QA explicitly approves: a QA role, human reviewer, or orchestrator acting on QA results marks the chunk as accepted. Developer self-check is not QA approval.
- Chunk notes updated: execution notes include relevant implementation decisions, validation results, manual smoke results, cleanup results, and known follow-ups.
- Git state reported: final response includes `git status` and `git diff --stat`.

## Not Done Conditions

Do not mark a chunk done when:

- Validation is skipped without a concrete reason.
- Runtime behavior was changed but not smoke-tested.
- Behavior changed without `## Test Impact` or without appropriate tests, smoke, scenario coverage, or accepted follow-up.
- The delivered change cannot be accessed or verified by a human because setup, docs, roles, credentials, environment variables, reset/seed steps, or UI/API reachability are missing.
- Required environment variables are introduced or relied on without `.env.example` entries, safe placeholders, comments, and setup documentation.
- Generated files may be stale.
- Test/dev data created by the work remains uncleared without documentation.
- QA has not approved the result.
- The implementation silently expands scope or hides follow-up work inside the current chunk.
