@suffolklitlab/alkiln 5.12.0 → 5.13.0-logs1

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.
Files changed (38) hide show
  1. package/.env.example +29 -0
  2. package/.github/workflows/github_server.yml +59 -12
  3. package/.github/workflows/playground.yml +11 -4
  4. package/CHANGELOG.md +41 -1
  5. package/CONTRIBUTING.md +98 -83
  6. package/README.md +1 -1
  7. package/action.yml +67 -29
  8. package/action_for_github_server/action.yml +59 -31
  9. package/docs/decisions/006_which_log_level_to_pick_2024_09_5.md +46 -0
  10. package/docs/decisions/adopt_architectural_decision_records.md +58 -0
  11. package/docs/decisions/detect_sign_in.md +124 -0
  12. package/docs/decisions/pdfjs_version_2024_08_08.md +18 -0
  13. package/docs/decisions/reports_and_logs_2024_08_11.md +141 -0
  14. package/docs/decisions/update_puppeteer_2024_07_28.md +62 -0
  15. package/docs/story_tables.md +1 -1
  16. package/lib/docassemble/docassemble_api_REST.js +67 -1
  17. package/lib/docassemble/docassemble_api_interface.js +225 -18
  18. package/lib/docassemble/server_install.js +23 -9
  19. package/lib/docassemble/setup.js +33 -20
  20. package/lib/docassemble/takedown.js +27 -7
  21. package/lib/run_cucumber.js +83 -33
  22. package/lib/scope.js +222 -82
  23. package/lib/steps.js +206 -62
  24. package/lib/utils/files.js +8 -6
  25. package/lib/utils/log.js +477 -84
  26. package/lib/utils/reports.js +14 -5
  27. package/lib/utils/session_vars.js +25 -18
  28. package/lib/utils/time.js +44 -0
  29. package/npm-shrinkwrap.json +635 -193
  30. package/package.json +8 -8
  31. package/setup.py +1 -1
  32. package/tests/log_codes/check_codes.sh +163 -108
  33. package/tests/log_codes/log_code_expected_instances.txt +213 -0
  34. package/tests/unit_tests/getAllFields.test.js +5 -0
  35. package/tests/unit_tests/getMatchingRows.test.js +5 -0
  36. package/tests/unit_tests/log.test.js +20 -0
  37. package/tests/unit_tests/normalizeTable.test.js +5 -0
  38. package/tests/log_codes/deleted_codes.json +0 -8
package/action.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: "ALKiln: Automated docassemble tests"
2
- description: "Automatically test any docassemble interview in a any branch on your GitHub repository whenever you commit or push. See https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/automated_integrated_testing."
2
+ description: "Automatically test any docassemble interview in a any branch on your GitHub repository whenever you commit or push. See https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/setup/#types."
3
3
 
4
4
  inputs:
5
5
  SERVER_URL:
@@ -41,6 +41,9 @@ outputs:
41
41
  PATH_TO_REPORT_FILE:
42
42
  description: 'An empty string ("") or the path to report.txt. Remember to check for the existence of the file before using it.'
43
43
  value: ${{ steps.alkiln_outputs.outputs.PATH_TO_REPORT_FILE }}
44
+ PATH_TO_REPORT_LOG_FILE:
45
+ description: 'An empty string ("") or the path to report_log.txt. Remember to check for the existence of the file before using it.'
46
+ value: ${{ steps.alkiln_outputs.outputs.PATH_TO_REPORT_LOG_FILE }}
44
47
  PATH_TO_UNEXPECTED_RESULTS_FILE:
45
48
  description: 'An empty string ("") or the path to unexpected_results.txt. Remember to check for the existence of the file before using it.'
46
49
  value: ${{ steps.alkiln_outputs.outputs.PATH_TO_UNEXPECTED_RESULTS_FILE }}
@@ -67,9 +70,16 @@ runs:
67
70
  DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
68
71
  shell: bash
69
72
  run: |
70
- # 💡 ALK0023 INFO: Set environment variables
73
+ log="💡 ALK0023 INFO: Set environment variables"
74
+
71
75
  # Human-readable date/time: https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/#how-to-format-a-date-in-bash
72
- echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
76
+ timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
77
+ artifact_folder="alkiln-${timestamp}UTC"
78
+ echo "ARTIFACT_FOLDER=$artifact_folder" >> $GITHUB_ENV
79
+ debug_path="${artifact_folder}/debug_log.txt"
80
+ echo "DEBUG_PATH=$debug_path" >> $GITHUB_ENV
81
+ echo "$log" >> "${debug_path}"
82
+
73
83
  echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
74
84
  echo "BRANCH_PATH=$BRANCH_PATH" >> $GITHUB_ENV
75
85
  # Workflow inputs
@@ -84,18 +94,21 @@ runs:
84
94
  - name: "💡 ALK0024 INFO: Confirm environment variables"
85
95
  shell: bash
86
96
  run: |
87
- # 💡 ALK0024 INFO: Confirm environment variables
88
- echo -e "\nALKiln version is $ALKILN_VERSION\nRepo is $REPO_URL\nBranch ref is $BRANCH_PATH\nMAX_SECONDS_FOR_SETUP is $MAX_SECONDS_FOR_SETUP\nSERVER_RELOAD_TIMEOUT_SECONDS is $SERVER_RELOAD_TIMEOUT_SECONDS\n"
97
+ log="💡 ALK0024 INFO: Confirm environment variables"
98
+ echo -e "\n$log" >> "$DEBUG_PATH"
99
+ vars_log="\nALKiln version is $ALKILN_VERSION\nRepo is $REPO_URL\nBranch ref is $BRANCH_PATH\nMAX_SECONDS_FOR_SETUP is $MAX_SECONDS_FOR_SETUP\nSERVER_RELOAD_TIMEOUT_SECONDS is $SERVER_RELOAD_TIMEOUT_SECONDS\n"
100
+ echo -e "$vars_log" >> "$DEBUG_PATH" && echo -e "$vars_log"
89
101
 
90
102
  # Install
91
- - name: "💡 ALK0025 INFO: Install node packages"
103
+ - name: "💡 ALK0025 INFO: Set up node"
92
104
  uses: actions/setup-node@v4
93
105
  with:
94
106
  node-version: "18"
95
107
  - name: "💡 ALK0026 INFO: Install ALKiln directly from npm"
96
108
  shell: bash
97
109
  run: |
98
- # 💡 ALK0026 INFO: Install ALKiln directly from npm
110
+ log="💡 ALK0026 INFO: Install ALKiln directly from npm"
111
+ echo -e "\n$log" >> "$DEBUG_PATH"
99
112
  npm install -g "@suffolklitlab/alkiln@$ALKILN_VERSION"
100
113
 
101
114
  # Install on playground
@@ -109,26 +122,32 @@ runs:
109
122
  if: ${{ inputs.INSTALL_METHOD == 'playground' }}
110
123
  shell: bash
111
124
  run: |
112
- # 💡 ALK0027 INFO: Create a Project and install the package from GitHub
125
+ log="💡 ALK0027 INFO: Create a Project and install the package from GitHub"
126
+ echo -e "\n$log" >> "$DEBUG_PATH"
113
127
  pip install "docassemblecli==$DOCASSEMBLECLI_VERSION"
114
- alkiln-setup
115
- - name: "😞 ALK0028 ERROR: Unable to create a Project"
128
+ alkiln-setup --path="$ARTIFACT_FOLDER"
129
+ - name: "🤕 ALK0028 ERROR: Unable to create a Project"
116
130
  if: ${{ inputs.INSTALL_METHOD == 'playground' && failure() }}
117
131
  shell: bash
118
132
  run: |
119
- # 😞 ALK0028 ERROR: Unable to create a Project
120
- echo -e "\n\n====\n😞 ALK0028 ERROR: Unable to create a Project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
133
+ # "🤕 ALK0028 ERROR: Unable to create a Project"
134
+ long_log="\n\n―――\n🤕 ALK0028 ERROR: Unable to create a Project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
135
+ echo -e "$long_log" >> "$DEBUG_PATH" && echo -e "$long_log"
121
136
 
122
137
  # Server installations - find folders and save session vars
123
138
  - name: "💡 ALK0029 INFO: Install the GitHub package onto the server"
124
139
  if: ${{ inputs.INSTALL_METHOD == 'server' }}
125
140
  shell: bash
126
- run: alkiln-server-install
127
- - name: "😞 ALK0030 ERROR: Unable to install the package"
141
+ run: |
142
+ log="💡 ALK0029 INFO: Install the GitHub package onto the server"
143
+ echo -e "\n$log" >> "$DEBUG_PATH"
144
+ alkiln-server-install --path="$ARTIFACT_FOLDER"
145
+ - name: "🤕 ALK0030 ERROR: Unable to install the package"
128
146
  if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
129
147
  shell: bash
130
148
  run: |
131
- echo -e "\n\n====\n😞 ALK0030 ERROR: Unable to install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
149
+ log="\n\n―――\n🤕 ALK0030 ERROR: Unable to install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
150
+ echo -e "$log" >> "$DEBUG_PATH" && echo -e "$log"
132
151
 
