# The CODEOWNERS file is used by Github to automate assigning code reviews, see
# [1] and [2]. We also use it in our internal tooling (see [3]) to automate test
# failure issue routing. To do this efficiently, we are enforcing a few rules in
# this file via linting. They are:
#
# - every file under ./pkg has to have at least one owner, and each owner must
#   be present in TEAMS.yaml (either as a map key or an alias).
# - you can opt out of Github-requested code review assignments (while
#   maintaining team ownership) by suffixing the handle with `-noreview`.
#   (This will essentially make it an unknown team to Github, but our internal
#   tooling continues to recognize the original team).
#
# Remember, *the last rule to match wins*, and you need a trailing slash to get
# recursive ownership of a directory.
#
# [1]: https://github.com/blog/2392-introducing-code-owners
# [2]: https://help.github.com/articles/about-codeowners/
# [3]: pkg/internal/codeowners

/.github/                    @cockroachdb/dev-inf
/.github/CODEOWNERS          @cockroachdb/unowned

/build/                      @cockroachdb/dev-inf

/docs/RFCS/                  @cockroachdb/rfc-prs
/docs/generated/redact_safe.md @cockroachdb/security

/Makefile                    @cockroachdb/dev-inf

/pkg/sql/                    @cockroachdb/sql-queries-noreview

/pkg/sql/opt/                @cockroachdb/sql-opt-prs
/pkg/sql/stats/              @cockroachdb/sql-opt-prs

/pkg/sql/sem/tree/           @cockroachdb/sql-syntax-prs
/pkg/sql/parser/             @cockroachdb/sql-syntax-prs
/pkg/sql/lex/                @cockroachdb/sql-syntax-prs
/pkg/sql/show_create*.go     @cockroachdb/sql-syntax-prs
/pkg/sql/types/              @cockroachdb/sql-syntax-prs

/pkg/sql/crdb_internal.go    @cockroachdb/sql-api-prs
/pkg/sql/pg_catalog.go       @cockroachdb/sql-api-prs
/pkg/sql/pgwire/             @cockroachdb/sql-api-prs
/pkg/sql/sem/builtins/       @cockroachdb/sql-api-prs
/pkg/sql/vtable/             @cockroachdb/sql-api-prs

/pkg/sql/sessiondata/        @cockroachdb/sql-experience
/pkg/sql/tests/rsg_test.go   @cockroachdb/sql-experience

/pkg/sql/catalog/            @cockroachdb/sql-schema
/pkg/sql/catalog/multiregion @cockroachdb/multiregion
/pkg/sql/doctor/             @cockroachdb/sql-schema
/pkg/sql/gcjob/              @cockroachdb/sql-schema
/pkg/sql/gcjob_test/         @cockroachdb/sql-schema
/pkg/sql/privilege/          @cockroachdb/sql-schema
/pkg/sql/schemachange/       @cockroachdb/sql-schema
/pkg/sql/schemachanger/      @cockroachdb/sql-schema
/pkg/sql/alter*.go           @cockroachdb/sql-schema
/pkg/sql/backfill*.go        @cockroachdb/sql-schema
/pkg/sql/create*.go          @cockroachdb/sql-schema
/pkg/sql/database*.go        @cockroachdb/sql-schema
/pkg/sql/drop*.go            @cockroachdb/sql-schema
/pkg/sql/grant*.go           @cockroachdb/sql-schema
/pkg/sql/rename*.go          @cockroachdb/sql-schema
/pkg/sql/revoke*.go          @cockroachdb/sql-schema
/pkg/sql/schema*.go          @cockroachdb/sql-schema
/pkg/sql/zone*.go            @cockroachdb/sql-schema

