Skip to content

Commit a078d9a

Browse files
committed
refactor(generator): 6-step wizard, one decision per page
The old step 2 was a vertedero: major levels, minor levels, feature counts, tree depth, relation distribution slider, feature-cardinality block and group-cardinality block — all on a single scroll-heavy page. Step 1 also mixed batch basics (num_models/seed/prefix) with post-processing options (ensure_satisfiable, filename suffixes). New layout — every step answers exactly one question: 1 Batch num_models, seed, name_prefix 2 Language levels major + minor toggles (pure expressivity) 3 Feature tree features/depth/relation dist + feat/group card 4 Constraints counts, vars/ctc, CTC_DIST + prob distributions 5 Attributes random/manual, DIST_BOOLEAN/INT/REAL/STRING 6 Output ensure_satisfiable, suffixes, download Internals - routes.py split into one validator per step (validate_step1..step6) plus one _apply_stepN_xxx persistor each. Each step only writes the fields it owns, so back-nav can't silently drop state from later steps. - _apply_step2_levels now normalises TYPE_LEVEL \u2192 ARITHMETIC_LEVEL so the session always matches what Params.__post_init__ would produce. - step2 UI script moved inside #stepper_generator so wizard-spa.js re-executes it on every SPA swap; the change handlers survive prev/next navigation. Tests - 367 generator tests green (13 engine + 22 validator + 140+ wizard output + 12 wizard flow + assorted contract/unit). - 454 uvlhub tests green overall, 0 flake8 errors.
1 parent 7a58a6f commit a078d9a

12 files changed

Lines changed: 2782 additions & 2661 deletions

File tree

app/modules/generator/routes.py

Lines changed: 821 additions & 1125 deletions
Large diffs are not rendered by default.

app/modules/generator/templates/generator/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@
5151

5252

5353
{% set steps = [
54-
('General information', 'Global settings'),
55-
('Feature tree', 'Structure and levels'),
54+
('Batch', 'Models, seed, name'),
55+
('Language levels', 'Pick the expressivity'),
56+
('Feature tree', 'Shape and relation mix'),
5657
('Constraints', 'Cross-tree constraints'),
5758
('Attributes', 'Attribute catalog'),
58-
('Finishing', 'Download your models')
59+
('Output', 'Final options & download')
5960
] %}
6061

6162
<div class="stepper stepper-pills stepper-column d-flex flex-column flex-xl-row flex-row-fluid gap-10" id="stepper_generator">
@@ -121,7 +122,7 @@ <h2 class="fw-bold text-gray-900">{{ steps[current_step - 1][0] }}</h2>
121122
{% endif %}
122123
</div>
123124
<div>
124-
{% if current_step < 5 %}
125+
{% if current_step < 6 %}
125126
<button type="submit"
126127
name="nav"
127128
value="next"

app/modules/generator/templates/generator/step1.html

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
{% extends "generator/index.html" %}
2-
{% from "generator/_macros.html" import info, number_field, check_field %}
2+
{% from "generator/_macros.html" import info, number_field %}
33

44
{% block title %}Generate random feature models{% endblock %}
55

66
{% block wizard_content %}
7+
<div class="notice d-flex bg-light-primary rounded border-primary border border-dashed p-5 mb-8">
8+
<i class="ki-duotone ki-information fs-2x text-primary me-4 mt-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i>
9+
<div class="fs-7 text-gray-700 fw-semibold">
10+
This first step is just the basics of the batch — how many models to produce, a seed for reproducibility, and a name prefix for the output files. Advanced options (language levels, tree shape, constraints, attributes, ensure-satisfiable, filename suffixes) come in later steps.
11+
</div>
12+
</div>
13+
714
<div class="row g-8">
815
<div class="col-xl-8">
916

@@ -18,28 +25,14 @@
1825
<div class="mb-7">
1926
<label for="name_prefix" class="form-label d-flex align-items-center">
2027
Name prefix
21-
{{ info("Prefix used when naming the generated UVL files (e.g. 'fm' produces fm_0.uvl, fm_1.uvl…).") }}
28+
{{ info("Prefix used when naming the generated UVL files (e.g. 'fm' produces fm0.uvl, fm1.uvl…).") }}
2229
</label>
2330
<input type="text" id="name_prefix" name="name_prefix"
2431
placeholder="fm"
2532
value="{{ values.get('name_prefix', '') }}"
2633
class="form-control form-control-solid">
2734
</div>
2835

29-
<div class="separator separator-dashed my-7"></div>
30-
31-
<div class="d-flex flex-column gap-4">
32-
{{ check_field('ensure_satisfiable', 'Ensure satisfiable',
33-
'If on, the generator rejects unsatisfiable models and keeps sampling until it gets a valid one.',
34-
values) }}
35-
{{ check_field('feature_count_suffix', 'Append feature count to filename',
36-
"Adds '_Nf' to each filename, where N is the number of features of that model.",
37-
values) }}
38-
{{ check_field('constraint_count_suffix', 'Append constraint count to filename',
39-
"Adds '_Nc' to each filename, where N is the number of cross-tree constraints of that model.",
40-
values) }}
41-
</div>
42-
4336
{% if errors.get('global') %}
4437
<div class="alert alert-danger mt-7">{{ errors['global'] }}</div>
4538
{% endif %}

app/modules/generator/templates/generator/step2.html

Lines changed: 31 additions & 210 deletions
Large diffs are not rendered by default.

app/modules/generator/templates/generator/step3.html

Lines changed: 97 additions & 193 deletions
Large diffs are not rendered by default.

app/modules/generator/templates/generator/step4.html

Lines changed: 211 additions & 347 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)