-module(lightspeed@ops@pipeline_operations_surface_harness).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/lightspeed/ops/pipeline_operations_surface_harness.gleam").
-export([run_scenario/1, run_matrix/0, scenario_label/1, pass_fail_label/1, signature/1, scenario/1, deterministic/1, outcomes/1, failed_scenarios/1, nondeterministic_failures/1, report_signature/1, snapshot_signature/0, snapshot_report_markdown/0]).
-export_type([scenario/0, scenario_outcome/0, report/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(" Deterministic integrated data-pipeline and ETL operations-surface harness (M60).\n").
-type scenario() :: run_replay_control_evidence |
checkpoint_resume_idempotency_under_load |
heavy_data_adapter_conformance |
tenant_aware_operations_observability |
regression_determinism_gate.
-type scenario_outcome() :: {scenario_outcome,
scenario(),
boolean(),
boolean(),
binary()}.
-type report() :: {report, list(scenario_outcome()), integer(), integer()}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 619).
-spec count_nondeterministic(list(scenario_outcome())) -> integer().
count_nondeterministic(Outcomes) ->
case Outcomes of
[] ->
0;
[Outcome | Rest] ->
case erlang:element(4, Outcome) of
true ->
count_nondeterministic(Rest);
false ->
1 + count_nondeterministic(Rest)
end
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 608).
-spec count_failed(list(scenario_outcome())) -> integer().
count_failed(Outcomes) ->
case Outcomes of
[] ->
0;
[Outcome | Rest] ->
case erlang:element(3, Outcome) of
true ->
count_failed(Rest);
false ->
1 + count_failed(Rest)
end
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 498).
-spec evaluate_regression_determinism_gate() -> {boolean(), binary()}.
evaluate_regression_determinism_gate() ->
First = lightspeed@pipeline@operations_surface:snapshot_signature(),
Second = lightspeed@pipeline@operations_surface:snapshot_signature(),
Suites = lightspeed@pipeline@operations_surface:fixture_snapshots(),
Pipeline_snapshot = lightspeed@ops@pipeline_harness:snapshot_signature(),
Etl_snapshot = lightspeed@ops@etl_reliability_harness:snapshot_signature(),
Slo_budget = lightspeed@pipeline@slo:budget_version_label(),
Passed = (((((First =:= Second) andalso (erlang:length(Suites) =:= 3))
andalso gleam_stdlib:string_starts_with(First, <<"m60.profile.v1|"/utf8>>))
andalso gleam_stdlib:string_starts_with(
Pipeline_snapshot,
<<"m31.snapshot.v"/utf8>>
))
andalso gleam_stdlib:string_starts_with(
Etl_snapshot,
<<"m33.snapshot.v"/utf8>>
))
andalso gleam_stdlib:string_starts_with(Slo_budget, <<"m33.budget.v"/utf8>>),
{Passed,
<<<<<<<<<<<<First/binary, "|pipeline_snapshot="/utf8>>/binary,
Pipeline_snapshot/binary>>/binary,
"|etl_snapshot="/utf8>>/binary,
Etl_snapshot/binary>>/binary,
"|slo_budget="/utf8>>/binary,
Slo_budget/binary>>}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 592).
-spec result_label({ok, any()} | {error, binary()}) -> binary().
result_label(Result) ->
case Result of
{ok, _} ->
<<"ok"/utf8>>;
{error, Reason} ->
<<"error:"/utf8, Reason/binary>>
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 585).
-spec result_is_error({ok, any()} | {error, binary()}) -> boolean().
result_is_error(Result) ->
case Result of
{ok, _} ->
false;
{error, _} ->
true
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 578).
-spec result_is_ok({ok, any()} | {error, binary()}) -> boolean().
result_is_ok(Result) ->
case Result of
{ok, _} ->
true;
{error, _} ->
false
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 637).
-spec join_with(binary(), list(binary())) -> binary().
join_with(Separator, Values) ->
case Values of
[] ->
<<""/utf8>>;
[First | Rest] ->
gleam@list:fold(
Rest,
First,
fun(Accumulator, Value) ->
<<<<Accumulator/binary, Separator/binary>>/binary,
Value/binary>>
end
)
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 428).
-spec evaluate_tenant_aware_operations_observability() -> {boolean(), binary()}.
evaluate_tenant_aware_operations_observability() ->
Tenant_runtime = lightspeed@tenant@policy:new(
lightspeed@tenant@policy:tenant_context(
<<"ops-limited"/utf8>>,
<<"tenant-orders"/utf8>>,
editor
),
lightspeed@tenant@policy:expanded_budget(4, 2, 2, 1, 0, 0)
),
Surface = lightspeed@pipeline@operations_surface:new(
<<"limited_policy_surface"/utf8>>,
standard_profile,
Tenant_runtime
),
{Surface@1, Start_first} = lightspeed@pipeline@operations_surface:start_run(
Surface,
400
),
{Surface@2, Start_second} = lightspeed@pipeline@operations_surface:start_run(
Surface@1,
401
),
{Surface@3, Replay_denied} = lightspeed@pipeline@operations_surface:apply_control(
Surface@2,
{replay, <<"write_orders"/utf8>>, <<"tenant_replay"/utf8>>},
402
),
{Surface@4, Pause_denied} = lightspeed@pipeline@operations_surface:apply_control(
Surface@3,
{pause, <<"tenant_pause"/utf8>>},
403
),
Decisions = begin
_pipe = lightspeed@tenant@policy:decisions(
lightspeed@pipeline@operations_surface:tenant_runtime(Surface@4)
),
gleam@list:map(_pipe, fun lightspeed@tenant@policy:decision_label/1)
end,
Audits = begin
_pipe@1 = lightspeed@pipeline@operations_surface:audits(Surface@4),
gleam@list:map(
_pipe@1,
fun lightspeed@pipeline@operations_surface:audit_signature/1
)
end,
Decisions_joined = join_with(<<";"/utf8>>, Decisions),
Audits_joined = join_with(<<";"/utf8>>, Audits),
Passed = ((((((((result_is_ok(Start_first) andalso result_is_error(
Start_second
))
andalso result_is_error(Replay_denied))
andalso result_is_error(Pause_denied))
andalso gleam_stdlib:contains_string(
Decisions_joined,
<<"|surface=pipeline|"/utf8>>
))
andalso gleam_stdlib:contains_string(
Decisions_joined,
<<"|decision=denied|"/utf8>>
))
andalso gleam_stdlib:contains_string(
Audits_joined,
<<"action=start_run|outcome=denied:"/utf8>>
))
andalso gleam_stdlib:contains_string(
Audits_joined,
<<"action=control:replay:write_orders:tenant_replay|outcome=denied:"/utf8>>
))
andalso gleam_stdlib:contains_string(
Audits_joined,
<<"action=control:pause:tenant_pause|outcome=denied:"/utf8>>
))
andalso lightspeed@pipeline@operations_surface:valid(Surface@4),
{Passed,
<<<<<<<<<<<<<<<<<<<<<<"start_first="/utf8,
(result_label(Start_first))/binary>>/binary,
"|start_second="/utf8>>/binary,
(result_label(Start_second))/binary>>/binary,
"|replay="/utf8>>/binary,
(result_label(Replay_denied))/binary>>/binary,
"|pause="/utf8>>/binary,
(result_label(Pause_denied))/binary>>/binary,
"|decisions="/utf8>>/binary,
Decisions_joined/binary>>/binary,
"|audits="/utf8>>/binary,
Audits_joined/binary>>}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 404).
-spec evaluate_heavy_data_adapter_conformance() -> {boolean(), binary()}.
evaluate_heavy_data_adapter_conformance() ->
Surface = begin
_pipe = lightspeed@pipeline@operations_surface:default_surface(),
lightspeed@pipeline@operations_surface:certify_heavy_data_conformance(
_pipe
)
end,
Records = lightspeed@pipeline@operations_surface:conformance_records(
Surface
),
Signatures = gleam@list:map(
Records,
fun lightspeed@pipeline@operations_surface:conformance_signature/1
),
Joined = join_with(<<";"/utf8>>, Signatures),
Passed = ((((lightspeed@pipeline@operations_surface:conformance_passed(
Surface
)
andalso (erlang:length(Records) =:= 3))
andalso gleam_stdlib:contains_string(Joined, <<"million_grid_scroll"/utf8>>))
andalso gleam_stdlib:contains_string(Joined, <<"burst_analytics_mix"/utf8>>))
andalso gleam_stdlib:contains_string(
Joined,
<<"longpoll_compact_view"/utf8>>
))
andalso lightspeed@pipeline@operations_surface:valid(Surface),
{Passed,
<<<<<<"conformance="/utf8, Joined/binary>>/binary, "|surface="/utf8>>/binary,
(lightspeed@pipeline@operations_surface:signature(Surface))/binary>>}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 599).
-spec ack_result_label(
{ok, lightspeed@pipeline@orchestrator:process_outcome()} | {error, binary()}
) -> binary().
ack_result_label(Result) ->
case Result of
{ok, Outcome} ->
lightspeed@pipeline@orchestrator:process_outcome_label(Outcome);
{error, Reason} ->
<<"error:"/utf8, Reason/binary>>
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 525).
-spec process_sink_batch(
lightspeed@pipeline@operations_surface:surface(),
binary(),
integer(),
integer(),
binary(),
integer(),
integer()
) -> {lightspeed@pipeline@operations_surface:surface(),
{ok, nil} | {error, binary()}}.
process_sink_batch(
Surface,
Key,
Records,
Lag_ms,
Idempotency_key,
Sequence,
At_ms
) ->
{Surface@1, Enqueue_result} = lightspeed@pipeline@operations_surface:enqueue_batch(
Surface,
Key,
<<"write_orders"/utf8>>,
Records,
Lag_ms,
Idempotency_key,
Sequence
),
{Surface@2, Started} = lightspeed@pipeline@operations_surface:start_available(
Surface@1,
At_ms
),
{Surface@3, Ack_result} = lightspeed@pipeline@operations_surface:acknowledge_batch(
Surface@2,
Key,
At_ms + 1
),
Result = case Enqueue_result of
{error, Reason} ->
{error, <<"enqueue:"/utf8, Reason/binary>>};
{ok, _} ->
case erlang:length(Started) =:= 1 of
false ->
{error,
<<"start_available_count:"/utf8,
(erlang:integer_to_binary(erlang:length(Started)))/binary>>};
true ->
case Ack_result of
{error, Reason@1} ->
{error, <<"ack:"/utf8, Reason@1/binary>>};
{ok, Outcome} ->
case gleam_stdlib:string_starts_with(
lightspeed@pipeline@orchestrator:process_outcome_label(
Outcome
),
<<"processed:applied:"/utf8>>
) of
true ->
{ok, nil};
false ->
{error,
<<"unexpected_outcome:"/utf8,
(lightspeed@pipeline@orchestrator:process_outcome_label(
Outcome
))/binary>>}
end
end
end
end,
{Surface@3, Result}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 323).
-spec evaluate_checkpoint_resume_idempotency_under_load() -> {boolean(),
binary()}.
evaluate_checkpoint_resume_idempotency_under_load() ->
Surface = lightspeed@pipeline@operations_surface:default_surface(),
{Surface@1, Start_result} = lightspeed@pipeline@operations_surface:start_run(
Surface,
200
),
{Surface@2, Batch_a} = process_sink_batch(
Surface@1,
<<"load-sink-a"/utf8>>,
10,
120,
<<"order-1"/utf8>>,
1,
201
),
{Surface@3, Batch_b} = process_sink_batch(
Surface@2,
<<"load-sink-b"/utf8>>,
12,
110,
<<"order-2"/utf8>>,
2,
205
),
{Surface@4, Batch_c} = process_sink_batch(
Surface@3,
<<"load-sink-c"/utf8>>,
14,
95,
<<"order-3"/utf8>>,
3,
209
),
{Surface@5, Replay_result} = lightspeed@pipeline@operations_surface:apply_control(
Surface@4,
{replay, <<"write_orders"/utf8>>, <<"load_replay"/utf8>>},
214
),
{Surface@6, Resume_result} = lightspeed@pipeline@operations_surface:apply_control(
Surface@5,
{resume, <<"post_replay_resume"/utf8>>},
215
),
{Surface@7, Dup_enqueue} = lightspeed@pipeline@operations_surface:enqueue_batch(
Surface@6,
<<"load-sink-dup"/utf8>>,
<<"write_orders"/utf8>>,
6,
80,
<<"order-2"/utf8>>,
4
),
{Surface@8, Started_dup} = lightspeed@pipeline@operations_surface:start_available(
Surface@7,
216
),
{Surface@9, Dup_ack} = lightspeed@pipeline@operations_surface:acknowledge_batch(
Surface@8,
<<"load-sink-dup"/utf8>>,
217
),
Surface@10 = lightspeed@pipeline@operations_surface:complete_run(
Surface@9,
230
),
Sink_keys = lightspeed@pipeline@operations_surface:sink_idempotency_keys(
Surface@10
),
Checkpoints = lightspeed@pipeline@operations_surface:checkpoints(Surface@10),
Freshness = lightspeed@pipeline@operations_surface:freshness(Surface@10),
Passed = ((((((((((((result_is_ok(Start_result) andalso result_is_ok(
Batch_a
))
andalso result_is_ok(Batch_b))
andalso result_is_ok(Batch_c))
andalso result_is_ok(Replay_result))
andalso result_is_ok(Resume_result))
andalso result_is_ok(Dup_enqueue))
andalso (erlang:length(Started_dup) =:= 1))
andalso (ack_result_label(Dup_ack) =:= <<"processed:duplicate_suppressed:write_orders:order-2"/utf8>>))
andalso (Sink_keys =:= [<<"order-1"/utf8>>,
<<"order-2"/utf8>>,
<<"order-3"/utf8>>]))
andalso (erlang:length(Checkpoints) =:= 3))
andalso (erlang:element(4, Freshness) >= 3))
andalso erlang:element(5, Freshness))
andalso lightspeed@pipeline@operations_surface:valid(Surface@10),
{Passed,
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"batch_a="/utf8,
(result_label(
Batch_a
))/binary>>/binary,
"|batch_b="/utf8>>/binary,
(result_label(
Batch_b
))/binary>>/binary,
"|batch_c="/utf8>>/binary,
(result_label(
Batch_c
))/binary>>/binary,
"|replay="/utf8>>/binary,
(result_label(
Replay_result
))/binary>>/binary,
"|resume="/utf8>>/binary,
(result_label(Resume_result))/binary>>/binary,
"|dup_enqueue="/utf8>>/binary,
(result_label(Dup_enqueue))/binary>>/binary,
"|dup="/utf8>>/binary,
(ack_result_label(Dup_ack))/binary>>/binary,
"|sink_keys="/utf8>>/binary,
(join_with(<<","/utf8>>, Sink_keys))/binary>>/binary,
"|checkpoints="/utf8>>/binary,
(lightspeed@pipeline@checkpoint:chain_signature(Checkpoints))/binary>>/binary,
"|freshness="/utf8>>/binary,
(lightspeed@pipeline@operations_surface:freshness_label(Freshness))/binary>>}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 201).
-spec evaluate_run_replay_control_evidence() -> {boolean(), binary()}.
evaluate_run_replay_control_evidence() ->
Surface = lightspeed@pipeline@operations_surface:default_surface(),
{Surface@1, Start_result} = lightspeed@pipeline@operations_surface:start_run(
Surface,
100
),
{Surface@2, Enqueue_source} = lightspeed@pipeline@operations_surface:enqueue_batch(
Surface@1,
<<"batch-source-1"/utf8>>,
<<"extract_orders"/utf8>>,
8,
90,
<<"source-key-1"/utf8>>,
1
),
{Surface@3, Started_source} = lightspeed@pipeline@operations_surface:start_available(
Surface@2,
101
),
{Surface@4, Ack_source} = lightspeed@pipeline@operations_surface:acknowledge_batch(
Surface@3,
<<"batch-source-1"/utf8>>,
102
),
{Surface@5, Enqueue_transform} = lightspeed@pipeline@operations_surface:enqueue_batch(
Surface@4,
<<"batch-transform-1"/utf8>>,
<<"normalize_orders"/utf8>>,
8,
70,
<<"transform-key-1"/utf8>>,
2
),
{Surface@6, Started_transform} = lightspeed@pipeline@operations_surface:start_available(
Surface@5,
103
),
{Surface@7, Ack_transform} = lightspeed@pipeline@operations_surface:acknowledge_batch(
Surface@6,
<<"batch-transform-1"/utf8>>,
104
),
{Surface@8, Enqueue_sink} = lightspeed@pipeline@operations_surface:enqueue_batch(
Surface@7,
<<"batch-sink-1"/utf8>>,
<<"write_orders"/utf8>>,
8,
40,
<<"order-1"/utf8>>,
3
),
{Surface@9, Started_sink} = lightspeed@pipeline@operations_surface:start_available(
Surface@8,
105
),
{Surface@10, Ack_sink} = lightspeed@pipeline@operations_surface:acknowledge_batch(
Surface@9,
<<"batch-sink-1"/utf8>>,
106
),
{Surface@11, Pause_result} = lightspeed@pipeline@operations_surface:apply_control(
Surface@10,
{pause, <<"tune_queue"/utf8>>},
107
),
{Surface@12, Resume_result} = lightspeed@pipeline@operations_surface:apply_control(
Surface@11,
{resume, <<"resume_queue"/utf8>>},
108
),
{Surface@13, Replay_result} = lightspeed@pipeline@operations_surface:apply_control(
Surface@12,
{replay, <<"write_orders"/utf8>>, <<"checkpoint_check"/utf8>>},
109
),
Surface@14 = lightspeed@pipeline@operations_surface:complete_run(
Surface@13,
120
),
Audits = lightspeed@pipeline@operations_surface:audits(Surface@14),
Signature = lightspeed@pipeline@operations_surface:signature(Surface@14),
Passed = ((((((((((((((((result_is_ok(Start_result) andalso result_is_ok(
Enqueue_source
))
andalso result_is_ok(Ack_source))
andalso result_is_ok(Enqueue_transform))
andalso result_is_ok(Ack_transform))
andalso result_is_ok(Enqueue_sink))
andalso result_is_ok(Ack_sink))
andalso result_is_ok(Pause_result))
andalso result_is_ok(Resume_result))
andalso result_is_ok(Replay_result))
andalso (erlang:length(Started_source) =:= 1))
andalso (erlang:length(Started_transform) =:= 1))
andalso (erlang:length(Started_sink) =:= 1))
andalso (erlang:length(
lightspeed@pipeline@operations_surface:lineage_records(Surface@14)
)
=:= 3))
andalso (erlang:length(Audits) >= 11))
andalso gleam_stdlib:contains_string(
Signature,
<<"control:replay:write_orders:checkpoint_check"/utf8>>
))
andalso gleam_stdlib:string_starts_with(
lightspeed@pipeline@operations_surface:lifecycle_label(Surface@14),
<<"completed:run-"/utf8>>
))
andalso lightspeed@pipeline@operations_surface:valid(Surface@14),
{Passed,
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"start="/utf8,
(result_label(
Start_result
))/binary>>/binary,
"|ack_source="/utf8>>/binary,
(ack_result_label(
Ack_source
))/binary>>/binary,
"|ack_transform="/utf8>>/binary,
(ack_result_label(
Ack_transform
))/binary>>/binary,
"|ack_sink="/utf8>>/binary,
(ack_result_label(
Ack_sink
))/binary>>/binary,
"|pause="/utf8>>/binary,
(result_label(
Pause_result
))/binary>>/binary,
"|resume="/utf8>>/binary,
(result_label(Resume_result))/binary>>/binary,
"|replay="/utf8>>/binary,
(result_label(Replay_result))/binary>>/binary,
"|telemetry="/utf8>>/binary,
(lightspeed@pipeline@operations_surface:telemetry_label(
Surface@14
))/binary>>/binary,
"|freshness="/utf8>>/binary,
(lightspeed@pipeline@operations_surface:freshness_label(
lightspeed@pipeline@operations_surface:freshness(
Surface@14
)
))/binary>>/binary,
"|checkpoints="/utf8>>/binary,
(lightspeed@pipeline@checkpoint:chain_signature(
lightspeed@pipeline@operations_surface:checkpoints(
Surface@14
)
))/binary>>/binary,
"|surface="/utf8>>/binary,
Signature/binary>>}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 189).
-spec evaluate(scenario()) -> {boolean(), binary()}.
evaluate(Scenario) ->
case Scenario of
run_replay_control_evidence ->
evaluate_run_replay_control_evidence();
checkpoint_resume_idempotency_under_load ->
evaluate_checkpoint_resume_idempotency_under_load();
heavy_data_adapter_conformance ->
evaluate_heavy_data_adapter_conformance();
tenant_aware_operations_observability ->
evaluate_tenant_aware_operations_observability();
regression_determinism_gate ->
evaluate_regression_determinism_gate()
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 65).
?DOC(" Run one M60 scenario twice and require deterministic parity.\n").
-spec run_scenario(scenario()) -> scenario_outcome().
run_scenario(Scenario) ->
{First_passed, First_signature} = evaluate(Scenario),
{Second_passed, Second_signature} = evaluate(Scenario),
Deterministic = (First_passed =:= Second_passed) andalso (First_signature
=:= Second_signature),
Passed = (First_passed andalso Second_passed) andalso Deterministic,
{scenario_outcome, Scenario, Passed, Deterministic, First_signature}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 46).
?DOC(" Run all M60 scenarios.\n").
-spec run_matrix() -> report().
run_matrix() ->
Outcomes = begin
_pipe = [run_replay_control_evidence,
checkpoint_resume_idempotency_under_load,
heavy_data_adapter_conformance,
tenant_aware_operations_observability,
regression_determinism_gate],
gleam@list:map(_pipe, fun run_scenario/1)
end,
{report, Outcomes, count_failed(Outcomes), count_nondeterministic(Outcomes)}.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 81).
?DOC(" Scenario label.\n").
-spec scenario_label(scenario()) -> binary().
scenario_label(Scenario) ->
case Scenario of
run_replay_control_evidence ->
<<"run_replay_control_evidence"/utf8>>;
checkpoint_resume_idempotency_under_load ->
<<"checkpoint_resume_idempotency_under_load"/utf8>>;
heavy_data_adapter_conformance ->
<<"heavy_data_adapter_conformance"/utf8>>;
tenant_aware_operations_observability ->
<<"tenant_aware_operations_observability"/utf8>>;
regression_determinism_gate ->
<<"regression_determinism_gate"/utf8>>
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 94).
?DOC(" Stable pass/fail label.\n").
-spec pass_fail_label(scenario_outcome()) -> binary().
pass_fail_label(Outcome) ->
case erlang:element(3, Outcome) of
true ->
<<"pass"/utf8>>;
false ->
<<"fail"/utf8>>
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 102).
?DOC(" Scenario signature accessor.\n").
-spec signature(scenario_outcome()) -> binary().
signature(Outcome) ->
erlang:element(5, Outcome).
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 107).
?DOC(" Scenario accessor.\n").
-spec scenario(scenario_outcome()) -> scenario().
scenario(Outcome) ->
erlang:element(2, Outcome).
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 112).
?DOC(" Determinism accessor.\n").
-spec deterministic(scenario_outcome()) -> boolean().
deterministic(Outcome) ->
erlang:element(4, Outcome).
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 117).
?DOC(" Report outcomes accessor.\n").
-spec outcomes(report()) -> list(scenario_outcome()).
outcomes(Report) ->
erlang:element(2, Report).
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 122).
?DOC(" Failed scenario count.\n").
-spec failed_scenarios(report()) -> integer().
failed_scenarios(Report) ->
erlang:element(3, Report).
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 127).
?DOC(" Nondeterministic scenario count.\n").
-spec nondeterministic_failures(report()) -> integer().
nondeterministic_failures(Report) ->
erlang:element(4, Report).
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 630).
-spec bool_label(boolean()) -> binary().
bool_label(Value) ->
case Value of
true ->
<<"true"/utf8>>;
false ->
<<"false"/utf8>>
end.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 132).
?DOC(" Stable report signature.\n").
-spec report_signature(report()) -> binary().
report_signature(Report) ->
Entries = gleam@list:map(
erlang:element(2, Report),
fun(Outcome) ->
<<<<<<<<<<<<(scenario_label(erlang:element(2, Outcome)))/binary,
"="/utf8>>/binary,
(pass_fail_label(Outcome))/binary>>/binary,
":deterministic="/utf8>>/binary,
(bool_label(erlang:element(4, Outcome)))/binary>>/binary,
":"/utf8>>/binary,
(erlang:element(5, Outcome))/binary>>
end
),
join_with(<<";"/utf8>>, Entries).
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 148).
?DOC(" Deterministic snapshot signature for M60 fixture drift gates.\n").
-spec snapshot_signature() -> binary().
snapshot_signature() ->
<<<<<<"m60.snapshot.v"/utf8, (erlang:integer_to_binary(1))/binary>>/binary,
"|"/utf8>>/binary,
(report_signature(run_matrix()))/binary>>.
-file("src/lightspeed/ops/pipeline_operations_surface_harness.gleam", 156).
?DOC(" Deterministic markdown report for M60 fixture scripts.\n").
-spec snapshot_report_markdown() -> binary().
snapshot_report_markdown() ->
Report = run_matrix(),
Failed = failed_scenarios(Report),
Nondeterministic = nondeterministic_failures(Report),
Status = case (Failed =:= 0) andalso (Nondeterministic =:= 0) of
true ->
<<"OK"/utf8>>;
false ->
<<"FAIL"/utf8>>
end,
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"# Pipeline Operations Surface Fixture Report\n\n"/utf8,
"snapshot_version: "/utf8>>/binary,
(erlang:integer_to_binary(
1
))/binary>>/binary,
"\n"/utf8>>/binary,
"profile_version: "/utf8>>/binary,
(lightspeed@pipeline@operations_surface:profile_version_label(
))/binary>>/binary,
"\n"/utf8>>/binary,
"status: "/utf8>>/binary,
Status/binary>>/binary,
"\n"/utf8>>/binary,
"failed_scenarios: "/utf8>>/binary,
(erlang:integer_to_binary(
Failed
))/binary>>/binary,
"\n"/utf8>>/binary,
"nondeterministic_failures: "/utf8>>/binary,
(erlang:integer_to_binary(Nondeterministic))/binary>>/binary,
"\n\n"/utf8>>/binary,
"snapshot_signature: "/utf8>>/binary,
(snapshot_signature())/binary>>/binary,
"\n\n"/utf8>>/binary,
"report_signature: "/utf8>>/binary,
(report_signature(Report))/binary>>/binary,
"\n"/utf8>>.