Skip to content

Add AGENTS.md for AI Co-Worker standardization#3473

Open
kpango wants to merge 1 commit intomainfrom
doc/add-agents-md-9898591043237542042
Open

Add AGENTS.md for AI Co-Worker standardization#3473
kpango wants to merge 1 commit intomainfrom
doc/add-agents-md-9898591043237542042

Conversation

@kpango
Copy link
Collaborator

@kpango kpango commented Feb 10, 2026

Add AGENTS.md for AI Co-Worker standardization

  • Unify AGENTS.md and GEMINI.md concepts into a single comprehensive guide.
  • Define "Senior Cloud-Native Distributed Systems Engineer" persona.
  • Establish "Plan -> Execute -> Show -> Propose" working style.
  • Set strict zero-diff policies and mandatory Makefile workflows.
  • Detail MCP tooling and routing rules.
  • Document critical architecture context (NGT, gRPC, K8s).
  • Provide explicit "Recommended Local Development Workflow" including k3d, helm, and e2e/v2 targets.
  • Outline gRPC error handling and streaming patterns.

PR created automatically by Jules for task 9898591043237542042 started by @kpango

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive agents development guide covering guidelines, patterns, workflows and repo mapping.
  • Chores
    • Updated tool/runtime version references across templates and dependency manifests.
    • CI/workflow actions and scanning step references updated.
    • Normalized several Kubernetes/CRD JSON serialization tags to ensure fields are always present.
  • Style
    • Various formatting and build-script tidy-ups with no functional impact.
  • Tests
    • Widespread test scaffolding and iteration updates for consistency.

@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 10, 2026

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 78b051f
Status: ✅  Deploy successful!
Preview URL: https://061991f3.vald.pages.dev
Branch Preview URL: https://doc-add-agents-md-9898591043.vald.pages.dev

View logs

@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

Important

Review skipped

Too many files!

This PR contains 280 files, which is 130 over the limit of 150.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new repository-level documentation file AGENTS.md, updates CI/action and template version references, bumps multiple Go/Rust dependency versions, adjusts several Makefile targets, modifies serialization tags on CRD types, replaces some helper usages (maps/ptr/slices), and applies widespread loop/context/reflection edits across code and tests.

Changes

