Repository navigation
Stage 4: never replace a test file's #include list with an empty one - #1347
Merged
Merged
Conversation
A make rule naming no #includes is a file with none, and an empty reconciled list is that file's true list when its text names none either. A failing first pass alone still reconciles as usual. The integration harnesses can now replace the bare-includes tool and set preprocess flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bare-includes pass now reads as its steps: run the tool on an isolated copy, check for a make rule, and parse it. The text scan's walk over active lines is its own method. Behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A bare-includes run that gives no make rule failed as a tool; the file's own errors still give one. It used to come back as an empty list, cached as fresh, so one killed or misconfigured run was remembered until the test file changed. It now gives nil, logged with the tool's output at obnoxious verbosity. Stage 4 skips caching it, so the next run tries again, and uses an empty list meanwhile. A header's or Partial's text scan stands in the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When GCC's bare list is empty and the second pass failed, nothing is left to check a test file's text scan against, and reconciling against the empty list wiped it. Stage 2's list now stands as it is, as a best effort, the Partial headers its configuration added included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reconciling a test file to no #includes while its text names some means preprocessing found none it should have, as when the second pass's output has no line markers. Ingesting that empty list replaced the test's header and source #includes, so its mocks and sources vanished and the build stopped on a compile error about a mock. Stage 2's list now stands, with a warning at default verbosity naming the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test preprocessing reads preprocessor line markers to find a file's #includes, its mockable functions, and its test cases. -P and --no-line-commands drop them, yet the preprocessor still succeeds, so a test lost its #includes, a mock its functions, or a test file its test cases without any error saying why. Configuration validation now names each such entry in the flags that reach test preprocessing, :compile flags included, and in the preprocessor tools' arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The includes handler now meets AbcSize and MethodLength, taking the total from 838 to 835. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Stage 4 could replace a test file's
#includelist with an empty one. The test then lost its mocks and sources, and the build stopped on a compile error about a mock (implicit declaration of function 'Gpt_StartTimer_Expect'). Nothing at default verbosity explained it. Analysis: https://claude.ai/artifact/TR6uCuBLbfdWz9oUNRPcVvIt happened two ways:
[]and cached it as fresh, so one killed or misconfigured run stuck until the test file changed. With pass 2 also failed, reconciling against that[]wiped the list. Since Fallback preprocessing: reconcile test #includes against a plain expansion #1346 this applies in fallback too.-P/--no-line-commandsreached pass 2. These strip the line markers pass 2 is read through. They also break mock header preprocessing, and stage 11 then finds zero test cases.Changes
A failed pass 1 is
nil, not[].Both passes found nothing. Stage 2's text-scan list stands as it is, as a best effort, with the Partial headers its configuration added.
Guard. Reconciliation never replaces a non-empty text-scan list with an empty one. Stage 2's list stays, with a COMPLAIN warning naming the file.
Validation. With test preprocessing on, startup validation now rejects
-Pand--no-line-commands::preprocessand:compileflags of:testand plugin contexts, both array and matcher shapes (:compileflags reach preprocessing by default);:arguments, naming a:tools_<name>shortcut when that is where the entry was written.The new stateless
LineMarkerSuppressorsfinds the entries, andConfiguratorSetup#validate_line_markersreports each by its configuration path.Refactor.
extract_bare_includesand the text scan are broken up. The handler now meets AbcSize and MethodLength, and the RuboCop backlog drops from 838 to 835.Docs.
PIPELINE.mdandpreprocess/README.mdare updated. The README's "deduplicated by filename" is corrected to filepath.Tests (7-step test-first, no new system specs)
#includes gives a cached[];niland its log.nil.LineMarkerSuppressors: shapes,-Wp,, joined entries, no false positives, malformed input, shortcut attribution.validate_line_markers: including:noneskipping the check.bare_tool:andflags:.FAILING_BARE_TOOL(an unrecognized option) reproduces a pass 1 failure. Examples run in both modes:-Phits the guard;configurator_pipeline_specrejects-Pand a shortcut's--no-line-commands, and accepts-Punder:none.conditional_mock_includes,conditional_include_macro_visibility,preprocessing_fallback_conditionals,delta_builds,partials_module_disambiguation,same_named_modules,include_path_reconciliation,test_source_file_directive.lint:changedis clean.Notes for review
#includesits in a branch that is off now keeps its text scan and warns, where it used to get the correct empty list. That needs no unconditional#includeat all, not evenunity.h.-Pbreaks a project that sets it with test preprocessing on. Such builds already fail or run zero tests.🤖 Generated with Claude Code