133
152
  # run tests
134
153
  - name: "💡 ALK0031 INFO: Run tests"
@@ -136,20 +155,26 @@ runs:
136
155
  env:
137
156
  ALKILN_TAG_EXPRESSION: ${{ inputs.ALKILN_TAG_EXPRESSION || github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
138
157
  shell: bash
139
- run: alkiln-run "$ALKILN_TAG_EXPRESSION"
158
+ run: |
159
+ log="💡 ALK0031 INFO: Run tests"
160
+ echo -e "\n$log" >> "$DEBUG_PATH"
161
+ alkiln-run "$ALKILN_TAG_EXPRESSION" --path="$ARTIFACT_FOLDER"
140
162
 
141
163
  # on playground, delete project
142
164
  - name: "💡 ALK0032 INFO: Delete the Project from the Playground"
143
165
  if: ${{ always() && inputs.INSTALL_METHOD == 'playground' }}
144
- run: alkiln-takedown
145
166
  shell: bash
167
+ run: |
168
+ log="💡 ALK0032 INFO: Delete the Project from the Playground"
169
+ echo -e "\n$log" >> "$DEBUG_PATH"
170
+ alkiln-takedown --path="$ARTIFACT_FOLDER"
146
171
 
147
172
  # Upload artifacts that subscribers can download on the Actions summary page
148
173
  - name: "💡 ALK0033 INFO: Upload artifacts folder"
149
174
  if: ${{ always() }}
150
175
  uses: actions/upload-artifact@v4
151
176
  with:
152
- name: ${{ env.ARTIFACT_NAME }}
177
+ name: ${{ env.ARTIFACT_FOLDER }}
153
178
  path: ./alkiln-*
154
179
 
155
180
  # Download artifacts folder internally to create action output
@@ -157,45 +182,56 @@ runs:
157
182
  if: ${{ always() }}
158
183
  uses: actions/download-artifact@v4
159
184
  with:
160
- name: ${{ env.ARTIFACT_NAME }}
185
+ name: ${{ env.ARTIFACT_FOLDER }}
161
186
 
162
187
  - name: "💡 ALK0184 INFO: Prepare ALKiln output file paths"
163
188
  if: ${{ always() }}
164
189
  id: alkiln_outputs
165
190
  shell: bash
166
191
  run: |
167
- # 💡 ALK0184 INFO: Prepare ALKiln output file paths
192
+ log="💡 ALK0184 INFO: Prepare ALKiln output file paths"
193
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo "$log"
168
194
 
169
195
  FOLDER=$(ls -d */ | grep -E '^alkiln-*' || true)
170
196
 
171
- echo "Test results artifacts folder is $FOLDER"
197
+ log_folder="Test results artifacts folder is $FOLDER"
198
+ echo -e "\n$log_folder" >> "$DEBUG_PATH" && echo "$log_folder"
172
199
 
173
200
  if [[ "$FOLDER" = "" ]]; then
174
- echo "Artifacts folder is missing. The path is an empty string: '$FOLDER'"
201
+ log_missing="Artifacts folder is missing. The path is an empty string: '$FOLDER'"
202
+ echo -e "\n$log_missing" >> "$DEBUG_PATH" && echo "$log_missing"
175
203
 
176
204
  else
177
205
  REPORT_PATH="${FOLDER}report.txt"
206
+ REPORT_LOG_PATH="${FOLDER}report_log.txt"
178
207
  UNEXPECTED_RESULTS_PATH="${FOLDER}unexpected_results.txt"
179
208
  DEBUG_LOG_PATH="${FOLDER}debug_log.txt"
180
209
 
181
210
  if [ -f "$REPORT_PATH" ]; then
182
- echo "$REPORT_PATH exists"
211
+ echo -e "\n$REPORT_PATH exists" >> "$DEBUG_PATH" && echo "$REPORT_PATH exists"
183
212
  else
184
- echo "$REPORT_PATH is missing"
213
+ echo -e "\n$REPORT_PATH is missing" >> "$DEBUG_PATH" && echo "$REPORT_PATH is missing"
185
214
  REPORT_PATH=""
186
215
  fi
187
216
 
217
+ if [ -f "$REPORT_LOG_PATH" ]; then
218
+ echo -e "\n$REPORT_LOG_PATH exists" >> "$DEBUG_PATH" && echo "$REPORT_LOG_PATH exists"
219
+ else
220
+ echo -e "\n$REPORT_LOG_PATH is missing" >> "$DEBUG_PATH" && echo "$REPORT_LOG_PATH is missing"
221
+ REPORT_LOG_PATH=""
222
+ fi
223
+
188
224
  if [ -f "$UNEXPECTED_RESULTS_PATH" ]; then
189
- echo "$UNEXPECTED_RESULTS_PATH exists"
225
+ echo -e "\n$UNEXPECTED_RESULTS_PATH exists" >> "$DEBUG_PATH" && echo "$UNEXPECTED_RESULTS_PATH exists"
190
226
  else
191
- echo "$UNEXPECTED_RESULTS_PATH is missing"
227
+ echo -e "\n$UNEXPECTED_RESULTS_PATH is missing" >> "$DEBUG_PATH" && echo "$UNEXPECTED_RESULTS_PATH is missing"
192
228
  UNEXPECTED_RESULTS_PATH=""
193
229
  fi
194
230
 
195
231
  if [ -f "$DEBUG_LOG_PATH" ]; then
196
- echo "$DEBUG_LOG_PATH exists"
232
+ echo -e "\n$DEBUG_LOG_PATH exists" >> "$DEBUG_PATH" && echo "$DEBUG_LOG_PATH exists"
197
233
  else
198
- echo "$DEBUG_LOG_PATH is missing"
234
+ echo -e "\n$DEBUG_LOG_PATH is missing" >> "$DEBUG_PATH" && echo "$DEBUG_LOG_PATH is missing"
199
235
  DEBUG_LOG_PATH=""
200
236
  fi
201
237
 
@@ -203,6 +239,7 @@ runs:
203
239
 
204
240
  echo "PATH_TO_ARTIFACTS=$FOLDER" >> "$GITHUB_OUTPUT"
205
241
  echo "PATH_TO_REPORT_FILE=$REPORT_PATH" >> "$GITHUB_OUTPUT"
242
+ echo "PATH_TO_REPORT_LOG_FILE=$REPORT_LOG_PATH" >> "$GITHUB_OUTPUT"
206
243
  echo "PATH_TO_UNEXPECTED_RESULTS_FILE=$UNEXPECTED_RESULTS_PATH" >> "$GITHUB_OUTPUT"
207
244
  echo "PATH_TO_DEBUG_LOG_FILE=$DEBUG_LOG_PATH" >> "$GITHUB_OUTPUT"
208
245
 
@@ -212,4 +249,5 @@ runs:
212
249
  - shell: bash
213
250
  if: ${{ always() }}
214
251
  run: |
215
- echo "💡 ALK0034 INFO: ALkiln finished running tests"
252
+ log="💡 ALK0034 INFO: ALkiln finished running tests. See above for more details."
253
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo "$log"
@@ -47,12 +47,25 @@ runs:
47
47
  # Place the root directory in this branch
48
48
  - uses: actions/checkout@v4
49
49
 
50
+ - shell: bash
51
+ if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
52
+ name: "💡 ALK0018 INFO: Get path names with date and time"
53
+ run: |
54
+ log="💡 ALK0018 INFO: Get path names with date and time"
55
+ timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
56
+
57
+ echo "DEBUG_PATH=/tmp/alkiln_docker_logs-${timestamp}UTC.txt" >> "$GITHUB_ENV"
58
+ echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln_github_server-${timestamp}UTC" >> "$GITHUB_ENV"
59
+ echo -e "$log" >> "$DEBUG_PATH"
60
+
50
61
  - shell: bash
51
62
  env:
52
63
  MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }}
