Skip to content

Fix six review defects in parsing, export and job handling - #1

Merged
hobby-programmer-5000 merged 1 commit into
mainfrom
fix/review-defects
Nov 14, 2026
Merged

hobby-programmer-5000 merged 1 commit into
mainfrom
fix/review-defects

Conversation

@hobby-programmer-5000

Copy link
Copy Markdown
Owner

Fixes six defects found in a multi-model review of 0.2.0. External APIs are unchanged, and the 16 existing tests in test_converter.py pass without edits.

Changes

# Defect Fix
1 Pasted text was compared to EDITOR_THRESHOLD (10 MiB) by character count, so up to ~30 MB of Korean text parsed on the GUI thread exceeds_editor_limit() measures UTF-8 bytes; used by app.py and parse_table
2 DiskRows.__iter__ called seek(0) on a shared handle, so concurrent or nested iterations corrupted each other; cleanup relied on __del__ Each iteration keeps its own offset and reads chunks under a lock; close(), with, weakref.finalize, and Table.close()
3 1e16 became a number while 10000000000000000 stayed text Cell type depends on the value's significant digits (trailing zeros ignored, no Decimal.normalize() rounding)
4 A destination open in Excel leaked a raw PermissionError ExportPermissionError (code locked) is both a ConversionError and a PermissionError, keeping errno, winerror, filename and the cause; short retries for transient locks
5 closeEvent silently ignored closes during jobs; delete=False temp files survived a killed process Cancel button and a quit confirmation; cooperative checkpoints; each export works in a .tablyfern-*.partial folder that the next export to the same folder removes if a crash left it
6 ODS rows lacked trailing empty cells Every row is padded to the sheet width and columns are declared

Verification

Windows 10, Python 3.14.7, Excel 16 (build 20326), synthetic samples only.

  • python -m unittest discover: 36 tests (16 existing + 20 new in test_regressions.py)
  • verify_formats.py: 182 verified exports, 5 batch formats, same as main
  • app.py --smoke-check and scripts/build.py (frozen smoke check, ZIP SHA256); the ZIP also ran from a fresh folder with no Python on PATH
  • Excel read-back of xlsx, xlsm, xltx, xltm and ods: 0 value or type mismatches
  • Saving over a workbook Excel holds open: main raises PermissionError (WinError 5); this branch reports locked, leaves the file unchanged and leaves no temp files
  • Forced termination during saves: main leaves 28 to 92 MB temp files permanently; this branch leaves a .partial folder that the next save removes
  • Real window on screen: Cancel stops in about 0.3 s; Cancel and quit closes in about 1.5 s with the destination unchanged

Notes for review

  • Defect 1 is milder than reported. Even a 29.8 MB Korean paste froze main for about 0.53 s on this PC, below the 5 s Windows needs to show "Not Responding". This branch keeps the longest freeze under about 0.15 s, but large pastes now spool to disk, so that preview takes about 1.5 s instead of 0.5 s.
  • Excel shows any ODS used range as 16,384 columns, even a minimal fully dense file, so defect 6 does not change that. The README's existing ODS note stays accurate.
  • Numbers like 10000000000000000 now export as numeric cells (1E+16 in Excel) instead of text.
  • Not tested: slow PCs, network drives, OneDrive-synced folders.

🤖 Generated with Claude Code

- Measure pasted text by UTF-8 bytes, not characters, before parsing it
  on the GUI thread, so multibyte input over 10 MiB moves to a worker.
- Give each DiskRows iteration its own read offset so concurrent or
  nested iterations no longer corrupt each other, and release the
  temporary file through close(), a with block or weakref.finalize
  instead of __del__.
- Decide numeric cells by significant digits of the value, so 1e16 and
  10000000000000000 both become numbers while 16+ digit values stay text.
- Turn OS errors while saving into ConversionError subclasses that keep
  errno, winerror and filename; a file held open by Excel reports
  "locked" and is still a PermissionError for existing callers.
- Add a Cancel button and a quit confirmation for running jobs. Jobs stop
  at checkpoints without changing the destination, and each export works
  in its own scratch folder; the next export to the same folder removes
  any that a crash or forced exit left behind.
- Pad every ODS row to the sheet width and declare its columns.

Verified on Windows 10 with Python 3.14.7: 36 unit tests (16 existing
unchanged, 20 new), verify_formats.py, the --smoke-check, a PyInstaller
build run from a clean folder, read-back of every export in Excel 16,
saving over a workbook open in Excel, forced termination during saves,
and the real window driven on screen for cancel and quit.

Co-authored-by: Claude <noreply@anthropic.com>
@hobby-programmer-5000
hobby-programmer-5000 merged commit dff11bb into main Nov 14, 2026
2 checks passed
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