You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Use `t.Setenv()` instead of `os.Setenv()` for better test isolation
40
40
- Avoid global state modifications in tests
41
41
42
+
### Global State Exceptions
43
+
44
+
While global state modifications should generally be avoided in tests, `slog` (structured logging) is an **accepted exception** in this project because:
45
+
46
+
1. Many functions throughout the codebase use the global `slog` for logging
47
+
2. Refactoring all functions to accept a logger parameter would be impractical
48
+
3. The save/restore pattern provides adequate test isolation
49
+
50
+
**When modifying slog in tests, you MUST use the save/restore pattern**:
This pattern ensures that global logger modifications don't affect other tests, even when running in parallel.
65
+
66
+
### Package-level Test Functions
67
+
68
+
In Go, test files within the same package share the same namespace. This means that helper functions defined in one test file (e.g., `main_flags_test.go`) are accessible from other test files in the same package (e.g., `main_platform_test.go`).
69
+
70
+
**DO NOT** report as missing when a test uses a helper function defined in another test file of the same package:
Copy file name to clipboardExpand all lines: CLAUDE.md
+23-11Lines changed: 23 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ spanner-mycli is a personal fork of spanner-cli, designed as an interactive comm
37
37
5.**Repository merge policy**: This repository enforces **squash merge only** via Repository Ruleset - AI assistants must use `squash` method for all automated merges
38
38
6.**PR merge process**: Before merging, if additional commits have been pushed since the initial review, request an updated summary by commenting `/gemini summary`. An initial summary is generated automatically, so this is only for updates. Then, use `go tool gh-helper reviews wait` (**DO NOT** use `--request-review`)
39
39
7.**Squash merge commits**: MUST include descriptive summary of PR changes in squash commit message
40
+
8.**GitHub comment editing**: NEVER use `gh pr comment --edit-last` - always specify the exact comment ID to avoid editing the wrong comment
40
41
41
42
## Essential Commands
42
43
@@ -162,26 +163,31 @@ This is a simplified guide. For detailed information, refer to:
162
163
1.**ALWAYS check**: [dev-docs/architecture-guide.md](dev-docs/architecture-guide.md) - Understand system architecture
163
164
2.**For system variables**: [dev-docs/patterns/system-variables.md](dev-docs/patterns/system-variables.md) - Implementation patterns
-`issues edit <issue> --after <other>` - Reorder sub-issue after another
179
185
-`issues edit <issue> --position first` - Move sub-issue to beginning
180
-
8.**Safe Issue/PR content handling**: ALWAYS use stdin or variables for Issue/PR creation/updates as they commonly contain code blocks with special characters (e.g., backticks, quotes, dollar signs, parentheses)
181
-
9.**GitHub GraphQL API**: [docs.github.com/en/graphql](https://docs.github.com/en/graphql) - Now only needed for:
182
-
- Complex custom field selections beyond gh-helper's output
183
-
- Advanced queries requiring specific field combinations
184
-
10.**Schema introspection**: Use `go tool github-schema` instead of GraphQL:
186
+
9.**Safe Issue/PR content handling**: ALWAYS use stdin or variables for Issue/PR creation/updates as they commonly contain code blocks with special characters (e.g., backticks, quotes, dollar signs, parentheses)
187
+
10.**GitHub GraphQL API**: [docs.github.com/en/graphql](https://docs.github.com/en/graphql) - Now only needed for:
188
+
- Complex custom field selections beyond gh-helper's output
189
+
- Advanced queries requiring specific field combinations
190
+
11.**Schema introspection**: Use `go tool github-schema` instead of GraphQL:
185
191
-`go tool github-schema type <TypeName>` - Show type fields and descriptions
186
192
-`go tool github-schema mutation <MutationName>` - Show mutation requirements
187
193
-`go tool github-schema search <pattern>` - Search for types/fields
0 commit comments