53
64
  DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
54
65
  run: |
55
- # 💡ALK0001 INFO: Set environment variables
66
+ log="💡ALK0001 INFO: Set environment variables"
67
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo "$log"
68
+
56
69
  echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV
57
70
  echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
58
71
  echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
@@ -63,7 +76,8 @@ runs:
63
76
  id: api_key_output_step
64
77
  shell: bash
65
78
  run: |
66
- # 💡 ALK0002 INFO: Create GitHub step output variables
79
+ log="💡 ALK0002 INFO: Create GitHub step output variables"
80
+ echo -e "\n$log" >> "$DEBUG_PATH"
67
81
  echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DA_ADMIN_API_KEY" >> "$GITHUB_OUTPUT"
68
82
  echo "DA_ADMIN_EMAIL=$DA_ADMIN_EMAIL" >> "$GITHUB_OUTPUT"
69
83
  echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
@@ -73,16 +87,20 @@ runs:
73
87
  CONFIG: ${{ inputs.CONFIG_CONTENTS }}
74
88
  shell: bash
75
89
  run: |
76
- # 💡 ALK0003 INFO: Get config
90
+ log="💡 ALK0003 INFO: Get config"
91
+ echo -e "\n$log" >> "$DEBUG_PATH"
92
+
77
93
  mkdir /tmp/config
