Skip to content

refactor(#562) + fix(#503): module architecture and R3 recovery safety (consolidated Draft) - #663

Draft
chigre wants to merge 1297 commits into
mainfrom
refactor/562-retire-root-image-utils-20261024
Draft

chigre wants to merge 1297 commits into
mainfrom
refactor/562-retire-root-image-utils-20261024

Conversation

@chigre

@chigre chigre commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Root source inventory reduced from 15 to 10 — same PR, no root stubs

Based on merged #662, this PR physically migrates five root modules:

  1. image_utils.py → preprocess/analysis_image.py. Shared denoising keeps exactly the same source-pixel output/metadata; EXIF/alpha/ink primitives are re-exported by identity from preprocess/page_pixels.py.

  2. entry_classification.py → proofreading/classification.py. The entire weakref/LRU state registry and single read/modify/publish sidecar transaction lock move together. JSON-v1 sidecar and PDIC schema remain unchanged.

  3. image_preprocessing.py → preprocess/pipeline.py. Its call-time patchable analyses, per-page geometry orchestration and rendering adapters remain together; persistent preprocessing model types continue in preprocess/models.py.

  4. cli.py → bootstrap/cli.py. The installed picture-capture-cli command name and CLI syntax remain identical; the pyproject.toml entrypoint points to the new module, and the existing core bootstrap still runs before I/O imports.

  5. launcher.py → bootstrap/launcher.py. The actual GUI entrypoints (run.py, python -m picture_capture, picture-capture) still route to bootstrap/application.py unchanged. The helpers' call-time forwards still target that canonical application module.

All repository imports, source contract tests, documentation, critical-path risk classification and physical owner guards are updated. Root inventory and architecture ratchet now require ≤10 direct Python modules. The guard AST-scans production, scripts and tests for executable imports of retired root paths. No byte-size ratchet was relaxed, and no root alias/stub was added.

Why training_export.py is not removed in this batch

The project intentionally assigns TrainingExportCancelled.__module__ and make_training_zip.__module__ to picture_capture.training_export, and verifies backwards-compatible pickling/unpickling. Deleting the root module would break historical objects unless a separate lazy import-compatibility mechanism were added. Retain the real canonical compatibility entry, not a cosmetic stub, and protect it for now. CLI/main/model/OCR root entrypoints have similar public or serialization constraints.

Compatibility and acceptance

Breaking source import change for external Python scripts: import from picture_capture.preprocess.analysis_image, picture_capture.preprocess.pipeline, picture_capture.proofreading.classification, picture_capture.bootstrap.cli and picture_capture.bootstrap.launcher instead of retired root modules. Existing PDIC/PPP/SECTION/OCR JSON schemas and actual models' persisted identities are not changed.

  • Exact-head six-platform CI, Windows/macOS/Ubuntu, Python 3.10 and 3.13, Tk smoke, wheel, F821, regression — CI #39997251458, completed SUCCESS on prior head
  • Exact-head CodeQL Python and Actions — CodeQL #39997244908, completed SUCCESS
  • Independent review and representative dictionary-page scan, editing, sidecar save/reopen, preprocess/PDIC parity verification

Additional cross-platform OCR smoke #39999364561 passed on Windows/macOS/Ubuntu on prior head. Keep Draft until independent review and real scanned-page GUI verification. Issue #562 remains open.

Core leaves (2026-10-24) — same PR and branch

Additional internal extraction, no root files deleted:

  • processing_core.py now delegates eight crop polygon primitives to crop/polygon_geometry.py, preserving historical function/module paths and injecting patchable subordinate callbacks at call time.
  • processing_core.resolve_crop_worker_count delegates to crop/worker_policy.py with the current os.cpu_count provider.
  • paddle_headwords_core.normalize_headword delegates to ocr/headword_normalization.py with the current core separators and regex module.
  • Characterization tests: tests/test_issue562_core_leaf_extract_20261024.py.
  • Compatibility audit, no-move boundaries and manual test plan: docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md.
  • Existing facade assignment mirrors, historical callable signatures, data-class/pickle module paths, OCR cache and PDIC/PPP schemas unchanged.
  • Root remains 10; no new root compatibility aliases or stubs.

Latest change head: b7f96063fbe2fb82ff03df661bd91912b0012e8f.

  • Review fresh exact-head CI / cross-platform OCR smoke before accepting this additional batch.
  • Independent representative dictionary-page GUI scan and save/reopen parity.

Keep Draft pending all checks.

Continued core extractions (2026-10-24)

This is still the same Draft PR with 10 physical root Python modules. The historical public/core modules remain importable and callable; class/pickle identities, OCR cache layout, stored sidecar schemas, and application entrypoints remain unchanged.

  • a9fe8ec4: extracted geometry/column_tracking_math.py and ocr/paddle_results.py. The latter accepts the current _json_payload/OCRRecord/NumPy dependencies at call time. Regression: tests/test_issue562_core_leaf_round2_20261024.py.
  • 0d873d77: extracted ordinary/ink_threshold.py and ocr/headword_script.py. Core wrappers preserve the historical threshold and language/script helper monkeypatches. Regression: tests/test_issue562_core_leaf_round3_20261024.py.
  • ea20a299: completed type-hint audit for new threshold owner and updated docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md.

Full cross-platform CI and OCR platform smoke must be checked on exact latest head ea20a299 before this series is considered verified. These source-level tests are not a substitute for an independent representative dictionary-page GUI scan / save-reopen test.

No automatic merge, and PR remains Draft.

Crop-column and OCR lemma leaf extraction — 2026-10-24

  • 7e3fb6ac: fixed a characterization-test expectation: U+30FB '・' belongs to the Katakana Unicode block, so the existing classifier returns kana. Production behavior was not changed.
  • 5b891ecb: physically moved the implementation of processing_core._entry_crop_box_for_column to crop/entry_column_bounds.py (gutter/column-path/canonical crop box computation), and paddle_headwords_core._repair_headword_ocr to ocr/lemma_repairs.py (length-preserving dictionary lemma OCR-confusion repair).
  • Original core callables, signatures and __module__ remain stable. The crop core passes current _source_px, clamp_box and NumPy module at each invocation; lemma core passes current re module. Historical facade assignment mirrors and patched callbacks remain in place.
  • tests/test_issue562_core_leaf_round4_20261024.py checks two-column crop bounds, gutter handling, live public patch points, common lemma repairs, and unchanged spelling length.
  • Root remains 10, without new root compatibility modules. Persistence data classes, raw OCR cache and PDIC/PPP sidecar formats have not moved.

Acceptance: review latest exact-head six-platform CI and Windows/macOS/Ubuntu OCR smoke on 5b891ecb, then independent real dictionary-page GUI + save/reopen check. Keep Draft; do not merge automatically.

SECTION reading-order and OCR-line extraction — 2026-10-24

  • 50cdc393: physically extracted geometry/reading_order.py (column-path/gutter-aware click classification, SECTION-first sort, stable PDIC repair order) and ocr/line_grouping.py (vertical box overlap, OCR fragment grouping, merged logical line). Historical processing_core and paddle_headwords_core functions remain at their original paths with unchanged signatures and __module__.
  • The core passes current column, SECTION, normalization, OCR-overlap, NumPy and OCRLine constructor dependencies at call time to preserve old public-facade monkeypatch behavior. Persisted Entry, Geometry, OCRRecord and OCRLine model identities are unchanged.
  • e573b64d: corrected synthetic curved-column expectations, resolved the leaf's non-importing Geometry annotation via TypeAlias, extended SECTION patch tests, and recorded compatibility checks in docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md.
  • tests/test_issue562_core_leaf_round5_20261024.py: asserts root inventory, historical callable origins, curved column and reading-order behavior, tie-stable sorts, merged OCR record text/box/repair metadata and patch-time callbacks.
  • Root inventory is still 10 physical Python files. No root aliases were added and no OCR caches, persisted schemas or crop transactions were relocated.

Windows runner note: earlier exact-head CI on 5b891ecb reported a Windows Python 3.13 Tk test failure because its runtime could not find a usable init.tcl; other test platforms and OCR smoke succeeded. Track separately from refactor regressions. Review newest exact-head CI and OCR smoke before readiness. Independent representative dictionary-page GUI/PDIC/PPP save/reopen verification still outstanding. Keep Draft and unmerged.

OCR alphabetical and ordinary marker-position leaf extraction — 2026-10-24

Commit 3ca0b0ac continues the original Draft PR without relocating any of the ten remaining root Python modules.

  • ocr/alphabetical_warnings.py now implements the Spanish dictionary collation key, page SECTION/column/axis-aware diagnostic warnings, and mapping warnings onto accepted Entry rows. This is annotation only; the logic does not change candidate acceptance, decision thresholds, or serialized schemas.
  • ordinary/separator_position_policy.py now owns single-Han recognition, grayscale whitespace evidence at a marker Y, and OCR-versus-ordinary marker Y selection. The original processing_core wrappers inject current column-edge/classifier/Otsu/NumPy functions, and the fusion choice reads live whitespace-score and single-CJK hooks.
  • Historical processing_core and paddle_headwords_core functions retain their original names, signatures and callable __module__; the legacy public façade assignment mirrors remain usable.
  • New tests/test_issue562_core_leaf_round6_20261024.py characterizes OCR/ordinary marker threshold choices and patch seams, alphabet warning diagnostics, name collation, and accepted Entry annotation.

Verification: exact-head CI and three-OS OCR Platform Smoke must be checked on 3ca0b0ac. Persisted models/PDIC/PPP/raw OCR caches and transactional crop publishing remain in place. Independent real-page GUI scan, editing and save/reopen acceptance remains outstanding; keep Draft.

Whole-entry vertical bounds, OCR band preprocessing, and language-model selection — 2026-10-24

  • fc5bf0f2 extracted crop/entry_vertical_bounds.py (whole-entry top/bottom bounds and special-pages policy) and ocr/band_preprocessing.py (RGB/grayscale/autocontrast/binary OCR band input, OCR-local Otsu threshold, scaling). Core functions remain at historical locations and forward current geometry, source pixel conversion, sidecar path, normalization, NumPy and Otsu callbacks.
  • 323dcbc1 extracted ocr/language_resolution.py, retaining the existing Chinese/Japanese detection and Paddle model-language fallback rules. This is deliberately distinct from the semantic OCR script guard.
  • New characterization tests tests/test_issue562_core_leaf_round7_20261024.py and tests/test_issue562_core_leaf_round8_20261024.py cover existing source-coordinate crop intervals, special-pages lookup, literal-pixel overrides, public monkeypatches, OCR pixel/scale and binary thresholds, language mapping edge cases and public callable module identities.
  • Detailed audit updated in docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md. Ten physical root modules retained, no new root shims, no relocation of pickle-visible classes, sidecar persistence format, OCR engine cache or staged crop-publish transactions.

CI/OCR smoke must be checked against latest exact head 323dcbc1; the prior 3ca0b0ac CI and OCR smoke succeeded. Keep this PR Draft pending real dictionary-page GUI scanning, manual editing, and PDIC/PPP/save/reopen parity acceptance; do not merge automatically.

Analysis-pixels, OCR coordinates and boundary measurements — 2026-10-24

  • 37519dbb: extracted preprocess/core_analysis_pixels.py and ocr/band_coordinates.py. The legacy processing_core._analysis_image and _adaptive_dark_mask call sites still pass live image normalizer, Pillow and NumPy. The legacy paddle_headwords_core._records_to_canonical_band imports the active LayoutTransform and passes the existing OCRRecord constructor at call time, preserving records, transformed half-open boxes, CJK recovery metadata and parent-box coordinates.
  • 5f63b62f: extracted ocr/boundary_measurements.py (ink ratio, leading lemma box, true-runs, local ROI, running-header cut-off). The old OCR-core functions remain public/patchable with the same signatures and __module__. The header cutoff receives the current historical _true_runs callback.
  • 552bc8c1: updated the internal compatibility audit. Regression tests tests/test_issue562_core_leaf_round9_20261024.py and tests/test_issue562_core_leaf_round10_20261024.py cover geometry modes, preserved OCRRecord model identity, image preprocessing, visible ink and header policy, and public monkeypatch seams.
  • Root package remains exactly 10 physical Python files. No new root shims, relocated persisted classes, sidecar changes, raw cache rewrites, or modifications to crop publish transactions.

Current exact-head CI and OCR smoke are required before considering this batch verified. Even when green, keep PR Draft until independent representative dictionary-page GUI scan/edit/save/reopen checks confirm PDIC/PPP and crop parity.

OCR image-boundary proposal and single-line crop-box extraction — 2026-10-24

  • c79532f0: extracted ocr/image_separator_geometry.py (visual whitespace→ink separator candidates and mutual-nearest OCR-line pairing) and crop/line_box_geometry.py (half-open PIL box clamping and literal-pixel single-line crop geometry).
  • Historical paddle_headwords_core.detect_image_separator_candidates still injects the current ROI, Otsu, contiguous-run and NumPy hooks at call time. Historical processing_core.line_box still passes the current column_index, _source_px and clamp_box hooks. Original callables retain their signatures and __module__.
  • ebe073b5: updated the synthetic line-crop geometry fixture to provide the established column_paths geometry field.
  • 90f3b49c: updated the compatibility audit.
  • tests/test_issue562_core_leaf_round11_20261024.py covers preserved root inventory (10), crop geometry and clamping, monkeypatch parity, synthetic blank-band candidate generation and OCR-line matching. No persisted data classes, raw OCR engine caches, review arbitration or publish transactions moved.

Exact-head CI and three-OS OCR smoke are required on 90f3b49c before marking this batch verified. Earlier 552bc8c1 full CI and OCR smoke completed successfully. Keep PR Draft until an independent real-page GUI scan/edit/save/reopen validates PDIC/PPP and cropped exports. Do not merge automatically.

Four-owner batch: grammar repairs, ordinary layout, fused Entry, marker crop — 2026-10-24

  • 17984901: extracted 7 historical functions into 4 physical leaf modules, without creating any root-file shim:
    • ocr/line_structure_repairs.py: right-side OCR fragments, wrapped POS lines, and multi-row grammar recovery. Historical paddle_headwords_core injects the current parser, overlap, merge, POS, text-strip, OCRLine, NumPy and regex hooks per call.
    • ordinary/auto_layout_policy.py: per-page settings clone and optional measured Layout parameter override, retaining lazy detector imports and original field-switch semantics.
    • ordinary/fusion_entry_mapping.py: combined-mode Entry metadata fusion and refined review candidate Entry creation; passes the original core Entry constructor, preserving model identity and serialized fields.
    • ocr/ordinary_marker_crop.py: memory-only ordinary-marker OCR crop, using existing classification, independent visual head scale, and source-direction-safe crop pixels. Core forwards its live RGB-normalization seam.
  • 541c1fc4 plus 6e491e7f: added two characterization suites (round12_processing and round12_ocr) and fixed the test-only POS regex escape.
  • b4f025ee: updated three historical source-contract tests to check both core delegation and actual code in the new leaf, instead of incorrectly asserting that all crop calculations still reside in the core.
  • 67a0000d: revised multiline grammar test to put its expected POS continuation in an indented position; preserve the production safety guard that never absorbs a new headword at the left edge.
  • Audit: docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md. Core root remains exactly 10 physical Python modules. No pickle-visible class migration, OCR cache/schema changes, or crop output publish transaction changes.
  • Previous CI at 90f3b49c failed only the Windows Python 3.10 runner's Tcl/Tk initialization; 3656 other tests passed. All three OCR smoke platforms passed. Latest exact-head CI/OCR smoke must be checked on 67a0000d before considering this batch green.

Keep PR Draft. Independent real-page GUI layout/OCR, manual editing, crop/export and PDIC/PPP save/reopen acceptance remains outstanding; do not merge or mark ready automatically.

Four additional pure policy leaves — round 13, 2026-10-24

  • 2a453df6: extracted 12 historical callable implementations from processing_core.py and paddle_headwords_core.py into four new owners, while retaining old function names, signatures, __module__, and live public façade patch seams:
    • ocr/visual_rescue_policy.py — accepted one-Han physical-row association, explicit post-lemma grammar evidence, saved Profile v1 vs legacy v0 rescue threshold and strong-edge rescue policy.
    • ocr/peer_typography.py — robust typography center/MAD and diagnostic-only page-local font prototype annotations; does not directly accept rejected OCR candidates.
    • ordinary/review_signals.py — positive-visual veto, single/dual hard-negative consensus, non-selected refined OCR candidate positions in the canonical reading axis.
    • geometry/column_offsets.py — per-column full-resolution pixel offsets and non-crossing column-start ordering; core Geometry / ColumnPath remain original.
  • The old core passes current _median_and_mad, _is_single_cjk_ideograph, _ordinary_visual_rescue_thresholds, column_index_for_click, _source_px, visual-positive check and hard-negative reason set at invocation. Thus public monkeypatches remain live rather than import-time frozen.
  • b22bb190: added tests/test_issue562_core_leaf_round13_ocr_20261024.py and tests/test_issue562_core_leaf_round13_processing_20261024.py, and updated the detailed compatibility audit. Guard coverage includes Profile v0/v1, CJK geometry, peer typography non-acceptance, latent rows, consensus veto and offset bounds.
  • Approx. 19 KB of prior core implementation was relocated across both old files; root inventory remains exactly ten physical Python modules, with no new root shims. No raw OCR cache schema or PDIC/PPP/sidecar changes, crop publishing transaction, GUI or persisted-class relocation.

Full six-platform CI and three-OS OCR smoke passed on the preceding exact-head baseline 67a0000d. The latest exact-head checks on b22bb190 must be reviewed independently before claiming success. Keep PR Draft until representative real-page GUI scan, edit and PDIC/PPP/crop save/reopen validation; do not merge automatically.

Round 14 — geometry construction, user rules, grammar parsing — 2026-10-24

  • 7b8ad625: extracted eight historical functions into geometry/geometry_construction.py and ocr/user_filter_rules.py. All four original nominal/curved geometry entrypoints remain in processing_core, supplying current pixel scaling, column nudges, curved path tracker, image normalization, transform and the original Geometry/ColumnPath model constructors. All four user-rule entrypoints remain in paddle_headwords_core, supplying active aliases, supported kinds, HeadwordFilterRule, parser, matcher and regex module.
  • ef731dde: added regression suites round14_geometry and round14_rules, plus compatibility audit updates.
  • ad44fe68: corrected the geometry fixture to use real, unchanged Geometry.top/bottom rather than non-existent top_y/bottom_y fields.
  • 9c563204: extracted five more memory-only OCR grammar functions into ocr/grammar_tail_parsing.py — morphology cues, parallel bars, whitespace cursor, structured grammar-tail state machine and ordered diagnostic bug tags. Old core forwards its live POS finder, prefix modifier stripper, usage abbreviation inventory, regex module and historical GrammarTailParse constructor.
  • b57aaed4: added grammar characterization tests and extended the compatibility audit.
  • b7f96063: corrected four compiled-regex .match() call sites unintentionally renamed during the grammar-tail extraction; preserves the original variant, closed/open inflection and pronunciation matching semantics.
  • Total round: 3 leaf modules, 13 historical callable implementations (~18.4 KB moved), 3 new regression suites. Package root remains 10 Python files with no root-level compatibility shim. No persisted class moved; PDIC/PPP, raw OCR caches, sidecar schemas, source-coordinate records, crop publish transactions and manual GUI work remain unchanged.

Previous baseline b22bb190 passed all six CI platform/interpreter jobs and three OCR smoke platforms. Check exact-head CI and OCR smoke on b57aaed4 before considering this batch verified. Keep PR Draft, unmerged, until real-page GUI scan/edit/save/reopen and crop/PDIC/PPP acceptance.

Full legacy VB ordinary scan extraction — Round 17 (2026-10-24)

Implementation moved, not just renamed: Five original processing-core functions are now thin compatibility entrypoints into three leaf modules, in addition to the preceding VB point/brightness leaves from Round 16:

  • ordinary/legacy_separator_search.py — complete historical two-stage VB separator search; original high/low whiteness, threshold sweep, centering, fallback reasons and per-call current brightness callbacks.
  • ordinary/legacy_page_detection.py — full-resolution Draw_Auto-style ordinary marker scan plus transform-aware column edge mapping; the original core sends current geometry, source-pixel, SECTION, marker, OCR-refinement and sorting hooks.
  • ordinary/cjk_marker_reconciliation.py — existing OCR-independent oversized CJK split-marker suppression and missing-marker rescue, with the same lazy Paddle public imports and current core callbacks.

Original processing_core / processing callable names and signatures stay unchanged. Root file inventory stays ten. No changes intended to pixel-coordinate serialization, persisted model identities, PDIC/PPP/SECTION or OCR cache formats, crop publish transaction or GUI entrypoints. Dedicated characterization tests: tests/test_issue562_core_leaf_round17_legacy_20261024.py; architecture audit expanded.

Latest Round 17 head: e8b998bb. Do not mark verified until exact-head six-platform CI and three-OS OCR smoke pass; independent dictionary-page GUI ordinary/OCR/combined scan, editing, crop and save/reopen parity remain acceptance blockers. Keep Draft; do not auto-merge.

Round 18 — profile symbol roles, source candidate coordinates and anchor alternatives (2026-10-24)

  • 04ccf516: extracted three substantial implementation owners from paddle_headwords_core.py: ocr/symbol_inventory.py, ocr/source_candidate_coordinates.py, and ocr/review_anchor_variants.py. The original core still exposes the same signatures and historical __module__ values.
  • Profile resolution continues to distinguish entry marker inventory from bracket-open symbol roles, allow saved Project Profile v1 policies, and filter visual marker templates; current core parser/template/family callbacks are passed at call time.
  • Candidate coordinate attachment continues to map private transformed reading-axis positions to original image X/Y without leaking canonical coordinates into saved diagnostics. Review anchor fallback still creates distinct unchecked -rawy alternatives, retaining grouping/ordering and copy-on-write issue lists.
  • Added tests/test_issue562_core_leaf_round18_symbols_20261024.py and tests/test_issue562_core_leaf_round18_coordinates_20261024.py, plus updated docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md.
  • Approximately 10.5 KB removed from the former Paddle core; package root remains 10 physical Python modules, with no new root-level compatibility files. Public/persisted class identities, PDIC/PPP/SECTION and raw OCR cache formats, crop publication and GUI entrypoints remain unchanged.

Acceptance: Latest exact-head six-platform CI and Windows/macOS/Ubuntu OCR smoke on 04ccf516 must be reviewed. Real dictionary-page GUI ordinary/OCR/combined scan, editing, crop, and sidecar save/reopen checks are still required. Keep PR Draft and do not merge automatically.

Round 19 — complete lemma parser and manual review selection (2026-10-24)

  • 5250d14a / fc8bdb6e: moved complete multiscript parse_headword_text implementation to ocr/lemma_parser.py (Latin/POS, numbered headword, Japanese/Kana, Arabic, CJK visual/marker/bracketed/single headword, OCR repair/grammar synthesis). Historical core/public signature and HeadwordParse identity remain, with 16 current call-time callbacks, not frozen imports.
  • 9e8def0b / af76fcd1: moved manual selection sidecar reader, refined-vs-original Y-variant selection, and manual override application into ocr/review_manual_selection.py; keep current path/JSON hooks and unchanged file format/selection semantics.
  • Tests test_issue562_core_leaf_round19_parser_20261024.py and test_issue562_core_leaf_round19_manual_20261024.py, plus extended compatibility audit. About 11 KB further implementation removed from the old Paddle core; package root remains 10 files without new root compatibility stubs.
  • Acceptance: Check exact-head six-platform CI and three-platform OCR smoke for 8507138c before claiming green. Separate real scanned dictionary-page GUI/OCR/manual edit, crop and sidecar save/reopen acceptance remains pending.

Keep Draft, never auto-merge.

Round 19 CI correction + Round 20 POS grammar extraction — 2026-10-24

  • On 8507138c, six-platform CI failed due to one new test's incorrect class-module assertion: production HeadwordParse intentionally remains picture_capture.paddle_headwords_core for pickling. Commit 6c623dc4 fixes the test's expectation and checks exact core.HeadwordParse identity; no production class moved.
  • New module ocr/pos_cue_policy.py takes the actual implementations of _compile_patterns, _strip_entry_modifiers, and _find_pos_cue out of paddle_headwords_core.py. The historical core functions remain with old signatures/module origins and forward current regexp, settings constructor, and patchable modifier callback at call time.
  • Dedicated regression: tests/test_issue562_core_leaf_round20_pos_20261024.py covers POS noise heuristics, Latin-only regex handling, numeric markers, pronunciation exclusions, invalid regex, current core patch callback and original signatures. Architecture compatibility audit updated.
  • Changes do not intentionally alter OCR parsing decisions, model identities, saved caches, manual review records, PDIC/PPP/SECTION, crop output or GUI. Root remains ten physical Python modules.

Latest Round 20 HEAD: bd16c293. Exact-head six-platform CI and Windows/macOS/Ubuntu OCR smoke must be reviewed before claiming green, with independent actual dictionary-page GUI scan/edit/save-reopen acceptance outstanding. Keep Draft, unmerged.

Round 20 CI import fix (2026-10-24)

The first Round 20 CI on bd16c293 failed during pytest collection with NameError: load_dictionary_profile in ocr/pos_cue_policy.py. Root cause: the extraction range unintentionally included five adjacent grammar-tail wrappers plus _BUNDLED_PROFILE / _USAGE_ABBREVIATIONS module globals.

  • 2696eb03: restored all five original grammar-tail wrappers and profile globals to their historical paddle_headwords_core.py locations/initialization order.
  • efe20945: restricted ocr/pos_cue_policy.py to its three intended functions, with no unintended global state.
  • 141822ad: AST regression guard ensuring exact extraction boundaries and original profile initialization.
  • a4e52f32: architecture compatibility audit corrected.

Latest HEAD a4e52f32 still requires exact-head six-platform CI and three-platform OCR smoke. Keep Draft and unmerged.

Round 21 — CJK OCR parser split (2026-10-24)

  • Baseline gate confirmed: prior a4e52f32 succeeded on all six main CI jobs and all three Windows/macOS/Ubuntu OCR smoke jobs.
  • Added ocr/cjk_prefix_parsing.py: configured-symbol eligibility, marker-led CJK+pinyin parsing, and bracketed/open-bracketed CJK/Japanese reading-prefix lemma parsing.
  • Added ocr/cjk_single_lemma_parsing.py: single-character+pinyin OCR recognition, visual HeadwordParse construction and short single-Han variants with radical label exclusions.
  • Moved implementation of six historical functions out of paddle_headwords_core.py, retaining every old function path/signature, active injected collaborator and HeadwordParse persisted class origin. The original core still owns all compiled regex constants and bracket mapping.
  • Added tests/test_issue562_core_leaf_round21_cjk_20261024.py with exact AST extraction boundaries, parsing behavior, class identity and live monkeypatch checks; extended architecture audit. Package root remains 10 Python files.
  • Latest Round 21 head c9c3ea14 needs its own six-platform CI and three-OS OCR Smoke confirmation; GUI real-page scan/edit/crop and PDIC/PPP save-reopen parity still pending. Keep Draft, no auto-merge.

Round 21 CI test correction and Round 22 — OCR column band extraction (2026-10-24)

  • b974aec5: fixed the new test's own monkeypatch assertion order (the old CJK visual constructor's __module__ was accidentally read from a temporary test spy). Production behavior was correct. Prior head c9c3ea14 passed Windows/macOS/Ubuntu OCR smoke but failed the six CI jobs on that test.
  • 4fea4383 / 285b5129: extracted the actual unwrap_column_band original-pixel OCR band implementation to ocr/column_band_sampling.py. The historical core function retains name, exact positional/keyword parameters and live NumPy/PIL/RGB normalizer patch seams.
  • 724e1e11 / a50166dc / 2ef0d57f: co-located the small candidate axis and OCR false-marker helper implementations with existing ocr/source_candidate_coordinates.py / ocr/lemma_parser.py owners; retain original core compatibility facades.
  • 12a3b8ec: regression characterization of pixel-by-pixel curved band strips, page-cache RGB shape checks, transformed crop route, module origins and AST extraction boundary.
  • d1e5e371: compatibility audit. Root remains 10 Python files, no root shim, no intentional change to source coordinates, persisted models, review, OCR cache, sidecars or crop publish.
  • Latest head d1e5e371: check exact-head six-platform CI and three-OS OCR Smoke. Manual real dictionary GUI scan/edit/export and PDIC/PPP save-reopen parity remain release blockers. Keep Draft and do not merge.

