Data pipeline / batch jobs
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- A pipeline runs without anyone watching, so silent failures and duplicates are the main risk. Typical class: M.
- Rule 1: a job can run twice for the same period and gives the same result.
- Rule 2: validate schemas, check data quality and freshness, and alert on failure.
- Rule 3: mask personal data early, bound retries, and document the flow.
Which class?
- S: a personal script for your own data.
- M: business or personal data, scheduled, others depend on results.
- L: sensitive data, many consumers, production dependencies.
- XL: very large volumes and strict recovery needs.
Audit checklist
Every project
- Facts are verified from current official documentation
- What: Commands, libraries, APIs and platform policies in the project come from current official documents, not from memory.
- How to check: Open the dependency list and the platform configuration; for each non-trivial choice find the official page it relies on (link in a comment or a decision note).
- Evidence: Decision note or code comment with the official URL and the date it was checked.
- Packages come from official sources, stable versions only
- What: Packages and versions are chosen from official sources; the current stable release is used, not alpha or beta.
- How to check: Read the dependency file for pre-release tags (alpha, beta, rc, next); check each package on its official registry page.
- Evidence: Dependency file without pre-release versions.
- No secrets in code, chat, commits or logs
- What: Passwords, keys and tokens live in environment variables or a secret manager;
.envis ignored by git; the repository has only.env.example. - How to check: Check
.gitignorefor.env; run a secret scanner (for example gitleaks) over the full history; search for key-like strings. - Evidence:
.gitignoreline, scanner report with zero findings,.env.examplepath.
- What: Passwords, keys and tokens live in environment variables or a secret manager;
- Reports separate “written”, “tested” and “works end to end”
- What: Status reports say clearly whether something is written, passed its tests, or was run end to end; skipped or failed steps are stated.
- How to check: Read the last HANDOFF or release notes; look for features reported as done that have no test or run record.
- Evidence: HANDOFF lines or a test log for each feature marked done.
- Project memory files exist and are current
- What: The repository has CLAUDE.md or AGENTS.md (permanent rules) and HANDOFF.md (where we stopped), updated at the end of every work round.
- How to check: Look in the repository root for both files; compare the HANDOFF date with the latest commit date.
- Evidence: File paths and the date of the last HANDOFF update.
- Jobs can be re-run safely
- What: Running a job twice for the same period gives the same result without duplicates.
- How to check: Run a job twice and compare row counts and values.
- Evidence: Test output.
- Data flow is documented
- What: A short description says sources, transformations, outputs, owners and schedules.
- How to check: Find the document and compare it with the real jobs.
- Evidence: Document with date.
+ If it has users, personal data or API keys (M)
- One package manager, lockfile committed
- What: Exactly one package manager is used and enforced; the lockfile is committed; installs are done from the lockfile (for example
--frozen-lockfile). - How to check: Look for a lockfile in the repository and a rule that forbids other managers; check the CI and Docker install commands.
- Evidence: Lockfile path; install command lines.
- What: Exactly one package manager is used and enforced; the lockfile is committed; installs are done from the lockfile (for example
- Input and output schemas are validated
- What: Incoming and outgoing data are checked against a schema; bad records go to a reject area with a reason, not silently dropped.
- How to check: Feed a malformed record.
- Evidence: Reject-area entry.
- Data quality checks and freshness alerts exist
- What: Checks for row counts, nulls, duplicates and freshness run with each load and alert the owner on failure.
- How to check: Read the checks and the alert targets.
- Evidence: Check definitions; alert test.
- Retries are bounded and failures visible
- What: Failed tasks retry a limited number of times with delay, and final failure alerts someone; nothing is lost silently.
- How to check: Read the scheduler settings; force a failure.
- Evidence: Settings; alert received.
- Backfill and replay are possible
- What: A documented way exists to reprocess a past period without hand edits.
- How to check: Find the backfill procedure and run it on a small period.
- Evidence: Procedure; run log.
- Personal data is masked or minimized
- What: Personal fields are dropped, hashed or masked as early as possible; access to raw data is restricted and logged.
- How to check: List personal fields at each stage.
- Evidence: Field map; access list.
- Personal data fields are documented
- What: For every personal data field the purpose, retention time and legal basis (KVKK, GDPR) are written down.
- How to check: List the database columns and form fields with personal data; find the matching entries in the data note.
- Evidence: Data note listing each field with purpose, period and basis.
- One deletion schedule covers all data
- What: Every kind of data has a deletion period, collected in one deletion schedule document, and the code implements it.
- How to check: Find the document; for each row find the job or code that deletes the data.
- Evidence: Schedule document and the matching job names.
- Automatic backups with a tested restore
- What: The database is backed up automatically, retention is written down, and a restore has actually been tried.
- How to check: Find the backup job and its schedule; find the record of the last restore test.
- Evidence: Backup schedule, retention setting and dated restore-test record.
- Logs contain no personal data or secrets
- What: Logs do not record passwords, tokens, keys or personal data; if needed they are masked.
- How to check: Read the logging setup; trigger a login and a form and inspect the log lines; search for e-mail and token patterns.
- Evidence: Sample log lines after a test run showing masking.
- Every access is least-privilege
- What: Database users, cloud service accounts and API keys have only the permissions they need.
- How to check: List the roles and key scopes in the provider console or infrastructure files; look for admin or wildcard permissions.
- Evidence: Role list or policy file with the narrow permissions.
- Critical flows have automated tests and a local check
- What: Login, saving data, payment (if any) and permission checks have automated tests; one local command runs the checks before pushing.
- How to check: List the test files; run the check command; look for a git hook that runs it.
- Evidence: Test names and a passing run log.
- Secret scanning runs before push and in CI
- What: A scanner (for example gitleaks or secretlint) runs before code is pushed and in CI.
- How to check: Find the hook or CI step that runs the scanner.
- Evidence: Hook file or CI step; latest clean run.
- One command starts everything locally
- What: The project starts locally with one command (for example
docker compose up) including database and object storage; the same image runs in every environment and only settings differ. - How to check: Read the compose file and Dockerfile; run the command on a clean checkout.
- Evidence: Compose file path; successful start log.
- What: The project starts locally with one command (for example
+ If it has an admin panel, file uploads, many users or a store app (L)
Items for class L: see Data pipeline / batch jobs: classes L–XL checklist.
+ If it targets millions of users (XL)
Items for class XL: see Data pipeline / batch jobs: classes L–XL checklist.
Common mistakes
- A job that appends data again every time it is re-run.
- Failed rows silently dropped.
- No alert when the data is late or empty.
- Raw personal data copied into reporting tables.
- Unlimited retries that hammer a failing source.
- No way to reprocess last month without hand edits.
- Credentials with write access to everything.
- Undocumented jobs that only one person understands.
Example projects
- Nightly sales report: pipeline, M.
- Sync between CRM and e-mail tool: pipeline, M, personal data.
- Daily export for analysts: pipeline, M.
- Log aggregation job: pipeline, S or M.
- Warehouse load from several sources: pipeline, L.
- Price scraper feeding a shop: pipeline, M.
- Customer data anonymization job: pipeline, L.
- Backup rotation job: pipeline, M.
- Financial reconciliation batch: pipeline, L.
- Machine learning feature builder: pipeline, M.
- IoT sensor ingestion: pipeline, L if volume is high.
- Personal finance import script: pipeline, S, still personal data.
Sources
- Apache Airflow: Best Practices — Apache Airflow
- PostgreSQL: PostgreSQL documentation — PostgreSQL Global Development Group
- PostgreSQL: Backup and Restore — PostgreSQL Global Development Group
- The Twelve-Factor App: III. Config — 12factor.net
- Secrets Management Cheat Sheet — OWASP Cheat Sheet Series
- Logging Cheat Sheet — OWASP Cheat Sheet Series
- Well-Architected Reliability: back up data — AWS
- Pro Build Guide v1.2: compiled team practices — Pro Build Guide