Skip to content

docs(gopilot): resolve self-contradiction in error-handling section - #21

Merged
gonzaloserrano merged 1 commit into
mainfrom
gsr/fix-err-handling
May 7, 2026
Merged

gonzaloserrano merged 1 commit into
mainfrom
gsr/fix-err-handling

Conversation

@gonzaloserrano

Copy link
Copy Markdown
Owner

The "Wrap with context" guidance and the "Handle Errors Once" section disagreed:

  • "Wrap with context" said use low-cardinality strings AND showed a Good example with slog.ErrorContext(...) at the wrap site followed by return fmt.Errorf(...). That's exactly the "log AND return" pattern the next section labels Bad.
  • "Handle Errors Once"'s Good example used fmt.Errorf("connect to %s", addr, err) — a high-cardinality wrap, contradicting the previous rule.

Real Go code is mostly intermediate (wrap-and-return), not boundary code. Mixing boundary-level logging into wrap-site advice is what created the contradiction. Resolution:

  1. Wrap sites only wrap (low-cardinality).
  2. Variable data (IDs, names, paths) is logged once at the application boundary — HTTP middleware, gRPC interceptor, top-level main — from ctx-scoped fields or from a single structured slog.Error call.
  3. Caveat acknowledging the rule presumes a boundary that surfaces variable data structurally; if it doesn't, embedding the variable in the wrap is the lesser evil. Treat low-cardinality as an optimization, not a correctness rule.

Bump to 1.0.34.

The "Wrap with context" guidance and the "Handle Errors Once" section
disagreed:

- "Wrap with context" said use low-cardinality strings AND showed a
  Good example with slog.ErrorContext(...) at the wrap site followed by
  return fmt.Errorf(...). That's exactly the "log AND return" pattern
  the next section labels Bad.
- "Handle Errors Once"'s Good example used fmt.Errorf("connect to %s",
  addr, err) — a high-cardinality wrap, contradicting the previous rule.

Real Go code is mostly intermediate (wrap-and-return), not boundary
code. Mixing boundary-level logging into wrap-site advice is what
created the contradiction. Resolution:

1. Wrap sites only wrap (low-cardinality).
2. Variable data (IDs, names, paths) is logged once at the application
   boundary — HTTP middleware, gRPC interceptor, top-level main —
   from ctx-scoped fields or from a single structured slog.Error call.
3. Caveat acknowledging the rule presumes a boundary that surfaces
   variable data structurally; if it doesn't, embedding the variable
   in the wrap is the lesser evil. Treat low-cardinality as an
   optimization, not a correctness rule.

Bump to 1.0.34.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".claude-plugin/plugin.json">

<violation number="1" location=".claude-plugin/plugin.json:3">
P2: Version bump is incomplete: `plugin.json` is `1.0.34` but marketplace manifest versions remain `1.0.33`, which can cause mismatched published/update metadata.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

{
"name": "gopilot",
"version": "1.0.33",
"version": "1.0.34",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Version bump is incomplete: plugin.json is 1.0.34 but marketplace manifest versions remain 1.0.33, which can cause mismatched published/update metadata.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .claude-plugin/plugin.json, line 3:

<comment>Version bump is incomplete: `plugin.json` is `1.0.34` but marketplace manifest versions remain `1.0.33`, which can cause mismatched published/update metadata.</comment>

<file context>
@@ -1,6 +1,6 @@
 {
   "name": "gopilot",
-  "version": "1.0.33",
+  "version": "1.0.34",
   "description": "gopilot is your Go copilot - a skill for writing idiomatic Go code, covering design patterns, error handling, testing, concurrency, generics, and stdlib patterns up to Go 1.26.",
   "author": {
</file context>

@gonzaloserrano
gonzaloserrano merged commit 5754f18 into main May 7, 2026
2 checks passed
@gonzaloserrano
gonzaloserrano deleted the gsr/fix-err-handling branch May 7, 2026 15:25
gonzaloserrano added a commit that referenced this pull request May 7, 2026
…ce.json (#22)

Manual edits to plugin.json bypassed make bump and left marketplace.json
behind, producing inconsistent published metadata (caught in PR #21 review).

- Add check-version-sync target as a prerequisite of bump; aborts with a
  diff dump if the three version fields drift.
- Fix CLAUDE.md: bump script doesn't touch SKILL.md frontmatters; warn
  against editing version fields by hand.
- Bump to 1.0.35.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant