Skip to main content

fix-bug

Use when diagnosing and fixing a bug in the Brainrot interpreter — crashes, wrong output, memory errors (ASan/UBSan/Valgrind), or a failing test_cases fixture. Covers root-causing across the lexer/parser/AST/semantic-analyzer/interpreter pipeline.

소스 정보

저장소
Brainrotlang/brainrot
최근 소스 활동
2026년 8월 17일 23:13
감지된 SKILL.md 언어
영어
스타
629
포크
48

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
fix-bug
description
Use when diagnosing and fixing a bug in the Brainrot interpreter — crashes, wrong output, memory errors (ASan/UBSan/Valgrind), or a failing test_cases fixture. Covers root-causing across the lexer/parser/AST/semantic-analyzer/interpreter pipeline.
## When to Use The user reports incorrect output, a crash, a compiler warning, a sanitizer error, a Valgrind leak, or a failing pytest case for a `.brainrot` program. ## Step-by-Step Instructions 1. **Reproduce minimally.** Write or reduce a `.brainrot` snippet that triggers the bug; run it directly: `./brainrot repro.brainrot`. Compare against a `git stash`-clean build if unsure whether it's a regression. 2. **Reproduce under sanitizers/Valgrind first** if the symptom is a crash/garbage output — the project's `CFLAGS` already build with `-fsanitize=address,undefined`, so a plain `make && ./brainrot repro.brainrot` often surfaces the exact line. For leaks specifically, use `valgrind --leak-check=full --track-origins=yes ./brainrot repro.brainrot`. 3. **Locate the layer**: use the error/stack trace to figure out whether the bug is in lexing (`lang.l`), grammar (`lang.y`), AST construction (`ast.c`), semantic checks (`semantic_analyzer.c`), or execution (`interpreter.c`/`visitor.c`/`stdrot/*.c`). Add `fprintf(stderr, ...)` trace points if the sanitizer trace isn't enough — don't leave them in the fix. 4. **Fix at the root cause**, not the symptom. Check `TRUTH.md`-adjacent history: `git log -p -- <file>` for the surrounding function to see if this area has had prior memory-safety fixes (it has — see commit `254f89b "fix: multiple memory safety bugs..."` for the pattern to follow: ownership/lifetime bugs around `String`/pointer handling). 5. **Add a regression test**: put the reducing fixture in `test_cases/` (name it for the bug, e.g. `division_by_zero.brainrot` style) and add its correct expected output to `tests/expected_results.json` so it can't regress silently. 6. **Verify the full suite still passes**: `make test && make valgrind`. Fixing one bug must not reintroduce another — the whole point of these two gates. Also run `make format-check` — CI's `lint` job blocks on any diff. 7. **Open the PR using `.github/PULL_REQUEST_TEMPLATE.md`**: fill in every section (Description, Related Issue, Type of Change, Checklist) — don't submit a bare description. ## Conventions and Best Practices - Prefer the smallest correct fix; don't refactor unrelated code in a bug-fix change. - If the bug is a missing NULL-check/bounds-check, check whether the same pattern exists elsewhere in the same file (semantic analyzer and interpreter both walk the same AST shape) — sanitizer bugs here tend to be systemic, not one-off. Mention it to the user if you spot more of the same class you didn't fix. - Never suppress a warning or sanitizer error by adding a cast, disabling a flag, or wrapping in an ignore — fix the underlying issue (see [AGENTS.md](../../../AGENTS.md) boundaries). ## Important Notes - `-Werror` means any new compiler warning is a build failure — treat it as part of the bug, not noise to silence. - If the bug can't be reproduced, say so explicitly and ask for a minimal `.brainrot` repro rather than guessing at a fix.
GitHub에서 보기