Skip to content

refactor(store): share the codec line reader and drop the test-only settings clear - #73

Closed
ewanc26 wants to merge 3 commits into
mainfrom
refactor/store-duplication
Closed

ewanc26 wants to merge 3 commits into
mainfrom
refactor/store-duplication

Conversation

@ewanc26

@ewanc26 ewanc26 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the store part of #53. The session and settings codecs each had a copy of the value-line check and of the read-a-line loop; both now use src/store/codec_text.h. The settings store's clear was a wrapper around indigo_file_remove that only the tests called, so it is gone and the tests call indigo_file_remove directly.

What changed

  • New src/store/codec_text.h: indigo_codec_has_break and indigo_codec_next_line, inline.
  • session_codec.c and settings_codec.c use them. The settings decoder keeps its CRLF tolerance.
  • indigo_settings_store_clear removed (it was test-only). indigo_session_store_clear stays, since session_auth.c uses it.

Scope and what was not done

  • The small-file helper the issue asks for (read, atomic write, set-aside, remove) already exists in src/store/file.c on main, and the three stores use it. Nothing to move there.
  • On current main, jscpd at the issue's --min-tokens 80 --min-lines 12 finds no clones in src/store. The issue's store and session-store clone numbers no longer match main.
  • The src/atproto/session_read.c, session_people.c and session_lists.c job functions still have repeated shapes. They are compiled only for 3DS, so this PR does not touch them, and session_auth.c and signin.c are untouched (PR feat(signin): password sign-in finds the PDS from the handle #72).
  • Not in this PR: indigo_media_known and indigo_layout_hit from the issue's cppcheck list.

Verification

  • make test: 4037 checks, 0 failures, before and after.
  • make warnings: clean.
  • 3DS cross-build (make with devkitARM, Wolfram v0.38.0): builds.
  • Not run on a 3DS or in Azahar.

Notes

Net line count is roughly neutral: 29 lines added and 48 removed in tracked files, plus the new 36-line header.

🤖 Generated with Claude Code

ewanc26 and others added 3 commits October 7, 2026 23:38
…ettings clear

The session and settings codecs each carried a copy of the value-line check
and of the read-a-line loop. Both now come from store/codec_text.h. The
settings store's clear was a wrapper around indigo_file_remove used only by
the tests, so the tests call indigo_file_remove directly. No behaviour change:
host tests stay at 4037 checks, 0 failures.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ewanc26

ewanc26 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the replacement PR: same refactor on a fresh branch from main, because this one conflicted with the v0.39.0 pin.

@ewanc26 ewanc26 closed this Oct 7, 2026
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