Repository navigation
Fallback preprocessing: reconcile test #includes against a plain expansion - #1346
Merged
Merged
Conversation
The directives-only and full preprocessor commands keep the file's own search paths ahead of vendor paths. In whole-run fallback, stand-ins are still placed and a mis-cased mock in a branch that is on still stops the build. The integration harness can now force fallback per example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The directives-only and Partial full-expansion runs differed only in their tool, so one private runner now builds and runs both commands. Each caller keeps its own failure handling, and both now fit RuboCop's method length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ator Stage 4's second pass is about to run in fallback too, with a plain preprocessor expansion in place of directives-only output, so its name follows what it produces for the third pass instead of one tool flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without -fdirectives-only, a plain preprocessor expansion still records every file it entered in its line markers. Preprocessinator can now write one for a test file, kept apart from stage 11's full expansion and named after the test file, as the line-marker extractor expects. Stage 1 gives each test a place to record its path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without -fdirectives-only, the second pass now runs the full preprocessor over each test file into its fallback expansion, cached and tracked as the directives-only output is. One table holds what differs between the two modes. Reconciliation still keeps the text-scan list in fallback, so no test's #includes change yet. Stage 4's sequencer no longer needs the configurator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In whole-run fallback, stage 4 kept every #include the text scan found, so a mock in a branch that is off stopped the build or replaced the real module, and a mock named by a macro was never generated. The third pass now reconciles against the fallback expansion's line markers, as a best effort, and the first pass sets mock search paths in both modes so the expansion finds the stand-ins. A test file whose expansion fails takes the per-file path: its text-scan #includes checked against GCC's bare list. The integration specs now run every scenario in both modes, and the fallback system examples build where they used to stop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two MethodLength offenses in Preprocessinator are gone, taking the total from 840 to 838. 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>
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
In whole-run fallback (no
-fdirectives-only, or:test_build↳:preprocess_force_fallback), stage 4 used to keep every#includethe text scan found. That scan ignores#ifand can't read an#includewhose name is a macro. So:Stage 4 now runs the full preprocessor tool (plain
-E) over each test file in fallback, with stand-ins on the search path. It then reconciles against the files the expansion's line markers name, the same way directives-only output is used.Fallback stays a best effort with no guarantees, and code, comments, logs and docs say so. A test file whose expansion fails takes the existing per-file path: its text-scan
#includes, checked against GCC's bare list.Analysis behind this (prototype results on GCC 14 and Apple Clang 15): https://claude.ai/artifact/LqCm4jSTjkN77DnYdxdHCV
Changes
Preprocessinatorhas one privaterun_preprocessorfor its directives-only, fallback and Partial full-expansion runs. Two long methods now fit RuboCop's limits, and misplaced and stale comments are fixed.TestDirectivesOnlyPreprocessinatoris nowTestIncludesPreprocessinator. A frozenMODEStable holds what differs in fallback: tool, output path, generator, testable key, and extra outputs. Caching and line-marker dependency tracking are shared.preprocess/files/<test>/fallback_expansion/under the test file's own name, which the line-marker reader needs. Its path is recorded intestable.preprocess[:fallback_expansion]. Stage 11 and its[:directives_only]contract are untouched.configuratorcollaborator.PIPELINE.mdandpreprocess/README.mdare updated. They also correct pass 1's flags (-M -MG) and a stale file reference.Tests (7-step test-first)
spec/integration/test_includes_extractinator_spec.rbruns every scenario under both modes with shared expectations. That covers Case 1, the mis-cased mock, the macro-named mock, all three Case 2 variants, the computed#include, narrowing, stand-ins and the per-file failure. It adds the mixed real-and-mocked module and a check of where the fallback expansion lives. The ten fallback scenarios failed before reconciliation was enabled.conditional_mock_includes: the two fallback examples now build instead of stopping. They were red on the prior commit.delta_builds: expects the new warning.conditional_mock_includes,delta_builds,plugin_delta_builds,preprocessing_fallback_conditionals,preprocessing_locale,preprocessing_encoding,encoding_stress,partials_module_disambiguation,test_source_file_directive.lint:changedis clean.Notes for review
-Eper stale test file in fallback, matching pass 2's count in normal mode.-P) now affects fallback reconciliation as well as stage 11. That is the empty-list case tracked separately (report: https://claude.ai/artifact/TR6uCuBLbfdWz9oUNRPcVv).🤖 Generated with Claude Code