Commit Graph

4 Commits

Author SHA1 Message Date
NB-076 0e7472598d fix: 跨文件KEY约束 + PERFORM分支统计 + 平面文件写入
1. 跨文件KEY约束(修复)
   匹配型程的M-KEY与D-KEY值不同导致匹配0条。
   修复: generate_data后处理检测IF KEY比较,
   前半记录对齐KEY值(8条匹配),后半保待差异(9条不匹配).
   实际cobc运行验证: MATCHED=8, PASS.

2. extract_structure PERFORM分支统计(修复)
   _walk函数未添加BrPerform决策点, total_branches缺失.
   修复: 为PERFORM UNTIL/VARYING决策点添加2分支(Enter/Skip).
   之前total_branches=0,现在=2.

3. flatfile.py(新增)
   COBOL固定长平面文件写入器.
   - analyze_fd_layout(): 从COBOL源码自动解析文件布局
   - write_flat_file(): 生成为COBOL可直接读取的二进制格式

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-22 13:52:56 +08:00
NB-076 0b0a013f51 fix: 3 critical parsing bugs found through statement benchmark testing
Bug 1: ELSE IF breaks IF false_seq parsing (core.py)
- _parse_if checked self.clean() == 'ELSE' which fails on 'ELSE IF ...'
- Fix: use startswith('ELSE'), reinsert IF portion for recursive parse
- Impact: ALL ELSE IF chains were silently dropped (huge branch loss)

Bug 2: READ skip loop greedily consumes subsequent statements (core.py)
- READ's AT END / NOT AT END skip loop used bare advance() with no
  statement boundary detection
- Fix: add _stmt_boundary regex that stops on IF/PERFORM/READ/etc.
- Impact: everything after first READ was consumed as 'AT END' lines

Bug 3: _walk() in extract_structure doesn't descend into BrPerform (__init__.py)
- Branch counting _walk() only handled BrIf/BrEval/BrSeq
- IF statements inside PERFORM bodies were never counted
- Fix: add BrPerform.body_seq and BrSearch descent

Combined impact: matching programs (MT01-33) now correctly report
their branches instead of 0. Full regression: 749 passed (unchanged).
2026-06-21 12:52:04 +08:00
hangshuo652 bc1d56d1a4 feat: Phase 2 complete — 13 Phases of COBOL type classification and test benchmark
P0.6: gcov infrastructure
P1: extract_structure output expansion (11 new feature fields)
P2: Confusion group rule engine (8 pairs + contradiction + backtrack)
P3: 4-factor confidence calculation + quality gate update
P4: 33+2 COBOL program type test samples (22 files, 7 categories)
P5: parametrized/ test data generation engine
P6: japanese_data.py lookup tables
P7-10: Type-specific test suites (~159 parametrized tests)
P11: Full classification pipeline (classify_program) + orchestrator integration
P12: Documentation (module-interfaces, test-plan v3.0, coverage-matrix)

Architecture decisions:
- classification_pipeline/ merged to hina/pipeline/
- parametrized/ as independent module
- japanese_data.py as root-level file
- hina/__all__ only exports classify_program()

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-19 23:51:55 +08:00
hangshuo652 097530b036 feat: Phase 1 - cobol_testgen API + quality fields + retry handler 2026-06-18 15:47:35 +08:00