Cohort / File(s) Summary
Repository docs & listing
AGENTS.md, .gitfiles
Adds AGENTS.md with agent guidelines and registers it in .gitfiles.
GitHub templates & workflows
.github/ISSUE_TEMPLATE/*, .github/PULL_REQUEST_TEMPLATE.md, .github/actions/.../action.yaml, .github/workflows/build-binaries.yaml, .github/workflows/reviewdog-markdown.yaml
Bumps tool/version lines in templates, updates action versions/SHAs and reviewdog rules; no control-flow changes.
Go module & manifests
go.mod, example/client/go.mod, example/client/go.mod.default, hack/go.mod.default
Large, multi-module dependency and toolchain version bumps and replace updates.
Makefiles & build includes
Makefile, Makefile.d/*, internal/core/algorithm/ngt/Makefile
Minor formatting/no-op edits, one target dependency change (kind restart), and one change affecting environment grouping for a bench target.
Rust manifests
rust/libs/*/Cargo.toml, rust/rust-toolchain.toml
Patch-level crate and toolchain bumps (tonic, wincode, futures-core, rust toolchain).
Kubernetes API (CRDs)
internal/k8s/.../api/v1/*_types.go
Removed omitempty from several JSON tags (metadata/spec/status/list metadata), changing marshaling omission behavior.
Pointer helper replacements (AWS/K8s/ptr)
internal/db/storage/blob/s3/*, pkg/index/job/readreplica/rotate/service/rotator.go, internal/k8s/client/client.go
Replaced aws.String/ptr.To/ptr helpers with direct new(...)/new(true) and removed unused imports.
Maps / slices helpers
internal/circuitbreaker/manager.go, internal/k8s/client/client.go, pkg/agent/core/ngt/service/ngt.go
Replaced manual map merges with maps.Copy, used slices.Contains for membership checks.
Reflection & type utilities
internal/info/info.go, internal/observability/..., internal/db/rdb/mysql/mysql_test.go, internal/errors/errors.go
Switched some reflect.TypeOf to reflect.TypeFor[...]() usages; removed exported ErrInvalidTypeConversion.
I/O & numeric simplifications
internal/io/copy.go, internal/net/grpc/stats/stats.go, tests/v2/e2e/metrics/scale.go
Replaced branch logic with concise clamp expressions (min/max) preserving behavior.
Widespread tests & iteration patterns
many *_test.go, internal/test/data/*, hack/*, pkg/*, tests/v2/e2e/*
Extensive edits: many index-based loops converted to range-style forms and many tests now use t.Context()/b.Context() instead of explicit context.WithCancel; numerous test-only loop changes are pervasive (review for correctness).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • datelier
  • Matts966
  • kmrmt

Poem

A guide appears at repo root, fresh and bright,
Actions and versions nudged into the right light.
Pointers swapped, maps copied, loops reshaped with care,
Tests now borrow test contexts, fewer cancels to spare.
Small edits stitch the code — the tree grows a new leaf tonight.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 24.10% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change—adding AGENTS.md documentation for AI Co-Worker standardization. It is clear, specific, and directly addresses the primary objective of this PR.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch doc/add-agents-md-9898591043237542042

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Around line 78-80: Replace the redundant phrase "API interfaces" in the
AGENTS.md languages bullet with a concise term like "APIs" (or simply
"interfaces"); locate the line containing "**API interfaces**" and change it to
"**APIs**" to remove the tautology while preserving meaning.
- Around line 24-155: The MD linter errors are caused by missing blank lines
around headings and fenced code blocks (e.g., the "Start Local Cluster (k3d):",
"Deploy Vald (Helm):", "Run E2E Tests (V2):", "Clean Up:", "6.1 gRPC &
Bidirectional Streaming (Critical)" headings and the surrounding
```bash```/```go``` fences). Fix by inserting a single blank line before each
heading and both before and after each fenced code block (and between the
preceding list/table and the next heading) so that every code fence and heading
is separated by blank lines, ensuring the numbered lists and tables remain
separated from code blocks to satisfy MD022/MD031/MD058 rules.

@kpango
Copy link
Collaborator Author

kpango commented Feb 10, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Around line 83-84: The documentation contains a typo in the Agent description:
change the phrase "State-full (requires PV)" to "Stateful (requires PV)" in the
AGENTS.md entry for "Agent (NGT)" so the wording is correct and consistent with
other docs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Around line 162-223: The Markdown headings (e.g., "Go", "Rust", "Kubernetes &
Helm (YAML)", "Dockerfile", "Makefiles", "GitHub Actions", "6.2 gRPC &
Bidirectional Streaming", "6.3 Error Handling Strategy (gRPC Codes)", and "6.4
Configuration & Tuning") each need a single blank line inserted immediately
after the heading line to satisfy MD022; edit AGENTS.md and add one empty line
after each of those heading lines so the linter no longer fails.

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch 3 times, most recently from dad9c66 to 5a1dd7a Compare February 10, 2026 15:45
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Line 1: Fix the typographical error in the AGENTS.md header: replace "Tesm"
with "Team" in the line "# You are The Vald Development Tesm's Co-Worker" so the
header reads "# You are The Vald Development Team's Co-Worker".
- Around line 248-257: Update the "Repository Map" entry for `pkg/` to
accurately describe that `pkg/` contains internal service implementations rather
than stable public SDKs: replace "Public SDKs and libraries" with a note that
`pkg/` houses service code such as agent handlers, gateway handlers, usecases,
and configuration types, and add a short warning that these are not guaranteed
as a stable public API surface to prevent AI or developers from assuming
stability.

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch from 5a1dd7a to 1134105 Compare February 10, 2026 20:09
@kpango
Copy link
Collaborator Author

kpango commented Feb 10, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Line 292: Update the grammatical error in the AGENTS.md entry for the cmd/
directory: replace the phrase "`Entry points for each components (Agent,
Gateway, Discoverer, etc.).`" with "`Entry points for each component (Agent,
Gateway, Discoverer, etc.).`" so the singular "component" is used; modify the
line containing the `cmd/` description accordingly.
- Around line 35-42: The ordered list in AGENTS.md is broken by an extra blank
line after the "2. **Cross-Language Dependency:**" heading which causes a MD029
linter violation; fix it by removing the blank line immediately following the
"2. **Cross-Language Dependency:**" line so the two sub-bullets remain part of
item 2 (ensure the sub-bullets "- Does a change in Go `apis/proto`..." and "-
Does a change in Rust `libs/`..." remain directly under that heading with
correct indentation), then run the Markdown linter to confirm MD029 is resolved.
- Around line 59-66: Update the two unclear checklist items: replace "Use
`internal/` Libraries As you can: Do not use standard `log` or `errors` or
`sync` or `strings`. Use `github.com/vdaas/vald/internal/**`." with a clearer
sentence like "Prefer internal packages whenever possible: avoid using standard
`log`, `errors`, `sync`, or `strings` and use
`github.com/vdaas/vald/internal/**` instead." and replace "Handle gRPC Errors:
Please do well handled gRPC Richer Error Model." with "Handle gRPC errors using
the gRPC richer error model and provide proper error handling and propagation."
Ensure these changes target the checklist items titled "Use `internal/`
Libraries As you can" and "Handle gRPC Errors" in the MANDATORY PATTERNS
section.
- Around line 193-204: The placeholders in the make examples use curly braces
which can be mistaken for shell parameter expansion; update the examples for the
Vald deploy/delete commands (the make invocation lines using VERSION and
HELM_VALUES) to use conventional angle-bracket placeholders like <version> and
<pr-number> (e.g., change VERSION={vX.Y.Z} and VERSION={pr-XXXX} to
VERSION=<version> and VERSION=<pr-number>) so examples for the make
k8s/vald/deploy and make k8s/vald/delete commands are unambiguous.

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch from bbb3b5a to 5b9a150 Compare February 10, 2026 20:27
Matts966
Matts966 previously approved these changes Feb 11, 2026
Copy link
Member

@Matts966 Matts966 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding how to write option.go and update helm can help?
LGTM!

@kpango
Copy link
Collaborator Author

kpango commented Feb 11, 2026

Thats sounds great, can you add it to the GitHub issues?
Because it would be better to add AGENTS.md to Vald repository first, we can improve it after that.

Adding how to write option.go and update helm can help?

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch from 975b076 to 9b3d197 Compare February 11, 2026 14:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Around line 35-38: The nested bullets under list item "2. Cross-Language
Dependency:" are not indented, breaking the ordered list (MD029); fix by
indenting the two sub-bullets under "2." (the lines starting with "- Does a
change in Go `apis/proto`..." and "- Does a change in Rust `libs/`...") so they
are children of item 2 (e.g., add consistent two-space or four-space
indentation), preserving the ordered list numbering for subsequent items.

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch 2 times, most recently from 69f0894 to 556262b Compare February 11, 2026 15:03
@github-actions github-actions bot added size/XXL and removed size/XL labels Feb 16, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
internal/test/data/hdf5/hdf5.go (1)

183-189: ⚠️ Potential issue | 🟠 Major

Pre-existing bug: r is zero-length but indexed — guaranteed panic.

Not introduced by this PR, but worth noting: r is allocated with make([][]float32, 0), yet the loop writes to r[x][y]. This will panic on any non-empty neighbors slice. Additionally, inner slices are never allocated.

If this code path is ever exercised, it needs something like:

Proposed fix
 	case "neighbors":
 		l := d.GetNeighbors()
-		r := make([][]float32, 0)
-		for x := range l {
-			for y, z := range l[x] {
+		r := make([][]float32, len(l))
+		for x := range l {
+			r[x] = make([]float32, len(l[x]))
+			for y, z := range l[x] {
 				r[x][y] = float32(z)
 			}
 		}
hack/benchmark/src/singleflight/singleflight_bench_test.go (1)

207-208: ⚠️ Potential issue | 🟡 Minor

Pre-existing typo: singleflighsingleflight in CSV filenames.

Both varianceCSV and averageCSV are missing the trailing t. Since you're already in this function, might be worth fixing.

Proposed fix
-		varianceCSV = "vald_internal_singlefligh_variance.csv"
-		averageCSV  = "vald_internal_singlefligh_average.csv"
+		varianceCSV = "vald_internal_singleflight_variance.csv"
+		averageCSV  = "vald_internal_singleflight_average.csv"
pkg/agent/internal/kvs/kvs_test.go (1)

1790-1790: 🧹 Nitpick | 🔵 Trivial

Unimplemented tests for bidi.Close and getShardID remain.

These are still stubbed out below the // NOT IMPLEMENTED BELOW marker. Not a blocker for this mechanical refactor PR, but worth tracking.

Would you like me to open an issue to track implementing the Test_bidi_Close and Test_getShardID test cases?

pkg/agent/core/ngt/handler/grpc/index_test.go (1)

2558-2569: ⚠️ Potential issue | 🟡 Minor

IndexProperty test no longer verifies a non-nil detail value.

The current type comparison is tautological and will pass even when the detail value is nil. This weakens the assertion and can let regressions slip.

✅ Strengthen the assertion (non-nil + optional value check)
- if _, ok := gotRes.Details[name]; ok {
-   if gotType != wantType {
-     return errors.Errorf("got_type: \"%s\", want_type: \"%s\"", gotType, wantType)
-   }
- } else {
-   return errors.Errorf("do not exists key: %s", name)
- }
+ prop, ok := gotRes.Details[name]
+ if !ok || prop == nil {
+   return errors.Errorf("missing property for key: %s", name)
+ }
+ if wantProp := w.wantRes.Details[name]; wantProp != nil && !reflect.DeepEqual(prop, wantProp) {
+   return errors.Errorf("got: \"%#v\", want: \"%#v\"", prop, wantProp)
+ }
🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Line 46: Replace the ambiguous heading text "Use `internal/` Libraries As you
can:" with a clearer directive that conveys preference and examples; for the
existing phrase (the string "Use `internal/` Libraries As you can:"), change it
to something like "Prefer Vald's `internal/` packages over standard packages"
and include the explicit guidance that standard packages "log, errors, sync, or
strings" should be replaced with "github.com/vdaas/vald/internal/**" where
possible, ensuring the wording is concise and unambiguous.
- Around line 200-210: The list entry for `tests/v2/e2e` is missing a trailing
period causing inconsistency; update the markdown under "## 5. 🗺 Repository Map
& Dependency Graph" so the `tests/v2/e2e` bullet ends with a period (matching
the other entries) to maintain consistent punctuation and parsing by agents.

In `@hack/benchmark/core/benchmark/strategy/util.go`:
- Around line 52-53: The inner loops that build the `train` slices never execute
because `train` is created with length 0 (make(..., 0, ...)) and the code uses
`len(train)` in the loop condition; change the loop to iterate over the intended
number of items (use `cap(train)` or compute a `count :=
dataset.TrainSize()/bulkInsertCnt` and loop `for j := 0; j < count; j++`) so
training data is actually populated before calling `BulkInsert`; apply this fix
in both insertAndCreateIndex32 (the `train := make([][]float32, 0,
dataset.TrainSize()/bulkInsertCnt)` block) and insertAndCreateIndex64 (the
analogous `train := make([][]float32, 0, dataset.TrainSize()/bulkInsertCnt)`
block).

In `@hack/helm/schema/crd/main.go`:
- Around line 25-26: Remove the redundant standard library import alias strings0
("strings") and replace usages of strings0.Builder with Vald's internal wrapper
by importing and using internal/strings.Builder; update any occurrences
(including the other spots around the file noted) to reference the internal
Builder type instead of strings0 so the code uses the project's internal strings
implementation consistently.

In `@internal/db/storage/blob/s3/writer/writer.go`:
- Around line 116-121: The code incorrectly calls new() with string values
causing compilation errors; add a small shared helper func stringPtr(s string)
*string (e.g., in internal/db/storage/blob/s3/ptr.go) and update the S3 code to
use it: replace new(w.bucket), new(key), new(w.contentType) in the
s3manager.UploadInput construction in writer.go and replace new(r.bucket),
new(key), new("bytes=...") in the getObject method in reader.go with
stringPtr(...) so s3manager.UploadInput and the GetObject calls receive *string
correctly.

In `@internal/errors/errors_test.go`:
- Around line 1327-1332: In uncomparableErr.Error(), remove the stray space
before the method call so use str.WriteString(e.msg) and return the built string
directly by replacing return fmt.Sprint(str.String()) with return str.String();
update the same pattern if present in the companion production method (e.g., in
errors.go) to avoid the redundant fmt.Sprint wrapper and keep the formatting
clean.
- Around line 472-474: Replace the invalid compile-time use of
reflect.TypeFor[untyped nil]() in the test builder with runtime
reflect.TypeOf(nil) so the constructed wantErr matches
ErrInvalidTypeConversion's runtime-value signature (update the anonymous func
that sets wantErr accordingly); also fix the String() implementation on the
error type by removing the stray space in "str .WriteString(e.msg)" to
"str.WriteString(e.msg)" and return str.String() directly instead of wrapping it
in fmt.Sprint(str.String()).

In `@internal/k8s/client/client.go`:
- Around line 279-282: The code uses invalid Go syntax `new(true)` for boolean
pointer fields (e.g., in the Patch call where Force: new(true) and in rotator
where Controller: new(true)); add a small helper `boolPtr(v bool) *bool { return
&v }` (or reintroduce `k8s.io/utils/ptr` and use `ptr.To(true)`) and replace
every `new(true)` with `boolPtr(true)` (target symbols: s.client.Patch call
where Force is set, and the Controller field in the rotator code) so the boolean
pointer fields are constructed correctly and the code compiles.

In `@internal/k8s/vald/mirror/api/v1/target_types.go`:
- Line 47: The Status and its timestamp are being serialized even when unset,
producing zero-time values; update the JSON tags so unset timestamps (and
optionally Status) are omitted: add `omitempty` to the LastTransitionTime json
tag on the MirrorTargetStatus struct (and restore `omitempty` on the parent
Status field in the MirrorTarget type if you want to avoid serializing an empty
status object) so zero-value times are not emitted when controllers do not set
them.

In `@pkg/index/job/readreplica/rotate/service/rotator.go`:
- Line 213: The code incorrectly uses Go's new with a value (new(true)) which
won't compile; replace each occurrence (e.g., the Controller field in the struct
literal where Controller: new(true), and the second occurrence around line 261)
with ptr.To(true) and ensure the pointer utility package is imported (alias ptr
from "k8s.io/utils/pointer" or similar) so Controller receives a *bool via
ptr.To(true).

In `@rust/libs/algorithm/Cargo.toml`:
- Line 27: The Cargo.toml currently pins tonic to "0.14.4" which isn't
published; update the tonic dependency declaration (the line containing tonic =
"0.14.4") to either use the published crate version "0.14.3" or switch to a git
dependency referencing the hyperium/tonic repository and v0.14.4 tag (e.g.,
replace the version string with a git spec) and ensure the same change is
applied consistently across the workspace so builds resolve correctly.

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch from a501d8e to 3ba4874 Compare February 16, 2026 09:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
hack/benchmark/src/singleflight/singleflight_bench_test.go (1)

207-208: ⚠️ Potential issue | 🟡 Minor

Pre-existing typo: singleflighsingleflight in CSV filenames.

Both varianceCSV and averageCSV are missing the trailing t. Since you're already touching this function, worth fixing to avoid confusing output artifacts.

Proposed fix
-		varianceCSV = "vald_internal_singlefligh_variance.csv"
-		averageCSV  = "vald_internal_singlefligh_average.csv"
+		varianceCSV = "vald_internal_singleflight_variance.csv"
+		averageCSV  = "vald_internal_singleflight_average.csv"
hack/helm/schema/crd/main.go (1)

256-274: ⚠️ Potential issue | 🟠 Major

Use internal/strings consistently throughout the function for performance and Vald compliance.

Line 264 uses strings0.Builder while lines 265 and 271 use unqualified strings.Split and strings.TrimRight. Beyond the inconsistency, the function has two performance issues:

  1. Lines 257–261: Indent construction via += loop is O(n). Replace with strings.Repeat.
  2. Lines 270–273: Second branch still accumulates via result += inside a loop (O(n²)), while the first branch uses strings.Builder. Both branches must use strings.Builder for consistency and performance.

Since internal/strings is already imported and re-exports Builder, Repeat, Split, and TrimRight, refactor to use it throughout:

Suggested refactor
 func indent(text string, nindent int) string {
-	indent := ""
-
-	for range nindent {
-		indent += " "
-	}
+	indent := strings.Repeat(" ", nindent)
 
 	if text[len(text)-1:] == "\n" {
-		var result strings0.Builder
+		var result strings.Builder
 		for _, j := range strings.Split(text[:len(text)-1], "\n") {
 			result.WriteString(indent + j + "\n")
 		}
 		return result.String()
 	}
-	result := ""
+	var result strings.Builder
 	for _, j := range strings.Split(strings.TrimRight(text, "\n"), "\n") {
-		result += indent + j + "\n"
+		result.WriteString(indent + j + "\n")
 	}
-	return result[:len(result)-1]
+	s := result.String()
+	return s[:len(s)-1]
 }

This eliminates the confusing strings0 alias, makes both branches consistent, and aligns with Vald's requirement to use internal packages for common functionality.

.github/actions/scan-docker-image/action.yaml (1)

31-31: 🧹 Nitpick | 🔵 Trivial

Pre-existing: trivy-action@master is unpinned.

Not introduced by this PR, but aquasecurity/trivy-action@master on lines 31 and 39 lacks a SHA pin—unlike the codeql-action reference you just hardened. Consider pinning it to a specific commit hash in a follow-up for consistent supply-chain posture across this composite action.

internal/sync/singleflight/singleflight_test.go (1)

251-261: 🧹 Nitpick | 🔵 Trivial

Mixed wg.Go and manual Add/Done on the same WaitGroup is fragile.

The first goroutine uses wg.Go(func() { ... }) (line 251), while the second (lines 256–261) uses the manual wg.Add(1) / wg.Done() pattern on the same wg. This works if Go internally calls Add(1) before spawning, but mixing idioms on the same group is easy to miscount during future edits.

If the time.Sleep ordering is the reason for keeping the manual pattern, consider wrapping the sleep inside the wg.Go closure instead:

Suggested consolidation
-				wg.Go(func() {
+				wg.Go(func() {
 					got, gotShared, err = g.Do(a.ctx, a.key, fn1)
 				})
 
 				// call with the same key but with another function
-				wg.Add(1)
-				time.Sleep(time.Millisecond * 100)
-				go func() {
+				wg.Go(func() {
+					time.Sleep(time.Millisecond * 100)
 					got1, gotShared1, err1 = g.Do(a.ctx, a.key, fn2)
-					wg.Done()
-				}()
+				})
hack/benchmark/core/benchmark/strategy/util.go (1)

45-48: ⚠️ Potential issue | 🟡 Minor

Capacity of ids is inflated by a factor of bulkInsertCnt.

ids is allocated as make([]uint, 0, dataset.TrainSize()*bulkInsertCnt). With bulkInsertCnt = 1000, each iteration inserts TrainSize()/1000 elements, so the total across 1000 iterations is TrainSize(). The capacity should be dataset.TrainSize(), not dataset.TrainSize()*bulkInsertCnt. Same issue exists at line 80.

pkg/agent/core/ngt/handler/grpc/insert_test.go (2)

811-862: ⚠️ Potential issue | 🟡 Minor

Duplicate test case: "Boundary Value Testing case 4.2" appears twice.

Lines 759–810 and 811–862 define identical test cases with the same name, args, fields, and expected error. This means the same scenario runs twice, wasting cycles and masking what should be a distinct test (e.g., case 5 per the comment plan at line 117, which describes NaN testing as case 5 for float32). One of these should be removed or replaced with the intended distinct case.


2758-2773: ⚠️ Potential issue | 🔴 Critical

Bug: errors.Join return value is discarded — joindErr is always nil.

errors.Join returns a new error; it does not mutate its arguments. The result is never assigned back, so the wrapped status error always has a nil cause. This silently breaks error matching in tests that rely on genAlreadyExistsJoinedErr.

🐛 Proposed fix
 	genAlreadyExistsJoinedErr := func(uuids []string, req *payload.Insert_MultiRequest, name, ip string) error {
-		var joindErr error
+		var joinedErr error
 		for _, uuid := range uuids {
-			errors.Join(joindErr, errors.ErrUUIDAlreadyExists(uuid))
+			joinedErr = errors.Join(joinedErr, errors.ErrUUIDAlreadyExists(uuid))
 		}
 		return status.WrapWithAlreadyExists(fmt.Sprintf("MultiInsert API uuids %v already exists", uuids),
-			joindErr,
+			joinedErr,
 			&errdetails.RequestInfo{
🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Around line 169-175: The fenced code block under the "#### Level 1: Unit Tests
(Fast)" heading in AGENTS.md has an extra trailing blank line; edit that code
block (the one containing "make test" and "make test/rust") and remove the blank
line so the closing ``` directly follows the last command, ensuring the code
block has no trailing blank line.
- Around line 140-165: Remove the trailing empty line inside the fenced bash
code block under the "Deployment & Operations" section so the closing ```
immediately follows the last make command; locate the code block containing the
make commands (e.g., "make VERSION=<version> k8s/vald/deploy
HELM_VALUES=example/helm/values.yaml" and the example lines) and delete the
blank line before the final fence.

In `@internal/db/storage/blob/s3/reader/reader.go`:
- Around line 169-176: The code incorrectly uses new(...) with string
expressions (e.g., constructing rng and passing new(r.bucket), new(key)) which
doesn't compile; change these to create *string values using aws.String(...) (or
a local helper that returns *string) and use that for Range, Bucket, and Key
when calling r.service.GetObjectWithContext; update the rng variable creation
(used in log.Debugf and GetObjectInput.Range) and the Bucket/Key arguments to
use aws.String so GetObjectWithContext, r.bucket, and key are passed as *string
values.

In `@internal/sync/semaphore/semaphore_bench_test.go`:
- Around line 86-93: The benchmark currently discards the error returned by
sem.Acquire(context.Background(), size) which can mask failures and skew
results; modify the loop that calls sem.Acquire to capture its returned error
(from Acquire) and handle it by failing the benchmark on error (e.g., call
b.Fatal or b.Fatalf) so any Acquire failure aborts the benchmark; keep the
sem.Release(size) calls unchanged and continue using N and size as before.

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch 5 times, most recently from 98d96cf to 8d75adb Compare February 16, 2026 19:44
@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch 11 times, most recently from 6f45ffa to edfea50 Compare February 17, 2026 02:46
@CLAassistant
Copy link

CLAassistant commented Feb 18, 2026

CLA assistant check
All committers have signed the CLA.

@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch from a63879c to 6df12da Compare February 18, 2026 07:21
Signed-off-by: kpango <kpango@vdaas.org>
@kpango kpango force-pushed the doc/add-agents-md-9898591043237542042 branch from 6df12da to 78b051f Compare February 18, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments