@suffolklitlab/alkiln 5.13.0 → 5.13.1

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/.env.example ADDED
@@ -0,0 +1,29 @@
1
+ # Setup
2
+ DOCASSEMBLE_DEVELOPER_API_KEY=<ask @niharikasingh>
3
+ SERVER_URL=https://apps-dev.suffolklitlab.org
4
+ REPO_URL=https://github.com/SuffolkLITLab/alkiln
5
+ SERVER_RELOAD_TIMEOUT_SECONDS=
6
+ MAX_SECONDS_FOR_SETUP=
7
+
8
+ # Set DEBUG to 1 to run in non-headless mode and see the test run live
9
+ DEBUG=
10
+ # If you edit interview files (.yml files), you should push to a new
11
+ # branch and update BRANCH_PATH to that branch name
12
+
13
+ # Custom variables for our tests
14
+
15
+ BRANCH_PATH=v5
16
+ USER1_EMAIL=<ask @niharikasingh>
17
+ USER1_PASSWORD=<ask @niharikasingh>
18
+ NORMAL_USER_EMAIL=<tbd>
19
+ NORMAL_USER_PASSWORD=<tbd>
20
+ NORMAL_USER_API_KEY=<tbd>
21
+ WRONG_EMAIL=wrong_email@example.com
22
+ WRONG_PASSWORD=wrong_password
23
+ INVALID_API_KEY=invalidAPIkey
24
+ SECRET_VAR1=secret-var1-value
25
+ SECRET_VAR2=secret-var2-value
26
+ SECRET_FOR_MISSING_FIELD=secret for missing field
27
+ SECRET_INVALID_THERE_IS_ANOTHER=invalid value for there_is_another
28
+ EMPTY_STRING=
29
+ _ORIGIN=local
@@ -50,8 +50,10 @@ jobs:
50
50
  SECRET_FOR_MISSING_FIELD: secret for missing field
51
51
  INVALID_API_KEY: invalidAPIkey
52
52
  EMPTY_STRING: ""
53
- USER_NO_PERMISSIONS_EMAIL: alkiln@example.com
54
- USER_NO_PERMISSIONS_PASSWORD: User123^
53
+ NORMAL_USER_EMAIL: alkiln@example.com
54
+ NORMAL_USER_PASSWORD: User123^
55
+ WRONG_EMAIL=wrong_email@example.com
56
+ WRONG_PASSWORD=wrong_password
55
57
 
56
58
  steps:
57
59
  # Place the root directory in this branch to access
@@ -91,8 +93,8 @@ jobs:
91
93
  -H 'Content-Type: application/json' \
92
94
  -d '{
93
95
  "key": "${{ env.KEY }}",
94
- "username": "${{ env.USER_NO_PERMISSIONS_EMAIL }}",
95
- "password": "${{ env.USER_NO_PERMISSIONS_PASSWORD }}"
96
+ "username": "${{ env.NORMAL_USER_EMAIL }}",
97
+ "password": "${{ env.NORMAL_USER_PASSWORD }}"
96
98
  }')
97
99
  echo "User data:"
98
100
  echo "$user_data"
@@ -113,7 +115,7 @@ jobs:
113
115
  unquoted="${no_end_quote#\"}"
114
116
  echo "unquoted: $unquoted"
115
117
 
116
- echo "USER_NO_PERMISSIONS_API_KEY=$unquoted" >> "$GITHUB_ENV"
118
+ echo "NORMAL_USER_API_KEY=$unquoted" >> "$GITHUB_ENV"
117
119
 
118
120
  #### Developer note: You can probably leave this out
119
121
  ## Optional debugging to explore things like docker issues
@@ -43,10 +43,12 @@ jobs:
43
43
  PLAYGROUND_ID: ${{ secrets.PLAYGROUND_ID }}
44
44
  USER1_EMAIL: ${{ secrets.USER1_EMAIL }}
45
45
  USER1_PASSWORD: ${{ secrets.USER1_PASSWORD }}
46
- USER_NO_PERMISSIONS_EMAIL: ${{ secrets.USER_NO_PERMISSIONS_EMAIL }}
47
- USER_NO_PERMISSIONS_PASSWORD: ${{ secrets.USER_NO_PERMISSIONS_PASSWORD }}
48
- USER_NO_PERMISSIONS_API_KEY: ${{ secrets.USER_NO_PERMISSIONS_API_KEY }}
46
+ NORMAL_USER_EMAIL: ${{ secrets.USER_NO_PERMISSIONS_EMAIL }}
47
+ NORMAL_USER_PASSWORD: ${{ secrets.USER_NO_PERMISSIONS_PASSWORD }}
48
+ NORMAL_USER_API_KEY: ${{ secrets.USER_NO_PERMISSIONS_API_KEY }}
49
49
  INVALID_API_KEY: invalidAPIkey
50
+ WRONG_EMAIL=wrong_email@example.com
51
+ WRONG_PASSWORD=wrong_password
50
52
  EMPTY_STRING: ""
51
53
  SECRET_VAR1: secret-var1-value
52
54
  SECRET_VAR2: secret-var2-value
package/CHANGELOG.md CHANGED
@@ -43,11 +43,30 @@ Format:
43
43
  -
44
44
  -->
45
45
 
