<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rabah Laouadi </title>
    <description>The latest articles on DEV Community by Rabah Laouadi  (@rabeh_sys).</description>
    <link>https://dev.to/rabeh_sys</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3922515%2F09e5ae9b-3a9a-497e-b64c-f0dd29a10cdd.jpg</url>
      <title>DEV Community: Rabah Laouadi </title>
      <link>https://dev.to/rabeh_sys</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rabeh_sys"/>
    <language>en</language>
    <item>
      <title>Even a Rust Progress Bar Can Become a Reliability Problem</title>
      <dc:creator>Rabah Laouadi </dc:creator>
      <pubDate>Wed, 13 May 2026 18:34:12 +0000</pubDate>
      <link>https://dev.to/rabeh_sys/even-a-rust-progress-bar-can-become-a-reliability-problem-13oc</link>
      <guid>https://dev.to/rabeh_sys/even-a-rust-progress-bar-can-become-a-reliability-problem-13oc</guid>
      <description>&lt;p&gt;While building &lt;em&gt;CommitGuard&lt;/em&gt;, I realized something interesting:&lt;/p&gt;




&lt;p&gt;even a simple CLI progress percentage can become dangerous under very large workloads.&lt;/p&gt;

&lt;p&gt;At first I had the classic calculation:&lt;/p&gt;

&lt;p&gt;let percentage =&lt;br&gt;
    (current_items * 100) / total_items;&lt;/p&gt;

&lt;p&gt;Looks harmless.&lt;/p&gt;

&lt;p&gt;And for many projects, it probably is.&lt;/p&gt;

&lt;p&gt;But CommitGuard is designed for huge repositories, fuzzing workloads, and long-running scans. That forced me to think more carefully about integer arithmetic and long-term reliability.&lt;/p&gt;

&lt;p&gt;The Overflow Problem&lt;/p&gt;

&lt;p&gt;The dangerous part is this:&lt;/p&gt;

&lt;p&gt;current_items * 100&lt;/p&gt;

&lt;p&gt;If "current_items" becomes large enough, multiplication overflows before division even happens.&lt;/p&gt;

&lt;p&gt;In Rust:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Debug builds panic.&lt;/li&gt;
&lt;li&gt;Release builds wrap around.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That means your progress percentage may silently become incorrect while the program keeps running.&lt;/p&gt;

&lt;p&gt;The code compiles perfectly.&lt;br&gt;
But correctness is already gone.&lt;/p&gt;

&lt;p&gt;Checked Arithmetic&lt;/p&gt;

&lt;p&gt;In low-level and defensive systems, I strongly prefer explicit arithmetic checks.&lt;/p&gt;

&lt;p&gt;Something like this:&lt;/p&gt;

&lt;p&gt;let scaled =&lt;br&gt;
    current_items.checked_mul(100);&lt;/p&gt;

