@suffolklitlab/alkiln 5.13.4 → 5.15.0-deps-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/github_server.yml +1 -1
- package/.github/workflows/playground.yml +2 -1
- package/.github/workflows/unit_tests.yml +1 -1
- package/CHANGELOG.md +40 -0
- package/action.yml +26 -10
- package/action_for_github_server/action.yml +31 -27
- package/docs/4_environments.md +2 -2
- package/docs/artifacts_folder_name.md +121 -71
- package/docs/constrained_random_tests.md +220 -289
- package/docs/decisions/move_runtime_config_to_sources_folder.md +3 -1
- package/docs/prioritize_constrained_random_tests.md +35 -76
- package/lib/docassemble/server_install.js +0 -2
- package/lib/docassemble/setup.js +1 -3
- package/lib/docassemble/takedown.js +2 -2
- package/lib/globals.js +10 -0
- package/lib/run_cucumber.js +40 -53
- package/lib/scope.js +44 -1
- package/lib/setup/TestGenerator.js +1757 -0
- package/lib/setup/artifacts.js +20 -0
- package/lib/setup/generate.js +42 -0
- package/lib/setup/get_Gherkin_AST.js +26 -0
- package/lib/setup/validate.js +89 -0
- package/lib/steps.js +101 -42
- package/lib/utils/Log.js +317 -165
- package/lib/utils/_alkiln-constrained_random_tests_old.js +1776 -0
- package/lib/utils/get_error_stacks.js +16 -0
- package/lib/utils/pdf_reader.js +9 -2
- package/lib/utils/reports.js +44 -22
- package/lib/utils/session_vars.js +77 -57
- package/lib/utils/set_sources_paths.js +98 -0
- package/npm-shrinkwrap.json +739 -924
- package/package.json +17 -10
- package/tests/log_codes/check_codes.sh +17 -13
- package/tests/log_codes/log_code_expected_instances.txt +58 -0
- package/tests/unit_tests/constrained_random_answers/invalid.fixtures.js +178 -0
- package/tests/unit_tests/constrained_random_answers/invalid.test.js +251 -0
- package/tests/unit_tests/constrained_random_answers/valid.fixtures.js +957 -0
- package/tests/unit_tests/constrained_random_answers/valid.test.js +563 -0
- package/tests/unit_tests/example_of_chai_test_lifecycle.js +78 -0
- package/tests/unit_tests/log.test.js +17 -41
- package/docs/seprate_file_generation_GitHub_action.md +0 -11
- package/lib/parse.js +0 -36
- package/lib/utils/get_sources_paths.js +0 -162
- package/lib/utils/parse.js +0 -1
- package/lib/utils/proccess_command_line_args.js +0 -267
- /package/docs/{expected_inernal_results.md → expected_internal_results.md} +0 -0
|
@@ -21,115 +21,165 @@ Our 4 environments can be condensed into 3 environments for the purpose of manag
|
|
|
21
21
|
- ALKilnInThePlayground
|
|
22
22
|
- The command line for internal development
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Every environment runs npm commands. Those commands are sometimes run separately and thus trigger separate processes. We must find a way to persist information, like the name of the artifacts folder, across these processes.
|
|
25
25
|
|
|
26
|
-
The artifact folder name
|
|
26
|
+
The GitHub action creates an artifact folder name and sends it to a script that use an instance of the `Log` class to create the folder and save the name. In other environments, an instance of the `Log` class is what creates the name.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
The scripts that GitHub action uses need to store its output in the same artifacts folder. The GitHub action therefore builds the name of the artifact folder and passes that around to the different scripts. The scripts pass the folder name to the `Log` class every time, which saves the folder name in `runtime_config.json`. After that, the core code uses that `json` value to put other artifacts in the same folder. We also have folder-naming code in the core code which we use for other purposes. The GitHub action duplicates that folder-naming code, which is unfortunate.
|
|
28
|
+
The instance of the `Log` saves the name in `runtime_config.json`. That instance of `Log` and other ALKiln code uses that name to create and store files in that artifacts folder.
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
The artifact folder name generation code is in 2 places - the GitHub action and ALKiln's core code[^1]. In future, we may be able to reduce that to just one location - the core code.
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
Below are more detailed descriptions of how each environment interacts with the folder name. Where the folder name is created, gets passed, gets saved, and gets used. These descriptions still gloss over many details.
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
-->
|
|
34
|
+
The diagrams highlight `Log` to help visualize a common point in all the flows.
|
|
37
35
|
|
|
38
|
-
A future goal is to remove the need to store the name in the runtime configuration file to reduce that complexity a bit. These flows are up for discussion.
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
### Shared behavior
|
|
38
|
+
|
|
39
|
+
For each environment, the start and end of how they manage the artifacts folder name is different. In the middle, though - once the artifacts folder name is already stored in the `runtime_config` file - the flow is the same.
|
|
40
|
+
|
|
41
|
+
Npm commands that come in the middle have this flow to save logs:
|
|
42
|
+
|
|
43
|
+
```mermaid
|
|
44
|
+
flowchart LR
|
|
45
|
+
|
|
46
|
+
environment --triggers--> commands["middle</br>commands"]
|
|
47
|
+
commands --trigger--> scripts["package</br>code"]
|
|
48
|
+
scripts --make--> log2["#96;Log#96;"]:::log
|
|
49
|
+
log2 --"gets name</br>from"--> runtime2["runtime config</br>file"]
|
|
50
|
+
log2 --"adds to"--> folder2[folder</br>& files]
|
|
51
|
+
|
|
52
|
+
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The core code also needs to use the artifacts folder name in order to save both logs and other artifacts:
|
|
56
|
+
|
|
57
|
+
```mermaid
|
|
58
|
+
flowchart LR
|
|
59
|
+
|
|
60
|
+
core["core</br>code"] --"makes"--> log4["#96;Log#96;"]:::log
|
|
61
|
+
core --"adds to"--> folder3[folder</br>& files]
|
|
62
|
+
core --"gets name</br>from"--> runtime3["runtime config</br>file"]
|
|
63
|
+
log4 --"gets name</br>from"--> runtime3
|
|
64
|
+
log4 --"adds to"--> folder3
|
|
65
|
+
|
|
66
|
+
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Those are the shared flows. Each environment, though, has its own way to store the name at the start and each environment has its own way to give the author the final artifacts.
|
|
41
70
|
|
|
42
|
-
The diagrams highlight `Log` to help visualize a common point in all the flows.
|
|
43
71
|
|
|
44
72
|
### GitHub action
|
|
45
73
|
|
|
46
|
-
|
|
47
|
-
2. GitHub action uses the same folder name, passes that same name to `run_cucumber`, which passes that same name to `Log`. The `runtime_cucumber` process uses that `Log`. The `run_cucumber` process also triggers the core code, which uses the folder name in `runtime_config.json` to create its own `Log`. The core code also uses that name to store other artifact files in the folder.
|
|
48
|
-
3. GitHub action creates the folder name, passes that same name to `takedown`, which passes that same name when instantiating its `Log`. The takedown `Log` uses the name to store logs in the folder.
|
|
74
|
+
The GitHub action starts off with an empty `runtime_config` file. The action creates a new folder name and passes that name to the `artifacts` script, which passes that name to a `Log`. The `Log` creates the artifacts folder and saves the name in `runtime_config.json`.
|
|
49
75
|
|
|
50
76
|
```mermaid
|
|
51
|
-
|
|
77
|
+
flowchart LR
|
|
78
|
+
|
|
79
|
+
action["GitHub action"] --creates--> name["artifacts</br>folder name"]
|
|
80
|
+
action --"passes</br>name "--> command["'artifacts'</br>command"]
|
|
81
|
+
command --"passes</br>name"--> artifacts["artifacts.js"]
|
|
82
|
+
artifacts --"passes</br>name"--> log1["#96;Log#96;"]:::log
|
|
83
|
+
log1 --"stores name in</br>& uses"--> runtime1["runtime config</br>file"]
|
|
84
|
+
log1 --"creates</br>with name"--> folder1["folder</br>& files"]
|
|
85
|
+
log1 --"adds to"--> folder1
|
|
52
86
|
|
|
87
|
+
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then other processes use the name from the config to store logs and other files in the artifacts folder (as we've already shown).
|
|
91
|
+
|
|
92
|
+
Finally, the action uses the name in the action context to download the artifacts folder so the user can have access to it after the action is done.
|
|
93
|
+
|
|
94
|
+
```mermaid
|
|
53
95
|
flowchart LR
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
log1 --create with name--> folder1[folder]
|
|
58
|
-
|
|
59
|
-
action2[action part 2] --pass name too--> run["run"]
|
|
60
|
-
run --pass name too--> log2["#96;Log#96;"]:::log
|
|
61
|
-
log2 --store name in/ignore--> runtime2["runtime config file"]
|
|
62
|
-
log2 --use with name--> folder2[folder]
|
|
63
|
-
run --> core["core code"]
|
|
64
|
-
core --pass name too--> log3["#96;Log#96;"]:::log
|
|
65
|
-
core --use with name--> folder2
|
|
66
|
-
core --get name from--> runtime2
|
|
67
|
-
log3 --use with name--> folder2
|
|
68
|
-
log3 --store name in/ignore--> runtime2
|
|
69
|
-
|
|
70
|
-
action3[action part 3] --pass name too--> takedown["takedown"]
|
|
71
|
-
takedown --pass name too--> log4["#96;Log#96;"]:::log
|
|
72
|
-
log4 --store name in/ignore--> runtime3["runtime config file"]
|
|
73
|
-
log4 --create with name--> folder5[folder]
|
|
96
|
+
|
|
97
|
+
action["GitHub action"] --previously created--> name["artifacts folder name"]
|
|
98
|
+
action --uses name to get--> folder["folder & files"]
|
|
74
99
|
|
|
75
100
|
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
76
101
|
```
|
|
77
102
|
|
|
103
|
+
|
|
78
104
|
### ALKilnInThePlayground
|
|
79
105
|
|
|
80
|
-
|
|
106
|
+
_Note: This should be implemented by the time anyone actually reads this. Here's hoping._
|
|
107
|
+
|
|
108
|
+
ALKilnInThePlayground starts off with an empty `runtime_config` file. ALKilnInThePlayground triggers the `artifacts` command, but without a folder name. The code still creates a `Log` (also without a folder name). The `Log` itself creates the name.
|
|
81
109
|
|
|
82
110
|
```mermaid
|
|
83
111
|
flowchart LR
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
log3 --use with name--> folder2
|
|
93
|
-
log3 --store name in/ignore--> runtime2
|
|
112
|
+
|
|
113
|
+
ALKilnInThePlayground --> command["'artifacts'</br>command"]
|
|
114
|
+
command --> artifacts["artifacts.js"]
|
|
115
|
+
artifacts --> log1["#96;Log#96;"]:::log
|
|
116
|
+
log1 --creates--> name["artifacts</br>folder name"]
|
|
117
|
+
log1 --stores name--> runtime1["runtime config file"]
|
|
118
|
+
log1 --"gets name</br>from"--> runtime1["runtime config</br>file"]
|
|
119
|
+
log1 --creates</br>with name--> folder1["folder</br>& files"]
|
|
94
120
|
|
|
95
121
|
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
96
122
|
```
|
|
97
123
|
|
|
124
|
+
Then other processes use the name from the config to store logs and other files in the artifacts folder (as we've already shown).
|
|
125
|
+
|
|
126
|
+
Finally, ALKilnInThePlayground itself uses the runtime config file to get the name so it can give the artifacts to the user.
|
|
127
|
+
|
|
128
|
+
```mermaid
|
|
129
|
+
flowchart LR
|
|
130
|
+
|
|
131
|
+
ALKilnInThePlayground --"gets name from"--> runtime1["runtime config file"]
|
|
132
|
+
ALKilnInThePlayground --"uses name to get"--> folder["folder & files"]
|
|
133
|
+
|
|
134
|
+
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
|
|
98
138
|
### Command line
|
|
99
139
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
140
|
+
The command line flow is similar to ALKilnInThePlayground, but has to deal with a pre-existing runtime config file[^2]. The command line flow overwrites the artifacts folder name on each run.
|
|
141
|
+
|
|
142
|
+
An internal developer uses the command line to trigger the `artifacts` command, but without a folder name. The code still creates a `Log` (also without a folder name). The `Log` itself creates a name and overwrites the current name in the runtime config file.
|
|
103
143
|
|
|
104
144
|
```mermaid
|
|
105
145
|
flowchart LR
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
log2 --create with name--> folder2[folder]
|
|
115
|
-
run --> core["core code"]
|
|
116
|
-
core --> log3["#96;Log#96;"]:::log
|
|
117
|
-
core --use with name--> folder2
|
|
118
|
-
core --get name from--> runtime2
|
|
119
|
-
log3 --use with name--> folder2
|
|
120
|
-
log3 --store name in/ignore--> runtime2
|
|
121
|
-
|
|
122
|
-
cmd3[command line] --> takedown["takedown"]
|
|
123
|
-
takedown --> log4["#96;Log#96;"]:::log
|
|
124
|
-
log4 --store name in/ignore--> runtime3["runtime config file"]
|
|
125
|
-
log4 --create with name--> folder5[folder]
|
|
146
|
+
|
|
147
|
+
dev --> command["'artifacts'</br>command"]
|
|
148
|
+
command --> artifacts["artifacts.js"]
|
|
149
|
+
artifacts --> log1["#96;Log#96;"]:::log
|
|
150
|
+
log1 --creates--> name["artifacts</br>folder name"]
|
|
151
|
+
log1 --"overwrites</br>previous name"--> runtime1["runtime config file"]
|
|
152
|
+
log1 --"gets name</br>from"--> runtime1["runtime config</br>file"]
|
|
153
|
+
log1 --creates</br>with name--> folder1["folder</br>& files"]
|
|
126
154
|
|
|
127
155
|
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
128
156
|
```
|
|
129
157
|
|
|
158
|
+
Then other processes use the name from the config to store logs and other files in the artifacts folder (as we've already shown).
|
|
159
|
+
|
|
160
|
+
ALKiln stores the artifacts folder in the root of the local repository folder. The developer has direct access to the file system and can see every new artifacts folder. In fact, they can also see any previous artifacts folders. We avoid adding those artifacts folders to the repo by including the folder name pattern in the `.gitignore` and `.npmignore` files.
|
|
161
|
+
|
|
162
|
+
```mermaid
|
|
163
|
+
flowchart LR
|
|
164
|
+
|
|
165
|
+
git --🙈--> folder["folders & files"]
|
|
166
|
+
dev --👁️--> folder
|
|
167
|
+
npm --🙉--> folder
|
|
168
|
+
|
|
169
|
+
classDef log fill:#d6fd88,stroke:#000,stroke-width:2px,color:#000
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
|
|
130
173
|
## Alternatives considered
|
|
131
174
|
|
|
132
|
-
-
|
|
133
|
-
-
|
|
175
|
+
- Each originator (GitHub, ALKilnInThePlayground, the dev) could always create the name from the outside. This would duplicate work, but would give more fine-grained control.
|
|
176
|
+
- Have `Log` make a different folder name each time and, at the very end, combine the contents of those folders into one folder. Hey, all ideas are welcome here.
|
|
177
|
+
|
|
178
|
+
For name creation:
|
|
179
|
+
|
|
180
|
+
- Avoid GitHub actions creating names. That is, create names only in `artifacts.js` and pass that out again. Needs research.
|
|
181
|
+
|
|
134
182
|
|
|
135
183
|
[^1]: **Core framework code/core code:** the code that implements the Steps in the `.feature` test files.
|
|
184
|
+
|
|
185
|
+
[^2] Keeping the `runtime_config` file around helps greatly improves the local development experience. You can read more in the document that talks about the 4 environments ALKiln supports.
|