Skip to content

Commit 9199611

Browse files
committed
copyedit: tighten comments and docstrings (Strunk pass)
Apply Elements-of-Style rules to the prose this PR added or modified. Focus on the heavy-comment files: buildvars package docs, hook declarations across compose/dgraphtest/t/testutil, hook-call comments in dgraphtest/local_cluster.go, FIPS-aware skip helpers in acl/jwt_algo_test.go and check_upgrade/check_upgrade_test.go and systest/integration2/acl_test.go, plus the misc one-off comments in dgraph/Makefile, t/Makefile, contrib/Dockerfile, dgraphtest/load.go, and graphql/e2e/auth/auth_test.go. Specific changes: - Active voice over passive where natural (Rule 10). - Positive form over negated (Rule 11): 'are unavailable' for 'isn't available', 'lacks' for 'does not have', etc. - Concrete over abstract (Rule 12): name the actual value or pattern in the example rather than 'various' or 'some'. - Drop needless words (Rule 13): cut hedging (essentially, basically, typically), pleonasms (actually, really, very), 'in order to' -> 'to', 'owing to the fact that' -> 'because', and 'is a function which' / 'is initialized to' constructions. - Em-dash discipline: at most one rhetorical em-dash per sentence; replace pile-on parentheticals with semicolons or split sentences. - Keep technical content unchanged. No code edits, only prose. 17 files; +277/-268 (net +9 from line wrapping).
1 parent 1656f20 commit 9199611

17 files changed

Lines changed: 277 additions & 268 deletions

File tree

acl/jwt_algo_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ import (
2323
)
2424

