Skip to content

Fix/preprocessing audit#12

Open
JoaquinCampo wants to merge 4 commits into
mainfrom
fix/preprocessing-audit
Open

Fix/preprocessing audit#12
JoaquinCampo wants to merge 4 commits into
mainfrom
fix/preprocessing-audit

Conversation

@JoaquinCampo
Copy link
Copy Markdown
Owner

No description provided.

JoaquinCampo and others added 4 commits March 7, 2026 13:39
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants