* chore: check enterprise-gated files are listed in both license configs A file reachable only through `#[cfg(feature = "enterprise")] mod ...;` is governed by the GreptimeDB Enterprise License, so it must appear in the `includes` of licenserc-enterprise.toml and the `excludes` of licenserc.toml. hawkeye stays silent when it does not: the file keeps its Apache-2.0 header and passes the default check precisely because it was never excluded from it. scripts/check-enterprise-license.py walks enterprise-gated `mod` declarations, resolves them to files (submodules included) and diffs that set against both configs, also reporting stale entries. It runs in the license job in CI and as `make check-enterprise-license`. Documents the split it cannot decide for you — whole enterprise features get their own file, a gated match arm stays inline — in .agents/architecture-invariants.md. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: tighten enterprise license checks Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
4.7 KiB
AGENTS.md
Guidance for coding agents (Claude Code, Codex, ...) and contributors working in
this repository. CLAUDE.md is a symlink to this file. If .local/AGENTS.md or
.local/CLAUDE.md is present, you MUST read it as well — it holds personal
or machine-local overrides (gitignored, not shared). To record a personal or
machine-local override, write it to .local/AGENTS.md (create .local/ and the
file if absent), not to this shared file.
GreptimeDB is an open-source, cloud-native observability database for unified collection and analysis of metrics, logs, and traces. It is written in Rust and provides sub-second querying at PB scale with high cost efficiency.
Core commands
| Task | Command |
|---|---|
| Build (debug) | make build |
| Build (release) | make build RELEASE=true |
| Run standalone | cargo run -- standalone start |
| Test | cargo nextest run (preferred over cargo test) |
| SQL tests | cargo sqlness bare (single case: cargo sqlness bare -t <name>) |
| Format | make fmt (and make fmt-toml for TOML) |
| Lint | make clippy (= cargo clippy --workspace --all-targets --all-features -- -D warnings) |
| Type check | make check |
Toolchain: Rust nightly, Protobuf compiler (>= 3.15), C/C++ build essentials.
Install the test runner with cargo install cargo-nextest --locked.
Repo map
GreptimeDB is a Cargo workspace rooted at the repository; most crates live under
src/ (plus tests-fuzz, tests-integration, tests/runner). Key areas:
- Frontend / protocol:
src/frontend/(request orchestration),src/servers/(wire protocols),src/sql/(SQL parsing) - Storage engines:
src/mito2/(main time-series engine),src/metric-engine/(metrics),src/file-engine/ - Coordination:
src/meta-srv/(metadata & cluster control),src/meta-client/ - Execution / statements:
src/operator/(DDL/DML, request conversion, procedures) - Stream / transform:
src/flow/(continuous aggregation),src/pipeline/ - Query / index:
src/query/,src/promql/,src/index/ - Shared:
src/common/,src/datatypes/,src/store-api/(engine contract),src/catalog/,src/table/
Hot crates carry their own AGENTS.md with a module map, read/write paths,
change-coupling points, and gotchas:
src/mito2/AGENTS.mdsrc/metric-engine/AGENTS.mdsrc/flow/AGENTS.mdsrc/frontend/AGENTS.mdsrc/meta-srv/AGENTS.md
Read before changing code
.agents/architecture-invariants.md— repo-wide rules that are easy to violate and expensive to get wrong (persisted/ wire format compatibility, crate layering, async runtimes, error handling, feature gating, the DataFusion fork)..agents/generated-files.md— tool-generated artifacts that must not be hand-edited (sqlness.result,config/config.md, Grafana dashboards, proto).docs/style-guide.md— code style.CONTRIBUTING.md— contribution flow and CLA.
High-signal entry points
- Main binary:
src/cmd/src/bin/greptime.rs - Configuration:
src/common/config/, example TOMLs inconfig/ - Error handling:
src/common/error/(ErrorExt,StatusCode) - Protocol implementations:
src/servers/src/
Before opening a PR
make fmtmake clippymake test(orcargo nextest run)make check-udeps(runmake fix-udepsif it reports unused dependencies).- If you added or changed a public configuration option, update the applicable
example TOMLs, configuration-loading and serialized-config snapshot tests,
and related user-facing documentation. Run
make config-docs(needs Docker) and commit the regeneratedconfig/config.md. - If you changed a persisted or wire format, add a compatibility test case (see
.agents/architecture-invariants.md). - If you added or gated an enterprise-only file, give it the enterprise license
header, list it in
licenserc-enterprise.toml(includes) andlicenserc.toml(excludes), and runmake check-enterprise-license. - Use a conventional-commit title, sign off commits (
git commit -s), and sign the CLA. - When creating or updating a pull request, follow
.github/pull_request_template.md: include the CLA statement, fill the change-intention section with enough detail, and update checklist items accurately.
More
- Agent skills and resources:
.agents/(see.agents/README.md) - Architecture decisions:
docs/rfcs/ - How-to guides:
docs/how-to/