2525
func TestACLJwtAlgo(t *testing.T) {
26-
// EdDSA (Ed25519) is outside Go's FIPS validation boundary; the
26+
// EdDSA (Ed25519) lies outside Go's FIPS validation boundary; the
2727
// FIPS-restricted dgraph binary rejects it at JWT-signing setup.
28-
// Skip the EdDSA iteration when buildvars.FIPSEnabled is true. The remaining algorithms
29-
// in jwt.GetAlgorithms() are FIPS-approvable and run in both modes.
28+
// Skip the EdDSA iteration when buildvars.FIPSEnabled is true. The
29+
// remaining algorithms in jwt.GetAlgorithms() are FIPS-approvable
30+
// and run in both modes.
3031
fipsBuild := buildvars.FIPSEnabled
3132
for _, algo := range jwt.GetAlgorithms() {
3233
if algo == "none" || algo == "" {

buildvars/buildvars.go

Lines changed: 120 additions & 118 deletions
Large diffs are not rendered by default.

buildvars/cmd/buildvars/main.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
// Command buildvars emits the [buildvars] registry as lines of text
7-
// in a selectable format for consumption by shell eval, GNU Make eval,
8-
// or direct parsing by a validation script.
6+
// Command buildvars emits the [buildvars] registry as lines of text in
7+
// a selectable format for consumption by shell eval, GNU Make eval, or
8+
// direct parsing by a validation script.
99
//
1010
// Formats:
1111
//
@@ -25,10 +25,10 @@
2525
// validation scripts — use plain format for diffing against
2626
// Make-side values
2727
//
28-
// Values in shell format are single-quoted with embedded single quotes
29-
// escaped. Values in make format are emitted raw (newlines and special
30-
// Make characters in values would break, but all current buildvars values
31-
// are simple strings).
28+
// The shell format single-quotes values and escapes embedded single
29+
// quotes. The make format emits values raw; newlines and special Make
30+
// characters would break it, but all current buildvars values are
31+
// simple strings.
3232
package main
3333

3434
import (
@@ -40,7 +40,7 @@ import (
4040
"github.com/dgraph-io/dgraph/v25/buildvars"
4141
)
4242

43-
// shellQuote wraps s in single quotes, escaping any embedded single
43+
// shellQuote wraps s in single quotes and escapes any embedded single
4444
// quotes. Matches POSIX shell conventions for literal string quoting:
4545
// 'foo'"'"'bar' unambiguously represents foo'bar.
4646
func shellQuote(s string) string {
@@ -58,7 +58,7 @@ func main() {
5858
}
5959
case "make":
6060
// `:=` rather than `?=` so this command's value overrides any
61-
// ambient Make default. Callers that want fallback-only shape
61+
// ambient Make default. Callers wanting fallback-only shape
6262
// can post-process to replace `:=` with `?=`.
6363
for _, v := range buildvars.All {
6464
fmt.Fprintf(os.Stdout, "%s := %s\n", v.Name, v.Get())

buildvars/fips.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
package buildvars
77

88
// FIPSEnabled reports whether this binary was built with FIPS 140-3
9-
// enforcement and is therefore restricted to validated cryptography.
10-
// Default false. A downstream fork that runs FIPS-enforced builds flips
11-
// this var to true from a tag-guarded init() (the tag is whatever the
12-
// fork uses to gate its FIPS-enforcing code paths) before any caller's
13-
// main() or test body runs.
9+
// enforcement and is restricted to validated cryptography. Default
10+
// false. A downstream fork running FIPS-enforced builds sets this var
11+
// to true from a tag-guarded init(), where the tag is whatever the fork
12+
// uses to gate its FIPS-enforcing code paths. The init() runs before
13+
// any caller's main() or test body.
1414
//
1515
// Test code uses it to skip cases the FIPS-tagged binary cannot satisfy:
1616
//

check_upgrade/check_upgrade_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ import (
2525
"github.com/dgraph-io/dgraph/v25/x"
2626
)
2727

28-
// skipIfFIPS skips the current test when buildvars.FIPSEnabled is true. Upgrade-path
29-
// tests pin a specific upstream SHA for the "old" binary; that commit
30-
// predates any FIPS-enforcing toolchain, so attempting to build it
31-
// under a FIPS configuration either fails outright or produces a binary
32-
// that refuses to start. Semantically valid in non-FIPS builds.
28+
// skipIfFIPS skips the current test when buildvars.FIPSEnabled is true.
29+
// Upgrade-path tests pin a specific upstream SHA for the "old" binary;
30+
// that commit predates any FIPS-enforcing toolchain, so building it
31+
// under a FIPS configuration fails outright or produces a binary that
32+
// refuses to start. The test remains semantically valid in non-FIPS
33+
// builds.
3334
func skipIfFIPS(t *testing.T) {
3435
if buildvars.FIPSEnabled {
3536
t.Skip("upgrade-path test pins a pre-FIPS upstream SHA; skipping under FIPS build")

compose/compose.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ func initService(basename string, idx, grpcPort int) service {
155155
svc.Image = opts.Image + ":" + opts.Tag
156156
svc.ContainerName = containerName(svc.name)
157157
svc.WorkingDir = fmt.Sprintf("/data/%s", svc.name)
158-
// EmitUser is a public hook (compose/hooks.go); the upstream default
159-
// returns "" so the generated compose service inherits the image's
160-
// own USER directive. Downstream consumers that run dgraph as a
161-
// non-root user under compose can override the hook to return a
162-
// "uid:gid" string (e.g. "${UID:-65532}"), which is then emitted as
163-
// the service's `user:` field. Bind-mounted host paths must be
164-
// readable by that uid for the container to start cleanly.
158+
// EmitUser is a public hook in compose/hooks.go. The upstream
159+
// default returns "" so the generated compose service inherits the
160+
// image's own USER directive. Downstream consumers that run dgraph
161+
// as a non-root user under compose override the hook to return a
162+
// "uid:gid" string such as "${UID:-65532}", which is emitted as the
163+
// service's `user:` field. Bind-mounted host paths must be readable
164+
// by that uid for the container to start cleanly.
165165
if u := EmitUser(); u != "" {
166166
svc.User = u
167167
}

compose/hooks.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ package main
99
// See testutil/hooks.go for the full convention.
1010

1111
// EmitUser returns the value for the generated `user:` field in docker
12-
// compose services. Default: empty string (no user override emitted —
13-
// matches upstream behavior where containers run as the image's default
14-
// user). Forks may return e.g. "${UID:-65532}" to pin services to the
15-
// host UID for bind-mount compatibility under nonroot runtime images.
12+
// compose services. Default: empty string, emitting no user override
13+
// and matching upstream behavior where containers run as the image's
14+
// default user. Forks may return, e.g., "${UID:-65532}" to pin services
15+
// to the host UID for bind-mount compatibility under nonroot runtime
16+
// images.
1617
var EmitUser = defaultEmitUser
1718

1819
func defaultEmitUser() string { return "" }

contrib/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ RUN rm -rf /var/lib/apt/lists/*
1515
# remove /var/lib/apt/lists/* to reduce image size.
1616
# see: https://docs.docker.com/develop/develop-images/dockerfile_best-practices
1717
#
18-
# Retry the install once on transient apt-get errors (most commonly the
19-
# `File has unexpected size... Mirror sync in progress?` race against
20-
# archive.ubuntu.com mid-publish, which surfaces frequently in CI). The
21-
# rm + sleep between attempts gives the mirror time to settle and forces
22-
# a fresh package-list fetch.
18+
# Retry the install once on transient apt-get errors. The most common
19+
# is the `File has unexpected size... Mirror sync in progress?` race
20+
# against archive.ubuntu.com mid-publish, which surfaces frequently in
21+
# CI. The rm + sleep between attempts gives the mirror time to settle
22+
# and forces a fresh package-list fetch.
2323
RUN set -eu; \
2424
install_pkgs() { \
2525
apt-get update && apt-get install -y --no-install-recommends \

dgraph/Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ ifneq ($(strip $(BUILD_RACE)),)
5151
endif
5252

5353
# jemalloc stuff
54-
# Check common package-manager install paths: /usr/local/lib (make install
55-
# from source), /usr/lib (apt-get libjemalloc-dev), /usr/lib/libjemalloc_pic.a
56-
# (apk add jemalloc-dev on Alpine/Wolfi).
54+
# Check common package-manager install paths: /usr/local/lib (make
55+
# install from source), /usr/lib (apt-get libjemalloc-dev), and
56+
# /usr/lib/libjemalloc_pic.a (apk add jemalloc-dev on Alpine/Wolfi).
5757
HAS_JEMALLOC = $(shell test -f /usr/local/lib/libjemalloc.a -o -f /usr/lib/libjemalloc.a -o -f /usr/lib/libjemalloc_pic.a && echo "jemalloc")
5858
JEMALLOC_URL = "https://github.com/jemalloc/jemalloc/releases/download/5.3.1/jemalloc-5.3.1.tar.bz2"
5959

@@ -89,9 +89,10 @@ install: jemalloc
8989
echo "Old SHA256:" `sha256sum $(INSTALL_TARGET) 2>/dev/null | cut -c-64` ; \
9090
fi
9191
@go mod tidy
92-
@# Use 'go build -o' rather than 'go install': the latter honors the
93-
@# package's default name (always "dgraph"), but we want to honor $(BIN)
94-
@# so renames (e.g. fork binary) produce the correct file name.
92+
@# Use 'go build -o' rather than 'go install': 'go install' honors
93+
@# the package's default name (always "dgraph"), but we want to
94+
@# honor $(BIN) so renames such as a fork binary produce the
95+
@# correct file name.
9596
@go build $(BUILD_FLAGS) -o $(INSTALL_TARGET)
9697
@echo "Installed $(BIN) ($(GOOS)/$(GOARCH)) to $(INSTALL_TARGET)"
9798
@if [ "$(HAS_SHA256SUM)" ] ; then \

dgraphtest/hooks.go

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,62 @@ package dgraphtest
88
import "github.com/docker/docker/api/types/container"
99

1010
// This file declares public extensibility hooks for the dgraphtest test
11-
// harness. See testutil/hooks.go for the full convention. Each hook is
12-
// initialized to an unexported default that implements upstream behavior;
11+
// harness. See testutil/hooks.go for the full convention. Each hook
12+
// initializes to an unexported default that implements upstream behavior;
1313
// a private fork reassigns the public var from its own init().
1414

1515
// ApplyContainerUser optionally sets cfg.User to pin a container to a
16-
// specific UID/GID. Default: no-op (container runs as the image's
17-
// default user). Forks that ship nonroot runtime images and want tests
16+
// specific UID/GID. Default: no-op, so the container runs as the image's
17+
// default user. Forks that ship nonroot runtime images and want tests
1818
// to run under the host UID (so bind-mounted paths are writable) set
1919
// cfg.User to "host-uid:host-gid".
2020
var ApplyContainerUser = defaultApplyContainerUser
2121

2222
// WidenTempDirPerms optionally relaxes the 0700 default permissions of
23-
// os.MkdirTemp to allow a container's nonroot user to traverse the
23+
// os.MkdirTemp so a container's nonroot user can traverse the
2424
// bind-mounted path. Default: no-op. Forks with nonroot runtime images
2525
// set the mode to 0755.
2626
var WidenTempDirPerms = defaultWidenTempDirPerms
2727

2828
// WidenSecretFilePerms optionally relaxes secret-file permissions from
29-
// the default 0600 to let a container's nonroot user read the file via a
30-
// bind-mount. Default: no-op. Forks with nonroot runtime images set 0644.
31-
// Tempdir isolation bounds the exposure to ephemeral test processes.
29+
// the default 0600 so a container's nonroot user can read the file via
30+
// a bind-mount. Default: no-op. Forks with nonroot runtime images set
31+
// 0644. Tempdir isolation bounds the exposure to ephemeral test
32+
// processes.
3233
var WidenSecretFilePerms = defaultWidenSecretFilePerms
3334

3435
// GeneratePlugins optionally overrides the plugin-build flow used by
35-
// LocalCluster.GeneratePlugins. If handled=true, the caller uses the
36+
// LocalCluster.GeneratePlugins. When handled=true, the caller uses the
3637
// returned tokenizers string to populate the cluster's custom_tokenizers
37-
// arg and skips the default native-go-build path. If handled=false, the
38-
// caller falls through to the default in-process build. Default:
39-
// returns ("", false, nil) — delegate to upstream.
38+
// arg and skips the default native-go-build path. When handled=false,
39+
// the caller falls through to the default in-process build. Default:
40+
// returns ("", false, nil) and delegates to upstream.
4041
//
4142
// Params:
4243
// - raceEnabled: forward the --race flag to the plugin build
43-
// - tempBinDir: the cluster's per-test tempdir (host-side); a plugins/
44-
// subdirectory will be created there and bind-mounted into the
45-
// container-side build environment
44+
// - tempBinDir: the cluster's per-test tempdir (host-side). The hook
45+
// creates a plugins/ subdirectory there and bind-mounts it into the
46+
// container-side build environment.
4647
// - repoRoot: host path to the dgraph repo root, mounted so the
4748
// builder sees testutil/custom_plugins/... source files
4849
//
4950
// The returned tokenizers string is the comma-separated list of .so
50-
// paths as seen by the alpha container at runtime (typically under
51-
// /gobin/plugins/…).
51+
// paths the alpha container sees at runtime, typically under
52+
// /gobin/plugins/.
5253
var GeneratePlugins = defaultGeneratePlugins
5354

5455
// SetupLinuxBinaries optionally overrides the dgraph-binary staging
55-
// performed by LocalCluster.setupBinary for the Linux branch. If
56+
// LocalCluster.setupBinary performs for the Linux branch. When
5657
// handled=true, the caller returns err without executing the upstream
57-
// single-binary Linux path. Default: (false, nil) — delegate to
58+
// single-binary Linux path. Default: (false, nil) and delegates to
5859
// upstream.
5960
var SetupLinuxBinaries = defaultSetupLinuxBinaries
6061

6162
// HostBinaryName optionally overrides the filename of the host-native
6263
// dgraph binary that LocalCluster.HostDgraphBinaryPath joins with
63-
// tempBinDir. Default: empty string (use upstream default path selection
64-
// based on runtime.GOOS). Forks may return e.g. "dgraph_host" to name a
65-
// separate host-native binary alongside a container-only binary.
64+
// tempBinDir. Default: empty string, which selects the upstream default
65+
// path based on runtime.GOOS. Forks may return, e.g., "dgraph_host" to
66+
// name a separate host-native binary alongside a container-only binary.
6667
var HostBinaryName = defaultHostBinaryName
6768

6869
func defaultApplyContainerUser(cfg *container.Config) {}

0 commit comments

Comments
 (0)