Round 22 CI syntax correction — 2026-10-24

The d1e5e371 full CI failed before pytest collection and the architecture change guard reported two malformed function declarations caused by an extraction/edit typo:

  • src/picture_capture/ocr/source_candidate_coordinates.py:73: ndef candidate_axis_v → def candidate_axis_v (59770cdf).
  • src/picture_capture/ocr/lemma_parser.py:287: ndef looks_like_marker_noise_lemma → def looks_like_marker_noise_lemma (2578c5c4).

The three-OS OCR smoke on the failing baseline had succeeded, but full CI had failed at the syntax gate. Only these two declaration keywords were changed; no core behavior, public signature, cache/sidecar/persistent model identity, or crop publishing format was changed. Existing AST/architecture guards should prevent reintroduction.

Corrected HEAD 2578c5c4: exact-head six-platform CI and three-OS OCR Smoke rerun automatically. Keep Draft; do not merge until both succeed and representative GUI page workflows receive independent acceptance.

Round 23 — large processing algorithms moved out of core (2026-10-24)

Baseline 2578c5c4: six-platform CI and three-OS OCR Smoke passed. Round 23 moves three complete implementation owners (approximately 27 KB source moved, approximately 24 KB net decrease in processing_core.py), preserving historical facades:

  • quality/detection_entry_fusion.py: entire ~14 KB ordinary/OCR candidate fusion implementation, ordered assignment, hard-negative/latent review, oversized-CJK suppression and final strict dedup; original core passes 12 current collaborators at call time.
  • geometry/column_path_tracking.py: curved column geometry tracking, adaptive ink mask, stable anchors, smoothing and source-pixel reconstruction; original core passes current constants/helpers and original ColumnPath identity.
  • ocr/ordinary_marker_text_enrichment.py: existing-marker multi-engine OCR text fill (no line-count/X-Y changes), profile/CJK rules, crop and channel reuse, manual protection, stats and only-blank behavior; original core forwards current crop/geometry/sort/text dependencies.

Added tests/test_issue562_core_leaf_round23_large_split_20261024.py with exact AST ownership, API signature, dynamic monkeypatch, basic behavioral and pixel anchor checks; extended docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md. Physical Python root stays 10, no new root shim. Source cache, class identity, project sidecars, crop output and GUI not intentionally changed.

Latest Round 23 HEAD af34d8e1: Require new exact-head six-platform CI + 3-OS OCR Smoke before claiming success. Independent real dictionary scan/edit/crop/PDIC/PPP save-reopen acceptance still pending. Keep PR Draft, do not merge.

Round 23 CI correction + Round 24 six-module batch extraction (2026-10-24)

CI correction: Previous head af34d8e1 failed five legacy source-location assertions: tests still looked for moved fusion / OCR implementation snippets in processing_core.py. Updated all five suites to verify the historical façade and canonical module as a complete chain, still asserting the same entry crop, profile-bracket policy, shared OCR channel and global ordered matching behavior. The 3-OS OCR Smoke on the old head passed.

Six newly extracted algorithm owners (about 12.7 KB net reduction in processing_core.py):

  • detection/page_method_dispatch.py — ordinary/OCR/combined method routing, Profile page eligibility, cached review candidates and sorting.
  • refinement/existing_entry_positions.py — source-pixel Y correction with optional verified ink-top route.
  • ocr/legacy_entry_text_reading.py — per-entry Paddle/Tesseract OCR with Profile-guarded bracket cleanup.
  • crop/illustration_export.py — standalone/associated PPP crop masks, manifest and atomic publish/rollback.
  • crop/illustration_source_bounds.py — transformed source-space top/bottom/margin policy.
  • crop/single_line_export.py — SW crop generation, manifest, stale artifact cleanup and atomic publish.

Every old processing_core function keeps its signature/module identity; its live dependencies are passed at call time, no persisted model classes move. Two new AST/live-hook regression suites: tests/test_issue562_core_leaf_round24_detection_20261024.py and tests/test_issue562_core_leaf_round24_crops_20261024.py. Architecture audit updated. Root stays ten Python files, with no compatibility stubs.

Exact-head CI and 3-OS OCR Smoke must independently pass; real representative page GUI ordinary/OCR/combined scan, editor, export, sidecar save/reopen remain release blockers. Keep Draft; do not merge.

