Skip to content

Commit fe79838

Browse files
committed
Merge branch 'update-dependencies-2025-08-14' into 'master'
chore: update dependencies to fix security issues See merge request postgres-ai/database-lab!1050
2 parents dd63115 + 1f67fc0 commit fe79838

File tree

7 files changed

+1743
-538
lines changed

7 files changed

+1743
-538
lines changed

CLAUDE.md

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5+
## Architecture Overview
6+
### Core Components
7+
1. **Backend code** (`engine/`)
8+
1.1. **Entry Points** (`cmd/`)
9+
2. **Frontend code** (`ui/`)
10+
511
## Build/Test/Lint Commands
612
- Build all components: `cd engine && make build`
713
- Lint code: `cd engine && make lint`
@@ -20,4 +26,123 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
2026
- Follow standard Go import ordering
2127
- Group similar functions together
2228
- Error messages should be descriptive and actionable
23-
- UI uses pnpm for package management
29+
- UI uses pnpm for package management
30+
31+
## Important Backend Workflow Notes
32+
33+
- Always run tests, linter and normalize comments BEFORE committing anything
34+
- Run formatting, code generation, linting and testing on completion
35+
- Never commit without running completion sequence
36+
- Run tests and linter after making significant changes to verify functionality
37+
- IMPORTANT: Never put into commit message any mention of Claude or Claude Code
38+
- IMPORTANT: Never include "Test plan" sections in PR descriptions
39+
- Do not add comments that describe changes, progress, or historical modifications
40+
- Comments should only describe the current state and purpose of the code, not its history or evolution
41+
- After important functionality added, update README.md accordingly
42+
- When merging master changes to an active branch, make sure both branches are pulled and up to date first
43+
- Don't leave commented out code in place
44+
- Avoid multi-level nesting
45+
- Avoid multi-level ifs, never use else if
46+
- Never use goto
47+
- Avoid else branches if possible
48+
- Write tests in compact form by fitting struct fields to a single line (up to 130 characters)
49+
- Before any significant refactoring, ensure all tests pass and consider creating a new branch
50+
- When refactoring, editing, or fixing failed tests:
51+
- Do not redesign fundamental parts of the code architecture
52+
- If unable to fix an issue with the current approach, report the problem and ask for guidance
53+
- Focus on minimal changes to address the specific issue at hand
54+
- Preserve the existing patterns and conventions of the codebase
55+
56+
## Backend Code Style Guidelines
57+
58+
### Import Organization
59+
- Organize imports in the following order:
60+
1. Standard library packages first (e.g., "fmt", "context")
61+
2. A blank line separator
62+
3. Third-party packages
63+
4. A blank line separator
64+
5. Project imports (e.g., "gitlab.com/postgres-ai/database-lab/v3/pkg/*")
65+
- Example:
66+
```go
67+
import (
68+
"context"
69+
"fmt"
70+
"net/http"
71+
72+
"github.com/docker/docker/api/types"
73+
"github.com/gorilla/mux"
74+
75+
"gitlab.com/postgres-ai/database-lab/v3/pkg/util/branching"
76+
)
77+
```
78+
79+
### Error Handling
80+
- Return errors to the caller rather than using panics
81+
- Use descriptive error messages that help with debugging
82+
- Use error wrapping: `fmt.Errorf("failed to process request: %w", err)`
83+
- Check errors immediately after function calls
84+
- Return early when possible to avoid deep nesting
85+
86+
### Variable Naming
87+
- Use descriptive camelCase names for variables and functions
88+
- Good: `notFoundHandler`, `requestContext`, `userID`
89+
- Bad: `not_found_handler`, `x`, `temp1`
90+
- Be consistent with abbreviations (e.g., `httpClient` not `HTTPClient`)
91+
- Local scope variables can be short (e.g., "lmt" instead of "orderLimit")
92+
- Use constants for magic numbers and strings
93+
- Use meaningful names for constants and enums
94+
95+
### Function Parameters
96+
- Group related parameters together logically
97+
- Use descriptive parameter names that indicate their purpose
98+
- Consider using parameter structs for functions with many (4+) parameters
99+
- If function returns 3 or more results, consider wrapping in Result/Response struct
100+
- If function accepts 3 or more input parameters, consider wrapping in Request/Input struct (but never add context to struct)
101+
102+
### Documentation
103+
- All exported functions, types, and methods must have clear godoc comments
104+
- Begin comments with the name of the element being documented
105+
- Include usage examples for complex functions
106+
- Document any non-obvious behavior or edge cases
107+
- All comments should be lowercase, except for godoc public functions and methods
108+
- IMPORTANT: all comments except godoc comments must be lowercase, test messages must be lowercase, log messages must be lowercase
109+
110+
### Code Structure
111+
- Keep code modular with focused responsibilities
112+
- Limit file sizes to 300-500 lines when possible
113+
- Group related functionality in the same package
114+
- Use interfaces to define behavior and enable mocking for tests
115+
- Keep code minimal and avoid unnecessary complexity
116+
- Don't keep old functions for imaginary compatibility
117+
- Interfaces should be defined on the consumer side (idiomatic Go)
118+
- Aim to pass interfaces but return concrete types when possible
119+
- Consider nested functions when they simplify complex functions
120+
121+
### Code Layout
122+
- Keep cyclomatic complexity under 30
123+
- Function size preferences:
124+
- Aim for functions around 50-60 lines when possible
125+
- Don't break down functions too small as it can reduce readability
126+
- Maintain focus on a single responsibility per function
127+
- Keep lines under 130 characters when possible
128+
- Avoid if-else chains and nested conditionals:
129+
- Never use long if-else-if chains; use switch statements instead
130+
- Prefer early returns to reduce nesting depth
131+
- Extract complex conditions into separate boolean functions or variables
132+
- Use context structs or functional options instead of multiple boolean flags
133+
134+
### Testing
135+
- Write thorough tests with descriptive names (e.g., `TestRouter_HandlesMiddlewareCorrectly`)
136+
- Prefer subtests or table-based tests, using Testify
137+
- Use table-driven tests for testing multiple cases with the same logic
138+
- Test both success and error scenarios
139+
- Mock external dependencies to ensure unit tests are isolated and fast
140+
- Aim for at least 80% code coverage
141+
- Keep tests compact but readable
142+
- If test has too many subtests, consider splitting it to multiple tests
143+
- Never disable tests without a good reason and approval
144+
- Important: Never update code with special conditions to just pass tests
145+
- Don't create new test files if one already exists matching the source file name
146+
- Add new tests to existing test files following the same naming and structuring conventions
147+
- Don't add comments before subtests, t.Run("description") already communicates what test case is doing
148+
- Never use godoc-style comments for test functions

