Skip to content

feat: corpus-back golang practice loader + 3 P0 concurrency/error practices#88

Merged
KailasMahavarkar merged 4 commits intomainfrom
feat/corpus-golang-practices
Apr 21, 2026
Merged

feat: corpus-back golang practice loader + 3 P0 concurrency/error practices#88
KailasMahavarkar merged 4 commits intomainfrom
feat/corpus-golang-practices

Conversation

@KailasMahavarkar
Copy link
Copy Markdown
Collaborator

Summary

  • Adds corpus support to src/plugins/golang/tools/get-practice.ts with a generic per-practice loader (validates name/topic/priority/rule/reason) that falls back to the in-file BEST_PRACTICES registry when the slice is missing
  • Creates the backend.golang corpus namespace (first backend domain)
  • Adds 3 corpus-backed practice slices: error-wrapping, goroutine-lifecycle, context-first-param
  • Registers backend.golang in corpus/index.yaml
  • New tests/golang-practice-corpus-backed-tools-behaviour.test.ts asserts corpus source for every migrated practice

Test plan

  • bun test tests/golang-practice-corpus-backed-tools-behaviour.test.ts - 4 pass
  • bun run build - typecheck exit 0

KailasMahavarkar and others added 4 commits April 22, 2026 02:35
Adds corpus support to `src/plugins/golang/tools/get-practice.ts`. Tool now reads per-practice slices from `corpus/backend/golang/<name>.yaml`, validates required fields (topic, priority, rule, reason), and falls back to the in-file BEST_PRACTICES registry when the corpus entry is missing or invalid.

Creates the golang corpus namespace (first backend domain):
- `corpus/backend/golang/index.yaml` registers the `backend.golang` namespace and practice files
- `corpus/backend/golang/error-wrapping.yaml` captures the P0 error-wrapping practice (fmt.Errorf with %w, good/bad examples)
- `corpus/index.yaml` registers the new namespace

New `tests/golang-practice-corpus-backed-tools-behaviour.test.ts` asserts corpus source for error-wrapping and fallback for goroutine-lifecycle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds corpus/backend/golang/goroutine-lifecycle.yaml with ctx.Done() exit pattern and unbounded jobCh anti-pattern.
Registers goroutine-lifecycle in namespace index.
Test asserts corpus source for goroutine-lifecycle; fallback check moves to context-first-param.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds corpus/backend/golang/context-first-param.yaml with ctx.Context first-param rule, good/bad signatures.
Registers context-first-param in namespace index.
Test asserts corpus source for context-first-param; fallback check moves to handle-once.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@KailasMahavarkar KailasMahavarkar merged commit 5758af1 into main Apr 21, 2026
4 checks passed
@KailasMahavarkar KailasMahavarkar deleted the feat/corpus-golang-practices branch April 21, 2026 21:09
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