Skip to content

fix: correct scanner violation positions and suppress stderr in JSON mode#189

Closed
rhuanbarreto wants to merge 6 commits intomainfrom
fix/scanner-positions
Closed

fix: correct scanner violation positions and suppress stderr in JSON mode#189
rhuanbarreto wants to merge 6 commits intomainfrom
fix/scanner-positions

Conversation

@rhuanbarreto
Copy link
Copy Markdown
Contributor

@rhuanbarreto rhuanbarreto commented Apr 4, 2026

Summary

  • Position remapping: Bun.Transpiler strips comments, type annotations, and trailing commas, which shifted AST node positions in the transpiled output. Replaced node.loc with string-search remapping (source-positions.ts) that finds violations in the original TypeScript source by occurrence, skipping matches inside comments and string literals.
  • Suppress stderr noise: Removed logError() in loader that printed scanner violations to stderr unconditionally — violations now flow only through the result pipeline.
  • Stdin hang fix: check.ts now races Bun.stdin.text() against a 100ms timeout so the CLI doesn't block when spawned by editors or in pipe chains with no stdin.
  • CI fix: Removed self-referencing archgate proto plugin from .prototools.

Test plan

  • 39 new tests across 3 files covering position remapping, adversarial edge cases (patterns in comments/strings), and source-positions unit tests
  • Smoke tests pass on both Linux and Windows
  • CI commitlint passes with updated PR title

🤖 Generated with Claude Code

rhuanbarreto and others added 5 commits March 23, 2026 20:08
…mode

- Remove logError in loader that printed scanner violations to stderr
  unconditionally — violations now flow only through the result pipeline
- Fix wrong line/column in scanner violations: Bun.Transpiler strips
  comments and types which shifted AST positions. Added string-search
  remapping that finds violations in the original source by occurrence
- Skip matches in comments and string literals when remapping positions
  so patterns like "// Don't use Bun.spawn" don't confuse the mapping
- Fix stdin hang in check command when spawned by editors or in pipes
  by racing Bun.stdin.text() against a 100ms timeout
- Suppress git credential prompts in test preload via GIT_TERMINAL_PROMPT,
  GCM_INTERACTIVE, and GIT_ASKPASS environment variables
- Add 39 new tests for position remapping and adversarial edge cases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CLI repo IS archgate — having it as a proto plugin creates a circular
dependency where CI tries to install archgate to build archgate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 4, 2026

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: ca3847e
Status: ✅  Deploy successful!
Preview URL: https://e262cc01.archgate-cli.pages.dev
Branch Preview URL: https://fix-scanner-positions.archgate-cli.pages.dev

View logs

@rhuanbarreto rhuanbarreto changed the title Fix/scanner positions fix: correct scanner violation positions and suppress stderr in JSON mode Apr 4, 2026
@rhuanbarreto
Copy link
Copy Markdown
Contributor Author

Closing — the core fix was already merged to main via #155. This branch is stale and behind main.

@rhuanbarreto rhuanbarreto deleted the fix/scanner-positions branch April 4, 2026 09:32
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