Add tag-based filtering to debug() / HL_DEBUG_CODEGEN - #9381
Open
alexreinking wants to merge 2 commits into
Open
Add tag-based filtering to debug() / HL_DEBUG_CODEGEN#9381alexreinking wants to merge 2 commits into
alexreinking wants to merge 2 commits into
Conversation
Selecting a specific debug() print via HL_DEBUG_CODEGEN currently requires naming a file and line range, which drifts as soon as the surrounding code changes. A call site can now be given a stable tag (debug(verbosity, "my-tag")) selectable via a new tag:name[,name...] rule that fires regardless of verbosity. Applied to the two prints that most benefit from a stable selector: the Simplify.cpp counter-example dump and the SimplifyCorrelatedDifferences.cpp non-monotonic warning. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A shell that already has HL_DEBUG_CODEGEN set to a tag-only rule (e.g. while exercising the new tag-filter feature) silently suppresses the test's untagged debug(0) call, and any inherited HL_DEBUG_CODEGEN_LOG_FILE would fight with the values the test sets per scenario. Clear both at the top of each role (HL_DEBUG_CODEGEN unconditionally; the log file only in the parent, before it starts overriding it). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
|
I'm thinking this debug logging filtering spec should probably also be explained in CLAUDE.md. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9381 +/- ##
==========================================
+ Coverage 70.03% 70.06% +0.02%
==========================================
Files 261 261
Lines 79223 79243 +20
Branches 19312 19317 +5
==========================================
+ Hits 55487 55522 +35
- Misses 17923 17926 +3
+ Partials 5813 5795 -18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
debug()call sites (debug(verbosity, "my-tag")), selectable via a newHL_DEBUG_CODEGEN=tag:name[,name...]rule that fires regardless of the configured verbosity — a way to select a specific print without relying on file/line ranges that drift as code changes.Simplify.cpp(tag:counterexample) and the "expression is non-monotonic" warning inSimplifyCorrelatedDifferences.cpp(tag:non-monotonic).HL_DEBUG_CODEGENgrammar documentation inREADME.mdand the malformed-entry warning message inDebug.cpp.The
debug(n)macro is now variadic; C++ overload resolution on argument count picks between the untagged and taggeddebug_is_active_imploverloads, so none of the ~1000 existing untagged call sites need any changes.Test plan
ctest --test-dir build -R correctness_debug_helpers— new unit tests for tag matching, non-matching, comma-separated tag lists, empty-entry tolerance, and malformedtag:/tag:,entries.ctest --test-dir build -R correctness_simplifyandcorrectness_debug_log_filepass.HL_DEBUG_CODEGEN=tag:counterexample(and the comma-separated form) surfaces the counter-example diagnostic fromcorrectness_simplifywithout needing a line-range guess; silent by default and with a non-matching tag.pre-commit run --all-filespasses.🤖 Generated with Claude Code