Skip to content

Zero Panic Policy: eliminate all panic() examples and close bootstrap exception loophole #277

@gandalf-at-lerian

Description

@gandalf-at-lerian

Problem

Ring standards contain 13 occurrences of panic() used as positive examples (✅ or unmarked) across 7 files. Agents copy these patterns and generate Must* helpers with panic() in business code — even though the rules explicitly forbid it.

The root cause: code examples contradict the rules. Agents prioritize concrete examples over abstract rules.

Reported by: @alexgarzao (thread)

Affected files

Standards with panic examples (bootstrap)

  • dev-team/docs/standards/golang/bootstrap.md — lines 371, 671
  • dev-team/docs/standards/golang/core.md — lines 396, 402
  • dev-team/docs/standards/golang/security.md — lines 103, 375
  • dev-team/docs/standards/sre.md — line 307
  • platforms/opencode/standards/sre.md — line 307
  • pm-team/skills/shared-patterns/code-example-standards.md — line 110

quality.md — example marked as ✅ REQUIRED

  • dev-team/docs/standards/golang/quality.md — line 95

logger.Fatalf (equivalent — calls os.Exit)

  • dev-team/docs/standards/golang/multi-tenant.md — line 2064

Proposal

Full proposal with before/after diffs for all 14 files (~50 edits):
https://alfarrabio.lerian.net/ring-zero-panic-proposal.md

Summary of changes (6 blocks)

  1. Replace all 13 panic() examples → return error (7 standard files)
  2. Rewrite panic detection table in domain.md (close the "main/init is ok" loophole)
  3. Expand anti-rationalization + pressure resistance tables in backend-engineer-golang.md
  4. Update CLAUDE.md with Zero Panic Policy
  5. Add post-generation self-check to dev-implementation and dev-cycle
  6. Update qa-analyst.md (fuzz checks)

Zero Panic Policy (tl;dr)

  • panic() is FORBIDDEN everywhere — including main, init, and bootstrap
  • Must* helpers that panic are FORBIDDEN — return (T, error) instead
  • log.Fatal() is FORBIDDEN — return error and let the caller decide
  • regexp.MustCompile() is the ONLY exception (compile-time constant)

cc @jeffersonRodrigues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions