Refactor forest domain protocol - #338
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: netkeep80#335
Solution summaryImplemented and pushed the fix for issue 335. PR 338 is ready for review: #338 What changed:
Verification:
Working tree is clean. Next useful steps:
This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (246.1K + 29.3M cached) input tokens, 47.8K output tokens, $16.969117 cost 🤖 Models used:
📎 Log file uploaded as Repository (55290KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 341f097.
|
Вот комментарий, который я бы оставил под PR:
|
|
🤖 AI Work Session Started Starting automated work session at 2026-04-20T17:54:47.420Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
|
Updated the PR for the const-correctness review feedback and marked it ready for review. What changed:
Verification:
Note: a direct local scripts/check-version-consistency.sh still reports the existing README badge/CMake version mismatch, but the release-owned CI version check passed because this PR does not touch release-owned files. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (326.3K + 15.2M cached) input tokens, 32.7K output tokens, $9.965145 cost 🤖 Models used:
📎 Log file uploaded as Repository (38584KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
|
В целом направление правильное: Но я бы всё-таки попросил исправить одну важную вещь перед merge:
Это ломает const-correctness и делает protocol слишком permissive. Мне кажется, здесь лучше выбрать один из двух вариантов:
Иначе получается, что новый “canonical protocol” уже чище старого пути, но всё ещё смешивает чтение и запись в одном объекте и делает это ценой |
|
🤖 AI Work Session Started Starting automated work session at 2026-04-20T18:19:59.117Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
|
Verified the latest repeated const-correctness feedback against branch head No additional code changes were needed: the current branch already removes Local verification rerun in this session:
Notes:
PR is marked ready for review again. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (87.6K + 4.9M cached) input tokens, 16.5K output tokens, $3.266316 cost 🤖 Models used:
📎 Log file uploaded as Gist (20269KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
ForestDomainViewDescriptor/ForestDomainViewOpssurface and a mutableForestDomainDescriptor/ForestDomainOpssurface.find,root_index, andnameavailable from const contexts while restrictingroot_index_ptr,insert, andreset_rootto mutable handles.pmap::forest_domain_ops() constand the_root_idxconst_cast;const pmapnow exposes onlyforest_domain_view_ops()plus normal read APIs (find,contains).pmaponto the same forest-domain protocol aspstringview, including keyed lookup throughcompare_key(key, node_pptr).pstringview/system/symbols, symbol bootstrap interning, public legacy root access, and public domain-root access through the canonical forest-domain root-index helpers.Fixes #335
Removed duplicate paths
pmap::_avl_find()andpmap::_avl_insert()as local wrappers around raw AVL helpers.pstringview::_avl_find()andpstringview::_avl_insert()as local wrappers aroundForestDomainOps.get_legacy_root_offset_unlocked(),set_legacy_root_offset_unlocked(), andsymbol_domain_root_offset_unlocked()in favor offorest_domain_root_index_unlocked(),forest_domain_root_index_ptr_unlocked(), andset_forest_domain_root_index_unlocked()._avl_find()helper path as canonical test intent.Canonical protocol
Read-only descriptor/view core:
name()root_index()resolve_node(node_pptr)compare_key(key, node_pptr)for keyed lookupMutable descriptor/ops core:
root_index_ptr()less_node(lhs, rhs)validate_node(node_pptr)insert(node)reset_root()Const-correctness
ForestDomainOps::insert,ForestDomainOps::reset_root, andForestDomainOps::root_index_ptrare no longerconstmethods.pmap::forest_domain_descriptorkeeps separate read and mutable root slots; descriptors created fromconst pmaphave no mutable root slot.tests/test_issue153_pmap.cppstatically asserts thatconst pmapcannot callforest_domain_ops()and that const policy handles cannot callinsert,reset_root, orroot_index_ptr.Line-count impact
Hand-written core include files changed by net +56 lines:
include/pmm/avl_tree_mixin.h: +40include/pmm/forest_domain_mixin.inc: -3include/pmm/persist_memory_manager.h: 0include/pmm/pmap.h: +23include/pmm/pstringview.h: -4The additional lines are mostly the explicit read-only/mutable split requested in PR feedback. The duplicate helper paths listed above remain removed.
Reproduction
Added
forest-domain descriptor drives pmap dictionaryintests/test_issue153_pmap.cpp.Before the original implementation,
cmake --build build --target test_issue153_pmapfailed to compile becauseMap::forest_domain_descriptorandmap.forest_domain_ops()did not exist.Before the const-correctness follow-up, the added static assertions failed because
const pmapexposedforest_domain_ops()andconst ForestDomainOpsstill allowedinsert,reset_root, androot_index_ptr.Verification
cmake --build build --target test_issue153_pmap test_issue151_pstringview test_issue162_deduplication test_forest_registry./build/tests/test_issue153_pmap(268 assertions, 16 test cases)./build/tests/test_issue151_pstringview(439 assertions, 26 test cases)./build/tests/test_issue162_deduplication(117 assertions, 11 test cases)./build/tests/test_forest_registry(75 assertions, 3 test cases)cmake --build buildctest --test-dir build --output-on-failure(92/92 passed)clang-format --dry-run --Werroron touched source/test filesbash scripts/check-file-size.shGITHUB_BASE_REF=main bash scripts/check-changelog-fragment.shbash scripts/check-docs-consistency.shbash scripts/check-repo-guard-rollout.shgit diff --checkbash scripts/generate-single-headers.sh --strip-comments --output-dir /tmp/generated-pmm-issue335-finalplusdiff -qagainst committed generated headersLocal notes
cppcheckwas not available in this runner (cppcheck: command not found), so local cppcheck was not run.bash scripts/check-version-consistency.shreports the existing release-owned README badge mismatch (0.55.12vs0.57.7). The GitHub workflow skips that check for this PR because no release-owned paths changed.