78
94
  # Worth making this silent by defining a variable with > /dev/null...?
79
95
  if [ -n "$CONFIG" ]
80
96
  then
81
- echo "💡 ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
97
+ log2="💡 ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
98
+ echo -e "\n$log2" >> "$DEBUG_PATH" echo "$log2"
82
99
  echo "$CONFIG" > /tmp/config/myconfig.yml
83
100
  echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
84
101
  else
85
- echo "💡 ALK0005 INFO: The developer did NOT provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
102
+ log3="💡 ALK0005 INFO: The developer did NOT provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
103
+ echo -e "\n$log3" >> "$DEBUG_PATH" echo "$log3"
86
104
  echo "CONFIG_ARGS=" >> $GITHUB_ENV
87
105
  fi
88
106
 
@@ -97,11 +115,14 @@ runs:
97
115
  SHOW_DOCKER_OUTPUT: ${{ inputs.SHOW_DOCKER_OUTPUT }}
98
116
  shell: bash
99
117
  run: |
100
- # 💡 ALK0006 INFO: Determine docker logs visibility
118
+ log="💡 ALK0006 INFO: Determine docker logs visibility"
119
+ echo -e "\n$log" >> "$DEBUG_PATH"
101
120
  if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
102
121
  echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV
122
+ echo -e "\n$SHOW_DOCKER_OUTPUT" >> "$DEBUG_PATH"
103
123
  else
104
124
  echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
125
+ echo -e "\nfalse" >> "$DEBUG_PATH"
105
126
  fi
106
127
 
107
128
  # Messages about output
@@ -110,13 +131,15 @@ runs:
110
131
  shell: bash
111
132
  run: |
112
133
  # 💡 ALK0007 INFO: ALKiln will now hide docker output
113
- echo -e '===\n💡 ALK0007 INFO: ALKiln will now hide docker output to avoid possibly showing details about your config. If you want to get output to see more of what is going on, use "with:" and set the input "SHOW_DOCKER_OUTPUT" to "true". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==='
134
+ log="===\n💡 ALK0007 INFO: ALKiln will now hide docker output to avoid possibly showing details about your config. If you want to get output to see more of what is going on, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"true\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
135
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
114
136
  - name: "💡 ALK0008 INFO: ALKiln will show docker output"
115
137
  if: ${{ env.OUTPUT_DOCKER == 'true' }}
116
138
  shell: bash
117
139
  run: |
118
140
  # 💡 ALK0008 INFO: ALKiln will show docker output
119
- echo -e '===\n💡 ALK0008 INFO: ALKiln will show docker output. ALKiln cannot control this output. If you want to prevent output, use "with:" and set the input "SHOW_DOCKER_OUTPUT" to "false". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==='
141
+ log="===\n💡 ALK0008 INFO: ALKiln will show docker output. ALKiln cannot control this output. If you want to prevent output, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"false\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
142
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
120
143
 
121
144
  # TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var
122
145
  # No docker output
@@ -126,13 +149,14 @@ runs:
126
149
  CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
127
150
  shell: bash
128
151
  run: |
129
- # 💡 ALK0009 INFO: Download and start docker silently
152
+ log="💡 ALK0009 INFO: Download and start docker silently"
153
+ echo -e "\n$log" >> "$DEBUG_PATH"
130
154
  docker pull jhpyle/docassemble > /dev/null 2>&1
131
155
  docker run --name docassemble_container \
132
156
  --env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
133
157
  --env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \
134
158
  --env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \
135
- $CONFIG_ARGS \
159
+ "$CONFIG_ARGS" \
136
160
  --cap-add SYS_PTRACE \
137
161
  --memory="4gb" -d -p 80:80 jhpyle/docassemble > /dev/null 2>&1
138
162
  # With output
@@ -142,13 +166,14 @@ runs:
142
166
  CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
143
167
  shell: bash
144
168
  run: |
145
- # 💡 ALK0010 INFO: Download and start docker
169
+ log="💡 ALK0010 INFO: Download and start docker"
170
+ echo -e "\n$log" >> "$DEBUG_PATH"
146
171
  docker pull jhpyle/docassemble
147
172
  docker run --name docassemble_container \
148
173
  --env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
149
174
  --env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \
150
175
  --env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \
151
- $CONFIG_ARGS \
176
+ "$CONFIG_ARGS" \
152
177
  --cap-add SYS_PTRACE \
153
178
  --memory="4gb" -d -p 80:80 jhpyle/docassemble
154
179
 
@@ -159,12 +184,14 @@ runs:
159
184
  shell: bash
160
185
  run: |
