refactor: compact kernel headers under size budget (#352)#353
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: netkeep80#352
Solution summaryImplemented and pushed the fix for issue #352. PR: #353 What changed:
Verification:
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: (282.7K + 26.6M cached) input tokens, 37.8K output tokens, $15.580149 cost 🤖 Models used:
📎 Log file uploaded as Repository (50907KB)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 |
netkeep80
left a comment
There was a problem hiding this comment.
This PR is moving in the right direction on surface reduction, but in its current form it over-compresses the kernel text surface and introduces a new policy-drift vector.
I am requesting changes for two reasons.
1. The 9000-line budget is now duplicated in too many enforcement layers
You fixed the drift between repo-policy.json and scripts/check-repo-guard-rollout.sh, which is good. But this PR also hardcodes the same 9000 threshold into tests/test_issue352_kernel_subtree_size.cpp.
That means the same policy value now lives in at least three places:
repo-policy.jsonscripts/check-repo-guard-rollout.shtests/test_issue352_kernel_subtree_size.cpp
This is exactly the kind of governance duplication that caused the rollout-checker drift in the first place. The test is not validating behavior of PMM as a library; it is validating repository governance state. As soon as the budget changes again, we now need synchronized edits across policy, rollout-checker, and C++ test code.
That is not a robust shape.
What I want instead:
- either make the test derive the threshold from the canonical policy source;
- or remove the hardcoded budget from the C++ test and keep the budget enforcement in repo-guard/governance tooling only.
Right now this PR solves one drift and bakes in the next one.
2. The compaction pass removes comments that are still carrying real contracts
I agree with removing tutorial prose, issue history, and repetitive header boilerplate. That part is consistent with the current text-discipline policy.
But the sweep went too far in places where comments were still doing real technical work.
The clearest example is include/pmm/pallocator.h.
Before this PR, that header explicitly documented a critical safety/persistence boundary: raw pointers returned by the allocator are not persistent handles and must not be treated as stable across manager destroy/load/remap cycles; persistent identity must go through pptr<T>.
That is not decorative prose. That is a persistence contract and a misuse-prevention note.
Removing that guidance makes the API more compact, but also easier to misuse, especially in exactly the kind of code that will later sit under pjson or other higher-level persistent abstractions.
Your own comment policy allows comments when they carry:
- invariant
- persistence contract
- safety note
- short design note
So this is not a case where “less text” automatically means “better text”. A compact kernel is good. A silent kernel that erases non-obvious persistence constraints is not.
What I want instead:
- restore short, high-signal comments where they encode persistence or safety semantics that are not obvious from the type signatures;
- keep the compaction, but stop deleting comments merely because they are comments.
The standard should be: remove redundant prose, preserve semantic guardrails.
Bottom line
The PR is close, but I do not want this merged in a state where:
- a governance constant is triplicated, and
- valid safety/persistence contracts are removed in the name of line-count reduction.
Please tighten those two points and I’ll re-review quickly.
| { | ||
| if ( entry.is_regular_file() ) | ||
| total_lines += count_lines( entry.path() ); | ||
| } |
There was a problem hiding this comment.
This hardcodes the same 9000 policy threshold that already exists in repo-policy.json and in the rollout checker. That recreates the very drift class this PR claims to fix. Either derive the threshold from the canonical policy source or keep this budget check entirely in governance tooling instead of C++ test code.
|
🤖 AI Work Session Started Starting automated work session at 2026-04-21T10:25:42.514Z 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. |
Review feedback addressedPushed review-response commit bd5d312 to Changes:
Verification:
PR: #353 |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (283.0K + 13.2M cached) input tokens, 32.3K output tokens, $8.746879 cost 🤖 Models used:
📎 Log file uploaded as Repository (36998KB)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 |
Fixes #352
Summary
include/pmm/**subtree stays below the 9,000-line blocking budget; current tracked count is8,754lines.scripts/check-repo-guard-rollout.shwith the current single aggregateinclude/pmm/** <= 9000size rule.globandmaxvalues from canonicalrepo-policy.jsoninstead of duplicating the9000threshold in C++ test code.pallocatorpersistence/safety guidance: raw allocator pointers are transient mapped addresses, while cross-run identity belongs inpptr<T>.single_include/pmm/pmm.hfrom the compacted modular headers;pmm_no_comments.hremains unchanged for this review patch because the added allocator guidance is comment-only.Review Response
test_issue352_kernel_subtree_sizenow reads the canonicalkernel-subtree-max-linesrule fromrepo-policy.json.Change Contract
Reproduction
test_issue352_kernel_subtree_sizebefore compacting headers.10256 <= 9000.git ls-files include/pmm | xargs wc -lreports8754 total.10768; the checker now expects the current aggregate rule.Verification
cmake -B buildcmake --build buildctest --test-dir build -R test_issue352_kernel_subtree_size --output-on-failurectest --test-dir build --output-on-failure(93/93passed)bash scripts/check-repo-guard-rollout.shbash scripts/check-docs-consistency.shGITHUB_BASE_REF=main bash scripts/check-changelog-fragment.shbash scripts/generate-single-headers.sh --strip-comments --output-dir /tmp/generated-pmm-issue352-reviewplusdiff -qr single_include/pmm /tmp/generated-pmm-issue352-reviewclang-format --dry-run --Werror include/pmm/pallocator.h tests/test_issue352_kernel_subtree_size.cpp<=1500lines per tracked source/header, excludingsingle_include)git diff --check origin/main...HEADLocal notes:
cppcheckis not installed in this runner, so local cppcheck was not run.build/found generated Catch2 files above 1500 lines; the tracked source-file check matching the CI source gate passed.