-module(lightspeed@ops@developer_tooling_harness).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/lightspeed/ops/developer_tooling_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 developer-tooling conformance harness for M59.\n").
-type scenario() :: runtime_diagnostics_coverage_without_custom_instrumentation |
profiling_hotspot_actionability |
generator_refactor_quality_gate_determinism |
editor_diagnostics_navigation_contracts |
productivity_determinism_gate.
-type scenario_outcome() :: {scenario_outcome,
scenario(),
boolean(),
boolean(),
binary()}.
-type report() :: {report, list(scenario_outcome()), integer(), integer()}.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 379).
-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/developer_tooling_harness.gleam", 368).
-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/developer_tooling_harness.gleam", 397).
-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/developer_tooling_harness.gleam", 311).
-spec evaluate_productivity_determinism_gate() -> {boolean(), binary()}.
evaluate_productivity_determinism_gate() ->
First = lightspeed@tooling@developer_productivity:snapshot_signature(),
Second = lightspeed@tooling@developer_productivity:snapshot_signature(),
Fixtures = lightspeed@tooling@developer_productivity:fixture_snapshots(),
Passed = (First =:= Second) andalso (erlang:length(Fixtures) =:= 3),
Entries = gleam@list:map(
Fixtures,
fun(Entry) ->
{Label, Signature} = Entry,
<<<<Label/binary, "="/utf8>>/binary, Signature/binary>>
end
),
{Passed,
<<<<First/binary, "|fixtures="/utf8>>/binary,
(join_with(<<";"/utf8>>, Entries))/binary>>}.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 288).
-spec evaluate_editor_diagnostics_navigation_contracts() -> {boolean(),
binary()}.
evaluate_editor_diagnostics_navigation_contracts() ->
Suite = lightspeed@tooling@developer_productivity:default_suite(),
Diagnostics = gleam@list:map(
lightspeed@tooling@developer_productivity:editor_diagnostics(Suite),
fun lightspeed@tooling@developer_productivity:editor_diagnostic_signature/1
),
Navigation = gleam@list:map(
lightspeed@tooling@developer_productivity:navigation_contracts(Suite),
fun lightspeed@tooling@developer_productivity:navigation_signature/1
),
Passed = lightspeed@tooling@developer_productivity:supports_editor_navigation(
Suite
),
{Passed,
<<<<<<"diagnostics="/utf8,
(join_with(<<";"/utf8>>, Diagnostics))/binary>>/binary,
"|navigation="/utf8>>/binary,
(join_with(<<";"/utf8>>, Navigation))/binary>>}.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 249).
-spec evaluate_generator_refactor_quality_gate_determinism() -> {boolean(),
binary()}.
evaluate_generator_refactor_quality_gate_determinism() ->
Suite = lightspeed@tooling@developer_productivity:default_suite(),
Gate_signatures = gleam@list:map(
lightspeed@tooling@developer_productivity:quality_gates(Suite),
fun lightspeed@tooling@developer_productivity:quality_gate_signature/1
),
Gate_prefixes = join_with(
<<","/utf8>>,
gleam@list:map(
lightspeed@tooling@developer_productivity:quality_gates(Suite),
fun(Gate) -> erlang:element(4, Gate) end
)
),
Generator_signature = lightspeed@ops@generator_harness:snapshot_signature(),
Hot_path_signature = lightspeed@ops@hot_path_harness:snapshot_signature(),
Render_signature = lightspeed@ops@render_churn_harness:snapshot_signature(),
Passed = (((((lightspeed@tooling@developer_productivity:stable_quality_signals(
Suite
)
andalso gleam_stdlib:string_starts_with(
Generator_signature,
<<"m25.snapshot.v"/utf8>>
))
andalso gleam_stdlib:string_starts_with(
Hot_path_signature,
<<"m35.snapshot.v"/utf8>>
))
andalso gleam_stdlib:string_starts_with(
Render_signature,
<<"m36.snapshot.v"/utf8>>
))
andalso gleam_stdlib:contains_string(
Gate_prefixes,
<<"m25.snapshot.v"/utf8>>
))
andalso gleam_stdlib:contains_string(
Gate_prefixes,
<<"m35.snapshot.v"/utf8>>
))
andalso gleam_stdlib:contains_string(
Gate_prefixes,
<<"m36.snapshot.v"/utf8>>
),
{Passed,
<<<<<<<<<<<<<<"gates="/utf8,
(join_with(<<";"/utf8>>, Gate_signatures))/binary>>/binary,
"|generator_signature="/utf8>>/binary,
Generator_signature/binary>>/binary,
"|hot_path_signature="/utf8>>/binary,
Hot_path_signature/binary>>/binary,
"|render_signature="/utf8>>/binary,
Render_signature/binary>>}.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 357).
-spec suites_all_reduce_patch_churn(
list(lightspeed@tooling@developer_productivity:productivity_suite())
) -> boolean().
suites_all_reduce_patch_churn(Suites) ->
case Suites of
[] ->
true;
[Suite | Rest] ->
lightspeed@tooling@developer_productivity:workflows_reduce_patch_churn(
Suite
)
andalso suites_all_reduce_patch_churn(Rest)
end.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 346).
-spec suites_all_have_profiling_contracts(
list(lightspeed@tooling@developer_productivity:productivity_suite())
) -> boolean().
suites_all_have_profiling_contracts(Suites) ->
case Suites of
[] ->
true;
[Suite | Rest] ->
(erlang:length(
lightspeed@tooling@developer_productivity:profiling(Suite)
)
>= 3)
andalso suites_all_have_profiling_contracts(Rest)
end.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 221).
-spec evaluate_profiling_hotspot_actionability() -> {boolean(), binary()}.
evaluate_profiling_hotspot_actionability() ->
Suites = lightspeed@tooling@developer_productivity:reference_suites(),
Passed = suites_all_have_profiling_contracts(Suites) andalso suites_all_reduce_patch_churn(
Suites
),
Entries = gleam@list:map(
Suites,
fun(Suite) ->
Profiling = gleam@list:map(
lightspeed@tooling@developer_productivity:profiling(Suite),
fun lightspeed@tooling@developer_productivity:profiling_signature/1
),
Workflows = gleam@list:map(
lightspeed@tooling@developer_productivity:refactor_workflows(
Suite
),
fun lightspeed@tooling@developer_productivity:refactor_workflow_signature/1
),
<<<<<<<<(lightspeed@tooling@developer_productivity:name(Suite))/binary,
":profiling="/utf8>>/binary,
(join_with(<<","/utf8>>, Profiling))/binary>>/binary,
":workflows="/utf8>>/binary,
(join_with(<<","/utf8>>, Workflows))/binary>>
end
),
{Passed, join_with(<<";"/utf8>>, Entries)}.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 335).
-spec suites_all_diagnosable_without_custom_instrumentation(
list(lightspeed@tooling@developer_productivity:productivity_suite())
) -> boolean().
suites_all_diagnosable_without_custom_instrumentation(Suites) ->
case Suites of
[] ->
true;
[Suite | Rest] ->
lightspeed@tooling@developer_productivity:diagnosable_without_custom_instrumentation(
Suite
)
andalso suites_all_diagnosable_without_custom_instrumentation(Rest)
end.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 325).
-spec suites_all_valid(
list(lightspeed@tooling@developer_productivity:productivity_suite())
) -> boolean().
suites_all_valid(Suites) ->
case Suites of
[] ->
true;
[Suite | Rest] ->
lightspeed@tooling@developer_productivity:valid_suite(Suite) andalso suites_all_valid(
Rest
)
end.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 199).
-spec evaluate_runtime_diagnostics_coverage_without_custom_instrumentation() -> {boolean(),
binary()}.
evaluate_runtime_diagnostics_coverage_without_custom_instrumentation() ->
Suites = lightspeed@tooling@developer_productivity:reference_suites(),
Passed = suites_all_valid(Suites) andalso suites_all_diagnosable_without_custom_instrumentation(
Suites
),
Entries = gleam@list:map(
Suites,
fun(Suite) ->
Diagnostics = gleam@list:map(
lightspeed@tooling@developer_productivity:diagnostics(Suite),
fun lightspeed@tooling@developer_productivity:diagnostics_signature/1
),
<<<<(lightspeed@tooling@developer_productivity:name(Suite))/binary,
":"/utf8>>/binary,
(join_with(<<","/utf8>>, Diagnostics))/binary>>
end
),
{Passed, join_with(<<";"/utf8>>, Entries)}.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 186).
-spec evaluate(scenario()) -> {boolean(), binary()}.
evaluate(Scenario) ->
case Scenario of
runtime_diagnostics_coverage_without_custom_instrumentation ->
evaluate_runtime_diagnostics_coverage_without_custom_instrumentation(
);
profiling_hotspot_actionability ->
evaluate_profiling_hotspot_actionability();
generator_refactor_quality_gate_determinism ->
evaluate_generator_refactor_quality_gate_determinism();
editor_diagnostics_navigation_contracts ->
evaluate_editor_diagnostics_navigation_contracts();
productivity_determinism_gate ->
evaluate_productivity_determinism_gate()
end.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 61).
?DOC(" Run one M59 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/developer_tooling_harness.gleam", 42).
?DOC(" Run all M59 scenarios.\n").
-spec run_matrix() -> report().
run_matrix() ->
Outcomes = begin
_pipe = [runtime_diagnostics_coverage_without_custom_instrumentation,
profiling_hotspot_actionability,
generator_refactor_quality_gate_determinism,
editor_diagnostics_navigation_contracts,
productivity_determinism_gate],
gleam@list:map(_pipe, fun run_scenario/1)
end,
{report, Outcomes, count_failed(Outcomes), count_nondeterministic(Outcomes)}.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 77).
?DOC(" Scenario label.\n").
-spec scenario_label(scenario()) -> binary().
scenario_label(Scenario) ->
case Scenario of
runtime_diagnostics_coverage_without_custom_instrumentation ->
<<"runtime_diagnostics_coverage_without_custom_instrumentation"/utf8>>;
profiling_hotspot_actionability ->
<<"profiling_hotspot_actionability"/utf8>>;
generator_refactor_quality_gate_determinism ->
<<"generator_refactor_quality_gate_determinism"/utf8>>;
editor_diagnostics_navigation_contracts ->
<<"editor_diagnostics_navigation_contracts"/utf8>>;
productivity_determinism_gate ->
<<"productivity_determinism_gate"/utf8>>
end.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 91).
?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/developer_tooling_harness.gleam", 99).
?DOC(" Scenario signature accessor.\n").
-spec signature(scenario_outcome()) -> binary().
signature(Outcome) ->
erlang:element(5, Outcome).
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 104).
?DOC(" Scenario accessor.\n").
-spec scenario(scenario_outcome()) -> scenario().
scenario(Outcome) ->
erlang:element(2, Outcome).
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 109).
?DOC(" Determinism accessor.\n").
-spec deterministic(scenario_outcome()) -> boolean().
deterministic(Outcome) ->
erlang:element(4, Outcome).
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 114).
?DOC(" Report outcomes accessor.\n").
-spec outcomes(report()) -> list(scenario_outcome()).
outcomes(Report) ->
erlang:element(2, Report).
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 119).
?DOC(" Failed scenario count.\n").
-spec failed_scenarios(report()) -> integer().
failed_scenarios(Report) ->
erlang:element(3, Report).
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 124).
?DOC(" Nondeterministic scenario count.\n").
-spec nondeterministic_failures(report()) -> integer().
nondeterministic_failures(Report) ->
erlang:element(4, Report).
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 390).
-spec bool_label(boolean()) -> binary().
bool_label(Value) ->
case Value of
true ->
<<"true"/utf8>>;
false ->
<<"false"/utf8>>
end.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 129).
?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/developer_tooling_harness.gleam", 145).
?DOC(" Deterministic snapshot signature for M59 fixture drift gates.\n").
-spec snapshot_signature() -> binary().
snapshot_signature() ->
<<<<<<"m59.snapshot.v"/utf8, (erlang:integer_to_binary(1))/binary>>/binary,
"|"/utf8>>/binary,
(report_signature(run_matrix()))/binary>>.
-file("src/lightspeed/ops/developer_tooling_harness.gleam", 153).
?DOC(" Deterministic markdown report for M59 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,
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"# Developer Tooling Fixture Report\n\n"/utf8,
"snapshot_version: "/utf8>>/binary,
(erlang:integer_to_binary(
1
))/binary>>/binary,
"\n"/utf8>>/binary,
"profile_version: "/utf8>>/binary,
(lightspeed@tooling@developer_productivity: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>>.