Skip to content

fix: graceful RC keys, JSON encode-error stream, and docs#87

Merged
peczenyj merged 2 commits into
develfrom
fix/v070-review-followups
May 29, 2026
Merged

fix: graceful RC keys, JSON encode-error stream, and docs#87
peczenyj merged 2 commits into
develfrom
fix/v070-review-followups

Conversation

@peczenyj
Copy link
Copy Markdown
Owner

Follow-ups from the v0.7.0 batch code review (PRs #63#74).

Changes

  • Important — graceful unknown RC keys (internal/app/app.go): .structalignrc keys that don't map to a flag are now skipped silently. This covers the documented "theme is not an RC key" exclusion and typos, which previously surfaced a confusing config: <key>: no such flag warning. A key that is a flag but gets a bad value still warns (e.g. threshold = garbage).
  • JSON encode-error stream (internal/ui/json.go): RenderJSON now returns its encode error instead of writing to the real os.Stderr (the Printer holds no stderr handle). app.Run reports it on the injected App.Stderr and exits 2.
  • Docs (README.md, AGENTS.md): new "JSON output" section documenting the two deliberate divergences from text mode — the diff document always carries the summary block (so machine consumers always get totals; -summary governs only the text trailing line), and the presentation flags (-diff/-summary/-verbose/-color/-width) are ignored in JSON.
  • Test tidy (internal/align/internal_test.go): replaced the unfinished readSource bounds comment with a deliberate note on why the remaining guards are intentionally uncovered.

Tests

  • New TestRunRCUnknownKeys covering the theme key, a typo'd key (both silent), and a bad value for a real flag (still warns).
  • RenderJSON callers updated to assert NoError.
  • Full task ci gate green (tidy, lint, go-consistent, build, test, smoke); golden fixtures unchanged.

Closes #86

🤖 Generated with Claude Code

peczenyj and others added 2 commits May 29, 2026 11:02
Follow-ups from the v0.7.0 batch code review:

- app: skip .structalignrc keys that don't map to a flag (the documented
  theme exclusion and typos) instead of warning "no such flag"; a real
  flag given a bad value still warns.
- ui: RenderJSON returns its encode error instead of writing to the real
  os.Stderr; app.Run reports it on App.Stderr and exits 2.
- docs: document that the JSON diff document always carries the summary
  block and that -format=json ignores the text presentation flags.
- test(align): replace the unfinished readSource bounds comment with a
  deliberate note on why the remaining guards are uncovered.

Closes #86

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add .bestpractices.json to the repository root containing all self-assertions and justifications for the project's security, quality, reporting, and licensing criteria. This allows the OpenSSF Best Practices portal to automatically parse and pre-populate the project's questionnaire, bypassing the need for manual form submission.
@peczenyj peczenyj force-pushed the fix/v070-review-followups branch from ad59394 to a6aa537 Compare May 29, 2026 09:03
@peczenyj peczenyj self-assigned this May 29, 2026
@peczenyj peczenyj merged commit b4040c5 into devel May 29, 2026
6 checks passed
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.

v0.7.0 review follow-ups: graceful RC keys, JSON stderr, docs

1 participant