Skip to content

fix some build warnings #5

Open
Anarchid wants to merge 2 commits intoanima-research:mainfrom
Anarchid:fix-warnings
Open

fix some build warnings #5
Anarchid wants to merge 2 commits intoanima-research:mainfrom
Anarchid:fix-warnings

Conversation

@Anarchid
Copy link
Copy Markdown
Contributor

  RECORD_HEADER_SIZE — the spookiest one. Introduced in 3b5b891 (Initial release, co-authored by Claude Opus 4.5). The math is correct: 4+1+1+8+8+8+8 = 38 bytes for the     
  fixed header prefix. But look at find_max_id — the one place it should have been used:
                                                                                                                                                                             
  // Skip version and flags                                                                                                                                                
  file.seek(SeekFrom::Current(2))?;                                                                                                                                        
  // Read ID ...
  // Skip: sequence(8) + branch(8) + timestamp(8)
  file.seek(SeekFrom::Current(24))?;

  The seeks are interleaved with reads, so a single "header size" constant doesn't fit the access pattern. The constant was defined as documentation of the format, then
  never actually used because the real code does field-by-field I/O. Classic "define first, implement differently."

  RecordLog.path and RecordIndex.path — also born in the initial release. Both stored the path on construction, never read it back. Likely intended for future error messages
   ("corruption in {path}"), reopen-after-fsync, or debug logging — but none of those were ever implemented.

  Subscription.id — born in ad27d7d (subscription system). The id is stored inside the struct, but the struct is already keyed by that same id in a HashMap<SubscriptionId,
  Subscription>. The struct never needs to know its own id — every code path that needs it already has it from the map key or the SubscriptionHandle.

  The mut in sync() — sync_all() takes &self on File, not &mut self. The write lock is needed to exclude concurrent writers, but the guard itself doesn't need to be mutable.
   Meanwhile append() correctly uses mut because seek() and write_all() do need &mut self.

Anarchid and others added 2 commits February 10, 2026 16:20
Previously, tail/slice/length/search endpoints returned 404 when
getStateTail etc. returned null, which happens for states that are
registered but have no data head on the current branch. Now checks
isRegistered() and returns empty results instead of 404.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Anarchid
Copy link
Copy Markdown
Contributor Author

Anarchid commented Mar 2, 2026

Added: e4484e2 Server: return empty results for registered-but-empty append_log states (fixes crash when querying a state key that was registered but has no records yet)

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