161
186
  # 💡 ALK0011 INFO: The following messages are not docker output
162
- echo "💡 ALK0011 INFO: The following messages are not docker output, just ALKiln waiting for the server to start"
187
+ log="💡 ALK0011 INFO: The following messages are NOT docker output, just ALKiln waiting for the server to start"
188
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
163
189
 
164
190
  - name: "💡 ALK0012 INFO: Waiting for server to start"
165
191
  shell: bash
166
192
  run: |
167
- # 💡 ALK0012 INFO: Waiting for server to start
193
+ log="💡 ALK0012 INFO: Waiting for server to start"
194
+ echo -e "\n$log" >> "$DEBUG_PATH"
168
195
 
169
196
  # Reset the SECONDS variable
170
197
  SECONDS=0
@@ -173,23 +200,28 @@ runs:
173
200
 
174
201
  response="start"
175
202
  while [[ $response != *"200"* ]]; do
176
- echo "💡 ALK0013 INFO: Time elapsed: $SECONDS seconds"
203
+ log2="💡 ALK0013 INFO: Time elapsed: $SECONDS seconds"
204
+ echo -e "\n$log2" >> "$DEBUG_PATH" && echo -e "$log2"
177
205
 
178
206
  # Check if max seconds till loading has passed
179
207
  if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
180
- echo "🤕 ALK0014 ERROR: Timed out waiting for docker container to serve the site. If you want to give your docker container more timem to install, set the MAX_SECONDS_FOR_DOCKER input for this action."
208
+ log3="🤕 ALK0014 ERROR: Timed out waiting for docker container to serve the site. If you want to give your docker container more timem to install, set the MAX_SECONDS_FOR_DOCKER input for this action."
209
+ echo -e "\n$log3" >> "$DEBUG_PATH" && echo -e "$log3"
181
210
  exit 1
182
211
  fi
183
212
 
184
213
  # Set the variable to a new string value in each iteration
185
214
  response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
186
- echo "💡 ALK0015 INFO: Response is $response"
215
+ log4="💡 ALK0015 INFO: Response is $response"
216
+ echo -e "\n$log4" >> "$DEBUG_PATH" && echo -e "$log4"
187
217
 
188
218
  # Check if the string includes the desired text
189
219
  if [[ $response == *"200"* ]]; then
190
- echo "🌈 ALK0016 SUCCESS: Success! The docker container is ready!"
220
+ log5="💡 ALK0016 SUCCESS: Success! The docker container is ready!"
221
+ echo -e "\n$log5" >> "$DEBUG_PATH" && echo -e "$log5"
191
222
  else
192
- echo "💡 ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
223
+ log6="💡 ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
224
+ echo -e "\n$log6" >> "$DEBUG_PATH" && echo -e "$log6"
193
225
  sleep 30
194
226
  fi
195
227
 
@@ -219,32 +251,28 @@ runs:
219
251
 
220
252
  # Upload artifacts that devs can download on the Actions summary page
221
253
  # Only if the developer wants to get that info, though
222
- - name: "💡 ALK0018 INFO: Get path names with date and time"
223
- if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
224
- shell: bash
225
- run: |
226
- # 💡 ALK0018 INFO: Get path names with date and time
227
- echo "GITHUB_SERVER_LOG_FILE_NAME=/tmp/alkiln_docker_logs-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC.txt" >> $GITHUB_ENV
228
- echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln_github_server-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
229
254
  - name: "💡 ALK0019 INFO: Create docker artifact data"
230
255
  if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
231
256
  shell: bash
232
257
  run: |
233
- # 💡 ALK0019 INFO: Create docker artifact data
234
- echo "$(docker output docassemble_container)" > "${{ env.GITHUB_SERVER_LOG_FILE_NAME }}"
258
+ log="💡 ALK0019 INFO: Create docker artifact data"
259
+ echo -e "\n$log" >> "$DEBUG_PATH"
260
+ echo "$(docker output docassemble_container)" >> "${{ env.DEBUG_PATH }}"
235
261
  - name: "💡 ALK0020 INFO: Upload artifacts folder"
236
262
  if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
237
263
  uses: actions/upload-artifact@v4
238
264
  with:
239
265
  name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
240
- path: ${{ env.GITHUB_SERVER_LOG_FILE_NAME }}
266
+ path: ${{ env.DEBUG_PATH }}
241
267
 
242
268
  - shell: bash
243
269
  if: ${{ success() }}
244
270
  run: |
245
- echo "🌈 ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
271
+ log="💡 ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
272
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
246
273
 
247
274
  - shell: bash
248
275
  if: ${{ failure() }}
249
276
  run: |
