Skip to content

chore: add stderr.write lint rule and document repo standards gaps#906

Merged
BYK merged 1 commit intomainfrom
enforce-standards
May 2, 2026
Merged

chore: add stderr.write lint rule and document repo standards gaps#906
BYK merged 1 commit intomainfrom
enforce-standards

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented May 2, 2026

Summary

Adds automated enforcement and documentation for patterns that fell through existing checks during PR #904 review.

Changes

Automated Enforcement

  • New GritQL rule (no-stderr-write-in-commands.grit): Bans stderr.write() in src/commands/**. Complements the existing no-stdout-write-in-commands.grit rule. Commands should use logger.withTag() for warnings and log.debug() for diagnostics.
  • Fix existing violation in issue/merge.ts: The --into preference warning now uses log.warn() instead of this.stderr.write().

Documentation (AGENTS.md)

Four new sections addressing gaps identified during PR #904 review:

  1. Catch Block Logging — Prohibits silent catch blocks in production code. Every catch must re-throw, log with log.debug()/log.warn(), or include a fallback with logging.

  2. Command File Structure — Commands should focus on arg parsing, API orchestration, and output dispatch. Extract formatting into src/lib/formatters/<domain>.ts when files exceed ~400 lines.

  3. Adding New Utility Files — Lookup table of existing shared modules to check before creating new utility files (duration formatting, hex ID validation, pagination, etc.). Prevents accidental duplication.

  4. Project Filtering in API Calls — Documents that different API endpoints use different project filtering mechanisms (buildProjectQuery vs projectSlugs vs project parameter). Prevents double-filtering bugs.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-906/

Built to branch gh-pages at 2026-05-02 08:14 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Codecov Results 📊

6660 passed | Total: 6660 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 13517 uncovered lines.
✅ Project coverage is 76.61%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    76.61%    76.61%        —%
==========================================
  Files          303       303         —
  Lines        57796     57794        -2
  Branches         0         0         —
==========================================
+ Hits         44276     44277        +1
- Misses       13520     13517        -3
- Partials         0         0         —

Generated by Codecov Action

- New GritQL rule: no-stderr-write-in-commands.grit bans stderr.write()
  in command files (complements existing stdout.write rule). Commands
  should use logger.withTag() for warnings and diagnostics.
- Fix one existing violation in issue/merge.ts (--into warning).
- AGENTS.md: add sections for catch block logging, command file
  structure (~400 line threshold), new utility file checklist,
  and project filtering in API calls.
@BYK BYK force-pushed the enforce-standards branch from 359a83b to 517400f Compare May 2, 2026 08:13
@BYK BYK merged commit fd98f9f into main May 2, 2026
26 checks passed
@BYK BYK deleted the enforce-standards branch May 2, 2026 08:21
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