Skip to content

v0.3.1: Phase 3 Industrial Hardening (SipHash-2-4, UAX #29 Unicode, OS Signals)

Choose a tag to compare

@spdedsec spdedsec released this 14 Oct 05:14
· 91 commits to main since this release

Shae v0.3.1 — Phase 3: Industrial Edge-Case Hardening

Shae v0.3.1 delivers enterprise-grade reliability, security, and international text ergonomics with the completion of Phase 3 (Option C: Industrial Edge-Case Hardening).


🛡️ What's New in v0.3.1

1. Hash-DoS Protection & First-Class Sets (std:collections)

  • Keyed SipHash-2-4 Hasher: Switched internal hash tables to randomized, per-process seeded SipHash-2-4 hashing. Verified byte-for-byte against the official veorq/SipHash reference test vectors, protecting all map and set lookups against algorithmic complexity (Hash-DoS) attacks.
  • First-Class Set Collection: High-performance ordered set collection backed by IndexSet with SipHash.
    • Bound methods: s.size(), s.add(item), s.has(item), s.delete(item), s.to_array(), s.clear(), s.union(other), s.intersect(other), s.difference(other).
    • Linear-time $O(N)$ operations for large dataset deduplication and set algebra.

2. UAX #29 Unicode & Rune Safety (std:unicode)

  • Extended Grapheme Clustering: Full UAX #29 compliance via std:unicode and built-in string methods. Multi-codepoint emojis (e.g. 👨‍👩‍👧‍👦, flags 🇺🇸, skin-tone modifiers 👍🏽) and combining accents are treated as single grapheme units.
  • Bound String Methods:
    • s.graphemes(): Returns array of grapheme cluster strings.
    • s.grapheme_len(): Accurate visual length of strings.
    • s.byte_len(): Raw UTF-8 byte length.
    • s.runes(): Array of unicode scalar values.
    • s.codepoints(): Array of 64-bit integer codepoint values.
    • s.slice_graphemes(start, [end]): Safe grapheme slicing that never splits UTF-8 code units.
    • s.is_ascii(): Fast ASCII check.
  • Unicode Utilities: unicode.category(char), unicode.from_codepoints(cps).

3. Cross-Platform Graceful OS Signals (std:sys)

  • Signal Handlers: Register callbacks with sys.on_signal("SIGINT" | "SIGTERM", callback) to intercept termination and interrupt signals on Linux, macOS, and Windows.
  • Process Lifecycle Control:
    • sys.trigger_signal(sig): Programmatic signal dispatch for deterministic testing and manual shutdown hooks.
    • sys.clear_signals([sig]): Teardown and reset registered handlers.
    • sys.poll_signals(): Drain and process asynchronous OS interrupts.
    • sys.signals(): List supported signals (["SIGINT", "SIGTERM", "SIGHUP"]).

4. Developer Tooling & VS Code Extension v0.3.1

  • Syntax Highlighting: Updated TextMate grammar to highlight jit, set, and all new stdlib modules.
  • Language Server Protocol: Autocomplete and hover documentation for std:unicode, std:sys signals, and std:collections.Set.
  • Standalone Demos: Added examples/unicode_demo.shae, examples/signals_demo.shae, and examples/collections_demo.shae.

🔮 Horizon Roadmap (Upcoming Phases)

  • Phase 4: Actor-Based Concurrency & Distributed Mailboxes (supervision trees, cluster channel remoting).
  • Phase 5: Self-Hosting Shae Compiler & Direct Native Linker (direct ELF/Mach-O/PE emission).
  • Phase 6: WebAssembly Target (wasm32-wasi and browser engine).