250
- echo "🤕 ALK0022 ERROR: Something went wrong. See above for more details."
277
+ log="🤕 ALK0022 ERROR: Something went wrong. See above for more details."
278
+ echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
@@ -0,0 +1,46 @@
1
+ # Which log levels to pick
2
+
3
+ ## Context and Problem Statement
4
+
5
+ The log levels we're giving access to in Log are `success` (`info` with a special icon), `info`, `warn`, and `throw` (`error` and throw the error). Sometimes, like in the log file itself, we hard-code the icons and such. Those places have access to other levels, like `error`.
6
+
7
+ We want to avoid distracting our users by logging errors everywhere, even when an error is what triggered the log. Does that hold true in the debug log? Successes can also be misleading about whether tests have passed or not.
8
+
9
+ When picking the log level for a log, how do we know which level to choose?
10
+
11
+ ## Considered Options
12
+
13
+ - Stay as true to technical behavior as possible.
14
+ - Stay as clear to users as possible - use levels that will help users pay attention to what affects them.
15
+
16
+ For example:
17
+
18
+ `success`:
19
+ - Use whenever anything completes successfully.
20
+ - Only use for success of major operations.
21
+ - Use for every test success.
22
+ - Use for success of all the tests.
23
+ `error`:
24
+ - Always use `error` when an error happens.
25
+ - Use `error` when an unexpected error happens.
26
+ - Only use `error` for user-relevant errors.
27
+
28
+
29
+ ## Decision Outcome
30
+
31
+ Distract the user as little as possible everywhere.
32
+
33
+ `success`:
34
+ - Only log success once for success of all tests.
35
+ - Include the `success` icon in the Scenario "Passed" section of the report.
36
+ `throw`:
37
+ - Use this level to throw errors for the user's tests (or our own internal tests).
38
+ - Use this if ALKiln itself needs to abort a test or the test suite.
39
+ `error`:
40
+ - Avoid using `error` explicitly. Only the debug logs should use the `error` level, and only to record critical errors that come in with `throw`.
41
+ `info`:
42
+ - Log expected errors as `info`. For example, the aborted promises when awaiting navigation.
43
+ `warn`:
44
+ - Avoid using the word "error" in warnings if possible.
45
+ - Use `warn` in the console for messages the user should investigate.
46
+ - Use `warn` in the debug log for messages ALKiln devs might investigate if necessary. If the warning comes from non-critical unexpected behavior, do try to be clear about what happened, but also try to avoid using the word "error" if possible. E.g. "Skipped creating metadata for the logs" instead of "Error while creating metadata for the logs".
@@ -0,0 +1,58 @@
1
+ # Document decisions
2
+
3
+ ## Context and Problem Statement
4
+
5
+ What is a good way to avoid re-hashing old decisions, or to at least know why those decisions were made?
6
+
7
+ ## Considered Options
8
+
9
+ - GitHub issues
10
+ - GitHub discussions
11
+ - Actual files in the repo
12
+
13
+ Formats:
14
+ - https://adr.github.io/madr
15
+
16
+
17
+ ## Decision Outcome
18
+
19
+ Use in-repo .md files using the https://adr.github.io/madr format. We found keeping the data within the repo to be the most compelling factor.
20
+
21
+ ## Pros and Cons of the Options
22
+
23
+ ### GitHub issues
24
+
25
+ Pros:
26
+
27
+ - Easy to search.
28
+ - Can add labels and such.
29
+ - In one of the most common places to search.
30
+ - Allows comments
31
+
32
+ Cons:
33
+
34
+ - Not actually in the repository, so any forks or clones would lose that info.
35
+ - Comments can get confusing and hard to read.
36
+
37
+ ### GitHub discussions
38
+
39
+ Pros:
40
+
41
+ - Labels and such.
42
+ - Probably easy to search?
43
+
44
+ Cons:
45
+
46
+ - A separate place from issues. Not everyone even knows those exist.
47
+ - All the cons of GitHub issues
48
+
49
+ ### Actual files in the repo
50
+
51
+ Pros:
52
+
53
+ - They go everywhere the repo goes.
54
+
55
+ Cons:
56
+
57
+ - Probably not as searchable, though maybe we could institute a way to "label"/tag them.
58
+ - Not very visible.
@@ -0,0 +1,124 @@
1
+ # Use response data to detect sign-in success
2
+
3
+ ## Context and Problem Statement
4
+
5
+ What is a robust way to detect whether signing in worked or not?
6
+
7
+ ## Considered Options
8
+
9
+ - Elements in the DOM.
10
+ - Use some class or ID that only the sign-in page has, so we can detect that a user is on a new page and succeeded.
11
+ - User-facing invalidation message elements in the DOM on failure.
12
+ - URL change.
13
+ - Response data.
14
+
15
+ ## Decision Outcome
16
+
17
+ Use a change in the URL to detect sign-in navigation.
18
+
19
+ ## Pros and Cons of the Options
20
+
21
+ ### DOM
22
+
23
+ Pros:
24
+
25
+ - It can be easy to do with the tools we are using.
26
+
27
+ Cons:
28
+
29
+ - The DOM can, and has been, changed by docassemble and these kinds of changes are made pretty quietly so we find it hard to keep track of them.
30
+ - It is pretty easy for site developers to change the HTML of standard pages like the sign-in page.
31
+
32
+ ### URL change
33
+
34
+ Pros:
35
+
36
+ - It seems very likely that developers will keep an unsuccessful sign-in on the same page, even if they change some other functionality.
37
+ - It seems very likely that developers will change the url when the sign-in succeeds.
38
+ - Sticking with checking the url would mesh with how we currently detecting page navigation. See the cons for issues with that.
39
+
40
+ Cons:
41
+
42
+ - It seems precarious, though I haven't yet been able to articulate why. I know it hasn't been a sufficient full solution in the past for interview pages. For example, in a `show if` infinite page loop.
43
+ - Developers can manipulate a page's url, though it seems unlikely in this situation.
44
+
45
+ ### Response data
46
+
47
+ Use the response data from the sign in request.
48
+
49
+ Pros:
50
+
51
+ - It seems reliable - it seems very likely that developers will re-direct their users to a different page, even if they change some other functionality.
52
+ - Less likely to change than the DOM.
53
+ - Has some standard values we can expect, like status codes.
54
+
55
+ Cons:
56
+
57
+ - DA's responses are not typical. There's no 400's in unsuccessful responses.
58
+ - Regular interview page navigation doesn't get a 302, so this method would be a special case for signing in.
59
+
60
+ Options are:
61
+
62
+ - 302 redirection status. It seems fairly reliable that a developer will send a user to a different page after they sign in, and also likely that they will keep the user on the same page if the sign-in failed.
63
+ - Cache-Control header value that contains "must-revalidate" (See [MDN cache control directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives)). It makes sure this data isn't cached. I'm not familiar with this and I'm not sure what might or might not trigger this.
64
+ - Cookie with the name "secret". This seems promising, but I don't know much about cookies.
65
+
66
+ Based on our current knowledge, we think the 302 status response will be most reliable.
67
+
68
+ Notes for response data:
69
+
70
+ I have isolated the differences between the sign-in success and failure responses.
71
+
72
+ Key for following entries:
73
+
74
+ ```
75
+ <key of object containing the data>
76
+ 🌈 <sign in success data>
77
+ vs
78
+ 🤕 <sign in failure data>
79
+ ```
80
+
81
+ Findings:
82
+
83
+ ```
84
+ response
85
+ 🌈 "redirectURL": "/path", "headersSize": 552, "bodySize": 0, "_transferSize": 552,
86
+ vs
87
+ 🤕 "redirectURL": "", "headersSize": 570, "bodySize": 1998, "_transferSize": 2568,
88
+ ---
89
+ response
90
+ 🌈 "status": 302, "statusText": "FOUND",
91
+ vs
92
+ 🤕 "status": 200, "statusText": "OK",
93
+
94
+ ---
95
+ headers
96
+ 🌈 no cache-control
97
+ vs
98
+ 🤕 { "name": "Cache-Control", "value": "no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0" },
99
+ ---
100
+ headers
101
+ 🌈 { "name": "Content-Length", "value": "209" },
102
+ vs
103
+ 🤕 { "name": "Content-Encoding", "value": "gzip" },
104
+ ---
105
+ headers
106
+ 🌈 { "name": "Location", "value": "/interviews" },
107
+ vs
108
+ 🤕 no location
109
+ ---
110
+ headers
111
+ 🌈 { "name": "Set-Cookie", "value": "secret=secretchars; Secure; HttpOnly; Path=/; SameSite=Lax" },
112
+ vs
113
+ 🤕 no secret
114
+ ---
115
+ headers
116
+ 🌈 no transfer-encoding
117
+ vs
118
+ 🤕 { "name": "Transfer-Encoding", "value": "chunked" },
119
+ ---
120
+ cookies
121
+ 🌈 { "name": "secret", "value": "secretchars", "path": "/", "domain": "site.com", "expires": null, "httpOnly": true, "secure": true, "sameSite": "Lax" },
122
+ vs
123
+ 🤕 no secret
124
+ ```