fix: sqlite database slicing + direct-write samples_summary (aggregator Phase D)#1380
Merged
Conversation
- database Aggregator.__getitem__: positive-stop slices returned len-stop-offset fits instead of stop-start (agg[:5] on 26 fits gave 21); existing test passed only by coincidence (2 fits, stop=1); fixed + 3-fit regression test - DatabasePaths.save_samples_summary/load_samples_summary: implemented (previously silent no-op), so session-written (direct-write) fits store and serve samples_summary like scraped fits; missing summary maps to the FileNotFoundError the Fitness resume check expects Aggregator Phase D (#1377); assessment on the issue. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase D of the aggregator work (#1377, follow-up to #1375/#1376): the sqlite results database was exercised at scale with the merged mock-results harness and assessed. Two genuine bugs found and fixed; the full where-it's-at assessment (including database-vs-directory performance, which shows the sqlite path currently offers no loading-speed advantage) is posted on #1377.
API Changes
None — bug fixes only.
agg[:5]on 26 fits returned 21 (len − stop − offsetitems instead ofstop − start);agg[3:8]returned 15. The pre-existing unit test passed only by coincidence (2 fits, stop=1, wherelen − stop == stop). Fixed indatabase/aggregator/aggregator.py::__getitem__with a 3-fit regression test.samples_summary:DatabasePathsfell through to the abstract no-op, sovalues("samples_summary")raisedAttributeErroron any session-written database — the summary-only workflows sped up in perf: aggregator result-loading speedups (single-scan listing, cached summaries, faster samples parse) #1376 were unusable there. Implementedsave_samples_summary/load_samples_summaryonDatabasePaths(mirrors the directory filter semantics; a missing summary maps to theFileNotFoundErrortheFitnessresume check expects). Verified end-to-end: a session-written fit's database now serves summaries.See full details below.
Test Plan
pytest test_autofit/— 1486 passed, 1 skippedtest_autofit/aggregator/test_aggregator.py::test_slicing(3 fits, breaks the old coincidence)scripts/database/session/general.pyfit →values("samples_summary")loads from the session-written databaseFull API Changes (for automation & release notes)
Changed Behaviour
database/aggregator/Aggregator.__getitem__— positive-stop slices now returnstop − startfits (previouslylen − stop − offset); negative indices normalised consistently.DatabasePaths.save_samples_summary/load_samples_summary— implemented (previously silent no-op /None); session-written fits now store the summary json exactly as scraped fits do;load_samples_summaryraisesFileNotFoundErrorwhen absent (matching directory semantics).Generated by the PyAutoLabs agent workflow.