Skip to content

fix(agentconfig): distinguish IsNotExist from other errors + chore(aep): remove dead code#99

Merged
hrygo merged 1 commit intohrygo:mainfrom
aaronwong1989:fix/combined-architecture-improvements
May 1, 2026
Merged

fix(agentconfig): distinguish IsNotExist from other errors + chore(aep): remove dead code#99
hrygo merged 1 commit intohrygo:mainfrom
aaronwong1989:fix/combined-architecture-improvements

Conversation

@aaronwong1989
Copy link
Copy Markdown
Contributor

Summary

This PR implements two architecture improvements from the selected issues:

  1. fix(agentconfig): readFile error handling (fix(agentconfig): readFile swallows all os.ReadFile errors including permission denied #80)

    • Modified readFile to return (string, error) instead of string
    • Properly distinguishes between IsNotExist errors (silent skip) and other errors like permission denied (propagate to caller)
    • Updated loadFile and Load to handle errors via new loadFileWithErrorCount helper
    • Added test case TestLoad_PermissionError to verify error propagation
  2. chore(aep): remove dead EncodeChunk function (chore(aep): remove dead EncodeChunk function #75)

    • Removed EncodeChunk function (duplicate of Encode)
    • Removed test cases TestEncodeChunk and TestEncodeChunk_NDJSONSafe
    • The function was only used in tests and provided no value

Verified Already Implemented

The following issues were verified as already implemented in the codebase:

Skipped

Test Plan

  • All existing tests pass (make test)
  • Linting passes (make lint)
  • Formatting passes (make fmt)
  • New test case added for permission error handling
  • Quality checks pass (make quality)

Architecture Impact

  • agentconfig: Improved error visibility and debugging capability
  • aep: Reduced code surface by removing unused function

Related Issues

Closes #80 (partially - error handling only)
Closes #75

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Modified readFile to return (string, error) instead of string, properly
distinguishing between IsNotExist errors (silent skip) and other errors
like permission denied (propagate to caller). Updated loadFile and Load
to handle errors via new loadFileWithErrorCount helper. Added test case
TestLoad_PermissionError to verify error propagation.

chore(aep): remove dead EncodeChunk function

Removed EncodeChunk function and its test cases (TestEncodeChunk,
TestEncodeChunk_NDJSONSafe). The function was only used in tests and
provided no value over the existing Encode function.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

❌ Patch coverage is 67.56757% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.54%. Comparing base (53f7fdd) to head (bfa83c0).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
internal/agentconfig/loader.go 67.56% 7 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
- Coverage   59.58%   59.54%   -0.04%     
==========================================
  Files         134      134              
  Lines       15969    15979      +10     
==========================================
  Hits         9515     9515              
- Misses       5860     5867       +7     
- Partials      594      597       +3     
Flag Coverage Δ
unittests 59.54% <67.56%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hrygo hrygo merged commit 53eb3a1 into hrygo:main May 1, 2026
9 checks passed
@aaronwong1989 aaronwong1989 deleted the fix/combined-architecture-improvements branch May 1, 2026 13:08
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.

fix(agentconfig): readFile swallows all os.ReadFile errors including permission denied chore(aep): remove dead EncodeChunk function

2 participants