&lt;p&gt;match scaled {&lt;br&gt;
    Some(value) =&amp;gt; {&lt;br&gt;
        let percentage =&lt;br&gt;
            value / total_items;&lt;br&gt;
    }&lt;br&gt;
    None =&amp;gt; {&lt;br&gt;
        // overflow detected&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because "checked_*" makes overflow visible instead of hiding it.&lt;/p&gt;

&lt;p&gt;For long-term systems, silent corruption is usually worse than explicit failure.&lt;/p&gt;

&lt;p&gt;Saturating Arithmetic&lt;/p&gt;

&lt;p&gt;Another possible approach is saturating arithmetic:&lt;/p&gt;

&lt;p&gt;let percentage =&lt;br&gt;
    current_items&lt;br&gt;
        .saturating_mul(100)&lt;br&gt;
        / total_items;&lt;/p&gt;

&lt;p&gt;This avoids crashes and prevents wraparound behavior.&lt;/p&gt;

&lt;p&gt;However, saturation may still produce incorrect logical results once values hit the numeric limit.&lt;/p&gt;

&lt;p&gt;So while it is safer than wrapping arithmetic, it is not always mathematically accurate.&lt;/p&gt;

&lt;p&gt;Widening Arithmetic&lt;/p&gt;

&lt;p&gt;For the progress calculation itself, I ended up widening the arithmetic:&lt;/p&gt;

&lt;p&gt;let percentage = if total_items == 0 {&lt;br&gt;
    100&lt;br&gt;
} else {&lt;br&gt;
    (&lt;br&gt;
        (current_items as u128 * 100)&lt;br&gt;
            / total_items as u128&lt;br&gt;
    ) as usize&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;Using "u128" here makes overflow practically impossible for realistic workloads while keeping the implementation allocation-free and extremely lightweight.&lt;/p&gt;

&lt;p&gt;This was a good balance between correctness, simplicity, and hot-path performance.&lt;/p&gt;

&lt;p&gt;Why I Avoided Heavy Progress Libraries&lt;/p&gt;

&lt;p&gt;While profiling CommitGuard, I noticed many progress implementations rely on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;background threads&lt;/li&gt;
&lt;li&gt;shared state&lt;/li&gt;
&lt;li&gt;"Arc&amp;gt;"&lt;/li&gt;
&lt;li&gt;heap allocations&lt;/li&gt;
&lt;li&gt;constant terminal writes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For normal CLI tools, this is usually fine.&lt;/p&gt;

&lt;p&gt;But for high-frequency scanning loops, tiny overheads accumulate very quickly.&lt;/p&gt;

&lt;p&gt;Especially when progress updates happen millions of times.&lt;/p&gt;

&lt;p&gt;So I kept the implementation intentionally simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no heap allocations&lt;/li&gt;
&lt;li&gt;no background workers&lt;/li&gt;
&lt;li&gt;no synchronization overhead&lt;/li&gt;
&lt;li&gt;no hidden allocations in the hot path&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also throttle terminal updates to around every 250ms instead of constantly redrawing the screen.&lt;/p&gt;

&lt;p&gt;That alone significantly reduces terminal I/O overhead.&lt;/p&gt;

&lt;p&gt;Small Math Becomes Systems Engineering&lt;/p&gt;

&lt;p&gt;One thing Rust keeps teaching me is this:&lt;/p&gt;

&lt;p&gt;there is no such thing as “just simple code” in long-term systems.&lt;/p&gt;

&lt;p&gt;A tiny arithmetic assumption can eventually become:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a panic&lt;/li&gt;
&lt;li&gt;corrupted state&lt;/li&gt;
&lt;li&gt;invalid metrics&lt;/li&gt;
&lt;li&gt;undefined behavior&lt;/li&gt;
&lt;li&gt;performance degradation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Especially under fuzzing or massive workloads.&lt;/p&gt;

&lt;p&gt;The code may compile.&lt;br&gt;
The tests may pass.&lt;br&gt;
But systems programming starts where edge cases begin.&lt;br&gt;
And honestly, that is one of the reasons I enjoy Rust so much.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>cybersecurity</category>
      <category>programming</category>
      <category>architecture</category>
    </item>
    <item>
      <title>14.8 Billion Fuzz Layer Zero Kernel</title>
      <dc:creator>Rabah Laouadi </dc:creator>
      <pubDate>Sat, 09 May 2026 22:17:26 +0000</pubDate>
      <link>https://dev.to/rabeh_sys/148-billion-fuzz-layer-zero-kernel-32jk</link>
      <guid>https://dev.to/rabeh_sys/148-billion-fuzz-layer-zero-kernel-32jk</guid>
      <description>&lt;p&gt;What 14.8 Billion Fuzz&lt;br&gt;
 Executions Revealed About My Rust Kernel Layer&lt;br&gt;
Over the past few days, I ran a long adversarial fuzzing campaign against the minimal kernel layer of my Rust __infrastructure stack.&lt;br&gt;
The target was intentionally small:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deterministic primitives&lt;/li&gt;
&lt;li&gt;zero-allocation design&lt;/li&gt;
&lt;li&gt;no_std compatibility&lt;/li&gt;
&lt;li&gt;stable binary serialization&lt;/li&gt;
&lt;li&gt;overflow-safe arithmetic&lt;/li&gt;
&lt;li&gt;&lt;p&gt;invariant-preserving types&lt;br&gt;
The fuzzing campaign executed approximately 14.8 billion iterations.&lt;br&gt;
Focus Areas&lt;br&gt;
The testing focused on validating:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ABI stability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;serialization roundtrips&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;algebraic correctness&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;normalization logic&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;overflow behavior&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ordering consistency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;mutation resistance&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Results&lt;br&gt;
The campaign successfully exposed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2 crash cases&lt;/li&gt;
&lt;li&gt;several edge-condition inconsistencies&lt;/li&gt;
&lt;li&gt;&lt;p&gt;missing algebraic symmetry in temporal primitives&lt;br&gt;
All issues were discovered before public release.&lt;br&gt;
One particularly interesting result was identifying an incomplete temporal algebra implementation:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"Timestamp + Duration"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"Timestamp - Timestamp"&lt;br&gt;
were implemented, but:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"Timestamp - Duration"&lt;br&gt;
was missing entirely.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fuzzing process exposed this architectural gap immediately.&lt;br&gt;
Why This Matters&lt;br&gt;
Infrastructure primitives are often treated like simple utility code.&lt;br&gt;
I believe this is a mistake.&lt;br&gt;
Low-level primitives become the foundation for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;distributed systems&lt;/li&gt;
&lt;li&gt;ledgers&lt;/li&gt;
&lt;li&gt;event sourcing&lt;/li&gt;
&lt;li&gt;databases&lt;/li&gt;
&lt;li&gt;synchronization layers&lt;/li&gt;
&lt;li&gt;audit systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the primitive layer is weak, every dependent system inherits that weakness.&lt;br&gt;
Final Thoughts&lt;br&gt;
Fuzzing is not just about finding crashes.&lt;br&gt;
It is one of the best tools for validating architectural assumptions under hostile input conditions.&lt;br&gt;
Especially for foundational systems software.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8whrtw5580b7z9sw5c4v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8whrtw5580b7z9sw5c4v.png" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>systems</category>
      <category>cybersecurity</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