Round 25 — 9 additional OCR/runtime/refinement/PPP/worker functions extracted (2026-10-24)

  • ocr/paddle_engine_lifecycle.py: complete PaddleOCR cached engine factory, eviction and raw-band prediction/coordinate upscaling migrated out of paddle_headwords_core.py; historical core cache identity, signatures and monkeypatch seam remain.
  • ocr/tesseract_subprocess.py: complete Tesseract RGB PNG stdin process and timeout/error mapping.
  • refinement/existing_entry_workflow.py: existing saved-marker Y-refinement orchestration and canonical geometry/source disposal.
  • illustration/ppp_detection_update.py: idempotent AUTO illustration detection update protecting manual PPP polygons.
  • illustration/crop_box_policy.py: original-source polygon bound clipping.
  • crop/spawn_job_owners.py: two spawn-safe WW/PPP worker implementations, retaining core importable target identities and live PDIC/PPP readers/export functions.

9 actual function bodies moved. Old core API signatures and persisted class module identity unchanged. Two regression suites added: tests/test_issue562_core_leaf_round25_paddle_20261024.py and tests/test_issue562_core_leaf_round25_processing_20261024.py. Updated docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md. Package root remains 10 modules, no compatibility shims.

Prior Round 24 head d6fc435f 3-OS OCR smoke succeeded; full CI was still queued at this change. Newest Round 25 head 200bdd3c must independently pass CI and OCR smoke before merge consideration. Real GUI page scan/edit/crop/save-reopen checks still outstanding. Keep Draft and unmerged.

Round 26 — seven source geometry, detection-job and crop-staging functions moved (2026-10-24)

Moved seven complete implementations into four owners:

  • geometry/page_runtime_context.py: source pixel RGB / Profile page template / canonical geometry context.
  • detection/spawn_job_execution.py: spawn-safe ordinary-page marker detection and PDIC commit.
  • illustration/source_detection_jobs.py: image-file illustration detection and background PPP-detection job.
  • crop/image_staging_io.py: clipped source PNG crop, UTF-8 flushed/fsynced manifest staging, crop temporary file creation with failure cleanup.

All existing processing_core functions keep their exact call signatures, module import locations, and call-time monkeypatch callbacks. Full historical models, root inventory (10 Python files), PDIC/PPP/SECTION/crop naming and publishing transaction semantics remain unchanged. The size reduction is modest because explicit compatibility wrappers are retained instead of replacing historical callbacks with frozen leaf imports.

New regression suites tests/test_issue562_core_leaf_round26_page_jobs_20261024.py and tests/test_issue562_core_leaf_round26_staging_20261024.py cover AST owner boundaries, original signatures, live Profile/PDIC/illustration callbacks, pixel-perfect crop dimensions, UTF-8 manifest temp stage, and simulated I/O failure cleanup. Extended architecture audit.

Round 25 head 200bdd3c had passed Windows/macOS/Ubuntu OCR smoke; six-job CI had not completed at start of this batch. Latest Round 26 HEAD 3caa91d1 needs independent 6-job CI and 3-OS OCR smoke. Real dictionary page GUI scan/edit/export/save-reopen acceptance still outstanding; PR remains Draft, do not merge.

Round 26 CI fix + Round 27 pickle-compatible model ownership (2026-10-24)

Round 26 CI root causes repaired: All six CI jobs encountered 14 failures: three delegated deps={{...}} literals caused runtime TypeError: unhashable type: 'dict' in ordinary/OCR dispatch, existing-marker Y refinement and legacy entry OCR. Corrected these to mappings in e2892160. Four older source-location tests were updated to verify both the original façade and relocated owners for auxiliary-line exports, Paddle GPU import timing and shared separator-Y refinement (unchanged behavior requirements). Previous Round 26 three-OS OCR Smoke was fully green, but six-job CI failed.

Round 27 moves eight complete dataclass implementations to:

  • geometry/processing_models.py — ColumnPath, Geometry.
  • crop/plan_models.py — CropRecord, EntryCropPiecePlan, IllustrationCropPlan, PageCropPlan, IllustrationCropEvent, IllustrationSplitResult.

processing_core.py re-exports the identical objects and restores their previous picture_capture.processing_core pickle module identity, without subclassing or changing positional fields, slots/defaults or sequence behavior. New tests/test_issue562_core_leaf_round27_model_compat_20261024.py tests exact AST class ownership, direct class identity, class/object pickle roundtrips, source coordinate transforms, crop plan fields and a regression guard that all former deps={{...}} sites use ast.Dict. processing_core.py shrank approximately 2.9 KB; package root remains 10 physical Python files with no compatibility stubs. Architecture audit extended.

Latest Round 27 HEAD b4e8c9c0 requires its own six-job CI and three-OS OCR Smoke. Real GUI dictionary page ordinary/OCR/combined scan/manual edit/crop/PDIC-PPP reopen parity is pending. Keep Draft and do not merge automatically.

Round 28 — large GUI implementation extraction, 38,806 bytes removed from app.py (2026-10-24)

Four full PictureCaptureApp method implementations relocated with exact historical class method signatures and per-call dynamic patch dependencies:

  • ui/main_appearance_policy.py: full light/dark ttk global-theme setup and PC.* scoped workspace styles (~12 KB).
  • ui/quick_settings_apply.py: full quick-settings validation, Profile pixel/percent conversion, content/OCR/Lens configuration, redraw/persistence (~7.6 KB).
  • ui/detection_batch_execution.py: full ordinary/OCR/combined multi-page batching, CPU/GPU workers, manual PPP flush, per-page PDIC writes, OCR checkpointing, final audit, progress and quality statistics (~21 KB); all relative imports adjusted from root app to canonical ui/ child. The historical PictureCaptureApp._detect_pages is still invoked by existing controllers and passes 20 current app module global hooks at call time.

app.py: 340,021 → 301,215 bytes (net −38,806 bytes) while retaining original method names, keyword/default signatures and Tk side effects. No new root stubs; root physical Python files remain 10.

Updated five earlier architecture/source-location tests to inspect the original app adapter and its new detection-batch owner: ordinary CPU pool, parallel single-writer, forced-refresh resume, combined blank-only OCR and manual PDIC preservation-before-final-audit. Added tests/test_issue562_ui_round28_large_batch_20261024.py to guard exact source ownership, historical APIs, currently patched global dependencies, safe no-project return and critical processing order. Architecture audit updated.

No intended changes to saved pixels, batch CPU/GPU limits, PDIC/PPP/SECTION models, manual edit preservation, OCR cache, file exports or GUI labels. Latest Round 28 HEAD 9477d640 needs new exact-head six-job CI and three-OS OCR smoke, plus independent real GUI scan/edit/crop/save-reopen acceptance. PR remains Draft and unmerged.

Round 28 CI fix + Round 29 — another 23,616 bytes of UI implementations extracted (2026-10-24)

CI repair: Previous head 9477d640 had ~15 failing tests caused by old physical app.py source-location expectations for relocated UI theme, quick-settings, detection batch processing. Corrected each source assertion to test the retained PictureCaptureApp façade and the canonical owner, without deleting theme, source pixel, single-writer, manual PPP, forced-resume or final-audit guarantees. Prior 3-OS OCR Smoke passed.

New Round 29 implementation owners:

  • ui/main_workspace_build.py: the full PictureCaptureApp._build_ui implementation (~15.3 KB), including sidebar, page index, status/progress, source image canvas and event bindings. Old app method/signature remains, forwarding live tk and ttk modules per invocation.
  • ui/settings/interactive_panels.py: complete SettingsDialog._scrollable_settings_page and SettingsDialog._add_check_group (~9.4 KB) for two-panel settings layout, live help text/wrapping/scroll events, contextual check groups. Exact old class methods, kwargs and live Tk/ttk bindings preserved.

app.py further shrank 301,215 → 277,599 bytes (−23,616 bytes), for cumulative −62,422 bytes across Rounds 28–29. Root physical .py file count stays 10, no root shims. New tests/test_issue562_ui_round29_widget_owners_20261024.py characterizes AST ownership, original signatures, patched Tk module seam and widget arrangement. Updated related existing settings and workspace source-owner assertions. Architecture audit appended.

Latest Round 29 HEAD b696e6b7: new exact-head six-job CI and three-OS OCR Smoke must both pass; real dictionary GUI ordinary/OCR/combined scan, manual editing, crop, PDIC/PPP save-reopen parity still outstanding. Keep PR Draft, do not merge automatically.

Round 29 CI source-owner fixes + Round 30 — SettingsDialog form/save and Review styles extraction (2026-10-24)

Previous head b696e6b7: Windows/macOS/Ubuntu OCR Smoke all passed; complete CI failed because ~25 tests still searched the physical app.py for fully relocated widget and Settings help implementations. Updated affected suites to check original app adapter plus canonical ui/main_workspace_build.py and ui/settings/interactive_panels.py, retaining keyboard, page-tree, scroll/wrap, styles and status guards.

Four additional complete methods now physically live in two new owners:

  • ui/settings/field_form_runtime.py: SettingsDialog._setting_widget, _add_setting_group, and full save workflow (field/type/profile pixel conversion, OCR backends, crop constraints, language defaults, font/appearance validation, rule checks, settings/Profile persistence, user-visible error handling).
  • ui/review_style_policy.py: ReviewWindow._configure_review_styles, including dense PCR.* light/dark palettes.

Original public methods and signatures remain in app.py and forward live current globals per invocation. New tests/test_issue562_ui_round30_form_review_20261024.py locks syntax/AST owners, historical entrypoints, patched dependencies and validation/palette behaviors; updated existing color picker and before-mutation test owners. app.py reduces another 16,694 bytes, from 277,599 to 260,905 bytes, totaling about 79 KB removed over Rounds 28–30; root still 10 physical .py modules with no compatibility shims. Extended architecture audit.

Exact latest Round 30 HEAD 7f0609ef requires a fully successful six-job CI and three-OS OCR Smoke before acceptance. Independent real-page GUI editing, scan, crop, PDIC/PPP save-reopen parity still outstanding. Remain Draft, do not merge.

Round 30 CI fix + Round 31 — six GUI runtime/UI implementations extracted (2026-10-24)

At prior Round 30 head 7f0609ef, all three Windows/macOS/Ubuntu OCR Smoke jobs passed. Main six-job CI failed eleven legacy assertions that searched the original app.py for now-relocated settings form/save and ReviewWindow style code. All eleven checks were re-grounded on both the original class method and its canonical owner, preserving the actual page navigation, color picker, settings validation, crop save, locale font and proofreading style policies.

Round 31 moves six complete implementation bodies into four domain owners:

  • ui/background_job_runtime.py: nonblocking _start_ui_worker and _poll_ui_worker_queue, generation safety, close-write synchronization and main Tk callback delivery.
  • ui/quick_settings_sync.py: complete percent/pixel quick settings synchronization, bool/color/Lens and font presentation.
  • ui/paddle_environment_report.py: PaddleOCR/PaddleX/PP-OCRv6 runtime and CPU/GPU/CUDA status reporting.
  • ui/main_action_buttons.py: compact sidebar/footer themed button creation.

The historical PictureCaptureApp method signatures and dynamically patched globals remain; no persisted data class or file format moves. app.py further shrank 9,058 bytes to 251,847 bytes. Package root stays 10 physical .py files with no alias shims.

New tests/test_issue562_ui_round31_runtime_20261024.py tests AST ownership/parser, original signatures, live hooks, worker generation stale-token handling/no worker-thread UI callbacks and exception-safe quick sync. Updated older architecture assertions for worker queue/footer button methods. Detailed architecture audit appended.

Latest Round 31 HEAD 3d49e68a requires exact-head six-job CI and 3-OS OCR Smoke; independent GUI scan/edit/crop/PDIC-PPP save/reopen acceptance still pending. Keep Draft, no merge.

Round 31 CI fix + Round 32 — 40,964 bytes of complete SettingsDialog/ReviewWindow constructors extracted (2026-10-24)

Prior head 3d49e68a: three-OS OCR Smoke all passed; main CI reported only two stale source-location assertions (highlightthickness moved to ui/main_action_buttons.py; worker _ui_worker_close_wait/generation callbacks moved to ui/background_job_runtime.py). Updated these to assert the historical app entrypoints and actual canonical owner, preserving all old safety requirements.

Round 32 relocates the full widget initialization after Tk Toplevel super construction:

  • ui/settings/dialog_initialization.py — ~24 KB Settings Center tabs, Profile/REF/illustration/crop/advanced controls, responsive help/scroll, no-modal-grab, autosave validation/event handlers and close behavior.
  • ui/review_window_initialization.py — ~16 KB Proofreading window workarea geometry, state and reference/online badges, digit replacements, review sizing and queued/prefetched rendering, widget build and after-idle alignment.

SettingsDialog.__init__ and ReviewWindow.__init__ remain in app.py, keep original signatures and invoke the same original zero-argument super().__init__(parent) before delegation, preventing any Tk MRO/initialization change. All original app module helpers/modules/constants are supplied dynamically per call. No persisted model class or project format moved, and physical root remains 10 .py files without new shims.

app.py decreases 251,847 → 210,883 bytes (net −40,964 bytes). New test tests/test_issue562_ui_round32_window_init_20261024.py checks AST, signatures, real Tk super-before-delegate order with no-display doubles, dependency wiring, Settings auto-save and modeless protections, and Review compact workarea/after-idle. Corrected previous constructor source-location tests including eleven detailed ReviewWindow invariants. Architecture audit updated.

Exact Round 32 HEAD must pass six CI matrix jobs and Windows/macOS/Ubuntu OCR Smoke independently, plus physical GUI scan/edit/PPP-PDIC/export/save-reopen acceptance before merge. Keep Draft and unmerged.

Round 32 post-extraction test audit (latest 81d1a9b7): Canonical constructor-owner checks added to existing SettingsDialog, compact ReviewWindow and eleven original ReviewWindow UX behavior tests in test_core.py; two remaining source guards for Settings Center color/display options and focused review variables corrected. All cross-platform OCR Platform Smoke jobs on this exact head passed (Windows, Ubuntu, macOS). Main six-job CI is running; do not treat the earlier smoke pass as a full CI pass. Manual real-page GUI acceptance is still required. No merge.

Round 33 — main app startup + theme refresh, and CI/GUI repairs (2026-10-24)

Large owner extraction: moved full post-tk.Tk.__init__ main-window startup implementation to ui/main_app_initialization.py, and full dynamic resolved-appearance refresh to ui/appearance_resolution.py. Historical PictureCaptureApp.__init__ and _apply_resolved_appearance stay callable with their exact signatures; real Tk superclass construction precedes startup delegation. App-module globals and packaged app_icon.png resolution remain call-time bound. The app.py source net reduction is approximately 18.2 KB in Round 33, with two new physical canonical owners and no new root stubs (root remains 10 files). New tests/test_issue562_ui_round33_app_startup_20261024.py checks true AST ownership, superclass ordering, live dependencies, and refresh wiring.

CI repairs: 6548b923 fixes missing ReviewWindow class-constant references and updates stale Round-32 source-location expectations. f2ebece7 restores live PageListGrid/PageThumbnailController/context-menu injection to the previously extracted workspace builder, discovered by real GUI startup smoke. a1216b2d and fdcc891f update affected Round-33 test contracts to inspect both original compatibility delegates and canonical owners. 3e2e7bc9 fixes the old SettingsDialog constructor's missing LATIN_ORDER dependency discovered by real GUI construction smoke; constant and settings/persistence policies remain unchanged. No production format/schema migration or physical root move.

Latest exact-head: b8da84c92ac5fa9b9f1295a0afc760dc858d1e6f. The three-OS OCR Platform Smoke #40083183559 succeeded. The exact-head six-platform CI #40083183557 succeeded, including all six OS/Python jobs (Ubuntu, macOS, Windows at Python 3.13 and 3.10), architecture/F821 guards, GUI construction smoke, compatibility checks, and wheel build. 6a649a31 and b8da84c9 repaired annotation-only F821 references in relocated main/review initialization owners without introducing imports from app.py. Canonical src/picture_capture/*.py root file count remains 10. The documentation-only architecture job is intentionally skipped by the risk-tier classifier.

Acceptance remains: representative real dictionary-page GUI ordinary/OCR/combined scan, manual PDIC/PPP edit/save/reopen and crop/export parity. Keep Draft and unmerged.

Round 34 — Profile Wizard large module extractions (2026-10-24)

This is the same Draft PR and branch, now carrying another substantial physical implementation reduction in the oversized profile/setup.py module:

  • profile/wizard_state_initialization.py now owns the complete original ProjectProfileWizard._build_vars (~13.3 KB).
  • profile/wizard_tab_builders.py now owns the original _build_template_tab (~7.1 KB) and _build_headword_tab (~17.8 KB).
  • profile/setup.py net source reduction ~35.7 KB, retaining original method names, annotated signatures, widget behavior and per-call live Tk/settings/reading/headword dependencies. No root shims or root deletions: physical root still 10 modules.
  • tests/test_issue562_profile_wizard_round34_20261024.py asserts historical compatibility delegates, canonical AST implementations, callback order, widget roles and live dependency injection.
  • Four previous source-location assertions in tests/test_next_stage_regressions.py now check both original wizard compatibility method and relocated owners without weakening actual CJK bracket/marker policy, page template nudging, settings/persistence and labels. A new owner F821 check identified recommended_headword_structures and commit 39902fbb explicitly restores it through call-time injection.