engine/go.mod

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module gitlab.com/postgres-ai/database-lab/v3
22

3-
go 1.23
3+
go 1.23.12
44

55
require (
66
github.com/AlekSi/pointer v1.2.0
@@ -12,13 +12,13 @@ require (
1212
github.com/docker/go-connections v0.4.0
1313
github.com/docker/go-units v0.5.0
1414
github.com/dustin/go-humanize v1.0.1
15-
github.com/golang-jwt/jwt/v4 v4.5.0
15+
github.com/golang-jwt/jwt/v4 v4.5.2
1616
github.com/google/go-github/v34 v34.0.0
17-
github.com/google/uuid v1.3.0
17+
github.com/google/uuid v1.6.0
1818
github.com/gorilla/mux v1.8.0
1919
github.com/gorilla/websocket v1.5.0
2020
github.com/jackc/pgtype v1.14.0
21-
github.com/jackc/pgx/v4 v4.18.1
21+
github.com/jackc/pgx/v4 v4.18.2
2222
github.com/lib/pq v1.10.9
2323
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
2424
github.com/pkg/errors v0.9.1
@@ -31,47 +31,48 @@ require (
3131
github.com/testcontainers/testcontainers-go v0.12.0
3232
github.com/urfave/cli/v2 v2.25.7
3333
github.com/wagslane/go-password-validator v0.3.0
34-
golang.org/x/crypto v0.14.0
35-
golang.org/x/mod v0.12.0
36-
golang.org/x/oauth2 v0.10.0
34+
golang.org/x/crypto v0.41.0
35+
golang.org/x/mod v0.26.0
36+
golang.org/x/oauth2 v0.30.0
3737
gopkg.in/yaml.v2 v2.4.0
3838
gopkg.in/yaml.v3 v3.0.1
3939
)
4040

4141
require (
42+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
4243
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
43-
github.com/Microsoft/go-winio v0.6.1 // indirect
44+
github.com/Microsoft/go-winio v0.6.2 // indirect
4445
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
45-
github.com/containerd/containerd v1.7.2 // indirect
46+
github.com/containerd/containerd v1.7.28 // indirect
4647
github.com/containerd/log v0.1.0 // indirect
4748
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
48-
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
4949
github.com/davecgh/go-spew v1.1.1 // indirect
5050
github.com/distribution/reference v0.6.0 // indirect
5151
github.com/felixge/httpsnoop v1.0.4 // indirect
5252
github.com/go-logr/logr v1.4.2 // indirect
5353
github.com/go-logr/stdr v1.2.2 // indirect
5454
github.com/go-ole/go-ole v1.2.6 // indirect
5555
github.com/gogo/protobuf v1.3.2 // indirect
56-
github.com/golang/protobuf v1.5.3 // indirect
56+
github.com/google/go-cmp v0.7.0 // indirect
5757
github.com/google/go-querystring v1.1.0 // indirect
5858
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
59-
github.com/jackc/pgconn v1.14.1 // indirect
59+
github.com/jackc/pgconn v1.14.3 // indirect
6060
github.com/jackc/pgio v1.0.0 // indirect
6161
github.com/jackc/pgpassfile v1.0.0 // indirect
62-
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
62+
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
6363
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
6464
github.com/jmespath/go-jmespath v0.4.0 // indirect
65-
github.com/klauspost/compress v1.16.7 // indirect
65+
github.com/klauspost/compress v1.18.0 // indirect
6666
github.com/kr/pretty v0.3.1 // indirect
6767
github.com/magiconair/properties v1.8.5 // indirect
68-
github.com/moby/patternmatcher v0.5.0 // indirect
69-
github.com/moby/sys/sequential v0.5.0 // indirect
70-
github.com/moby/sys/user v0.3.0 // indirect
68+
github.com/moby/patternmatcher v0.6.0 // indirect
69+
github.com/moby/sys/sequential v0.6.0 // indirect
70+
github.com/moby/sys/user v0.4.0 // indirect
71+
github.com/moby/sys/userns v0.1.0 // indirect
7172
github.com/moby/term v0.5.0 // indirect
7273
github.com/morikuni/aec v1.0.0 // indirect
7374
github.com/opencontainers/go-digest v1.0.0 // indirect
74-
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
75+
github.com/opencontainers/image-spec v1.1.0 // indirect
7576
github.com/pmezard/go-difflib v1.0.0 // indirect
7677
github.com/rogpeppe/go-internal v1.10.0 // indirect
7778
github.com/russross/blackfriday/v2 v2.1.0 // indirect
@@ -83,17 +84,13 @@ require (
8384
github.com/yusufpapurcu/wmi v1.2.3 // indirect
8485
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
8586
go.opentelemetry.io/otel v1.30.0 // indirect
86-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.18.0 // indirect
8787
go.opentelemetry.io/otel/metric v1.30.0 // indirect
88-
go.opentelemetry.io/otel/sdk v1.18.0 // indirect
8988
go.opentelemetry.io/otel/trace v1.30.0 // indirect
90-
golang.org/x/net v0.17.0 // indirect
91-
golang.org/x/sys v0.13.0 // indirect
92-
golang.org/x/text v0.13.0 // indirect
93-
golang.org/x/tools v0.11.0 // indirect
94-
google.golang.org/appengine v1.6.7 // indirect
95-
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
96-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
97-
google.golang.org/protobuf v1.31.0 // indirect
89+
golang.org/x/net v0.42.0 // indirect
90+
golang.org/x/sys v0.35.0 // indirect
91+
golang.org/x/text v0.28.0 // indirect
92+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
93+
google.golang.org/grpc v1.67.0 // indirect
9894
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
95+
gotest.tools/v3 v3.5.2 // indirect
9996
)

0 commit comments

Comments
 (0)