Cleanup: extract helpers, reduce duplication, restore idiomatic patterns
- Extract `formatSourceCodeFrame` helper in format-issue.ts to deduplicate
code-frame rendering between primary and additional sources
- Extract `SourcePosition` type in types.ts to replace inline position objects
- Improve comments and simplify `extractErrorBlock` in test file
- Inline `source_ref()`/`with_source()` into `to_generated_code_source()`
since they had no other callers
- Restore `bail!` macro usage instead of `Err(anyhow!(...))` in Rust files
- Fix `bail!(format!(...))` → `bail!(...)` and typo "need" → "needs"