Repository navigation
Add table_mode parameter for complete table isolation in dictsqlite_v2 - #196
Conversation
- Added TableMode enum (Prefix, Separate) in lib.rs - Updated Config struct with table_mode field - Updated DictSQLiteV4 and AsyncDictSQLite to accept table_mode parameter - Added separate table storage methods in storage.rs - Updated TableProxy and AsyncTableProxy to support both modes - Added Modes.TABLE_PREFIX and Modes.TABLE_SEPARATE constants - Added tests for the new table_mode feature Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
- Use kv_main instead of main for empty table name fallback - Improve list_tables to filter out tables without kv_ prefix for security - Remove unused TableMode import in storage.rs Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Bandit found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
変更内容報告書概要dictsqlite_v2のテーブル機能に 追加されたモード
変更ファイル1.
2.
3.
4.
5.
使用例from dictsqlite import DictSQLiteV4, Modes
# プレフィックスモード(デフォルト)
db = DictSQLiteV4("test.db", table_mode=Modes.TABLE_PREFIX)
# 分離モード
db = DictSQLiteV4("test.db", table_mode=Modes.TABLE_SEPARATE)
users = db.table("users")
users["alice"] = {"name": "Alice"}セキュリティ対策
テスト結果関連テスト66件全てパス |
Added thorough testing for both prefix and separate modes: - Encryption integration tests - All storage modes (pickle, json, jsonb) tests - All persist modes (memory, lazy, writethrough) tests - Many tables (20+) tests - Special character handling tests - Large data tests - Update/delete operations tests - Async mode tests - Table items/values tests - Default behavior and backward compatibility tests Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
両モードの徹底的なテストを追加しました(コミット: 9e2e7b5) テスト結果サマリーtable_mode テスト(28件全てパス)
他機能への影響テスト(304件全てパス)
既存機能への影響はありません。 |
dict操作を網羅するpytestを確認しました。以下に詳細を報告します: dict操作のテストカバレッジ既存のテストファイル(dict操作を網羅)
table_mode テストでの dict 操作カバレッジ現在の
結論: 主要なdict操作は網羅されています。 |
Added to TableProxy and AsyncTableProxy: - .get(key, default) method - .pop(key, default) method - .setdefault(key, default) method - .update(dict) method - __iter__ for iteration support (for key in table) - __delitem__ for AsyncTableProxy - values() for AsyncTableProxy - clear() for AsyncTableProxy Added comprehensive tests (8 new tests): - test_table_proxy_get_method - test_table_proxy_pop_method - test_table_proxy_setdefault_method - test_table_proxy_update_method - test_table_proxy_iter_method - test_table_proxy_delitem - test_async_table_proxy_all_dict_ops - test_table_proxy_bytes_mode All 312 tests pass. Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
TableProxyに完全なdict操作を追加しました(コミット: 3aa4f6d) 追加されたメソッドTableProxy / AsyncTableProxy
テスト結果
両モード(prefix/separate)と全ストレージモード(pickle/json/jsonb/bytes)で動作確認済みです。 |
There was a problem hiding this comment.
Pull request overview
This PR adds a table_mode parameter to DictSQLite v4.2 to provide users with a choice between two table isolation strategies: prefix mode (default, backward compatible) and separate mode (complete SQLite table isolation).
Key changes:
- Introduced
TableModeenum withPrefix(default) andSeparatemodes - Enhanced both
TableProxyandAsyncTableProxywith complete dict-like operations (get, pop, setdefault, update, iteration support) - Added comprehensive storage engine methods for separate table operations with proper SQL sanitization
- Implemented 36 tests covering both modes across various scenarios (encryption, storage modes, persistence modes, large data)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
dictsqlite_v2/dictsqlite/tests/test_table_mode.py |
New comprehensive test suite with 36 tests covering both table modes, dict operations, and edge cases |
dictsqlite_v2/dictsqlite/src/storage.rs |
Added 7 new methods for separate table mode operations with proper SQL sanitization and error handling |
dictsqlite_v2/dictsqlite/src/lib.rs |
Introduced TableMode enum, enhanced TableProxy with dict operations, added iterator support, and updated table operations to support both modes |
dictsqlite_v2/dictsqlite/src/async_ops.rs |
Enhanced AsyncTableProxy with complete dict operations matching sync implementation, added async iterator, fixed repr string |
dictsqlite_v2/dictsqlite/python/dictsqlite/__init__.py |
Added table_mode parameter to both sync and async constructors, documented new table mode constants |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for name in table_names: | ||
| table = db.table(name) | ||
| table["key1"] = {"test": True} | ||
| assert table["key1"]["test"] == True |
There was a problem hiding this comment.
Use is True or assert table["key1"]["test"] instead of == True for boolean comparison. Direct comparison with boolean literals using == is considered less pythonic than using identity checks (is) or just asserting the boolean value directly.
| for name in table_names: | ||
| table = db.table(name) | ||
| table["key1"] = {"test": True} | ||
| assert table["key1"]["test"] == True |
There was a problem hiding this comment.
Use is True or assert table["key1"]["test"] instead of == True for boolean comparison. Direct comparison with boolean literals using == is considered less pythonic than using identity checks (is) or just asserting the boolean value directly.
| assert table["key1"]["test"] == True | |
| assert table["key1"]["test"] |
|
|
||
| # Test .get() with default value | ||
| result = users.get("nonexistent", {"default": True}) | ||
| assert result["default"] == True |
There was a problem hiding this comment.
Use is True or assert result["default"] instead of == True for boolean comparison. Direct comparison with boolean literals using == is considered less pythonic than using identity checks (is) or just asserting the boolean value directly.
| assert result["default"] == True | |
| assert result["default"] is True |
|
|
||
| # Test .pop() with non-existing key and default | ||
| result = users.pop("nonexistent", {"default": True}) | ||
| assert result["default"] == True |
There was a problem hiding this comment.
Use is True or assert result["default"] instead of == True for boolean comparison. Direct comparison with boolean literals using == is considered less pythonic than using identity checks (is) or just asserting the boolean value directly.
| assert result["default"] == True | |
| assert result["default"] is True |
| # Test get() | ||
| assert users.get("alice")["name"] == "Alice" | ||
| assert users.get("nonexistent") is None | ||
| assert users.get("nonexistent", {"default": True})["default"] == True |
There was a problem hiding this comment.
Use is True instead of == True for boolean comparison. Direct comparison with boolean literals using == is considered less pythonic than using identity checks (is).
| assert users.get("nonexistent", {"default": True})["default"] == True | |
| assert users.get("nonexistent", {"default": True})["default"] is True |
Changed `== True` to `is True` for boolean comparisons as per code review feedback. Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
レビューコメントに対応しました(コミット: df7bfb5) 5箇所の
全36テストがパスしています。 |
コメントが途中で切れているようです。 現在の実装では、 |
コメントが途中で切れています。他のAIからどのようなフィードバックがあったか、完全なメッセージを教えていただけますか? 現在の
他のAIからの指摘が何か具体的にあれば、対応を検討します。 |
banditセキュリティ分析を実行しました。 結果ソースコード(python/)
テストコード(tests/)
結論セキュリティ上の問題は検出されませんでした。テストファイルでのassert使用はpytestの標準的な使い方であり、許容されます。 |
is Trueinstead of== True)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.