46
- <!-- ## [Unreleased] -->
46
+ ## [Unreleased]
47
+
48
+ ### Changed
49
+
50
+ - Moves "expected" status error to only be visible to internal test errors. Closes [#933](https://github.com/SuffolkLITLab/ALKiln/issues/933).
51
+
52
+ ### Fixed
53
+
54
+ - Detects failed sign in. Closes [#918](https://github.com/SuffolkLITLab/ALKiln/issues/918).
55
+ - Updates pdfjs-dist for node v20 and v22. See [#952](https://github.com/SuffolkLITLab/ALKiln/issues/952).
56
+
57
+ ### Internal
58
+
59
+ - Improved checks of log codes - more robust and flexible. See [#920](https://github.com/SuffolkLITLab/ALKiln/issues/920).
60
+ - Returns report text from `.addToReport()` so it can be used again for error messages.
61
+ - Update puppeteer to v22.15.0. Closes [#930](https://github.com/SuffolkLITLab/ALKiln/issues/930).
62
+ - Update npm vulnerabilities except pdfjs-dist. See docs/decisions/pdfjs_version_2024_08_08.md.
63
+ - Adds decision docs
64
+ - Updated CONTRIBUTING.md
65
+ - Added example.env, closes [#374](https://github.com/SuffolkLITLab/ALKiln/issues/374)
47
66
 
48
67
  ## [5.13.0] - 2024-07-11
49
68
 
50
- ## Added
69
+ ### Added
51
70
 
52
71
  - Authors can now make sure that ALKiln deletes the interviews it creates for an ALKiln testing account. They can add a new (optional) value, an API key, to [the "sign in" Step](https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#sign-in) and use the ["start interview" Step](https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#start-interview) to go to the interview. The API key must belong to the user who signs in. Example: `Given I sign in with the email "<username env var>", the password "<password env var>", and the API key "<user API key>`. Admins can create an API key for a regular user with https://docassemble.org/docs/api.html#api_user_user_id_api_post. We will add this to the documentation for the "sign in" Step.
53
72
 
package/CONTRIBUTING.md CHANGED
@@ -33,90 +33,83 @@ Before making a pull request
33
33
  1. Wait for the GitHub tests to pass. You may have to re-run failing tests—server restarts or race conditions may interfere with them. We have reduced them greatly, but some are impossible to avoid.
34
34
  1. Make your pull request. Work in progress pull requests are great too. A pull request must be reviewed before it can be merged.
35
35
 
36
- ## .env
36
+ ## Running internal tests
37
+
38
+ ### Setup and takedown
37
39
 
38
- You need to make your own `.env` file. It contains sensitive variables, like passwords. We use them for our internal tests. The file should look something like the below:
40
+ Only run this the first time you run our internal tests. That will install the code that you will test onto the docassemble server:
39
41
 
40
42
  ```bash
41
- # For everyone
42
-
43
- DOCASSEMBLE_DEVELOPER_API_KEY=<ask @niharikasingh>
44
- SERVER_URL=https://apps-dev.suffolklitlab.org
45
- REPO_URL=https://github.com/SuffolkLITLab/alkiln
46
- SERVER_RELOAD_TIMEOUT_SECONDS=
47
- MAX_SECONDS_FOR_SETUP=
48
-
49
- # For internal tests
50
-
51
- # Set DEBUG to 1 to run in non-headless mode and see the test run live
52
- DEBUG=
53
- # If you edit interview files (.yml files), you should push to a new
54
- # branch and update BRANCH_PATH to that branch name
55
- BRANCH_PATH=v4
56
- USER1_EMAIL=<ask @niharikasingh>
57
- USER1_PASSWORD=<ask @niharikasingh>
58
- SECRET_VAR1=secret-var1-value
59
- SECRET_VAR2=secret-var2-value
60
- SECRET_FOR_MISSING_FIELD=secret for missing field
61
- SECRET_INVALID_THERE_IS_ANOTHER=invalid value for there_is_another
43
+ npm run setup
62
44
  ```
63
45
 
64
- ## Running internal tests
46
+ If you run `takedown`, you will then have to run `setup` again:
65
47
 
66
- Only run this the first time you run tests in this repository to make the code available to test on the docassemble server:
48
+ ```bash
49
+ npm run takedown
50
+ ```
51
+
52
+ Use the syntax below to trigger all tests that should be passing[^1] (`pass` and unit tests):
67
53
 
68
54
  ```bash
69
- npm run setup
55
+ npm run test
70
56
  ```
71
57
 
72
- If you run `takedown`, you will then have to run `setup` again.
58
+ Run only cucumber tests that should pass:
73
59
 
74
- Use the syntax below to trigger all tests (cucumber and unit tests):
60
+ ```bash
61
+ npm run pass
62
+ ```
63
+
64
+ Run deliberately failing cucumber tests:
75
65
 
76
66
  ```bash
77
- npm run test
67
+ npm run fail
78
68
  ```
79
69
 
80
- Run only cucumber tests:
70
+ Run all cucumber tests, even those that are incorrectly failing:
81
71
 
82
72
  ```bash
83
73
  npm run cucumber
74
+ ```
75
+
76
+ Run tests with specific cucumber tags or tag expressions:
84
77
 
85
- # To test Features or Scenarios specific tags:
86
- npm run cucumber -- "--tags" "@tagname"
78
+ ```bash
79
+ npm run cucumber @tagname
87
80
  ```
88
81
 
89
- To run the unit tests in isolation:
82
+ Run only unit tests:
90
83
 
91
84
  ```bash
92
85
  npm run unit
93
86
  ```
94
87
 
95
- If you or someone else changes the interview code in `./docassemble`, you have to clean up the old data on the server before running `setup` again:
88
+ If you or someone else changes the interview code in `./docassemble/ALKilnTests/data/questions/*.yml`, you have to clean up the old code on the server before running `setup` again:
96
89
 
97
90
  ```bash
98
91
  npm run takedown
99
92
  ```
100
93
 
101
- ## How the tests run
94
+ ## Updating dependencies
95
+
96
+ To add or update a dependency, edit `package.json` with an exact version. That means avoid notations like `^`, `~`, and `x`. Then run `npm install` and `npm shrinkwrap` to update `npm-shrinkwrap.json`.
97
+
98
+ ## How one type of GitHub setup runs tests
102
99
 
103
- Our tests require the user/developer to have a docassemble server on which they host these interviews (online forms) and at least one developer account. With our help, our users set up the tests to run when they commit new code or to run manually. When GitHub runs the tests, it does the following:
100
+ Our tests require the user/interview author/developer to have a docassemble server on which they host these interviews (online forms) and at least one developer account. With our help, our users set up the tests to run when they commit new code to GitHub. When these GitHub tests run, ALKiln does the following:
104
101
 
105
- 1. Sets up on the docassemble server. In a given developer account:
106
- 1. Creates a new interview for this particular branch of the repository.
107
- 1. Pulls in the code from that branch into the docassemble server.
102
+ 1. Sets up on the docassemble server.
103
+ 1. In a given docassemble developer account's Playground it creates a new Project.
104
+ 1. Pulls in the code from the given branch into the new Project.
108
105
  1. Runs the tests
109
- 1. Pretends to be an anonymous account that comes to the form and inputs answers.
110
- 1. Writes up reports and possibly takes screenshots to show to the developer.
111
- 1. Cleans up by deleting the interview it created
106
+ 1. Pretends to be an anonymous or signed-in account that comes to the form and inputs answers.
107
+ 1. Writes up reports and creates other artifacts to show to the developer.
108
+ 1. Cleans up by deleting the Project it created.
112
109
 
113
110
  When the developer commits code to GitHub, their account triggers our code, passing along variables that our code needs, like their GitHub secret of the API key for their docassemble server developer account.
114
111
 
115
- ## Updating dependencies
116
-
117
- Sometimes you will have to add dependencies to ALKiln. You can do so by adding the dependency in the `package.json` "dependencies" section, specifying an exact version. Then, run `npm install` to update `npm-shrinkwrap.json` to have the new dependency.
118
-
119
- If you have to update an existing dependency, you can change the version in `package.json`, and run `npm install` to update `npm-shrankwrap.json`.
112
+ There are [other kinds of test you can read more about in the user documentation](https://assemblyline.suffolklitlab.org/docs/alkiln/setup). The differences can be subtle and hard to explain, but they each have their pros and cons.
120
113
 
121
114
  ## Very general architecture of files and folders
122
115
 
@@ -124,24 +117,7 @@ An honest look at our current project architecture—some of our files and folde
124
117
 
125
118
  ### Logic architecture
126
119
 
127
- ALKiln uses [cucumber](https://cucumber.io/docs/installation/javascript/)[^1] with [Gherkin](https://cucumber.io/docs/gherkin/reference/) syntax, [puppeteer](https://pptr.dev/), and [chai](https://www.chaijs.com/).
128
-
129
- #### .feature files
130
-
131
- The `.feature` files are written in Gherkin, a syntax cucumber uses. The "code" in there relies on the functions set up in `./lib/steps.js`.
132
-
133
- ```js
134
- // The test_something.feature file step
135
- Then I sign
136
-
137
- // relies on the code in steps.js
138
- Then('I sign', { timeout: -1 }, async () => {
139
- return wrapPromiseWithTimeout(
140
- scope.steps.sign( scope ),
141
- scope.timeout
142
- );
143
- });
144
- ```
120
+ ALKiln uses [cucumber](https://cucumber.io/docs/installation/javascript/)[^2] with [Gherkin](https://cucumber.io/docs/gherkin/reference/) syntax, [puppeteer](https://pptr.dev/), and [chai](https://www.chaijs.com/).
145
121
 
146
122
  #### steps.js
147
123
 
@@ -170,42 +146,81 @@ The file handles things like:
170
146
  * Checking for server restarts
171
147
  * Generating test report content
172
148
 
173
- ### Logging
149
+ #### Setup and takedown logic
174
150
 
175
- `./lib/utils/log.js` takes care of logging information of various kinds (normal, debug, error) to the command line in ways we hope are useful. We should probably find a logging library instead, but this is what we have for now. An important feature is that it ensures the messages clearly belong to ALKiln and not to some other process.
151
+ All of the setup and takedown logic is in the `./lib/docassemble` directory. It is named after the docassemble API code that is in there. Setup and takedown interact very closely with docassemble and the docassemble server API.
176
152
 
177
- ### session_vars.js
153
+ ### .env
178
154
 
179
- The `./lib/utils/session_var.js` file keeps track of what you might otherwise think of as environment variables. We like to think of them as constants, but some of them do need to go through functions, so for consistency we get them all through functions. Also because it was easier to test them when they are functions.
155
+ You need to copy [our `.env.example` file](https://github.com/SuffolkLITLab/ALKiln/blob/HEAD/.env.example). It has sensitive variables, like passwords. It also has custom values our tests need. Contact us to get involved with the project and get the sensitive information. We need to use environment variables in the same way our users do when they run their workflow files in their GitHub action. At the moment, it is the only way to pass values into ALKiln from a GitHub action.
180
156
 
181
- ### Setup and takedown logic
157
+ ### GitHub composite actions
182
158
 
183
- All of the setup and takedown logic is in the `./lib/docassemble` directory. It is named after the docassemble API code that is in there. Also, setup and takedown interact very closely with docassemble and the docassemble server.
159
+ Our `./action.yml` and `action_for_github_server/action.yml` are [composite actions](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action). The GitHub workflow files are there to trigger the code in these files. These composite actions install npm, install ALKiln. They execute the scripts in our `package.json` to set up the tests, run them, save the output of the tests - artifacts reports, errors, screenshots, etc. - clean up the tests, and output the reports back to the author's workflow files.
184
160
 
185
- Other files also use the docassemble API functions, so this folder is in a bit of a messy position.
161
+ ### Internal tests
186
162
 
187
- ### Bash commands
163
+ We have our own docassemble package inside our repo `./docassemble` folder to test our own code with its own interview files and `.feature` test files.
188
164
 
189
- When you `npm run` the scripts in our `./package.json` you can setup, run, or takedown tests. We are working on converting this to a command line tool to avoid some complexity in GitHub actions, increase security, and align more with what this framework has grown into. (TODO: Define this better)
165
+ There are other files the docassemble package needs, like `./setup.py`, so if you see them around, don't worry about them.
190
166
 
191
- ### GitHub composite action
167
+ If you want to run the tests, you can go to the [instructions for running tests section](#running-internal-tests) in this README.
192
168
 
193
- Our `./action.yml` is a [composite action](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action). The users/developers let it do most of the work for them. It installs npm, installs our repo, then uses our repo to set up the tests, run the tests, generate and save reports, errors, and screenshots, and clean up the tests.
169
+ #### .feature and .yml files
194
170
 
195
- ### Internal tests
171
+ The `.feature` are in `./docassemble/ALKilnTests/data/sources/*.feature`. They're written in Gherkin, a syntax cucumber uses. The "code" in there relies on the functions set up in `./lib/steps.js`. For example:
196
172
 
197
- We have our own docassemble package in our repo to test our own end-to-end tests. Most of what the package needs is in `./docassemble`. That docassemble package is what the test setup pulls into the docassemble server. Our internal end-to-end cucumber tests are `.feature` files that are stored in `./docassemble/ALKilnTests/data/sources`. The interview (online form) `.yml` files that those `.feature` files use are also deep in the `./docassemble` package. You probably won't be touching the interview files. If you get curious, feel free to ask us.
173
+ ```js
174
+ // The test_something.feature file Step
175
+ Then I sign
198
176
 
199
- There are other files the docassemble package needs, like `./setup.py`, so if you see them around, don't worry about them.
177
+ // relies on the code in steps.js
178
+ Then('I sign', { timeout: -1 }, async () => {
179
+ return wrapPromiseWithTimeout(
180
+ scope.steps.sign( scope ),
181
+ scope.timeout
182
+ );
183
+ });
184
+ ```
200
185
 
201
- Our unit tests are in `./tests/unit_tests` and their filenames end in `.test.js`. Like the cucumber tests, they use chai for assertions. The fixtures for the tests are also contained in that folder and end in `.fixtures.js`.
186
+ See [the documentation](https://assemblyline.suffolklitlab.org/docs/alkiln/writing) for other examples.
202
187
 
203
- If you want to know the commands, you can go to the [instructions for running tests](#running-internal-tests).
188
+ The `.yml` interviews (online forms) those tests go to are in `./docassemble/ALKilnTests/data/questions/*.yml`.
204
189
 
205
- ### Files that you don't need to look at
190
+ #### Unit tests
191
+
192
+ Our unit tests are in `./tests/unit_tests` and their filenames end in `.test.js`. Like some of the cucumber Steps, they use chai for assertions. The fixtures for the tests are also contained in that folder and end in `.fixtures.js`.
193
+
194
+ We also validate our log codes. Log codes help identify specific messages the user gets. An example of a log code is `ALK0105`. We want to avoid repeating or leaving out log code numbers, so we check those log codes before pushing or merging. That test, a bash file, is also in `./tests/unit_tests`.
195
+
196
+ #### GitHub workflow files
197
+
198
+ Like our users, we use GitHub workflow files in `.github/workflows` to trigger the ALKiln composite actions. These files do their best to act as the most up-to-date demonstration of what an ALKiln workflow file can look like. They contain notes for our users to try to help them adjust the code to their purposes. It's not ideal, but they're the files that we can update most reliably.
199
+
200
+ Those files use [environment variables that store sensitive information and custom variables](#env).
201
+
202
+ We also use workflow files to trigger our unit tests and our log codes validation.
203
+
204
+ ### Logging
205
+
206
+ `./lib/utils/log.js` and `./lib/utils/reports.js` take care of logging information of various kinds (normal, debug, error) to the command line in ways we hope are useful, as well as building files to store the same information. We should probably find a logging library instead, but this is what we have for now. An important feature is that it ensures the messages clearly belong to ALKiln and not to some other process.
207
+
208
+ ### session_vars.js
209
+
210
+ The `./lib/utils/session_var.js` file keeps track of what you might otherwise think of as environment variables. We like to think of them as constants, but some of them do need to go through functions, so for consistency we get them all through functions. It is also easier to test them when they are functions.
211
+
212
+ ### Bash commands
213
+
214
+ ALKiln is a command line tool to avoid some complexity in GitHub actions, increase security, and align with what this framework has grown into. When you `npm run` the scripts in our `./package.json` they will setup, run, or take down tests.
215
+
216
+ ### Files that you probably don't need to look at
206
217
 
207
218
  `index.js` and `world.js` are short files that cucumber needs.
208
219
 
209
220
  ## Footnotes
210
221
 
211
- [1] To be clear, our framework is a misuse of cucumberjs. cucumberjs is geared towards behavior driven development. We try to make BDD available to our developers, but it's not always possible and not necessarily our goal.
222
+ [^1]: Some of our tests are sometimes in a failing state. For example, at times docassemble has changed its behavior and accessibility tests have failed. Those problems take a while to update and in the meantime we still need to continue development. For that reason, we sometimes mark tests with the tag `@temp_error`.
223
+ </br></br>We have tests that pass when they cause errors. They let us test our own error messages and error behavior. They will log an `F` in the console and yet those Scenarios will still pass.
224
+ </br></br>We also have some tests that cause actual errors so we can see their proper behavior. We have to run those manually and we avoid running them on GitHub. They have the tag `@error`.
225
+
226
+ [^2]: To be clear, our framework is a misuse of cucumberjs. cucumberjs is geared towards behavior driven development. We try to make BDD available to our developers, but it's not always possible and not necessarily our goal.
@@ -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
+ ```
@@ -0,0 +1,18 @@
1
+ # Leave pdfjs at its current version
2
+
3
+ ## Context and Problem Statement
4
+
5
+ pdfjs has a security vulnerability (that does not affect us) where malicious PDFs can inject code into an unsuspecting project and cause havoc.
6
+
7
+ Our users are downloading and manipulating their own PDFs. We will assume they're not putting malicious code into their PDFs.
8
+
9
+ The update changes pdfjs .js files to be .mjs files. It might take some bother to configure our repo to use .mjs files.
10
+
11
+ ## Considered Options
12
+
13
+ - Update pdfjs
14
+ - Leave pdfjs at its current version, 3.2.146
15
+
16
+ ## Decision Outcome
17
+
18
+ Leave pdfjs at its current version, 3.2.146. The vulnerability is irrelevant for our situation and we don't have bandwidth to set up the configurations right now.
@@ -0,0 +1,62 @@
1
+ # Use response data to detect sign-in success
2
+
3
+ ## Context and Problem Statement
4
+
5
+ Should we update to the newest version of puppeteer, [22.15.0](https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/CHANGELOG.md#22150-2024-07-31)?
6
+
7
+ See https://github.com/SuffolkLITLab/ALKiln/issues/930.
8
+
9
+ ## Considered Options
10
+
11
+ - Update to 22.15.0
12
+ - Update to 22.12.0, which is the lowest version that would fix our current problems
13
+ - Stay with 20.8.2
14
+
15
+ See pros and cons
16
+
17
+ ## Decision Outcome
18
+
19
+ Update puppeteer from 20.8.2 to 22.15.0
20
+
21
+ ## Pros and Cons of the Options
22
+
23
+ ### Update at all {#update}
24
+
25
+ **Pros:**
26
+
27
+ - Makes the current fix possible
28
+
29
+ **Cons:**
30
+
31
+ - Change in the middle of a complex PR
32
+ - [A few breaking changes](https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/CHANGELOG.md#2200-2024-02-05), which includes for us at the very least:
33
+ - "Removes the deprecated `$x` (replace with `$$`) and `waitForXpath` (replace with `waitForSelector`)." We need to add [extra syntax to the start of our selector strings](https://github.com/puppeteer/puppeteer/pull/11782): "xpath//."
34
+ - Replace any `page.waitForTimeout` with cucumber's version or ours.
35
+
36
+ ### Update to to 22.15.0
37
+
38
+ **Pros:**
39
+
40
+ - Has all the most recent bug fixes and features
41
+
42
+ **Cons:**
43
+
44
+ - Exposes us to possible unknown new bugs
45
+
46
+
47
+ ### Update to to 22.12.0
48
+
49
+ This is the lowest version that would fix our problem
50
+
51
+ **Pros:**
52
+
53
+ - Avoids possibly unknown new bugs
54
+
55
+ **Cons:**
56
+
57
+ - Doesn't have fixes to already known bugs
58
+
59
+
60
+ ### Stay with 20.8.2
61
+
62
+ Opposite of first entry ["Update at all"](#update).