Contributing / 贡献指南
Datakeel connects data ingestion, processing, quality, lineage, evidence and controlled actions. Bug fixes, reproducible reports, documentation and focused improvements are welcome. Please follow the Code of Conduct.
Datakeel 将数据导入、处理、质量、血缘、证据与受控动作连接起来。欢迎提交缺陷修复、可复现的问题、文档和范围明确的改进。参与时请遵守行为准则。
Set up locally / 本地开发
Use Python 3.12+, uv, Node.js 22, npm, and Rust 1.96 with rustfmt and clippy. From a checkout of the repository, run:
准备 Python 3.12+、uv、Node.js 22、npm,以及带 rustfmt 和 clippy 的 Rust 1.96,在仓库根目录执行:
uv sync --locked
(cd web && npm ci)
uv run pre-commit install
make check-rust
uv run datakeel demo
The optional Rust extension is built locally by make check-rust; see acceleration.
The demo uses generated local samples and the fake model provider. The English README and 中文 README describe the UI, command-line tools and local configuration. Use a separate data directory for experiments and an available port when another demo is already running.
演示使用本地生成的样例和假模型服务。界面、命令行及本地配置见 README。实验使用独立数据目录;已有演示运行时另选可用端口。
Make a focused change / 完成一个主题
- Read AGENTS.md, the architecture and code standards, then inspect the implementation and existing tests. 先读规约、架构、代码规范和真实实现。
- Keep one change focused on one problem. Add a regression test for a bug and meaningful tests for changed behavior. Use generated data, local fixtures and fake providers. 一次改动解决一个问题,用回归测试说明改动前后行为。
- Update public documentation and
CHANGELOG.mdwhen behavior changes. HTTP and tool boundaries use pydantic v2 models; frontend response types come from OpenAPI. 公共行为变更同步文档;接口响应类型不得手写。 - Run the required gates below. Include the commands, results and any unverified cases in your pull request. 交付时提供验证命令、结果和仍未验证的场景。
For API schema changes and any frontend source change, regenerate the corresponding artifacts before the final gate:
接口 schema 或前端源码变化后,先更新对应产物,再跑最终门禁:
(cd web && npm run generate:api)
(cd web && npm run build)
make check
make check enforces public-content scanning, formatting, lint, strict types, layering, size limits, runtime license auditing, test coverage, frontend tests and a production build. Overall Python coverage must remain at least 85%; the modules listed in docs/CODE_STANDARDS.md must remain at least 90%. Do not weaken checks to make a change pass. make fix applies formatters and safe lint fixes; review its diff.
make check 包含公开内容扫描、格式、lint、严格类型、分层、规模、运行时许可审计、测试覆盖率及前端测试和构建。Python 总覆盖率至少 85%,规范列出的模块至少 90%。不得通过降低门禁来交付。make fix 可执行格式化与自动修复,执行后检查差异。
The Python MPL audit needs the original compatible certifi/orjson wheels in
DATAKEEL_LICENSE_WHEEL_DIR (or UV_CACHE_DIR/license-wheels). Retain the exact archives
listed in uv.lock; unpacked install caches are insufficient. The audit never fetches missing
evidence. CI's two gate stacks opt into license-wheels: 'true' on the shared setup action:
the separate supplier downloads only these locked wheel URLs into a runner temporary directory,
rejects every redirect and verifies filename, byte length, SHA-256 and wheel metadata before
exporting the directory. Existing evidence is revalidated; invalid files fail without replacement.
Do not commit wheel files. See license evidence rules.
Python MPL 审计需要原始兼容 wheel,不能用解包缓存替代。将目录设置为
DATAKEEL_LICENSE_WHEEL_DIR;CI 由独立供给步骤下载并验证,审计本身保持离线。原始归档不入仓。
For the same extended checks used in CI, run:
复现 CI 的扩展门禁:
bash scripts/ci-check.sh
This also exercises README commands and mutation tests. CI runs the same commands split into
parallel jobs per stack (pytest and mutation shards plus a report job that merges them); see
the CI layout. / 该脚本还执行 README 命令和变异测试;
CI 在每个栈上把同一组命令拆成并行 job(pytest 分片、变异分片及合并判定的汇总 job)。
SQLite is the default. Each worker
migrates one empty source; each db fixture receives a complete SQLite backup or a fresh
PostgreSQL database cloned from that worker's private source, retaining constraints,
functions and triggers. Each test also has its own home directory. Copies are cleaned up
after the test, and sources after the worker session.
To repeat the gate on PostgreSQL, set DATAKEEL_TEST_DATABASE_URL to a fresh local database
you own. The fixture accepts only localhost or 127.0.0.1. The test role needs CREATEDB
and permission to clone its owned templates. UUID database names separate test copies;
their copied schema names may be identical because the databases are independent.
Cleanup drops only databases recorded as created by the fixture; WITH (FORCE) ends
only sessions still connected to that UUID copy. Migration tests using unmigrated_db retain the original
per-test empty-schema path and remove only that schema. Never use a shared or production
database for tests.
The Python and mutation steps use bounded parallel workers. Set DATAKEEL_TEST_WORKERS=1
for serial execution or a positive integer to choose concurrency. The full pytest wrapper
uses a custom loadgroup scheduler and explicitly loads its plugin in workers. The real
sandbox security group runs alone first while other workers stay idle, protecting Docker
startup and cleanup. The remaining tests then run concurrently, with a static full-node-ID
priority list dispatching costly cases early; unlisted tests retain their relative order.
This remains one pytest session: no tests are omitted or repeated, security failures still
fail the gate, and -m 'not integration' and coverage thresholds remain unchanged. See the
bilingual test execution guide for scheduling, isolation and
measurement details.
Python 测试和变异步骤默认有限并行;DATAKEEL_TEST_WORKERS=1 切换串行,正整数指定并行数。
完整 pytest 入口采用自定义 loadgroup 调度器并显式为 worker 加载插件。真实沙箱安全组
先独占执行,其它 worker 保持空闲,保护 Docker 启动和清理;随后并行执行其余测试,按静态
完整 node ID 列表优先派发昂贵用例,未列出的用例保持相对顺序。仍为同一个 pytest 会话,
不遗漏、不重复用例,安全失败仍使门禁失败,-m 'not integration' 与覆盖率门槛保持不变。
调度、隔离和测量方法见测试执行指南。
该入口还执行 README 命令和变异测试。默认使用 SQLite。每个 worker 迁移一个空模板,
每个 db 夹具得到完整 SQLite backup 副本,或从该 worker 私有模板克隆的独立 PostgreSQL
数据库,保留约束、函数与触发器。每个用例也有独立 home;用例结束清理副本,会话结束清理模板。
PostgreSQL 验证时将 DATAKEEL_TEST_DATABASE_URL 指向自己新建的本地测试库,夹具仅接受
localhost 或 127.0.0.1。测试角色须有 CREATEDB 及克隆自有模板的权限。UUID 库名隔离
用例副本;独立数据库中的 schema 名可以相同。清理只删除夹具记录为自己创建的数据库,
WITH (FORCE) 只结束仍连在该 UUID 副本上的会话。unmigrated_db 迁移测试保留原有按用例创建空 schema 的路径,
只清理对应 schema。不要使用共享库或生产库跑测试。
Capacity workloads / 容量压测
The reproducible S/M/L workloads, measurement boundaries and operating limits are documented in
CAPACITY.md. make check includes the S dataset smoke and a fourfold-growth
regression guard with a quadratic negative control. Run large workloads independently with result
JSON and profiles outside the checkout, against explicitly authorized local fixtures.
可复现的 S/M/L 场景、计量范围与使用边界见 CAPACITY.md。make check 包含
S 数据集冒烟与四倍规模退化检查,并用 O(n²) 变异验证拦截能力。大规模运行应独立执行,结果
JSON 与 profile 放在仓库之外,且只使用明确授权的本地 fixture。
Reports and pull requests / 问题与合并请求
Search existing issues before filing a report. Use the bug template for expected and actual behavior, a minimal reproduction, version details and redacted logs. Use the feature template for the user problem, proposed outcome and acceptance criteria. Reports may be written in English or Chinese.
提交前先检索已有问题。缺陷模板需填写预期、实际结果、最小复现、版本和脱敏日志;功能模板说明用户问题、预期结果和验收条件。中文或英文均可。
Keep each commit about one topic and use Conventional Commits, such as fix(actions): 统一拒绝执行状态 or docs: clarify local setup. Review git diff --cached before committing. A pull request should explain the problem, resulting behavior, validation and remaining limitations; complete its checklist and link the related issue if there is one.
每个提交只包含一个主题,使用 Conventional Commits。提交前检查 git diff --cached。合并请求应说明问题、最终行为、验证结果与限制,完成检查清单,有相关 issue 时附上链接。
Licensing, privacy and security / 许可、隐私与安全
Contributions are provided under the repository's Apache-2.0 license. Include only material you have the right to contribute. New dependencies must comply with the license policy in the code standards, including transitive runtime packages and assets bundled into the frontend; retain their notices.
贡献内容按仓库 Apache-2.0 许可提供,请确保有权提交。新依赖及其运行时传递依赖、前端打包资源均须符合代码规范的许可要求,并保留上游声明。
Do not include credentials, personal local paths, private network addresses, customer identifiers or real tenant data in code, logs, screenshots or fixtures. Send suspected vulnerabilities through the private process in SECURITY.md, not a public issue.
代码、日志、截图和样例不得包含凭证、本机个人路径、内网地址、客户标识或真实租户数据。疑似漏洞按 SECURITY.md 私下报告,不放进公开 issue。
The public-content gate reads current tracked files and untracked files that Git does not ignore, including unstaged edits. Findings report a relative file, line and rule without copying sensitive values. Use reserved domains such as example.org for generated email samples; the contributor identity rule still requires GitHub noreply addresses. Run make check-public for this scan alone.
公开内容门禁读取当前已跟踪文件及未忽略的新文件,包含未暂存修改;命中仅报告相对文件、行号和规则。生成的邮箱样例使用 example.org 等保留域名;提交身份仍要求 GitHub noreply 地址。可用 make check-public 单独执行扫描。
Maintainers can prepare a local public copy using the export guide. 维护者可按导出指南准备本地公开副本,发布仍是单独的人工步骤。