Latest Round 34 HEAD: 39902fbbfdb06001de413d7310044620522d9821. Exact-head six-platform CI #40087415895 completed SUCCESS (Windows/macOS/Ubuntu on Python 3.10 and 3.13; Risk-tier CI gate passed). Exact-head three-OS OCR Platform Smoke #40087415931 completed SUCCESS. Ubuntu Python 3.13 pytest: 3,793 passed, 3 skipped, and GUI construction, F821 and wheel checks passed. Earlier Round 34 a47910bf OCR smoke passed, while CI exposed stale source-contract checks; the follow-up 88710f72 fixed those and isolated one missing free-name injection.

Independent real scanned dictionary GUI, Profile Wizard visual controls, manual editing, crop output and PDIC/PPP save/reopen parity remain outside automated proof. Keep Draft; do not merge automatically.

Round 35 — Profile Wizard preview/settings/diagnostics physical extraction (2026-10-24)

Same Draft PR and branch. Extracted four substantial canonical implementations out of profile/setup.py, with a net ~24.9 KB source reduction (from 135.5 KB to 110.2 KB on the same branch):

  • wizard_template_preview.py: historical _refresh_template_preview with background PIL/decode worker, immutable preview state snapshot and UI-thread Tk photo rendering unchanged.
  • wizard_settings_assembly.py: historical _settings_from_ui with original Profile defaults, column adjustments, CJK bracket-versus-entry-marker guard and visual sample serialization unchanged.
  • wizard_workspace_builder.py: historical _build_right_image_workspace and all three Wizard sample/validation UI callbacks unchanged.
  • wizard_validation_diagnostics.py: historical static _validation_coverage_summary retaining raw OCR/headword diagnostic fields, alerts and calculated coverage.

Legacy ProjectProfileWizard names, annotated signatures and public access paths remain on the original class. The canonical owner calls receive current live module dependencies, with annotation-only Tk ttk.Frame referenced in TYPE_CHECKING to preserve F821 correctness. No root compatibility shim or changed settings/PDIC/PPP/OCR formats. Physical root Python file count remains 10.

Test coverage added in tests/test_issue562_profile_wizard_round35_20261024.py for owner AST and live dependency compatibility, background/UI-thread handoff and important headword decision constraints; prior appearance, worker-concurrency and profile source-location contracts were reanchored onto their actual owner modules, retaining semantic assertions.

Verified exact-head a371169161c4b66bf6592ed2bcdee483ac6388cb: six-platform CI #40088536160 SUCCESS (Windows/macOS/Ubuntu, Python 3.10/3.13, risk-tier gate success); exact-head three-platform OCR Platform Smoke #40088536138 SUCCESS. Ubuntu Python 3.13 reported 3,797 passed, 3 skipped, GUI construction smoke OK, F821 all passed and wheel built. Documentation-only job skipped as intended for its risk tier.

Keep Draft and unmerged. Human review of real dictionary image Profile Wizard ordinary/OCR/combined runs, PDIC/PPP manual changes/save/reopen, crop/export parity remains outstanding.

Round 36 — Multi-page Profile Wizard OCR validation extraction (2026-10-24)

