Fix/preprocessing audit#12
Open
JoaquinCampo wants to merge 4 commits into
Open
Conversation
Context:
A systematic 5-pass audit compared the thesis PDF (neuralshield-docs, March 4 2026)
against the actual codebase across Chapters 4 (Design), 5 (Implementation), and
6 (Evaluation). The audit identified 19 discrepancies, 23 minor observations, and
verified 61 claims. This commit addresses the 9 highest-priority code fixes where
the code diverged from the documented behavior. The guiding principle was "fix the
code to match the PDF" wherever possible, to minimize document changes.
Full audit findings are documented in docs/PDF_CODE_AUDIT.md.
Fixes:
- 1.1: Emit MIXEDSEP flag when both & and ; separators present (step 10)
PDF Table 4.3 lists MIXEDSEP but code never emitted it.
- 1.2: Add _aggregate_flags() to collect inline flags into [FLAGS] summary
PDF describes a consolidated [FLAGS] line but pipeline never aggregated
inline flags from tagged lines into a summary.
- 1.3b: Make NFKC diagnostic-only — detect flags without mutating content (step 07)
PDF Section 4.3.2 describes NFKC as a detection mechanism, but code was
destructively replacing content with NFKC-normalized form. Now NFKC is used
only for comparison; original content is preserved for downstream steps.
- 1.4: Prefix HOSTMISMATCH output with [FLAGS] tag (step 06)
_emit_global_flags() emitted bare flag text instead of tagged [FLAGS] line.
- 1.5: Remove orphaned query_processor.py (dead code, not in pipeline config)
File used [QPARAM] tags not referenced anywhere; not in TOML pipeline order.
- 1.10: Add TODO to verify Figure 4.2 Phase 2 flag list completeness
Figure 4.2 omits BADHDRCONT, BADCRLF, HDRMERGE, HOPBYHOP, HDRNORM.
- 1.12: Add TODO to regenerate Listing 4.2 end-to-end example
The walkthrough example needs regeneration after bug fixes are applied.
- 1.16: Fix MULTIPLESLASH false positive on all absolute paths (step 11)
_segment_path() inserts "" at index 0 for absolute paths, and
_detect_multiple_slashes() checked `"" in segments` which was always True.
Fixed to `"" in segments[1:]`.
- 1.18: Add split_line_content() utility; fix flag corruption in steps 06/07/08/11
Steps used naive line[6:] slicing to extract content, but this included
trailing inline flags appended by prior steps. Added a shared utility that
walks backwards from end of line collecting known flags, returning clean
(content, flags) tuples. Applied to all 4 affected steps.
Readable markdown summary of all 9 fixes applied in the PDF-vs-code audit, with context, root causes, and remaining items.
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.
No description provided.