Skip to content

refactor: modernize Morse Tree Decoder - #1

Merged
LucasPMM merged 6 commits into
masterfrom
refactor/project-modernization
Sep 17, 2026
Merged

LucasPMM merged 6 commits into
masterfrom
refactor/project-modernization

Conversation

@LucasPMM

Copy link
Copy Markdown
Owner

Summary

Incrementally modernize the original 2019 C project without replacing its
file-backed binary trie algorithm. Preserve dot-left/dash-right traversal,
standard-input decoding, / word separators, and optional preorder output while
making the project easier to build, understand, and verify.

Changes

  • Organize sources, public headers, data, examples, tests, and historical documents
    into English-named directories, with a root Makefile and consistent formatting.
  • Extract focused application, trie, table-loading, decoding, and text-I/O modules
    with explicit ownership, status returns, and relevant English comments.
  • Adopt C17, strict compiler diagnostics, incremental builds, and isolated release,
    test, sanitizer, coverage, and static-analysis profiles.
  • Correct nine letter mappings using ITU-R M.1677-1, Annex 1.
  • Replace fixed-size line buffers with checked dynamic growth; validate mapping
    uniqueness, codes, bytes, CLI options, allocation failures, and stream errors.
  • Add --help and --print-tree, retaining the original -a flag.
  • Add independent reference-based, exhaustive, fault-injection, and exact-byte CLI tests.
  • Add bounded GitHub Actions checks for GCC, Clang, sanitizers/leaks, formatting,
    static analysis, and coverage, with read-only permissions and SHA-pinned checkout.
  • Document usage, contracts, complexity, historical evidence, and verified results
    in English, including a new partial-trie diagram and executable README examples.

Intentional behavior changes

  • Successful decoded lines now end with LF; tree output is no longer joined to
    the final message.
  • Physical lines are decoded as complete messages, including long lines, CRLF,
    and an unterminated final line. Spaces and tabs delimit tokens.
  • Unknown options, malformed/duplicate mappings, unknown codes, and unsupported
    bytes fail with English diagnostics instead of being ignored or interpreted unsafely.
  • An invalid line and the optional tree are omitted; earlier valid lines may
    already have been emitted, following the documented streaming contract.

Historical evidence

The original report and tree image are preserved byte-for-byte, and the original
mapping/output fixtures remain archived separately from corrected expectations.
The unchanged report input reproduces OS MEDOS QUE with the original table and
OS NETOS QIE with international mappings. Neither output nor benchmark measurements
were recorded in the 2019 report; these outputs were reproduced during modernization.

Local verification

  • GCC 13.3 and Clang 18.1.3: 359 module checks, 10,310 exhaustive checks,
    2,296 fault-injection checks, and 77 CLI cases passed.
  • Exhaustive domains: all 62 nonempty dot/dash codes of lengths 1-5 and all
    2,592 ordered-character-pair/separator combinations.
  • Allocation failure matrix: each of 49 allocation occurrences fails in turn,
    with complete project-owned-memory cleanup verified.
  • AddressSanitizer, UBSan, and LeakSanitizer passed the complete suite.
  • GCC/gcov: 100% application line, branch, and function coverage across 290
    executable lines, 242 branches, and 24 functions.
  • Clean/incremental builds, static analysis, clang-format 18, shell syntax,
    relative links, SVG mappings/edges, workflow timeouts, and archival hashes passed.

These are local results, not a hosted CI status or proof for all unbounded inputs.
Hosted CI must be confirmed after pushing the completed branch.

Scope and follow-up

The supported alphabet remains uppercase A-Z and digits 0-9. This change does
not add encoding, audio, punctuation, lowercase, a GUI, or a legacy decoding mode.
The executable remains morse. Repository renaming to morse-tree-decoder and
remote repointing are deferred until after the reviewed branch is merged/closed.

@LucasPMM
LucasPMM merged commit 5e08996 into master Sep 17, 2026
8 checks passed
@LucasPMM
LucasPMM deleted the refactor/project-modernization branch September 17, 2026 00:49
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