Skip to content

Add silent-fallback, BOUND-5 embedded-code, and cloned-family detectors - #647

Merged
trissim merged 1 commit into
mainfrom
feat/silent-fallback-and-embedded-code-detectors
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
feat/silent-fallback-and-embedded-code-detectors

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds four high-precision detectors (PatternId 60–63) closing the blind spots reported from OpenHCSDev/personal-model where real silent-failure and inline-asset slop sailed through NRA cleanly:

  1. EmbeddedCodeLiteralDetector (PatternId.EMBEDDED_CODE_LITERAL = 60, BOUND-5): flags non-docstring multiline string literals (>= 20 lines or >= 1,500 chars) embedding foreign source code (HTML/CSS/JS, JavaScript, Shell, SQL DDL) without requiring a subprocess/node -e call site.
  2. SilentMissingPathFallbackDetector (PatternId.SILENT_MISSING_PATH_FALLBACK = 61): flags positive .is_file()/.exists()/.is_dir() comprehension filters over non-discovery iterables, existence-guarded call ternaries returning empty/sentinel defaults, and existence-guarded / or fallbacks to Default*/Fallback* constructors. Excludes filesystem discovery iterables (iterdir, glob, rglob, parents, scandir, walk, os, glob) and negated existence checks (if not p.exists()).
  3. SilentExceptionFallbackDetector (PatternId.SILENT_EXCEPTION_FALLBACK = 62, BOUND-7 EAFP bypass + broad silent swallow): flags single-statement silent except handlers (pass, continue, return/assign of constant/empty/name != caught binding) catching AttributeError (with non-I/O companions TypeError/IndexError/KeyError/ValueError) or broad Exception/BaseException/bare except.
  4. ClonedDeclaredFamilyDetector (PatternId.CLONED_DECLARED_FAMILY = 63, MEMB-1/TIME-1): flags two or more unrelated modules declaring distinct DeclaredFamily roots with the same class name.

Live Precision & Recall

  • OpenHCSDev/personal-model pre-fix (4ec38215c1):
    • P60: serving/media_gallery.py:5171 (2,199 lines / 127,203 chars HTML/CSS/JS)
    • P61: train_offbox/compact_prune_stage.py:2217, 2294, 2361, 2830, 2924, serving/media_gallery.py:3950
    • P62: train_offbox/sft.py:126, 275, 806, train_offbox/self_study_corpus.py:134, 420, serving/sft_row_inspector.py:396, 418, 458
  • OpenHCSDev/personal-model HEAD (a4364f95) — 23 live hits still present:
    • P61 (7): train_offbox/pipeline.py:701, 704, 844, 913, 995, train_offbox/probe_callback.py:1819, serving/media_gallery.py:4262
    • P62 (14): train_offbox/probe_callback.py:1013, 1086, 1892, 1896, 1905, 1916, 1924, 1971, 2040, 2050, 2157, 2239, 2264, train_offbox/sft.py:126
    • P63 (2): MediaArtifact (practice/captured_media.py:111 vs serving/media_gallery.py:1461), PipelineStage (serving/media_gallery.py:3717 vs train_offbox/pipeline.py:1078)
  • Cross-repo precision:
    • NominalRefactorAdvisor (300 modules): P60=0, P61=5, P62=4, P63=0
    • agent-comms (955 modules): P60=0, P61=16, P62=0, P63=0
  • REL_IMPORTS=0

@trissim
trissim merged commit 781c4e3 into main Nov 28, 2026
1 of 10 checks passed
@trissim
trissim deleted the feat/silent-fallback-and-embedded-code-detectors branch November 28, 2026 09:37
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.

1 participant