/pkg/cli/                    @cockroachdb/cli-prs
# last-rule-wins so bulk i/o takes userfile.go even though cli-prs takes pkg/cli
/pkg/cli/userfile.go         @cockroachdb/bulk-io
/pkg/cli/demo*.go            @cockroachdb/cli-prs @cockroachdb/sql-experience @cockroachdb/server-prs
/pkg/cli/debug*.go           @cockroachdb/cli-prs @cockroachdb/kv-prs
/pkg/cli/debug_job_trace*.go @cockroachdb/bulk-io
/pkg/cli/doctor*.go          @cockroachdb/cli-prs @cockroachdb/sql-schema
/pkg/cli/import_test.go      @cockroachdb/cli-prs @cockroachdb/bulk-io
/pkg/cli/sql*.go             @cockroachdb/cli-prs @cockroachdb/sql-experience
/pkg/cli/start*.go           @cockroachdb/cli-prs @cockroachdb/server-prs
/pkg/cli/mt_proxy.go         @cockroachdb/sqlproxy-prs @cockroachdb/server-prs
/pkg/cli/mt_start_sql.go     @cockroachdb/sqlproxy-prs @cockroachdb/server-prs
/pkg/cli/mt_test_directory.go @cockroachdb/sqlproxy-prs @cockroachdb/server-prs
/pkg/cli/connect*.go         @cockroachdb/cli-prs @cockroachdb/server-prs
/pkg/cli/init.go             @cockroachdb/cli-prs @cockroachdb/server-prs
/pkg/cmd/cockroach-sql/      @cockroachdb/cli-prs

/pkg/server/                 @cockroachdb/server-prs
/pkg/server/testserver*.go   @cockroachdb/server-prs @cockroachdb/test-eng

/pkg/ccl/changefeedccl/      @cockroachdb/cdc-prs
/pkg/ccl/streamingccl/       @cockroachdb/cdc-prs
# last-rule-wins so *after* CDC takes most of streamingccl bulk-io takes ingest pkg.
/pkg/ccl/streamingccl/streamingest @cockroachdb/bulk-io

/pkg/ccl/backupccl/          @cockroachdb/bulk-io
/pkg/ccl/importccl/          @cockroachdb/bulk-io
/pkg/ccl/storageccl/         @cockroachdb/bulk-io
/pkg/cloud/                  @cockroachdb/bulk-io
/pkg/sql/distsql_plan_csv.go @cockroachdb/bulk-io

/pkg/geo/                    @cockroachdb/geospatial

/pkg/kv/                     @cockroachdb/kv-prs

/pkg/storage/                @cockroachdb/storage

/pkg/ui/                     @cockroachdb/cluster-ui-prs
/pkg/ui/embedded.go          @cockroachdb/cluster-ui-prs
/pkg/ui/src/js/protos.d.ts   @cockroachdb/cluster-ui-prs
/pkg/ui/src/js/protos.js     @cockroachdb/cluster-ui-prs

/docs/generated/http/        @cockroachdb/http-api-prs @cockroachdb/server-prs
/pkg/cmd/docgen/http.go      @cockroachdb/http-api-prs @cockroachdb/server-prs

/pkg/ccl/sqlproxyccl/        @cockroachdb/sqlproxy-prs @cockroachdb/server-prs

/pkg/acceptance/             @cockroachdb/sql-experience
/pkg/base/                   @cockroachdb/server-prs
/pkg/bench/                  @cockroachdb/sql-queries
/pkg/bench/rttanalysis       @cockroachdb/sql-schema
/pkg/blobs/                  @cockroachdb/bulk-io
/pkg/build/                  @cockroachdb/dev-inf
/pkg/ccl/baseccl/            @cockroachdb/cli-prs
/pkg/ccl/buildccl/           @cockroachdb/dev-inf
/pkg/ccl/cliccl/             @cockroachdb/cli-prs
/pkg/ccl/cmdccl/enc_utils/   @cockroachdb/storage
/pkg/ccl/cmdccl/stub-schema-registry/ @cockroachdb/cdc-prs
/pkg/ccl/gssapiccl/          @cockroachdb/sql-queries
/pkg/ccl/kvccl/              @cockroachdb/kv-noreview
/pkg/ccl/migrationccl/       @cockroachdb/kv-prs
/pkg/ccl/logictestccl/       @cockroachdb/sql-queries-noreview
/pkg/ccl/multiregionccl/     @cockroachdb/multiregion
/pkg/ccl/multitenantccl/     @cockroachdb/unowned
/pkg/ccl/oidcccl/            @cockroachdb/sql-queries
/pkg/ccl/partitionccl/       @cockroachdb/sql-schema @cockroachdb/multiregion
/pkg/ccl/serverccl/          @cockroachdb/server-prs
/pkg/ccl/serverccl/statusccl @cockroachdb/sql-observability
/pkg/ccl/telemetryccl/       @cockroachdb/obs-inf-prs
/pkg/ccl/testccl/sqlccl/     @cockroachdb/sql-queries
/pkg/ccl/testccl/workload/schemachange/ @cockroachdb/sql-schema
/pkg/ccl/testutilsccl/       @cockroachdb/test-eng-noreview
/pkg/ccl/utilccl/            @cockroachdb/server-prs
/pkg/ccl/workloadccl/        @cockroachdb/sql-experience
/pkg/ccl/benchccl/rttanalysisccl/     @cockroachdb/sql-experience
/pkg/clusterversion/         @cockroachdb/kv-prs-noreview
/pkg/cmd/allocsim/           @cockroachdb/kv-prs
/pkg/cmd/bazci/              @cockroachdb/dev-inf
/pkg/cmd/cmdutil/            @cockroachdb/dev-inf
/pkg/cmd/cmp-protocol/       @cockroachdb/sql-experience
/pkg/cmd/cmp-sql/            @cockroachdb/sql-experience
/pkg/cmd/cmpconn/            @cockroachdb/sql-experience
/pkg/cmd/cockroach/          @cockroachdb/cli-prs
/pkg/cmd/cockroach-oss/      @cockroachdb/cli-prs
/pkg/cmd/cockroach-short/    @cockroachdb/cli-prs
/pkg/cmd/compile-build/      @cockroachdb/dev-inf
/pkg/cmd/cr2pg/              @cockroachdb/sql-experience
/pkg/cmd/dev/                @cockroachdb/dev-inf
/pkg/cmd/docgen/             @cockroachdb/docs
/pkg/cmd/docs-issue-generation/ @cockroachdb/dev-inf
/pkg/cmd/fuzz/               @cockroachdb/test-eng
/pkg/cmd/generate-binary/    @cockroachdb/sql-experience
/pkg/cmd/generate-metadata-tables/ @cockroachdb/sql-experience
/pkg/cmd/generate-spatial-ref-sys/ @cockroachdb/geospatial
/pkg/cmd/generate-test-suites/ @cockroachdb/dev-inf
/pkg/cmd/geoviz/             @cockroachdb/geospatial
/pkg/cmd/github-post/        @cockroachdb/test-eng
/pkg/cmd/github-pull-request-make/ @cockroachdb/dev-inf
/pkg/cmd/gossipsim/          @cockroachdb/kv-prs
/pkg/cmd/import-tools/       @cockroachdb/dev-inf
/pkg/cmd/internal/issues/    @cockroachdb/test-eng
/pkg/cmd/prereqs/            @cockroachdb/dev-inf
/pkg/cmd/protoc-gen-gogoroach/ @cockroachdb/server-prs
/pkg/cmd/publish-artifacts/  @cockroachdb/dev-inf
/pkg/cmd/publish-provisional-artifacts/ @cockroachdb/dev-inf
/pkg/cmd/reduce/             @cockroachdb/sql-queries
/pkg/cmd/returncheck/        @cockroachdb/dev-inf
/pkg/cmd/roachprod/          @cockroachdb/dev-inf
/pkg/cmd/roachprod-stress/   @cockroachdb/test-eng
/pkg/cmd/roachtest/          @cockroachdb/test-eng
/pkg/cmd/tag-merged-pr/      @cockroachdb/dev-inf
# This isn't quite right, each file should ideally be owned
# by a team (or at least most of them), namely the team that
# is the Owner for the roachtest, but until we unify these
# two concepts of ownership we don't want to ping test-eng
# on each test change.
/pkg/cmd/roachtest/tests     @cockroachdb/test-eng-noreview
/pkg/cmd/roachvet/           @cockroachdb/dev-inf
/pkg/cmd/skip-test/          @cockroachdb/test-eng
/pkg/cmd/skiperrs/           @cockroachdb/sql-experience
/pkg/cmd/skipped-tests/      @cockroachdb/test-eng
/pkg/cmd/smithcmp/           @cockroachdb/sql-queries
/pkg/cmd/smithtest/          @cockroachdb/sql-queries
/pkg/cmd/teamcity-trigger/   @cockroachdb/dev-inf
/pkg/cmd/testfilter/         @cockroachdb/test-eng
/pkg/cmd/uptodate/           @cockroachdb/dev-inf
/pkg/cmd/urlcheck/           @cockroachdb/docs
/pkg/cmd/whoownsit/          @cockroachdb/test-eng
/pkg/cmd/workload/           @cockroachdb/sql-experience
/pkg/cmd/wraprules/          @cockroachdb/obs-inf-noreview
/pkg/cmd/zerosum/            @cockroachdb/kv-noreview
/pkg/col/                    @cockroachdb/sql-queries
/pkg/compose/                @cockroachdb/sql-experience
/pkg/config/                 @cockroachdb/server-prs
/pkg/docs/                   @cockroachdb/docs
/pkg/featureflag/            @cockroachdb/cli-prs-noreview
/pkg/gossip/                 @cockroachdb/kv-noreview
/pkg/internal/client/requestbatcher/ @cockroachdb/kv-prs
/pkg/internal/codeowners/    @cockroachdb/test-eng
/pkg/internal/reporoot       @cockroachdb/dev-inf
/pkg/internal/rsg/           @cockroachdb/sql-queries
/pkg/internal/sqlsmith/      @cockroachdb/sql-queries
/pkg/internal/team/          @cockroachdb/test-eng
/pkg/jobs/                   @cockroachdb/sql-schema
/pkg/keys/                   @cockroachdb/kv-prs
# Don't ping KV on updates to reserved descriptor IDs and such.
/pkg/keys/constants.go       @cockroachdb/kv-prs-noreview
/pkg/migration/              @cockroachdb/kv-prs @cockroachdb/sql-schema
/pkg/multitenant             @cockroachdb/unowned
/pkg/release/                @cockroachdb/dev-inf
/pkg/roachpb/                @cockroachdb/kv-prs
/pkg/roachprod/              @cockroachdb/dev-inf
/pkg/rpc/                    @cockroachdb/server-prs
/pkg/scheduledjobs/          @cockroachdb/bulk-io
/pkg/security/               @cockroachdb/server-prs
/pkg/settings/               @cockroachdb/server-prs
/pkg/spanconfig/             @cockroachdb/multiregion
/pkg/startupmigrations/      @cockroachdb/server-prs @cockroachdb/sql-schema
/pkg/streaming/              @cockroachdb/bulk-io
/pkg/testutils/              @cockroachdb/test-eng-noreview
/pkg/testutils/reduce/       @cockroachdb/sql-queries
/pkg/testutils/sqlutils/     @cockroachdb/sql-queries
/pkg/ts/                     @cockroachdb/kv-prs
/pkg/ts/catalog/             @cockroachdb/obs-inf-prs
/pkg/util/                   @cockroachdb/unowned
/pkg/util/log                @cockroachdb/server-prs
/pkg/util/metric             @cockroachdb/obs-inf-prs
/pkg/util/stop               @cockroachdb/server-prs
/pkg/util/tracing            @cockroachdb/obs-inf-prs
/pkg/workload/               @cockroachdb/sql-experience

# Own all bazel files to dev-inf, but don't request reviews for them
# as they are mostly - but not only - generated code that changes with
# changes to the Go code in the package.
**/BUILD.bazel               @cockroachdb/dev-inf-noreview
# Avoid mass pings when updating proto tooling.
# For some reason, **/*.pb.go does not work (in the
# sense that ./pkg/cmd/whoownsit will not match this
# pattern to any files).
**.pb.go                     @cockroachdb/unowned
**.pb.gw.go                  @cockroachdb/unowned