009 composed timing

✓ Passing This code compiles and runs correctly.

Code

// Test 430_009: Composed Timing - Multiple Independent Overrides
//
// Override BOTH the whole pipeline AND individual passes.
// Demonstrates that abstract event overrides compose cleanly.

~import "$std/compiler"
~import "$std/time"
~import "$std/io"

// ============================================================================
// WHOLE PIPELINE TIMING (outer layer)
// ============================================================================

~std.compiler:coordinate = std.time:now()
| t pipeline_start |> std.compiler:coordinate.default(program_ast, allocator)
    | coordinated c |> std.time:elapsed(start: pipeline_start.ns, label: "TOTAL PIPELINE")
        |> coordinated { c.ast, c.code, c.metrics }
    | error e |> error { message: e.message }

// ============================================================================
// FRONTEND PASS TIMING (inner layer - composes with above!)
// ============================================================================

~std.compiler:frontend = std.time:now()
| t start |> std.compiler:frontend.default(ctx)
    | ctx c |> std.time:elapsed(start: start.ns, label: "  frontend") |> ctx c

// ============================================================================
// THE PROGRAM
// ============================================================================

~std.io:print.ln("Compiled with composed timing!")
input.kz

Expected Output

Compiled with composed timing!

Test Configuration

MUST_RUN

Post-validation Script:

#!/bin/bash
# Post-validation: Verify BOTH timing outputs appear
# This proves that the two overrides composed correctly

set -e

if [ ! -f "backend.err" ]; then
    echo "❌ FAIL: No backend.err file found"
    exit 1
fi

# Check for frontend timing
if ! grep -q "⏱️.*frontend:" backend.err; then
    echo "❌ Missing frontend timing output"
    exit 1
fi
echo "✅ Frontend timing found"

# Check for total pipeline timing
if ! grep -q "⏱️.*TOTAL PIPELINE:" backend.err; then
    echo "❌ Missing total pipeline timing output"
    exit 1
fi
echo "✅ Total pipeline timing found"

# Display both timings
echo ""
echo "Timing results:"
grep "⏱️" backend.err

echo ""
echo "🎉 Composed timing working! Both overrides fire independently."
exit 0