Physically extracted six complete Profile Wizard implementations from profile/setup.py into three canonical validation modules. The legacy module has decreased to ~92.2 KB (from ~110.2 KB at Round 35), a further ~18 KB physical file reduction, without introducing root compatibility stubs. Root src/picture_capture/*.py count remains 10.

  • profile/wizard_validation_execution.py: ProjectProfileWizard.validate_profile, including project/indices/settings snapshots, forced PaddleOCR refresh, explicit OCR cache path, cooperative stop event, wait_on_close=True, and UI-thread done/failed callbacks.
  • profile/wizard_validation_controls.py: _build_validation_tab and _apply_validation_feedback, keeping CJK/Latin/numbered/marker-specific tuning and 0/±2 guardrails.
  • profile/wizard_validation_visuals.py: static _marker_preview, _render_validation_result and _finish_validation; translucent RGBA masks drawn onto RGB, themed Tk photos on UI thread, status and revision validity unchanged.

Original ProjectProfileWizard class and method/static signatures remain at profile.setup and delegate via live dependencies. No changes to PDIC/PPP schemas or save logic. Added tests/test_issue562_profile_wizard_round36_20261024.py for legacy entrypoints, live globals, worker snapshot/cancellation, translucent overlay and feedback safety. Reanchored existing dark mode/concurrency/mask source checks to new canonical implementations without weakening behavioral expectations. Architecture audit updated.

Exact-head validation a9e92ce0575daa04dbb4ca4f326115e6ddd809a2: six-platform CI #40089927238 SUCCESS (Ubuntu, macOS, Windows × Python 3.10/3.13; risk-tier gate succeeded); three-OS OCR Platform Smoke #40089927245 SUCCESS. Ubuntu 3.13 pytest: 3,802 passed, 3 skipped; GUI construction smoke OK, F821 passed and wheel built. The documentation-only check was intentionally skipped by risk-tier classification.

PR remains Draft and unmerged. Real photographed/scanned dictionary-page Profile Wizard ordinary/OCR/combined operation, manual PDIC/PPP modification/save/reopen and crop/export parity still require independent human validation.

Round 37 — Profile Wizard representative-page thumbnail and layout analysis owners (2026-10-24)

Extracted 13 complete methods from profile/setup.py into two coherent leaf owners while keeping all original ProjectProfileWizard method names and signatures with call-time live dependency passing:

  • profile/wizard_sample_thumbnails.py: representative thumbnail grid/loading; full-set off-thread decode, per-slot off-thread replacement and queue polling, main-thread Tk photo rendering, and manual picker. Slot replacement still decodes only the selected image, keeps siblings intact, and avoids refreshing an invisible template preview. Load-generation guards and closure cancellation are retained.
  • profile/wizard_sample_analysis.py: multi-page background layout analysis, queue polling, revision-guarded aggregation, conservative ink-height suggestion and explicit/qualified automatic application. Input paths, settings and indices are snapshotted before workers; stale results are rejected.

The class owner profile/setup.py is now 78,538 bytes, versus 92,202 bytes after Round 36 (approximately 13.7 KB smaller, with ~13.1 KB net Python source character reduction). The src/picture_capture root still has 10 Python modules. No new root shims, crop/PDIC/PPP format mutations or OCR schema changes.

New tests/test_issue562_profile_wizard_round37_20261024.py checks 13 compatibility delegates, parameter signatures, live dependency seams, snapshot workers, token/generation guards, per-slot changes and Tk/main-thread rendering. Existing next-stage and verified ink-height tests were updated to check the new canonical owner behind original wrapper calls, without dropping the established invariants. Architecture audit updated. First CI identified a multiline signature formatting issue, fixed in 180c0f26; the next run exposed three stale source-location tests, fixed in the final HEAD c618c7a3e48aaa7056375b251ed672ba159bf861.

Exact-HEAD results: six-platform CI #40091030636 SUCCESS (Ubuntu/macOS/Windows, Python 3.10 + 3.13; risk-tier CI gate SUCCESS), and OCR Platform Smoke #40091030616 SUCCESS across three OS. Ubuntu Python 3.13: 3,806 passed, 3 skipped, GUI construction smoke OK, ruff F821 all passed, wheel successfully built. Documentation-only architecture job intentionally skipped by risk tier.

Keep PR Draft and unmerged until real dictionary scans pass ordinary/OCR/combined manual GUI verification, editing and PDIC/PPP save/reopen, plus crop/export parity checks.

Round 38 — Wizard shell, reading/OCR controls and headword explanations (2026-10-24)

Physically extracted 12 additional ProjectProfileWizard methods from profile/setup.py into three canonical owner modules, reducing the legacy class source from 78,538 bytes after Round 37 to 60,200 bytes (about 18.3 KB less on disk, ~17 KB net Python source character reduction):

  • profile/wizard_shell_builder.py: _build_ui, _apply_initial_pane_split, _apply_left_wraps, _show_right_image_page, _on_wizard_tab_changed. Four-tab setup, initial 40:60 left/right pane split, resize text wrapping, and tab-specific representative/preview/validation views remain unchanged.
  • profile/wizard_reading_controls.py: _build_reading_tab, _build_language_section, _body_page_range_changed, _refresh_language_summary. Dictionary identity and body-page range UI, reading mode, OCR/index/content-language hints, and body-range resampling/revision invalidation remain unchanged. Legacy keyword-only row signature preserved.
  • profile/wizard_headword_explanations.py: _refresh_headword_description, _refresh_headword_structure_summary, _refresh_headword_specificity_visibility. Latin/CJK layout guidance, classic headword example image handling, tail evidence summary and selective panel visibility unchanged.

Original public ProjectProfileWizard class/method paths and annotated signatures remain in setup.py, forwarding live module-level dependencies to the physically relocated owners on each invocation, including image theme and example-path globals. __init__, data storage and save/restore logic intentionally remain at their previous owner; no new root compatibility stubs, changed OCR or PDIC/PPP formats. Root Python module count still 10.

Added tests/test_issue562_profile_wizard_round38_20261024.py (AST owner/legacy signatures; dynamically monkeypatched delegates; 40:60 panes/four tabs; OCR language/revision behavior; CJK/headword guidance) and reanchored existing next-stage, appearance and illustrated-layout source checks without weakening their original semantics. Architecture audit updated. First CI identified two stale source-location assertions, fixed in 69580329; the next CI revealed four missing live example/theming dependencies in the extracted headword owner, fixed and regression-covered in exact HEAD 24d7808088e0496a97d4f1e0fe1959893aba662a.

Exact-head validated: CI #40092554677 SUCCESS across 6/6 OS/Python matrix (Windows/macOS/Ubuntu × 3.10/3.13), Risk-tier CI gate SUCCESS; OCR Platform Smoke #40092554666 SUCCESS. Ubuntu Python 3.13 pytest 3,811 passed, 3 skipped; GUI Smoke OK, ruff F821 passed, wheel built successfully. Docs-only check intentionally skipped by risk classification.

Keep Draft and unmerged. Manual real dictionary-page ordinary/OCR/combined GUI verification, page/template controls, image thumbnails, and PDIC/PPP save/reopen, crop/export parity are still outstanding.

Round 39 — Profile save workflow, revision events and visual marker owners (2026-10-24)

Physically extracted 25 complete methods from profile/setup.py to three new canonical owner modules, with all historical ProjectProfileWizard method names and argument signatures retained as thin compatibility delegates with call-time dependency passing:

  • profile/wizard_persistence.py (5 methods): draft versus finalized settings/profile save, navigation/step-save, confirm-and-close, close-with-autosave, validation cancellation and optional runtime redraw. Preserves the original copy_settings, settings_path, write_project_profile, project_profile_path, sync_quick_settings, messagebox and PROFILE_SETUP_VERSION semantics.
  • profile/wizard_profile_events.py (14 methods): reading/headword/profile change revision tracking, invalidation of stale page-validation results, structure/tail/symbol defaults, specificity, CJK role normalization, OCR language changes and human-readable tuning states.
  • profile/wizard_visual_markers.py (6 methods): configured symbol inventory descriptions, image-page visual marker capture, sample replace/deduplicate, versioned sample JSON serialization, listing and clear with confirmation.

profile/setup.py is now 50,216 bytes, down from 60,200 bytes after Round 38 (about 10.0 KB physical reduction); root src/picture_capture/*.py count remains 10. No new root shims and no changes to PDIC/PPP output schemas or OCR model behavior. ProjectProfileWizard.__init__ still owns widget lifecycle.

Added tests/test_issue562_profile_wizard_round39_20261024.py to characterize 25 AST delegations, signature preservation, live dependency globals, profile save semantics, illustrated-mode gate, symbol sample serialization, and validation invalidation without a Tk root. Updated existing long-form source-location regression checks, plus the specific illustrated-mode guard test to assert its new physical owner, retaining its original safety condition. Architecture audit updated.

Exact-head validation 7cc6420f0aecf1261a41f71cc62f56ca6d3d1e80: CI #40094407661 SUCCESS (all six Windows/macOS/Ubuntu × Python 3.10/3.13 combinations; risk-tier gate SUCCESS), OCR Platform Smoke #40094407627 SUCCESS across three OS. Ubuntu 3.13 3,817 passed, 3 skipped; GUI Smoke passed; ruff F821 passed and wheel built successfully. Docs-only CI was intentionally skipped by risk classification.

PR remains Draft and unmerged. Independently check real scanned dictionary-page ordinary/OCR/combined GUI operation, Profile edits, PDIC/PPP save/reopen, and crop/export parity before marking ready.

Round 40 — Wizard lifecycle bootstrap and template column interaction ownership (2026-10-24)

Extracted 13 additional complete implementation bodies from profile/setup.py into two leaf owners, with original user-facing ProjectProfileWizard paths, signatures, and UI logic preserved:

  • profile/wizard_bootstrap.py owns the post-superclass initialization: parent project and settings snapshots, centered screen/work-area geometry, close protocol, per-slot queues, photo caches, validation stop/event flags, revision state, representative selection and delayed full thumbnail decode. The real super().__init__(parent) remains in ProjectProfileWizard.__init__ for Tk Toplevel/MRO semantics. Legacy new_project remains keyword-only. Original helpers are passed through live class-module globals at call time; nothing runs in a background thread before the original after(20, ...) call.
  • profile/wizard_template_interactions.py owns 12 column/template methods: selection and per-column pixel offsets, adjustment status and UI highlight, cached canvas line-only nudge and reset, static nearest-line distance, click selection, template header/footer/side controls and representative template page navigation. Keeps 0.1% column-width shift and 25% offset cap, without refreshing/decompressing images on each incremental edit. _preview_path_distance_sq remains a @staticmethod on the historical class wrapper.

The profile/setup.py Git blob shrank from 50,216 bytes after Round 39 to 42,538 bytes, a 7,678-byte physical reduction (~7.6 KB source-character net reduction). Root src/picture_capture/*.py still has 10 Python modules, no root shims, new data formats, OCR model changes or persistence schema changes. tests/test_issue562_profile_wizard_round40_20261024.py adds unit-level checks for superclass-first initialization, live dependency injection, legacy method signatures/ownership, geometric distance, exact pixel offset changes and reset behavior, and conditional template controls without a Tk root. Existing source-inspection regression tests updated to assert the new physical owners. Architecture audit updated. The first CI run identified two stale/misleading test source assertions (window centering location and docstring containing literal superclass text); these were repaired without changing implementation in final HEAD 1982df58b5ed50ab65843fb258117418f2ace70f.

Exact HEAD CI evidence: CI #40096082502 SUCCESS (Windows/macOS/Ubuntu × Python 3.10/3.13, 6/6 jobs, risk-tier gate SUCCESS), OCR Platform Smoke #40096082501 SUCCESS across three OS; Ubuntu 3.13 3,823 tests passed, 3 skipped, GUI construction smoke succeeded, ruff F821 succeeded and wheel built. Docs-only architecture check skipped intentionally under risk classification.

Keep this PR Draft and unmerged, pending real photographed/scanned dictionary-page manual checks for Wizard and ordinary/OCR/combined workflows, PDIC/PPP save/reopen and crop/export equivalence.

Round 41 — Root training_export v2 page exporter physically migrated (2026-10-24)

Following Round 40, began explicitly migrating remaining root package business logic, rather than only shrinking profile/setup.py. The complete export_training_page v2 annotation staging implementation (PDIC/PPP ground truth, OCR cache/candidates, source X/Y coordinates, page layout and file copy) moved from src/picture_capture/training_export.py to the canonical src/picture_capture/training/export_page_v2.py owner. The root import module remains an intentional stable facade with unchanged export_training_page(page, project_root, settings, staging_root, page_index) signature and call-time forwarding of 20 global bindings (including patchable _candidate_ground_truth_link) so that existing callers, patches and static v3 composition keep working. Manifest/ZIP publication and cancellation exception identities remain untouched. The physical root file decreased 9,723 → 2,972 bytes (6,751 bytes, ~69% reduction); owner is 9,629 bytes. Root Python module count stays 10 pending compatibility ABI audits; historical architecture guard explicitly requires the training_export facade to remain, so no fake root-file deletion or new root shim was introduced.

Added tests/test_issue562_training_export_page_v2_round41_20261024.py to verify unchanged import/API and composed v3 identities, live monkeypatch propagation, and a generated-image v2 export of saved PDIC/PPP, OCR review candidates/manual selection, template exclusion geometry and source-pixel coordinates. Existing alpha-safe RGB normalization source-location check now asserts the physical owner and legacy delegate without weakening the invariant. Architecture audit updated.

Exact HEAD 4a804f8e847d37bbde45504e1cce42e3564d3333: CI #40101069851 SUCCESS, all 6/6 Windows/macOS/Ubuntu × Python 3.10/3.13 matrix and risk-tier gate; OCR Platform Smoke #40101069843 SUCCESS on 3 OS. Ubuntu Python 3.13: 3,826 passed, 3 skipped; GUI smoke, F821 checks and wheel build succeeded. Documentation-only check skipped by risk classification.

Keep PR Draft and unmerged. Real scanned/photographed dictionary-page testing of ordinary/OCR/combined, GUI, PDIC/PPP save/reopen and crop/export remains mandatory for manual acceptance.

Round 42 — Processing facade's real Layout/ordinary implementations migrated (2026-10-25)

Physically moved three complete algorithm bodies from root processing.py into two responsibility-bound owners:

  • layout/current_page.py:understand_page_current: optional illustration mask, trace and replay evidence, Layout-only/composed dispatch, fail-open/fail-closed policy, temporary image lifetime.
  • ordinary/layout_roles.py:materialize_layout_role_entries and ordinary_vb_fallback: final Layout-role Entry creation, source-coordinate and Y refinement, classification metadata and emergency VB fallback. The historical processing call signatures and call-time patchable Entry/refinement/detector/filter/sort seams remain.
  • No model/pickle identity, OCR cache, PDIC/PPP/SECTION schema, Tk dispatch, public processing import or GPU worker ownership was changed. No new root shim.

Verified Git tree at exact HEAD 4b382f434d812af6cdcc7751a8c2b728e4d5967a: root direct Python files 10 → 10, aggregate root Python bytes 449,419 → 444,564 (−4,855 bytes); processing.py 41,760 → 36,905 bytes. New owners are 4,508 and 3,506 bytes. Added tests/test_issue562_processing_layout_owner_round42_20261025.py and updated six existing source-owner tests to check actual moved implementations, without removing their behavioral guards. Architecture audit and root classification updated.

First exact-head CI exposed two stale source-location assertions, not algorithm failures (3,828 tests passed); corrected them and reran. Final exact HEAD 4b382f434d812af6cdcc7751a8c2b728e4d5967a: CI #40112805630 SUCCESS, 6/6 Windows/macOS/Ubuntu × Python 3.10/3.13, risk-tier gate, Tk GUI smoke, wheel and F821; Ubuntu 3.13 3,830 passed / 3 skipped. OCR Platform Smoke #40112805656 SUCCESS, Windows/macOS/Ubuntu 3/3. Exact-head CodeQL Python/Actions SUCCESS; documentation-only check intentionally skipped. No unresolved PR review threads at this checkpoint.

Remain Draft; do not merge or mark Ready. Independent representative scanned dictionary-page GUI checks of ordinary/OCR/combined, Profile, PDIC/PPP save/reopen, and crop/export parity remain NOT DONE. Next: continue root processing.py/core and profile/setup.py physical business-logic extraction with characterization tests.

chigre commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Exact-head acceptance checkpoint — root image_utils migration

  • HEAD f5ce2e3e7921fa4b7001069dbad633b7c4510683
  • Exact-head full CI #39992668474 completed: SUCCESS. All six Windows/macOS/Ubuntu Python 3.10/3.13 jobs passed, including Tk smoke, architecture policy, compatibility, F821, wheel and final risk-tier gate; Python 3.13 Ubuntu 3,595 passed / 3 skipped.
  • Exact-head CodeQL #39992662480 completed: SUCCESS for Python and GitHub Actions.
  • Physical package-tree count 15 → 14, with no src/picture_capture/image_utils.py and canonical preprocess/analysis_image.py present. Pixel helpers remain physically owned by preprocess/page_pixels.py. Original tight facade byte-size ratchets unchanged.
  • Three CI rounds were addressed as targeted repairs: shorter direct pixel imports to stay inside original byte thresholds, retained legacy pixel tests migrated to canonical imports, and root inventory assertion 15→14. No original pixel parity test suppressed.
  • Outstanding, keep Draft: independent code review and real dictionary-scan/PDIC parity on representative pages. The retired picture_capture.image_utils path is a documented Python source import migration for third-party callers, not a transparent compatibility preservation.

@chigre chigre changed the title refactor(#562): retire root image_utils and move shared analysis into preprocess refactor(#562): cut root modules 15→12 with preprocess and classification owners Oct 23, 2026

chigre commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Exact-head acceptance after continuation (2026-10-24)

HEAD 79d05c9ae598278464dbcbd9c52fefba07b9b768, same Draft PR #663. Root direct-Python inventory 15 → 12, confirmed against Git tree, no root stubs:

  • Retired image_utils.py → preprocess/analysis_image.py
  • Retired image_preprocessing.py → preprocess/pipeline.py
  • Retired entry_classification.py → proofreading/classification.py

All original pixel coordinate semantics, classification registry and JSON-v1 sidecar locking, and persistent preprocessing model types stay owned in canonical modules. All tracked production/script/test imports were migrated; AST architecture guard rejects executable old imports, root guard now ratchets ≤12. No historical data schema or size threshold changed.

Exact-head checks ALL GREEN:

  • CI #39997251458: completed success, all 6 Windows/macOS/Ubuntu Python 3.10/3.13 tasks passed, architecture, Tk smoke, package wheel, compatibility, final risk-tier gate; Ubuntu 3.13 3595 passed / 3 skipped.
  • CodeQL #39997244908: completed success, Python + Actions.

training_export.py intentionally remains because the existing ZIP exception/callable are serialized under explicit picture_capture.training_export pickle identity, verified in regression tests; removing its module would cause legacy unpickle breaks unless a separately validated lazy compatibility mechanism is introduced. Do not replace with a cosmetic root shim.

PR remains Draft / not merged, with no completed independent code review and no real scanned-dictionary-page or manual edit/sidecar save-reopen parity acceptance performed. External Python callers using the three retired module paths require import migration. Issue #562 remains open.

@chigre chigre changed the title refactor(#562): cut root modules 15→12 with preprocess and classification owners refactor(#562): reduce root Python files 15→10 with canonical bootstrap owners Oct 23, 2026

chigre commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

#562 root-file audit continuation — PR #663, 15 → 10 (2026-10-24)

Extended the same Draft PR #663, exact HEAD 92c9f7e63770c357acb8c567c77375733e555e76, by physically moving two additional root files:

  • picture_capture.cli → picture_capture.bootstrap.cli: pyproject.toml entry now targets canonical module; installed picture-capture-cli command name, arguments and core-service bootstrap remain unchanged. picture-capture GUI command, python -m picture_capture and run.py remain unchanged.
  • picture_capture.launcher → picture_capture.bootstrap.launcher: same lazy prepare/main forwarding, no root compatibility stub. External direct Python import users must update.
    Root Git tree verified 10 Python files, no former image_utils.py, image_preprocessing.py, entry_classification.py, cli.py or launcher.py; five physical owners exist in their canonical subpackages. Root count architecture ratchet now ≤10. Added direct canonical CLI/launcher tests, parser/installed console-script verification, runtime forwarder and root absence tests.

Exact-head checks: 6-platform CI #39999364650 completed success (including final Risk-tier CI gate, GUI smoke, wheel/compile/compat); CodeQL #39999359484 completed success (Python/Actions); OCR platform smoke #39999364561 completed success on Windows, macOS and Ubuntu.

Audited remaining root: __init__/ __main__ package entry; app.py native Tk GUI ABI; models.py persisted model classes; ocr_channel.py OcrChannel* pickle identities; paddle_headwords.py / processing.py dynamic core assignment-mirror public surfaces; paddle_headwords_core.py / processing_core.py live patch seams and legacy core compatibility; training_export.py explicit historic ZIP callable/exception pickle identities. Do not mechanically retire these without an import/pickle/monkeypatch compat strategy and code review.

PR remains Draft / unmerged, pending independent review and actual scanned-page/sidecar GUI parity. Issue #562 remains open.

chigre commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

2026-10-25 — Round 43: physical Profile policy + ordinary trace extraction (Draft PR #663)

Exact PR HEAD: 3df485fb57e8943c92e56a64f3540bfe777069b5 (implementation commit 291a13f18ff0b759066fb1298ad8f7451385d416; source-contract test repair 3df485fb57e8943c92e56a64f3540bfe777069b5). PR #663 remains open / Draft / unmerged; no Ready transition.

  • Physically moved the Profile Wizard OCR-language/label catalog and actual CJK bracket/entry-marker normalization + capture-role precedence algorithms out of profile/setup.py into profile/wizard_catalog.py. Historical setup names, mapping object identities, parser and bracket-role monkeypatch hooks are retained through call-time injection. profile/setup.py 42,538 → 38,438 bytes (−4,100).
  • Physically moved read-only Layout replay stage provenance (added/removed marker snapshots) from root processing.py into ordinary/debug_stage.py. Historical processing._record_ordinary_debug_stage remains the exact imported callable and can be patched at runtime. processing.py 36,905 → 35,448 bytes (−1,457).
  • Git tree root Python inventory 10 → 10, root bytes 444,564 → 443,107 (−1,457). No root shim added. New focused regression tests/test_issue562_profile_catalog_debug_stage_20261025.py covers CJK role precedence, sample immutability, live parser injection, physical ownership, read-only trace deltas and facade patch seam. Updated existing Profile Wizard source-contract test to include its canonical physical owner, without dropping its content assertions. Updated docs/architecture/ROOT_MODULE_CLASSIFICATION_20261023.md.
  • Initial CI exposed a source-location-only assertion looking for headword_example_1.png inside the former setup.py source; repaired by including wizard_catalog.py in that contract. No runtime algorithm workaround or test suppression.

Verified exact-head CI: CI #40117087240 completed SUCCESS, all six Windows/macOS/Ubuntu × Python 3.10/3.13 jobs, final risk-tier gate, Tk smoke, wheel/compat; Ubuntu 3.13 3,834 passed / 3 skipped. OCR Platform Smoke #40117087259 SUCCESS 3/3 (Windows/macOS/Ubuntu). PR #663 CodeQL run #40117084567 SUCCESS, Python + GitHub Actions analysis.

Not accepted manually: real scanned-dictionary-page GUI ordinary/OCR/combined flows, Profile interaction, PDIC/PPP save/reopen, and crop/export format parity. Independent code review also remains pending. Keep Draft and Issue #562 open; continue physical extraction of remaining large root/core and profile/setup.py modules.

chigre commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Round 46 large-batch physical extraction (2026-10-25)

Continued existing open Draft PR #663 (refactor/562-retire-root-image-utils-20261024), with no merge/Ready conversion.

Physical implementations moved (15 methods/functions):

  • Root ocr_channel.py → ocr/channel_preparation.py (3 algorithms: language/Otsu/OCR pixel preparation) and ocr/channel_results.py (4 algorithms: payload normalization/records/rescaling/candidates).
  • Root models.py → project/page_discovery.py (4: cover recognition, cover path, scanned pages and natural ordering).
  • profile/setup.py → existing profile/wizard_validation_controls.py (4 Tk queue/feedback/fit/preview handlers; still run on the original main event loop).
  • Retained historical public call signatures, current monkeypatch dependencies, OCR source coordinate boxes, class/pickle identities and PDIC/PPP/SECTION/export schemas. Focused characterization tests: tests/test_issue562_ocr_channel_project_profile_round46_20261025.py. Updated both architecture audit and root classification documents.

Measured exact Git-tree before/after (d9f1b669 → final HEAD 07a2bf7eef66e766d173bfbc9811f6825b6c5c4b): 10→10 root Python files; root total 440,326→433,797 bytes (−6,529); ocr_channel.py 29,327→24,072; models.py 49,088→47,814; profile/setup.py 37,400→36,804 bytes (Profile not a root file).

Commits: 84837b1 algorithm extraction; 025094e Profile, tests, docs and legacy identity test isolation; 333f2a3 type-only annotation visibility; 07b9e36 cross-platform cover case test; 07a2bf7 Otsu annotation fix.

Verified on exact final HEAD: CI #40127156204 SUCCESS, Ubuntu/Windows/macOS × Python 3.10/3.13 6/6, Ubuntu 3.13 3,847 passed, 3 skipped; OCR Platform Smoke #40127156175 SUCCESS 3/3. Existing Round45 stale-source assertion and in-process monkeypatch identity test were addressed; no tests removed or guards relaxed. A new exact-head CodeQL run is not in the current workflow list, so do not label CodeQL as verified for this SHA.

Pending: independent code review; actual scanned dictionary-page GUI ordinary/OCR/combined workflows; Profile interactive behavior; PDIC/PPP save/reopen and crop/export byte/format parity. These require representative real pages and remain manual acceptance outstanding. Keep PR Draft, open, unmerged.

chigre commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Root-retirement Phase 1 — physically move main GUI algorithms (2026-10-25)

Executed on existing open Draft PR #663 (no merge or Ready).

Our initial commit 33a298fe13665f4753e088e292c896e2f9b7a85e physically moved 19 complete algorithms out of the ~194KB root src/picture_capture/app.py:

  • 9 main GUI Toplevel/icon/theme and OS-appearance polling handlers to ui/main_appearance_policy.py
  • 6 main sidebar width/collapsed-state/grid restoration algorithms to new ui/main_sidebar_sections.py
  • 4 percent↔pixel quick parameter/scheduling/geometry algorithms to ui/quick_settings_apply.py.

Existing PictureCaptureApp signatures and class module, live monkeypatch hooks, Tk event dispatch/thread and persisted PDIC/PPP/SECTION/export formats retained. Dedicated behavior/ownership tests tests/test_issue562_root_ui_ownership_phase1_20261025.py, and both architecture audit and root classification documents updated. Follow-up 14225f0a8bd9121154e169213f06880b3ed73337 retargets six pre-existing source-location/owner-exact tests to the new physical locations without dropping functional assertions.

Measured Git-tree impact for this UI batch: root Python file count 10 → 10, aggregate root bytes 430,865 → 421,084 (−9,781); app.py 193,973 → 184,192 bytes. No new root shims.

Exact UI-batch SHA 14225f0a…: CI #40130062628 SUCCESS 6/6 Ubuntu/Windows/macOS × Python 3.10/3.13, Ubuntu Py3.13 3,852 passed, 3 skipped, Risk-tier CI gate SUCCESS. OCR Smoke #40130062510 SUCCESS 3/3.

Another independent Profile extraction/fix advanced the same Draft branch to 82d11273757a9df8107907309cff5955e8e2b791 while we verified: that is not the UI-batch commit; exact new HEAD CI #40130407568 is being checked independently, OCR Smoke #40130407792 succeeded. Profile/setup now 36,283 bytes on this newer HEAD.

Not complete: root has not reached only __init__.py+__main__.py (deletion of compatibility paths needs verified API/monkeypatch/pickle/worker compatibility). Representative actual scanned dictionary-page UI ordinary/OCR/combined, Profile, PDIC/PPP save-reopen/crop/export equivalence and independent manual review remain NOT DONE. PR still Open/Draft/unmerged.

chigre commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Exact current Draft HEAD CI verified (2026-10-25)

Final current PR #663 HEAD 82d11273757a9df8107907309cff5955e8e2b791: CI #40130407568 SUCCESS 6/6 Ubuntu/Windows/macOS × Python 3.10/3.13 (risk-tier gate success); OCR Smoke #40130407792 SUCCESS 3/3. Windows Python 3.10 initially failed in GitHub Runner Tcl setup (init.tcl unavailable); the same job was rerun without changing code or relaxing tests, and passed.

My main UI physical extraction commits remain 33a298fe13665f4753e088e292c896e2f9b7a85e + 14225f0a8bd9121154e169213f06880b3ed73337 (19 methods, root bytes 430865→421084, app.py 193973→184192, ten root files), with its own independently green 6/6 and 3/3 at exact 14225f0a…. Separate concurrent Profile change to 82d11273757a9df8107907309cff5955e8e2b791 remains compatible and profile/setup.py is now 36283 bytes.

Manual real dictionary-page GUI ordinary/OCR/combined, Profile, PDIC/PPP save/reopen, crop/export equivalence and independent code review are still outstanding. PR stays open/Draft, not merged or Ready.

chigre commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — root-retirement Phase 5 completed on e54f5b5dbd727e653f7afbb9dbfa17f191bdc6f2 (Draft, unmerged).

  • Physically migrated 12 methods out of root app.py: 4 display/geometry cache algorithms to ui/main_display_cache.py; the main crop preview plan builder to ui/main_canvas_render_workflow.py; 7 PDIC/editor/autosave/reading-order methods to ui/main_pdic_persistence.py. Original app method signatures, live patched dependencies, R3 quarantine, deferred snapshot, batch PPP ownership and save/reopen format remain unchanged.
  • Root Python modules: 10 → 10; root bytes: 397,742 → 389,749 (−7,993); app.py: 178,533 → 170,540 (−7,993). profile/setup.py remains 36,283 B (already almost entirely delegates; no fake wrapper added).
  • Added focused characterization tests and updated four historical source-location guards to inspect both public delegates and real owners; first CI exposed 8 stale guards, repaired in follow-up commit.
  • Exact-head CI #40143275620: success, all Ubuntu/Windows/macOS × Python 3.10/3.13, Risk-tier gate success. OCR Platform Smoke #40143275631: success, all 3 OS.
  • Manual acceptance NOT DONE: representative real scanned dictionary page GUI/Profile, ordinary/OCR/combined, PDIC/PPP save and reopen, crop/export parity. Keep Draft, do not merge or mark Ready.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — root-retirement Phase 6 (2026-10-25), exact HEAD aebea5b464e781a36391210f078ae2d49ea12137.

Physically migrated five complete OcrChannelSession algorithms from src/picture_capture/ocr_channel.py into ocr/channel_engine_execution.py: run_paddle_raw, run_paddle_records, run_tesseract_records, run_lens_records, and recognize_crop. Stable session class/API, monkeypatchable legacy globals, engine dispatch, source-pixel boxes, and Lens conflict/diagnostic policy are preserved. Added tests/test_issue562_ocr_channel_engine_execution_phase6_20261025.py; updated core-leaf compatibility audit and root-module classification. Follow-up commits repaired type-only annotations/docstrings, including Ruff F821; no persisted formats, Tk or worker ownership changed.

Root Python modules: 10 → 10; bytes: 389,749 → 381,734 (−8,015 B). ocr_channel.py: 21,140 → 13,125 B. profile/setup.py: unchanged 36,283 B (mostly legacy compatibility delegates; no artificial wrappers added).

Exact HEAD CI: https://github.com/chigre/Picture_Capture/actions/runs/40147328269 — success, Ubuntu/Windows/macOS × Python 3.10/3.13 all six matrix jobs successful; risk-tier gate successful. Exact HEAD OCR Platform Smoke: https://github.com/chigre/Picture_Capture/actions/runs/40147328267 — success, Ubuntu/Windows/macOS all three successful.

MANUAL ACCEPTANCE NOT DONE: real scanned dictionary page ordinary/OCR/combined flows, GUI/Profile, PDIC/PPP save/reopen and crop/export parity. Keep this PR Draft, Open, unmerged.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Root-retirement Phase 7 (2026-10-25, verified exact HEAD 5fcc6876664598cb869df61329ed4afab2cf6a07)

  • 13 real method implementations physically moved out of src/picture_capture/app.py: ten ReviewWindow pane/collapse/first-render/resize/debounced zoom functions to ui/review_layout_events.py; SettingsDialog._setting_var to ui/settings/field_form_runtime.py; _add_collapsible_settings and _settings_intro to ui/settings/interactive_panels.py. Stable old class signatures, call-time monkeypatchable Tk/ttk and geometry providers and Tk-thread execution retained.
  • Root Python files 10 → 10; root bytes 381,734 → 375,787 (−5,947 B), all from app.py (170,540 → 164,593 B). profile/setup.py stays 36,283 B (mostly compatibility delegation; no fake wrappers added). No changes to OCR/ordinary/combined, PDIC/PPP, pickle or crop/export formats.
  • Added tests/test_issue562_review_settings_layout_phase7_20261025.py; reanchored legacy source-location assertions in test_core.py, UI round29/30, test_compact_layout_profile_menu_20261011.py and test_next_stage_regressions.py to the actual new owners, without dropping behavioral checks. Updated both architecture audit/classification docs. Initial CI failures were stale source-location assertions; repaired and rerun on exact HEAD.
  • Exact HEAD verification: CI #40151372119 SUCCESS: Ubuntu/Windows/macOS × Python 3.10/3.13 6/6, Risk-tier gate SUCCESS (Ubuntu 3.13: 3,883 passed, 3 skipped); OCR Platform Smoke #40151372130 SUCCESS: Ubuntu/Windows/macOS 3/3.
  • Manual acceptance NOT DONE: real scanned dictionary-page GUI/Profile, ordinary/OCR/combined detection, PDIC/PPP save/reopen and crop/export parity. Keep PR Draft/Open/unmerged; final package root __init__.py + __main__.py only remains a target, not achieved.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — root retirement Phase 8 (2026-10-25, exact HEAD 9d1ca4ab2fd2bbf9dc2376f4003fef23f803d8a4)

Physically relocated nine complete app.py methods into ui/main_dialog_lifecycle.py (Settings, Project Profile, Guide, Environment Center, Review) and existing ui/main_pdic_persistence.py (PDIC/PPP page-navigation save, user save, SECTION persistence). The original public Tk callbacks and runtime monkeypatch points remain stable. Added targeted regression tests/test_issue562_main_dialog_page_save_phase8_20261025.py; repaired nine older source-location assertions to inspect the actual implementation owners, retaining original guards.

Root Python count 10 → 10; root bytes 375,787 → 370,187 (−5,600 B); app.py 164,593 → 158,993 B; profile/setup.py remains 36,283 B (already largely compatibility delegates). Architecture audit and root classification updated.

Validation of the exact 9d1ca4ab2fd2bbf9dc2376f4003fef23f803d8a4: CI https://github.com/chigre/Picture_Capture/actions/runs/40154986440 success (Ubuntu/Windows/macOS × Python 3.10/3.13 all six pass; risk-tier gate success); OCR Platform Smoke https://github.com/chigre/Picture_Capture/actions/runs/40154986453 success (Ubuntu/Windows/macOS 3/3). Ubuntu Python 3.13 pytest: 3,889 passed, 3 skipped. Initial CI for earlier HEAD failed only nine stale source-location tests, fixed before this successful HEAD.

MANUAL ACCEPTANCE NOT DONE: representative scanned dictionary-page GUI/Profile, ordinary/OCR/combined detection, PDIC/PPP save/reopen and crop/export parity. Keep this PR Draft/Open/unmerged; do not claim end-state root-only __init__.py/__main__.py yet.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 9 physical UI ownership (2026-10-25)

Exact verified HEAD: ee29a5e73330730e5bae73e7246736fc7a55cf7f.

Physically moved 15 actual algorithms out of root src/picture_capture/app.py into existing domain owners: ui/controllers/canvas.py (single-column viewport fitting); ui/canvas_pointer_workflow.py (eight PPP labels, rectangle-side edits and SECTION gap calculations); ui/quick_settings_apply.py (five color/overlay/quick-save handlers); ui/main_app_lifecycle.py (preprocess/batch editing guard). The original PictureCaptureApp public methods and staticmethod semantics remain, with call-time injection of patchable symbols, class-level rectangle bounds, Tk and messagebox. No serialization, OCR, ordinary/combined detection, or PDIC/PPP export format changes.

Root inventory: 10 Python files unchanged; 370,187 → 366,538 bytes (−3,649 B). app.py: 158,993 → 155,344 B. profile/setup.py: 36,283 B unchanged (primarily compatibility delegates; no artificial wrapper expansion).

Added tests/test_issue562_main_canvas_ppp_quick_owner_phase9_20261025.py; updated four historical source-contract tests to inspect the real owner without weakening functional expectations. Updated both architecture audit/classification documents. First test run exposed old source-location assumptions; fixed and verified on exact HEAD.

Verified exact-head CI: CI #40158742949 success — Ubuntu/Windows/macOS × Python 3.10/3.13 all six successful; risk-tier gate successful. OCR Platform Smoke #40158743189 success — Ubuntu/Windows/macOS all three successful.

Still NOT DONE: manual representative real scanned dictionary-page acceptance of GUI, Profile, ordinary/OCR/combined workflows, PDIC/PPP save/reopen and crop/export parity. Keep PR Draft, Open, unmerged; package-root-only __init__.py + __main__.py remains a future compatibility-gated target.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 10 physical ownership (2026-10-25)

Latest verified HEAD: 0a51c07398d51dd034d2dc11f917aa4c528258ed (Draft, Open, unmerged).

Moved 10 real method implementations from src/picture_capture/app.py to five existing UI domain owners: main_sidebar_sections.py (3 pointer/wheel), page_index_workflow.py (2 page list/overlay), main_app_lifecycle.py (1 transformed geometry guard), background_job_runtime.py (2 worker generation), and paddle_environment_report.py (2 version checks). Original public method signatures, staticmethod identity, live monkeypatch globals and Tk-thread dispatch remain intact. Added tests/test_issue562_root_remaining_ui_algorithms_phase10_20261025.py and updated both architecture documents.

Root Python inventory 10 → 10 files, 366,538 → 365,602 bytes (−936 B); app.py 155,344 → 154,408 B (−936 B). profile/setup.py unchanged at 36,283 B (mostly compatibility delegations). Final two-file package-root target is still pending compatibility work.

Initial CI exposed a missing argument separator in a migrated callback, an overstrict new test and historical exact owner-function inventories. Fixed all without dropping behavioral assertions. Exact-HEAD verification: CI #40162439685 success (Ubuntu/Windows/macOS × Python 3.10/3.13: 6/6; risk-tier gate passed; Ubuntu 3.13: 3,900 passed, 3 skipped), OCR Platform Smoke #40162439601 success (3/3).

Still NOT DONE: representative real scanned dictionary-page manual acceptance across ordinary/OCR/combined detection, Profile, PDIC/PPP save/reopen and crop/export parity. Keep PR Draft/Open/unmerged.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — root retirement Phase 11 (2026-10-25)

Final exact HEAD: ba9cd1375802a3e8a65e109ac8b1bb65b3afec6f (Phase 11 extraction 66c07017d8a57332e50ce3c0f5a492a7ea13bc21, historical source-guard correction ba9cd1375802a3e8a65e109ac8b1bb65b3afec6f).

Actual physical moves: root models.AppSettings.to_json and from_json implementations to profile/settings_storage_io.py; root models.ProjectState.open implementation to project/state_opening.py. Retained original class/dataclass/pickle identities, signatures and live monkeypatch providers. No PDIC/PPP/OCRed schema or crop/export format modifications.

Git tree measurements: src/picture_capture/*.py 10 → 10 files, 365,602 → 361,324 B (−4,278 B); models.py 47,814 → 43,536 B. profile/setup.py unchanged (36,283 B).

Regression: new tests/test_issue562_model_io_project_open_phase11_20261025.py checks physical ownership, initial/open storage, settings round-trip, live hooks, failure rollback, and legacy nonproject behavior. Existing settings migration source guard re-anchored to the actual implementation without deleting its one-way-dependency and legacy-migration constraints. Both architecture audits updated.

Exact final HEAD GitHub Actions: CI https://github.com/chigre/Picture_Capture/actions/runs/40165423323 SUCCESS (Ubuntu/Windows/macOS × Python 3.10/3.13 = 6/6; Ubuntu 3.13 3,906 passed, 3 skipped; risk-tier gate success). OCR Platform Smoke https://github.com/chigre/Picture_Capture/actions/runs/40165423445 SUCCESS 3/3. The preceding intermediate HEAD initially failed solely because an old test required the moved function body in models.py; fixed on final HEAD.

Still NOT DONE: manual acceptance with real scanned dictionary pages: GUI, Profile, ordinary/OCR/combined, PDIC/PPP save and reopen, crop/export parity. Do not equate green synthetic CI with real-page functional validation. Keep this PR Draft / Open / unmerged; no automatic merge or Ready transition.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

2026-10-25 — Phase 12–13, exact-head CI verified (Draft PR #663)

Continued on the existing open Draft PR #663, branch refactor/562-retire-root-image-utils-20261024, without merging or changing readiness. Started at ba9cd1375802a3e8a65e109ac8b1bb65b3afec6f; final verified HEAD 0cc1d22c13634fb8b2d25d4c30358a7be275598a.

Actual physical moves (not empty wrappers):

  • d655f807df4e759ac2119a9255bcf330d2e20999: migrated the legacy VB detector + profile-specific CJK topology/oversized-head and non-CJK visual-recovery sequence from root processing._detect_entries_left_edge to ordinary/visual_fallback.py:detect_entries_left_edge_with_recovery. Historical signature, original detector, call-time monkeypatch callbacks, SECTION sort and combined/OCR CJK skip remain.
  • 087720efa196779f4ea7938676a5c3943e93c765: migrated the complete OCR multi-engine/Lens mode/legacy fallback/voting policy from root ocr_channel.resolve_ocr_channel_plan to ocr/channel_policy.py:resolve_plan. The public OcrChannelPlan dataclass/pickle identity, live aliases/order/factory, OCR caches and engine ownership remain.
  • 0cc1d22c13634fb8b2d25d4c30358a7be275598a: repaired one historical test that looked for the CJK combined guard in the old physical source; it now asserts the real owner and public forwarding hook, without relaxing the behavior guard.

Targeted regression: new tests/test_issue562_ordinary_visual_fallback_phase12_20261025.py, tests/test_issue562_ocr_channel_policy_phase13_20261025.py; adjusted tests/test_page_understanding_shared.py. Updated both docs/architecture/ROOT_MODULE_CLASSIFICATION_20261023.md and docs/architecture/CORE_LEAF_COMPATIBILITY_AUDIT_20261024.md.

Git-tree inventory: direct root Python files 10 → 10; total bytes 361,324 → 359,865 (−1,459). processing.py 14,984 → 14,649 (−335); ocr_channel.py 13,125 → 12,001 (−1,124). These are algorithm extractions from retained compatibility entrypoints, not fake file deletions. profile/setup.py remains a largely delegated Tk surface; no cosmetic split was attempted.

Exact HEAD 0cc1d22c checks: CI run #40166359595 SUCCESS, Ubuntu/macOS/Windows × Python 3.10/3.13 6/6; Ubuntu Python 3.13 3,912 passed, 3 skipped. Architecture and change guards, Tk GUI smoke, wheel and F821 passed; documentation-only architecture check skipped by risk tier. OCR Platform Smoke #40166359534 SUCCESS 3/3 on Windows/macOS/Ubuntu. Exact-head CodeQL Python/Actions SUCCESS; no unresolved review threads.

Not accepted: independent representative real scanned dictionary-page GUI checks of ordinary/OCR/combined workflows, Profile, PDIC/PPP save/reopen, crop/export format parity are NOT DONE. Keep PR Draft/open/unmerged and Issue #562 open.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 14 / native AppSettings assignment policy (2026-10-25)

  • Final exact HEAD: 847a10a12a5de98d1d629013eac845a0fdbd83fd. Extraction commit b4ef2535c7b0caa86555e5b64998997cd7aa7f5a, indentation correction 847a10a12a5de98d1d629013eac845a0fdbd83fd.
  • Physical migration: models._normalize_display_opacity, models._app_settings_storage_alias, and models.AppSettings.__setattr__ (all value-validation branches) into profile/settings_value_policy.py. Historical root signatures, AppSettings class/module/pickle identity, dataclass field order, old alias descriptors and call-time patchable opacity/math remain. No Tk, OCR/normal/combined flow, PDIC/PPP, settings JSON schema, or crop/export format modification.
  • Git tree: direct root Python files 10 → 10; total direct-root bytes 359,865 → 357,643 (−2,222 B); models.py 43,536 → 41,314 (−2,222 B). profile/setup.py unchanged at 36,283 B, already dominated by necessary Tk compatibility delegate methods.
  • Regression and docs: tests/test_issue562_appsettings_value_policy_phase14_20261025.py covers implementation ownership, constructor/assignment validation, state rollback on invalid values, separator ink boundaries and integer threshold, patched runtime hooks, legacy aliases, and pickle identity. Both core compatibility audit and root classification documents updated.
  • Final exact-head gates: CI https://github.com/chigre/Picture_Capture/actions/runs/40167410480 SUCCESS, Windows/macOS/Ubuntu × Python 3.10/3.13 6/6, risk-tier gate success; Ubuntu Python 3.13 3,922 passed, 3 skipped. OCR Platform Smoke https://github.com/chigre/Picture_Capture/actions/runs/40167410310 SUCCESS 3/3. Zero unresolved review threads.
  • Still NOT DONE: independent GUI/real scanned dictionary-page manual acceptance for Profile, ordinary/OCR/combined, PDIC/PPP save–reopen, crop/export parity. Synthetic CI cannot substitute for this. PR refactor(#562) + fix(#503): module architecture and R3 recovery safety (consolidated Draft) #663 remains Draft/Open/unmerged; do not merge or mark Ready.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 15: native AppSettings dataclass physical relocation (2026-10-25)

Final exact PR HEAD: c5c750ac66707dd6279588aae50e4723847dbe0b (extraction abb0d85ac779be35fc03f0f28f57348e5de6c09f; update canonical audit and source-location tests c5c750ac66707dd6279588aae50e4723847dbe0b).

  • Physical move: all 150+ native AppSettings dataclass field definitions, _AppSettingsMeta, constructor alias normalization, static compatibility properties, methods and Profile model integration moved from root models.py to profile/settings_model.py. models.AppSettings and profile.settings_model.AppSettings are the same class object, not a subclass/copy; historical __module__, pickle identity and dataclass field order preserved. Runtime root monkeypatch callbacks remain dynamically resolved. The class's JSON and validation algorithms stay under the previously migrated Profile owner modules.
  • Measured from Git tree: direct-root Python files 10→10; direct-root bytes 357,643→324,171 (−33,472 B); models.py 41,314→7,842 B (−81%). profile/setup.py remains 36,283 B (existing Tk delegate compatibility).
  • Targeted test tests/test_issue562_appsettings_native_owner_phase15_20261025.py adds exact identity, pickle roundtrip, field-order, default, aliases, dataclass replace, atomic JSON and monkeypatch protection. Updated scripts/audit_settings_runtime.py to find the real schema in profile/settings_model.py and reanchored 7 obsolete static source-location assertions without losing the semantic checks. Both architecture docs updated. No PDIC/PPP/OCR/ordinary/combined/export format changes.
  • Exact final-head CI SUCCESS, Ubuntu/Windows/macOS × Python 3.10/3.13 6/6 (Ubuntu 3.13 3,927 passed, 3 skipped), risk tier gate success: https://github.com/chigre/Picture_Capture/actions/runs/40168604439. Exact-head OCR smoke SUCCESS 3/3: https://github.com/chigre/Picture_Capture/actions/runs/40168604290. No unresolved review threads.
  • Real dictionary scan manual acceptance NOT DONE: GUI/Profile; normal/OCR/combined detection; PDIC/PPP save and reopen; crop/export parity. CI is synthetic. Preserve PR Draft/Open/unmerged, no auto-merge or Ready.
  • Next priority for rapid root retirement: large app.py, paddle_headwords_core.py and processing_core.py physical ownership, while explicitly handling stable root imports/pickle/Windows spawn rather than deleting public names to game the root-file counter.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 / PR #663 — OCR core physical owner migration, 2026-10-25

Exact validated HEAD: cd49d41d6692f9a4abc560aa5824490fbcae164c. The complete legacy paddle_headwords_core.py implementation (154 top-level functions and live OCR state) was physically moved to ocr/headword_core_runtime.py. The root file is now a 434-byte import-identity bridge, required to preserve the existing metadata-only bare package import, legacy direct imports, public monkeypatch mirroring and callable pickle __module__ paths. It is not counted as a retired physical root file.

Root inventory: 10 → 10 Python files; aggregate direct-root Python bytes 324,171 → 247,298 (−76,873 bytes). The new physical owner and root bridge have one shared module object. Targeted pickle/import/patch regressions were added; the six architecture guard OCR delegation source checks were reanchored to the real owner; three stale source-location tests were updated. Architectural inventory/audit documentation was revised. No persisted model identity, OCR cache, PDIC/PPP/SECTION formats, ordinary/combined flow or export transaction was intentionally changed.

Exact-HEAD verification:

  • CI #40169845353: SUCCESS, Windows/macOS/Ubuntu × Python 3.10/3.13 6/6, risk-tier gate SUCCESS, Tk GUI smoke, wheel and F821. Windows Python 3.13 passed 3,932 tests / 2 skipped on the targeted rerun after an intermittent hosted-runner init.tcl failure.
  • OCR Platform Smoke #40169845451: SUCCESS, Windows/macOS/Ubuntu 3/3.

Not completed: independent real scanned/photographed dictionary-page GUI/Profile verification, ordinary/OCR/combined review/editing, PDIC/PPP save/reopen, and crop/export parity. These synthetic CI passes do not replace manual acceptance. Keep Draft/Open, unmerged; do not mark Ready or auto-merge.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 16: complete PaddleOCR core implementation physical relocation (2026-10-25)

  • Exact final HEAD: cd49d41d6692f9a4abc560aa5824490fbcae164c on Draft PR refactor(#562) + fix(#503): module architecture and R3 recovery safety (consolidated Draft) #663 (Open/unmerged). Implementation extraction 5050dfd4ce895d2d64fb82a1cc1680b8fa27a54b, package-import compatibility repaired on later commits, final CJK static owner guard cd49d41d6692f9a4abc560aa5824490fbcae164c.
  • Physically moved all 154 top-level OCR core function implementations and mutable state from src/picture_capture/paddle_headwords_core.py into ocr/headword_core_runtime.py. The root module is now a 434 B deliberate compatibility bridge mapping the same module object into sys.modules, preserving old imports, original function __module__ and pickling, public facade monkeypatch mirrors, Windows spawn and lazy bare package import (package __init__.py remains metadata-only).
  • Verified Git tree: Direct root Python files 10 → 10 (ABI bridge remains), direct root source bytes 324,171 → 247,298 B (−76,873 B); paddle_headwords_core.py 77,307 → 434 B. profile/setup.py unchanged. No claim of root-file retirement.
  • Targeted tests/test_issue562_retired_paddle_core_phase16_20261025.py, CJK source owner test and Windows OCR source check updated without dropping behavior gates. Both architecture documents updated.
  • Final exact-head CI: https://github.com/chigre/Picture_Capture/actions/runs/40169845353 SUCCESS after re-running the failed Windows 3.13 job, where the first attempt encountered runner-side Tcl init.tcl read error; unchanged production/test code passed on retry. Full Ubuntu/macOS/Windows × Python 3.10/3.13 6/6, risk-tier gate success; Ubuntu 3.13 3,931 passed, 3 skipped. Exact-head OCR Platform Smoke: https://github.com/chigre/Picture_Capture/actions/runs/40169845451 SUCCESS, 3/3 OS. No unresolved PR review threads.
  • Still NOT DONE: independent manual acceptance with real scanned dictionary pages: GUI/Profile, normal/OCR/combined detection, PDIC/PPP save/reopen, crop/export parity. Keep PR Draft/Open/unmerged; never mark Ready or automatically merge.
  • Next: actual major processing_core.py and app.py owner migration and a documented strategy for compatibility/pickle modules. Goal of only __init__.py and __main__.py at the root is not yet achieved.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 17: processing core runtime ownership (2026-10-25)

  • Final exact HEAD: 6196f6631d011f1519c09ed64dd0364c0583b826, PR refactor(#562) + fix(#503): module architecture and R3 recovery safety (consolidated Draft) #663 Draft / Open / unmerged.
  • Actual physical relocation: all 83 original processing_core.py top-level functions and their cross-domain geometry/ordinary detection/OCR/crop/PPP/PDIC/Windows spawn coordination now execute from runtime/processing_core_runtime.py. The original root path contains only a 411-byte single-module-identity compatibility bridge, not duplicate algorithms. Old public processing facade and monkeypatch globals still refer to one real module; historical function and model __module__/pickle paths and spawn-worker callables are preserved. Leaf geometry/crop/detection implementations remain in their coherent domain packages.
  • Exact Git tree: direct root Python file count 10 → 10 (legacy ABI path deliberately retained), direct root bytes 247,298 → 196,896 B (−50,402 B). processing_core.py 50,813 → 411 B. profile/setup.py unchanged 36,283 B; still needs staged retirement. The goal of only __init__.py + __main__.py is NOT yet achieved.
  • Regression: added tests/test_issue562_processing_core_runtime_phase17_20261025.py (canonical single-owner, spawn/function/class pickling, monkeypatch, source coordinates, lazy import). Updated both architecture docs, maintained the original crop-delegate architecture guard in the new physical owner, corrected four source-location tests and the two additional AST/benchmark paths without dropping assertions; fixed a Windows-specific new test path assertion. No changes to OCR/ordinary/combined, Tk main-thread, PDIC/PPP/SECTION schemas, crop export or project persistence.
  • Exact-head CI: https://github.com/chigre/Picture_Capture/actions/runs/40171780655 SUCCESS, all Ubuntu/Windows/macOS × Python 3.10/3.13 6/6, risk-tier CI gate success; Ubuntu 3.13 3,936 passed, 3 skipped. Exact-head OCR Smoke https://github.com/chigre/Picture_Capture/actions/runs/40171780822 SUCCESS, 3/3 OS. No unresolved review threads.
  • MANUAL ACCEPTANCE STILL NOT DONE: genuine scanned/photographed dictionary pages across Profile GUI, ordinary/OCR/combined detection, PDIC/PPP save/reopen and crop/export equality. Synthetic tests cannot replace human acceptance. Never merge or mark Ready automatically.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 18: physically retire root training exporter (2026-10-25)

Exact final HEAD: fd5aa498e247a1c710ca4b67fcd298ac2376cdfe, PR #663 Open / Draft / unmerged.

  • Real implementation relocation: _read_json, _copy_if_exists, and export_training_page with their live dependency/monkeypatch interfaces moved from src/picture_capture/training_export.py to training/export_runtime.py. The former root file is deleted. The backward-compatible import picture_capture.training_export is provided by training_export/__init__.py as a single live module identity alias (no duplicate states/functions), retaining legacy callable/exception pickle paths. Existing training/export_page_v2.py, ZIP publisher, manifest serializer and file formats remain unchanged.
  • Precise Git tree: direct-root *.py count 10 → 9, bytes 196,896 → 193,924 (−2,972 B). profile/setup.py remains 36,283 B. Still short of only __init__.py and __main__.py.
  • Regression: tests/test_issue562_training_root_retirement_phase18_20261025.py checks canonical physical owner, exact legacy module state/pickle identity, runtime monkeypatch, lossless Unicode file copies and invalid JSON, bare-package metadata-only import. Existing training ZIP, manifest/context, matcher and v2 export invariants remain gating. Updated both architecture audit documents and tightened architecture guard to ≤9 root files, requiring the live alias and rejecting any returning physical root exporter.
  • Reanchored 42 stale historical root-inventory or training-source-path assertions and one additional relative-import guard, without deleting tests or losing semantic validations. Initial runs identified these static expectations; corrected and reran the exact final HEAD.
  • Exact-head six-combination CI: https://github.com/chigre/Picture_Capture/actions/runs/40173188148 — SUCCESS (Ubuntu / Windows / macOS × Python 3.10/3.13 all 6/6, risk-tier gate success). Ubuntu Python 3.13 3,940 passed, 3 skipped.
  • Exact-head three-platform OCR Smoke: https://github.com/chigre/Picture_Capture/actions/runs/40173188147 — SUCCESS 3/3. No unresolved PR review threads.
  • MANUAL REAL SCANNED DICTIONARY-PAGE ACCEPTANCE NOT DONE: GUI/Profile, normal/OCR/combined detection, PDIC/PPP save and reopen, crop/export parity. Automated success is not a substitute. Keep PR refactor(#562) + fix(#503): module architecture and R3 recovery safety (consolidated Draft) #663 Draft/Open/unmerged, never mark Ready or auto-merge.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 automated continuation (2026-10-25), exact HEAD c8cd4f6fedf46ff04837ee74c05517a312dfa7ab — Draft/Open, not merged.

Physical changes in this pass:

  • 4294dfe852e0c9f2d3c65ece9eea19e7b620e8eb: moved project ISO-639-1 language vocabulary, OCR-to-index mapping and first-language conversion from app.py into profile/language_policy.py; moved Wizard label lookup and OCR-language resolution into profile/wizard_catalog.py. Historical signatures and call-time monkeypatchable mappings retained. Added focused regression and updated source guard / architecture inventory.
  • f372364144a555a17c861298b9d726f6c33e0ff4: moved actual scrollable read-only Tk text-report widget assembly from app.PictureCaptureApp._show_text_report to ui/main_dialog_lifecycle.py; retained original callback and live Tk/font/window hooks. Added display-free fake-widget regression and architecture notes.
  • 689788564389038c89c0f7f1295bef5cf7598257: reduced profile/setup.py compatibility adapters while keeping original public call sites.
  • c8cd4f6fedf46ff04837ee74c05517a312dfa7ab: repaired two stale test source-path assertions exposed by concurrent root core compatibility-file retirement; preserved checks for package identity and canonical OCR runtime.

A separate concurrent commit series retired paddle_headwords_core.py and processing_core.py as root files in favor of same-module-identity package aliases. Do not count those pre-existing implementation moves as newly migrated algorithms in this pass. Root inventory since fd5aa498: 9 → 7 direct Python files; 193,924 → 192,010 bytes (−1,914), including those concurrent compatibility-file retirements. Our app.py reduced 154,408 → 153,339 bytes (−1,069); profile/setup.py reduced 36,283 → 36,233 bytes (−50).

Exact-head checks: CI SUCCESS (Ubuntu/Windows/macOS × Python 3.10/3.13, 6/6); OCR Platform Smoke SUCCESS (3/3). A prior intermediate HEAD failed stale source-path tests; repaired and revalidated at the final SHA above. Real scanned dictionary-page manual Profile/Tk, ordinary/OCR/combined, PDIC/PPP save/reopen and crop/export parity acceptance remains NOT DONE. No merge or Ready transition.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 19: retire two legacy core files from the package root (2026-10-25)

Exact final Draft PR HEAD: c8cd4f6fedf46ff04837ee74c05517a312dfa7ab (Draft/Open/unmerged). Actual physical root removals: src/picture_capture/paddle_headwords_core.py (434 bytes) and src/picture_capture/processing_core.py (411 bytes). Their original OCR and processing algorithms were already migrated in earlier phases (154 OCR functions to ocr/headword_core_runtime.py, 83 processing functions to runtime/processing_core_runtime.py). Phase 19 replaces these only-identity 400 B files with paddle_headwords_core/__init__.py and processing_core/__init__.py, whose historic imports resolve to the same canonical module objects. Public import behavior, mutable monkeypatches, pickle and Windows spawn identities remain covered by regression tests.

Measured from committed Git tree: direct-root *.py count 9→7, total 193,924→192,010 B (−1,914 B) between previous phase and final HEAD. The two root files account for −845 B. The other −1,069 B was contributed by parallel work moving main-app Tk text report behavior to the UI lifecycle; app.py is 154,408→153,339 B. profile/setup.py is 36,283→36,233 B due to separate parallel compatibility cleanup. We did not overwrite or duplicate those parallel changes.

Architecture and tests: Both architecture audit docs updated; root classification/guard tightened to seven physical *.py files and reject the two retired core files returning. New tests/test_issue562_root_core_packages_phase19_20261025.py checks module-object identity, native paths, old worker/function pickle identities, live monkeypatch propagation and lazy metadata-only package initialization. Existing Phase 16/17 ownership checks reanchored; historical root inventory checks retained with threshold seven. Initial CI exposed two stale old-file assertions (CJK and high-risk processing root entrypoint); the concurrent corrective commit c8cd4f6fedf46ff04837ee74c05517a312dfa7ab reanchored them to subpackage/owner paths without dropping behavior gates.

Exact final-head GitHub Actions: full CI https://github.com/chigre/Picture_Capture/actions/runs/40174478638 SUCCESS, Ubuntu/Windows/macOS × Python 3.10/3.13 6/6 success; risk-tier gate success (Documentation architecture check workflow job was skipped); Ubuntu Python 3.13 3,948 passed, 3 skipped. OCR Platform Smoke https://github.com/chigre/Picture_Capture/actions/runs/40174478763 SUCCESS 3/3. Zero unresolved PR review threads.

Still NOT DONE: human manual acceptance on real scanned dictionary pages covering Profile/Tk UI, normal/OCR/combined detection, PDIC/PPP save/reopen and crop/export equivalence. CI does not replace it. Final target only __init__.py and __main__.py at the root is NOT YET MET (seven remain, five more to retire); high-volume remaining work includes app.py and profile/setup.py. Keep PR #663 Draft/Open/unmerged; do not merge or mark Ready.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Issue #562 — Phase 20: retire public OCR and processing facade root files (2026-10-25)

Exact final HEAD: bc1fd6d1bd48604ab467de3ecd7fd46276b3d4f5; PR #663 stays Draft / Open / unmerged, with zero unresolved review threads.

  • Real physical moves: root processing.py (14,649 B) → processing/__init__.py (actual normal/combined detection facade implementation and crop adapters), and root paddle_headwords.py (3,907 B) → paddle_headwords/__init__.py (actual public OCR/evidence/refinement facade). Both old root files deleted. The module import names remain picture_capture.processing and picture_capture.paddle_headwords, with the same namespace publication and install_core_assignment_mirror(__name__, _core) public monkeypatch contract. Original processing_core/paddle_headwords_core module identity aliases, class/function pickle paths and Windows spawn workers remain intact; no duplicated algorithms, modified PDIC/PPP/SECTION serialization or OCR/export formats.
  • Precise Git root inventory: direct root Python files 7 → 5; direct root bytes 192,010 → 173,454 B (−18,556 B). Remaining: __init__.py (113 B), __main__.py (159 B), app.py (153,339 B), models.py (7,842 B), ocr_channel.py (12,001 B). profile/setup.py remains 36,233 B, and only-two-root-files target is not yet achieved.
  • Architecture/regressions: updated the two architecture docs, physical root classification (5/5), and root count ratchet ≤5; canonical facade mirror ownership still admits only these two historical consumers. The change architecture guard narrowly allows only these exact two legacy package __init__.py modules to reinstall their preexisting mirror with exactly (__name__, _core), while still forbidding newly invented module-level installers. Added tests/test_issue562_public_facades_packages_phase20_20261025.py for public module names, no root files, delayed metadata-only imports, pickle/function identity, and live monkeypatch mirroring. Kept historical source-path/CI architecture guards but reanchored them to actual physical owner files; fixed 9 stale source-location cases found by the first complete CI without deleting tests.
  • Exact final-head CI: https://github.com/chigre/Picture_Capture/actions/runs/40176332533 — SUCCESS, all Ubuntu/Windows/macOS × Python 3.10/3.13 6/6, risk-tier gate SUCCESS; Ubuntu 3.13 3,951 passed, 3 skipped. Exact final-head OCR Smoke: https://github.com/chigre/Picture_Capture/actions/runs/40176332619 — SUCCESS, 3/3. Architecture documentation-check job was skipped by its workflow conditional, not failed.
  • Still NOT DONE: real scanned dictionary-page manual verification of GUI/Profile, normal/OCR/combined flows, PDIC/PPP save/reopen, crop/export equality. Automated CI is not a substitute. Do not merge PR refactor(#562) + fix(#503): module architecture and R3 recovery safety (consolidated Draft) #663 or mark Ready.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

2026-10-25 checkpoint — Rounds 48–50 (continue Issue #562 on the same Draft PR)

  • Round 48 b91ea46f: OCR channel engine aliases/voting/Lens-conflict policy and immutable result accessors physically moved into ocr/channel_policy.py and ocr/channel_results.py. Original session, dataclasses/pickle identities, runtime patchpoints unchanged. Exact-head six-matrix CI #40177509225 SUCCESS, three-OS OCR smoke #40177509211 SUCCESS.
  • Round 49 b2e42099: complete SETTING_LABELS, SETTING_HELP, SETTING_HELP_IMAGES, CHECK_HELP moved to ui/settings/help_catalog.py with shared object identity and unchanged Chinese help text, refinement expansions, and UI aliases. Static settings audit reads the true physical owner. Initial CI identified only three obsolete source-location test assertions, while Ubuntu had 3,956 passing tests; repair a4bd6a08 reanchored assertions to the canonical catalog without weakening behavior requirements. Source schema.py physically shrank 97,560 → 29,474 bytes. Repair CI #40178722659 is not yet confirmed complete as of this comment.
  • Round 50 b3350811: eight GUI lazy controller cache bodies unified into ui/controller_lifecycle.py (Canvas, Review, Detection, Export, Crop, Illustration, Headword, Project). All historical callback signatures and live class/parser/fill injection preserved; no reverse import or Tk initialization. Added tests for cache/None behavior, constructor failure atomicity, dynamic monkeypatching and project/headword semantics. Existing eight source-shape tests now verify the actual owner. Exact HEAD b33508111e04bb16136862fda39f7f771ec0785a: OCR three-OS smoke #40178773972 SUCCESS; full six-platform CI #40178773963 still in progress when checked.
  • The package has five direct Python root files (same root cap), no new root compatibility stubs. No PDIC/PPP/SECTION, model/pickle, OCR cache, Profile serialization or export format changes.
  • Do not merge/mark Ready pending exact-head CI + independent real scanned dictionary-page GUI (ordinary/OCR/combined), Profile editing, PDIC/PPP save/reopen and crop/export parity. Cross-platform CI alone does not establish manual behavior parity.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Exact-head verification update (2026-10-25): HEAD b33508111e04bb16136862fda39f7f771ec0785a is now fully green. CI #40178773963 SUCCESS across all six Windows/macOS/Ubuntu × Python 3.10/3.13 jobs, with risk-tier gate SUCCESS; Ubuntu tests 3,969 passed / 3 skipped. OCR Platform Smoke #40178773972 SUCCESS across three OS. Earlier Round 49 source-location assertion failures were corrected by a4bd6a08 and the latest matrix is green. Manual representative dictionary-page GUI/Profile, normal/OCR/combined drawing, PDIC/PPP save/reopen and crop/export parity remain NOT DONE. PR #663 remains Draft, open, unmerged.

chigre commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

2026-10-25 architecture checkpoint — Rounds 51–52

Round 51 commit a85b92eb physically consolidated homography matrix solving, analytic Jacobian, homogeneous coordinate/polygon mapping, inverse perspective image sampling and three duplicated paper-corner RGB median algorithms into new leaf owner preprocess/homography_ops.py. Preserved geometry, deskew, orthogonal_dewarp callable locations, runtime patchpoints and preprocess.pipeline._paper_fill pickle identity. Exact-head CI #40179737155 SUCCESS, all six Windows/macOS/Ubuntu × Python 3.10/3.13 variants; 3-OS OCR smoke #40179737139 SUCCESS.

Round 52 commit 5d8ec845 physically extracted 200+ lines of paired text polygon-scale stability analysis, robust log-plane gradient and inline/cross measurement to preprocess/text_scale_audit.py. Historical geometry.TextScaleStabilityAudit dataclass/pickle identity, original public functions, five original safety thresholds and call-time monkeypatch hooks remain in geometry.py. geometry.py shrank from 83,172 source characters before R51 to 73,632 after R52 (≈9.5K characters). Added dedicated numerical/serialization/threshold tests. Exact-head CI #40180090624 in progress as of this checkpoint and OCR smoke #40180090611 SUCCESS.

No PDIC/PPP/SECTION, public model/pickle, OCR model/cache, saved Profile schema, source-coordinate contract, or crop/export format changes. Do not mark Ready or merge PR #663: real scanned dictionary page manual GUI / ordinary / OCR / combined, Profile, PDIC/PPP reopen, crop/export equivalence remains NOT DONE.

chigre commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

PC-CQ-20261014 — 2026-11-07: three NEW independently RED-first R4.2/R3 repairs (single #663 Draft)

Live authority: sole Open/Draft/Unmerged PR #663 on refactor/562-retire-root-image-utils-20261024, current docs HEAD fd95cd22f8e58a33840beebaa2a7d67d32162dc1; main@ec20989ea8c026cca5337293e67850b6b6df30f2 unchanged; 0 unresolved review threads at checkpoint.

  1. SECTION same-size/same-mtime revision — test-only RED b9db9eaf, CI #42256668385 Ubuntu3.10/3.13 2 intended failed/5754 passed/3 skipped, positive unchanged-cache PASS. Source 0dd0adfc streams SECTION SHA-256 to prevent same-stamp stale prefetch; CI #42257286009 had 5/6 matrix success pending macOS3.13 at prior checkpoint; OCR #42257285923 3/3 and CodeQL #42257278831 2/2 SUCCESS.
  2. Async crop ignores newer human Tk text — RED 3b348524 CI #42257858949, Ubuntu3.10/3.13 1 intended failed/5757 passed/3 skipped, unchanged positive PASS. Source db786f1b rechecks live bound Tk text before accepting worker crop; exact CI #42258437428 6/6 matrix + Risk-tier/gate SUCCESS, OCR #42258437502 3/3, CodeQL #42258431303 2/2 SUCCESS.
  3. R3 simplified text erased on unsafe same-page repaint — RED 5751c2f4, CI #42258690755 Ubuntu3.13 1 expected failed/5759 passed/3 skipped after destructive clear; first-empty-view positive PASS. Source 4b8dff8a verifies existing simplified Tk row owner before destroy and preserves unconfirmed human input. CI #42259170860 Ubuntu3.13 5760 passed/3 skipped; latest source six matrix at checkpoint 4/6 SUCCESS, other macOS/Windows jobs still running/queued; OCR #42259170995 3/3, CodeQL #42259159683 2/2 SUCCESS.

Permanent checkpoint: STATE, RESUME, three new architecture audits provide source/test SHA, RED, new gate URLs and recovery instruction without this chat.

Docs HEAD separate exact-gate runs at this comment: CI #42260039110: Risk tier SUCCESS; test (macos-latest) QUEUED; test (ubuntu-latest) IN_PROGRESS; Python 3.10 / macos-latest QUEUED; test (windows-latest) IN_PROGRESS; Python 3.10 / ubuntu-latest IN_PROGRESS; Python 3.10 / windows-latest IN_PROGRESS; Documentation architecture check SKIPPED. OCR #42260039097: cpu-ocr (windows-latest) IN_PROGRESS; cpu-ocr (ubuntu-latest) SUCCESS; cpu-ocr (macos-latest) IN_PROGRESS. CodeQL #42260026414: Analyze (actions) SUCCESS; Analyze (python) IN_PROGRESS. QUEUED/IN_PROGRESS not PASS; documentation architecture check SKIPPED not PASS.

One next action: read LIVE #663 HEAD and verify these docs-head six CI/Risk-tier/gate + OCR 3OS + CodeQL python/actions, read failing logs, then continue a NEW R3 main/Review save-retry or R4.2 render zoom callback owner synthetic RED-first. Keep PR Draft/unmerged; main unchanged; no schema/XY/protocol/consent or private data changes. Human Windows R3 E3, #483 W1-W11, #503 manual Undo/Redo, actual scans and PDIC/PPP/SECTION/Profile/OCR save-reopen, R6 real labels/R8 scans NOT PERFORMED/DEFERRED; synthetic E2 ≠ human acceptance.

chigre commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

PC-CQ R4.2 next synthetic candidate — review crop geometry epoch (2026-11-07)

Live source inspection at fd95cd22f8e58a33840beebaa2a7d67d32162dc1: src/picture_capture/ui/review_workspace_workflow.py::_request_render_rows snapshots settings = replace(parent.settings), review_zoom, and viewer_width before building the crop; done() currently validates the page/Entry identity and live Tk original text, but does not compare the current zoom, viewport width, or settings against the worker's geometry snapshot before render_rows(preloaded_crops=...). This is a candidate stale-crop acceptance gap, independently distinct from the now-fixed async live-text witness.

A new test-only Git object was created as b3b66870a874f6b656af84642b16e0c219c83e7d (parent fd95cd22f8e58a33840beebaa2a7d67d32162dc1), adding tests/test_r42_review_crop_geometry_epoch_20261107.py with negative zoom, viewport width, settings-revision tests and a positive unchanged control. It is NOT on PR #663's branch: the non-force update_ref(expected_sha=fd95cd22...) action was blocked by tool safety checks; the ref was not moved. NO CI RED or GREEN exists for this candidate; production source must not be changed on this unverified basis.

Next allowed resumption after live HEAD and exact-head six-matrix/Risk/OCR/CodeQL verification: safely add/recreate this isolated test-only fixture on the sole Draft PR branch, run actual failure-first CI, confirm intended failures vs fixture errors, then minimally bind callback publication to the captured geometry revision, and rerun full gates. Do not treat a dangling Git commit or old SHA as authoritative. Human E3, W1–W11, real scanning and persistence reopen remain deferred.

chigre commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

PC-CQ R4.2 — ReviewWindow crop geometry epoch RED → exact-source GREEN (2026-11-07)

Live sole PR #663 OPEN/DRAFT/UNMERGED, branch refactor/562-retire-root-image-utils-20261024, source HEAD 9874b5fe8f15b83ea0f1af2db5891650b5461ea2, base main ec20989ea8c026cca5337293e67850b6b6df30f2; zero review threads returned. This completes the previously unverified candidate described in issuecomment-6690943195; it is not a repeat of prior R3/R4.2 fixes.

  • Test-only RED b3b66870a874f6b656af84642b16e0c219c83e7d, CI #42332071293: all six OS×Python matrix jobs failed as intended; Ubuntu3.13 3 failed / 5761 passed / 3 skipped: stale manual zoom, viewport width, changed settings; unchanged-geometry positive control passed. RED is not acceptance.
  • Minimal source 9874b5fe8f15b83ea0f1af2db5891650b5461ea2: only src/picture_capture/ui/review_workspace_workflow.py checks captured page index, settings, canvas and image-area width, manual zoom before publishing crops; stale callback requests fresh rows rather than painting old crop. The test file is tests/test_r42_review_crop_geometry_epoch_20261107.py.
  • Exact source HEAD gates: CI #42336850006 Windows/macOS/Ubuntu × Python 3.10/3.13 6/6 SUCCESS, Risk-tier and Risk-tier CI gate SUCCESS, Ubuntu3.13 5764 passed / 3 skipped. OCR #42336850028 three platforms 3/3 SUCCESS. CodeQL #42336847116 Analyze python/actions 2/2 SUCCESS. Documentation architecture check SKIPPED, not PASS. These are source-HEAD gates; any later docs/code HEAD requires its own gates.
  • Limits: synthetic E2, not human Windows E3, actual OCR/project scan or PDIC/PPP/SECTION/Profile save/reopen. No source XY/schema/security writer/human records/default experiment changed; no cross-file atomicity claims.

Single next actionable step: read live PR HEAD and exact-head CI/OCR/Risk/CodeQL; inspect reachable R3 ordinary ReviewWindow/main-window text save/retry and R4.2 async callback/SECTION/crop epoch for an independent synthetic counterexample. Commit tests first, observe actual RED, then minimal source fix and new exact-HEAD gates. Keep sole #663 Draft/main unchanged. R3 E3, #483 W1–W11, #503 human Undo/Redo, real scans and save/reopen, R6 real-label learning, R8 scans NOT PERFORMED / DEFERRED.

chigre commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner Author

PC-CQ R4.2 — ordinary ReviewWindow crop failure owner/launch retry: synthetic RED → exact-source GREEN (2026-11-07)

Authority: sole #663 remains Open/Draft/Unmerged on refactor/562-retire-root-image-utils-20261024; main ec20989ea8c026cca5337293e67850b6b6df30f2 untouched. Latest documentation HEAD 192fbb243dc049ac0b31e2513eb48fd7996b32c5, with its own checks PENDING.

  • The canonical background worker already suppresses superseded same-key worker generations; this packet addresses a distinct gap: page/geometry changes before replacement dispatch could allow the old ordinary crop failed() to overwrite current status, and a synchronous current crop worker-start exception escaped without a retryable visible message.
  • Test-only RED: dfc7d3362ba5b72cffede917e369d03b8e61306f, CI #42350346410: six test matrices FAILURE as intended; Ubuntu3.13 4 failed /5766 passed /3 skipped, and two current-worker/normal-launch positive controls passed. This RED is NOT acceptance.
  • Minimal source GREEN: 683b624d32ff6a59808d596354fa457e6d9549e6, only src/picture_capture/ui/review_workspace_workflow.py, preserving existing human editors on launch failure. CI #42350577910 6/6 + Risk-tier/gate SUCCESS, Ubuntu3.13 5770 passed /3 skipped; OCR #42350577904 3/3 SUCCESS; CodeQL #42350575452 Python/Actions 2/2 SUCCESS. Documentation architecture check SKIPPED, not PASS.
  • Handoff: STATE/RESUME and architecture audit updated in docs 192fbb243dc049ac0b31e2513eb48fd7996b32c5. Independently verify exact docs HEAD CI #42351123097, OCR #42351123085, dynamic CodeQL #42351120081; verified on the exact documentation HEAD: Windows/macOS/Ubuntu × Python3.10/3.13 6/6 SUCCESS, Risk-tier/gate SUCCESS, OCR 3/3 SUCCESS, CodeQL Python/Actions 2/2 SUCCESS. Documentation architecture check SKIPPED (not PASS). Next independent synthetic R3 save-failure/retry or R4.2 SECTION/crop-save epoch work package, test-only RED first.

No real dictionary/PDIC/PPP/SECTION/Profile/OCR uploaded or modified, no schema/writer/source XY/experiment-default change, no force/merge/Ready/new PR. Windows R3 E3, #483 W1–W11, #503 manual Undo/Redo, genuine scans/save-reopen, R6/R8 remain NOT PERFORMED / DEFERRED.

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