Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Improve support for searching indexes#36

Merged
Schamper merged 1 commit intomainfrom
improve-index-support
Apr 29, 2025
Merged

Improve support for searching indexes#36
Schamper merged 1 commit intomainfrom
improve-index-support

Conversation

@Schamper
Copy link
Member

Fixes #35

@codecov-commenter
Copy link

codecov-commenter commented May 15, 2024

Codecov Report

Attention: Patch coverage is 77.88018% with 48 lines in your changes missing coverage. Please review.

Project coverage is 78.84%. Comparing base (3f721c4) to head (d51d52c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dissect/esedb/cursor.py 77.52% 20 Missing ⚠️
dissect/esedb/table.py 65.71% 12 Missing ⚠️
dissect/esedb/btree.py 86.11% 10 Missing ⚠️
dissect/esedb/index.py 80.00% 3 Missing ⚠️
dissect/esedb/page.py 0.00% 1 Missing ⚠️
dissect/esedb/record.py 50.00% 1 Missing ⚠️
dissect/esedb/tools/sru.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
+ Coverage   78.81%   78.84%   +0.02%     
==========================================
  Files          15       16       +1     
  Lines        1284     1418     +134     
==========================================
+ Hits         1012     1118     +106     
- Misses        272      300      +28     
Flag Coverage Δ
unittests 78.84% <77.88%> (+0.02%) ⬆️

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.

@Schamper Schamper force-pushed the improve-index-support branch 2 times, most recently from 3457f2c to ddf1b35 Compare May 15, 2024 14:49
@Schamper Schamper force-pushed the improve-index-support branch from bd439f9 to 01dec74 Compare January 28, 2025 12:22
@Schamper Schamper force-pushed the improve-index-support branch 2 times, most recently from 70ae493 to 4d1b6cb Compare January 28, 2025 16:38
@Horofic Horofic requested review from Horofic and Copilot April 25, 2025 09:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the support for searching indexes by enhancing test coverage and refactoring the index, table, cursor, and BTree implementations. Key changes include new tests for index searching, replacing the use of Cursor with BTree in long value retrieval, and modifying parsing behavior for multi‐value tagged fields.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_table.py Added tests for find_index with various column orders
tests/test_index.py Updated index search tests to retrieve records and check values (including a change to the long binary test)
tests/test_cursor.py Added tests for cursor navigation and search functionality
dissect/esedb/tools/sru.py Minor formatting update in repr
dissect/esedb/table.py Added properties/methods for primary_index, cursor, and find_index; switched to BTree for certain searches
dissect/esedb/record.py Changed _parse_multivalue to return a list and raise an error for unrecognized flags
dissect/esedb/page.py Updated repr formatting
dissect/esedb/index.py Updated index flag usage and repr formatting
dissect/esedb/cursor.py Refactored cursor implementation to rely on BTree and enhance search methods
dissect/esedb/c_esedb.py Added new flag definitions for IDBFLAG and IDXFLAG
dissect/esedb/btree.py Introduced a new BTree class for B+Tree navigation
Comments suppressed due to low confidence (2)

tests/test_index.py:86

  • The test for 'IxLongBinary' now expects a long binary value concatenated with 1000 bytes, instead of the previous 1024. Please confirm that this truncation is intended and update the test or underlying logic if necessary.
record = table.indexes[14].search(LongBinary=b"test long binary data " + (b"a" * 1000))

dissect/esedb/record.py:285

  • Introducing an exception for unknown tag field flags changes existing behavior; please ensure that test coverage is provided for this new code path and that this change is compatible with existing data.
raise ValueError(f"Unknown flags for tag field: {tag_field}")

@Schamper Schamper force-pushed the improve-index-support branch from 4d1b6cb to d295381 Compare April 28, 2025 14:34
@Schamper Schamper requested a review from Horofic April 28, 2025 14:34
@Schamper
Copy link
Member Author

I don't agree with most of your comments since those docstrings are talking about those topics in a more general form, not referring to any of those classes or implementations specifically. And most will be covered by argument and return type hinting being clickable in the docs.

@Schamper Schamper force-pushed the improve-index-support branch from d295381 to 27390c5 Compare April 28, 2025 14:46
@Schamper Schamper force-pushed the improve-index-support branch from 27390c5 to d51d52c Compare April 29, 2025 08:51
@Schamper Schamper requested a review from Horofic April 29, 2025 08:51
@Schamper Schamper merged commit e11d651 into main Apr 29, 2025
23 of 24 checks passed
@Schamper Schamper deleted the improve-index-support branch April 29, 2025 10:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve cursor and btree implementations

4 participants