Commit Graph

1770 Commits

Author SHA1 Message Date
Aaron Ogata bbcaa7d738 use full lockfile in deployment mode
refs DE-1492

Change-Id: Ie565ad1c77ad3c8ff2d7dadf0ac7f1d0d88fa864
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309634
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2023-01-26 15:42:59 +00:00
Aaron Ogata 0ba85efda0 fix various bundle issues for deployment
refs DE-1492

Change-Id: I154e43040b368ff5129e2604fe0921beea9d339a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309548
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Build-Review: Aaron Ogata <aogata@instructure.com>
2023-01-25 19:21:18 +00:00
Aaron Ogata f3469cd16f commit partial lockfiles
refs AE-1492

Test Plan:
1. Ensure that all appropriate gem versions are installed for CANVAS_RAILS=6.1 with plugins enabled
2. Ensure that all appropriate gem versions are installed for CANVAS_RAILS=7.0 with plugins enabled
3. Ensure that removing Gemfile.rails*.lock and running “bundle install” produces both 6.1 & 7.0 lockfiles with no overwrites to the partial files
4. Ensure that all lockfiles update when using “bundle update” in both versions and there are changes to commit
5. Ensure that removing plugins and running “bundle install” produces no changes to commit
6. Ensure that “bundle exec rails c” with CANVAS_RAILS=6.1 runs the right version
7. Ensure that “bundle exec rails c” with CANVAS_RAILS=7.0 runs the right version
8. Ensure that the Gemfile.*.lock.partial does not contain any secrets or private plugin names

NOTE: “vcr” gem is intentionally pinned to an old version (6.0.0) for testing

Change-Id: Id8e449466ec7839b3b71f2430256c0e8d0967775
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309093
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Build-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2023-01-25 15:32:17 +00:00
Dave Wenzlick eef742d5e6 Fix missing records in outcomes report
closes OUT-5418
flag=outcome_service_results_to_canvas

Test plan
- Find an authoritative result that appears in the csv report.
- Using the outcomes service rails console, delete the corresponding
  attempt record.
- Regenerate the outcomes csv report and verify that the record is
  still there. Note if the result was for an outcome that was aligned
  with a question, the report will now be missing the question id
  and question title because that info is stored on the metadata
  of the attempt.

Change-Id: If1d1fa5ba7c434e23215e41e8aa6ef86b6cd199a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308391
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2023-01-17 17:02:19 +00:00
Aaron Ogata ac2a5d74a5 remove unused i18n import tasks
refs AE-101

Change-Id: Ie7542f5d734e1fd65972b04262f05d618a95d77e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308700
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2023-01-12 18:20:19 +00:00
Ethan Knapp d2196b69ee improve InstFS error handling when uploading reports
Test Plan:
1. Validate that reports can be generated as usual

flag=none
refs PFS-21068, PFS-21064

Change-Id: I0be559dd3fefc9b4f4e7f26919d0614a86c11ca4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306962
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Mark Valentine <mvalentine@instructure.com>
Reviewed-by: Mark Valentine <mvalentine@instructure.com>
QA-Review: Trevor Byington <tbyington@instructure.com>
2023-01-11 17:03:16 +00:00
Jeremy Stanley 2502fd32ce rubocop_canvas: fix add_reference non-transactional logic
we don't need to suggest `disable_ddl_transaction!` when adding
a non-indexed reference

fixes FOO-3298
test plan: specs

Change-Id: I33ca47954e5760bf3f14d8b240891713f735eeda
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308301
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-01-06 18:14:08 +00:00
Dave Wenzlick 5722177937 Break outcome report query up into smaller queries.
refs OUT-5415
flag=outcome_service_results_to_canvas

Test plan
- This relies on https://gerrit.instructure.com/c/outcomes-service/+/307601
- Before adding these patch sets to your workspace
  - ensure you have some new quizzes that are aligned with account
    level outcomes and students have taken them.
  - Generate the csv report and ensure that there are new
    quiz results.
- Add these two patch sets to your workspace
  - Generate the report again
  - Diff this reprot with the one previously generated. There
    should be no differences. (use the CLI diff tool)

Change-Id: Id637622b2f04df884bd3ab91554079c32bafd0c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307578
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2023-01-05 21:15:27 +00:00
Isaac Moore d6584b490a Remove unnecessary require statements
closes AE-30

flag=none

test plan:
- verify Canvas boots in CD
- verify no influx of new errors in CD

[fsc-timeout=30]

Change-Id: Ifa04bebe1b09f01c6d3b8b2d8f3bb424759730f5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308067
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Build-Review: James Butters <jbutters@instructure.com>
2023-01-04 21:38:21 +00:00
Jacob Burroughs cd8305d633 Downgrade mail gem
Change-Id: I885f4ab5f8362314b74a366ce76225b585aef554
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307862
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-21 20:08:15 +00:00
Jacob Burroughs 881e1b98d9 Fix specs for ruby 3.1
Change-Id: Id369e06932ce1d8f63ffd228aa3a9577dfb1b61f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307833
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-21 16:30:15 +00:00
Jacob Burroughs 23655bb7df Bump gems for ruby 3.1
Change-Id: I761b73d17e67f7ee230221ce13b893325089ce0e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307832
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-21 16:01:27 +00:00
Jacob Burroughs b48f69f216 Drop support for classic autoloading
Change-Id: I99875135a37cfc302897ce6ffebbe6dee9a4a610
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307802
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-12-21 15:19:59 +00:00
Aaron Ogata 6545c41462 stop using deprecated URI.* methods
refs AE-92

These deprecated methods were previously a wrapper around URI::DEFAULT_PARSER.*. Just convert them to the underlying method for the least risk.

Change-Id: I2d7e24e61fca15346c2c9d7254ad4f3eff0cbae2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307348
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2022-12-14 15:18:20 +00:00
Aaron Ogata 3e02f54279 fix incoming_mail_processor gem specs
refs AE-92

Change-Id: Ifcc02e18079e62ac68eb92dcc96dc4414c893727
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307352
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2022-12-14 15:17:44 +00:00
Aaron Ogata d942569348 fix dynamic_settings gem spec
refs AE-92

Change-Id: Icd09f8ecf4492c4c9df8a932371732c69775374c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307349
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2022-12-14 15:17:39 +00:00
Aaron Ogata c0d85dd957 fix qti_exporter specs
refs AE-92

Change-Id: Ic96df9c81a35da64d8c916ea60fefec3718b188e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307249
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-12-13 14:33:42 +00:00
Aaron Ogata 51edc4b9af fix canvas_security for ruby 3.x
refs AE-92

Change-Id: I387339094a37b9d30762bf33914484c7b9448931
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307185
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2022-12-12 16:59:18 +00:00
Aaron Ogata a7551281f7 fix canvas_partman for ruby 3.x
refs AE-92

Change-Id: I8ff11a585c55db190d9a436646d8fb570edde516
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307186
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-12-12 16:58:09 +00:00
Aaron Ogata 3205554b31 fix csv_diff specs for ruby 3.x
refs AE-92

Change-Id: Ib9fdfc1d6cf09a5cd6508633c471f59524b87c7e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307184
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-12-12 16:58:02 +00:00
Luis Oliveira 6b03944721 Correct answer id handling on export for multiple choice questions
Alphanumeric ids for answers on multiple choice assesment question
would cause errors due to an integer typecast during conversion.

fixes LS-3598
flag=none

test plan:
- Create a imscc file with a question bank
- Set a response_label ident of alphanumeric values that
  would be integer cast to the same value
- Make a quiz set to pull this question from the bank.
- Take the quiz as a student and check the student results API
- Ensure the choices have different answer IDs

Change-Id: I6a87f0a1f21754f55284748b71bef9764b87fe9f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306407
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
2022-12-12 16:52:03 +00:00
Jacob Burroughs f47293eee9 Stop net/http retrying internally
Change-Id: Ibf04a5556a17af0fb03e73aff16ac1c8a03487c7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306905
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-08 20:31:07 +00:00
Jon Scheiding c179dc2d0f Use the right port for notorious when HTTP
flag=none
test plan
- set up your notorious to use http
- make sure you can upload a video

Change-Id: I537c92c9abf0bca43484db27e191f60343243cdd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306722
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Deyvison Penha <deyvison.penha@instructure.com>
QA-Review: Deyvison Penha <deyvison.penha@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
2022-12-07 16:42:37 +00:00
Dave Wenzlick 227e5ac3d2 Check for outcome_service_results_to_canvas FF before exec SQL
closes OUT-5414
flag=outcome_service_results_to_canvas

Test Plan
- Jenkins pass

Change-Id: I2e18dc52ff47a549131c73cf2c0694063d2fb1e5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306249
QA-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-11-29 22:47:57 +00:00
Jacob Burroughs ab450f64c5 Eliminate tableless jankiness
Also move some files used in initializers

Change-Id: Ieb4ea21b0c1888361f4b1dd227fa6db12eed453f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304381
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-11-28 17:50:51 +00:00
Jeremy Stanley 658bedfc9f support bbultra "Presentation Only" questions
test plan:
 - text-only questions in the BB Ultra test package
   should import properly (and not as "Error" questions)

flag=none
closes LS-3596

Change-Id: I2cb93c5735704e6cd04dd66d432f49504e0985ae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304326
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Luis Oliveira <luis.oliveira@instructure.com>
QA-Review: Luis Oliveira <luis.oliveira@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-11-18 15:24:12 +00:00
Jeremy Stanley 576df22fae fix BB Ultra multiple-choice imports
the answer and response ids don't match in BB Ultra, but they
do seem to appear in the same relative order in the XML, so
match them by position

test plan:
 - the test BB Ultra package should import multiple-choice
   quiz questions properly

flag=none
closes LS-3594

Change-Id: Ia30095b8fbcf162b13d3a13e95987779183b5f11
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304245
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Luis Oliveira <luis.oliveira@instructure.com>
QA-Review: Luis Oliveira <luis.oliveira@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-11-18 15:23:58 +00:00
Danail Kozhuharov 2a12b050aa Fix faulty Redis-based cache cleanup
During test execution a sequence of tests fail with:
"Only Redis glob strings are supported: /^dynamic_settings\//"

This is because Redis does not support regular expressions
as parameters for "cache.delete_matched(...)"

The accepted format is glob
(see https://redis.io/commands/keys/)

fixes DE-1463
flag=none

test plan:
- existing tests pass and the above error is not found in the flaky failures

Change-Id: I411faef90bb4b0f7b7e3e3ff948453cac23e5a19
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/305400
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-11-16 16:40:53 +00:00
Chrystal Langston 136c8fe930 Add threading for OS API calls
This also includes handling pagination for results
that contains more than 1 page of data.

closes OUT-5387

flag=outcome_service_results_to_canvas

test plan:
- Jenkins passes
- Since this requires a large number of outcomes,
  assignments, and users in a Course with new quiz results
  this PS will be tested in Beta in the next Bug Bash.

Change-Id: I33a3d502bb1a1412d2120d7c676789316707418c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/305274
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
QA-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2022-11-15 22:49:16 +00:00
Jon Scheiding 984cadbc66 Log errors in Kaltura client
Mainly for troubleshooting local Notorious setup

flag=none
test plan
- do something that makes your Notorious return HTTP errors
  (e.g. change the client ID or secret in plugin settings)
- find an RCE
- try to embed a video
* expect that your web container logs show "Error from Kaltura service"
  and some error information

Change-Id: Ic79856b8957336054f1d4c2ab6e13cc6053c0f0a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/305132
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
2022-11-14 15:56:27 +00:00
Dave Wenzlick b30247557f Add retry when calling OS
closes OUT-5227
closes OUT-5391
flag=outcome_service_results_to_canvas

Test Plan
- dc down on outcome service
- In canvas, navigate to account settings
- ensure you have outcome_service_results_to_canvas flag enabled
- go to reports and generate the Outcome Results report
- it will error out because it cannot communicate with OS
- Bring OS back up
- generate the report again and verify it didn't fail

Change-Id: I9ee6ea5220fc458e1dd374bf5def092085403e4b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304019
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Martin Yosifov <martin.yosifov@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
2022-11-11 20:00:24 +00:00
Jon Scheiding 521f7b403a Allow specifying notorious protocol for local dev
Adds a plugin option in development environments to specify whether to
talk to Notorious over HTTP or HTTPS. In production environments, this
option will not be available. If option is nil, will default to still
using HTTPS.

flag=none

test plan prerequisites
- Working Notorious setup that is using HTTP
  - make sure PROTOCOL env var in your Notorious override file is set
    to HTTP
  - make sure there is no cert for Notorious in `~/.dinghy/certs`

test plan
- Go to http://canvas.docker/plugins/kaltura?all=1
- Change the "Protocol" setting to "http" and click Apply
- Find an RCE
- Try to upload a video
- Find an Assignment submission
- Try to add a media comment

Change-Id: If18015d7b6b401db56d320d168f753a1e40e9868
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300494
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Jon Scheiding <jon.scheiding@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
2022-11-10 20:18:32 +00:00
Jacob Burroughs 803e7b4930 Misc rails 7.0 spec fixes
Change-Id: I38480368611e4b4166ee2a262038c6a1319f2f58
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304807
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-11-08 00:52:31 +00:00
Joe Hernandez ff352e892f Prevent data-method partial CSRF
Remove data-method when present in html element when RCE is saved.

fixes MAT-1045
flag=none

Test Plan
- Need a course with at least one student
- Steps outlined below taken from SEC-6537
** The steps in that ticket seem to rely on a tool called "burp". I
instead switched the RCE to Raw HTML edit before saving.
- As a teacher or admin (victim), create a new assignment in the course
-- 10 possible points
-- Use appropriate dates to make it available
-- Click on "Save & Publish"
-- Copy the course_id and assignment_id from the URL & keep them handy
-- e.g. * http://canvas.docker/courses/1/assignments/3

- As a student, navigate to /dashboard/eportfolios
-- I went to the course > People > select student > Act as user
-- Copy the student's user_id from the URL & keep it handy
- Click on "Create an ePortfolio", name it, make it public
- Click on the "Welcome" link on right side of page
- Click on "Edit this page"
- Put the RCE in Raw HTML Edit mode
- Add HTML similar to the one in my recent comment MAT-1045:
- Click on "Save Page"
- Copy the URL after the ePortfolio save page
- Log back in as the teacher or admin (victim)
- Paste the copied url and navigate to it
- Click on the "check out my resume" link
* Verify:
1. Bad URL error in canvas
2. Navigate to Course > Grades and verify student's grade was not
updated.

Change-Id: I4a9fc50baa00ff998bda1f344036479390b18eac
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304040
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-10-27 15:33:30 +00:00
Dave Wenzlick 999152496b Use submitted_at date if present
closes OUT-5339
flag=outcome_service_results_to_canvas

Test plan
- Jenkins build passes

Change-Id: I2ce0334b5aaa65ec8329b7398c8f251749d2d9cf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304037
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Chrystal Langston <chrystal.langston@instructure.com>
2022-10-25 19:29:18 +00:00
Chrystal Langston c3eff1e944 exclude muted assocations from OS results in sLMGB
closes OUT-5299

flag=outcome_service_results_to_canvas

test plan:
- tests pass in Jenkins: please pay extra attention
to the test plan.  These tests should line up with
the tests in learning_outcome_result_spec.rb to
ensure all assignments that are classified as muted
are removed from the OS results.
- For testing in the UI:
- In a course with outcomes, create 2 New Quizzes
  - Each quiz should be aligned to a different outcome
- Turn on LMGB, sLMGB, and Outcome Service Results to
  Canvas FF on.
- Take each quiz as a student
- As a teacher, confirm:
  - both outcomes have results in the LMGB
  - both outcomes have results in the sLMGB
    - results will be identified as a mastered/unmaster
      pill.  The list of assignments & its aligning
      mastery in PS OUT-5297 & OUT-5298
- As a student, confirm:
  - both outcomes has results in the sLMGB
- As a teacher, mute 1 quiz in the gradebook:
https://community.canvaslms.com/docs/DOC-12961-4152724339
- As a teacher, confirm:
  - both outcomes are displaying in the LMGB & sLMGB
- As a student, confirm:
  - Only 1 outcome results is displaying in the sLMGB
- As a teacher, mute the 2 quiz in the gradebook and
  confirm:
  - both outcomes are displaying in the LMGB & sLMGB
- As a student, confirm:
  - 0 outcome results is displaying in the sLMGB
- As a teacher, unmute both quizzes & confirm:
  - both outcomes has results in the LMGB & sLMGB
- As a student, confirm:
  - both outcomes has results in the sLMGB

Change-Id: I21e085b3e856410cfe89ce57db2271f05858c097
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/302565
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Dave Wenzlick <david.wenzlick@instructure.com>
QA-Review: Dave Wenzlick <david.wenzlick@instructure.com>
Product-Review: Chrystal Langston <chrystal.langston@instructure.com>
2022-10-19 15:37:54 +00:00
jake.oeding b87c556c54 sanitize area tag's href attribute
also add safety net for similar potential
issues

fixes MAT-1046
flag=none

test plan:
-follow the steps outlined in SEC-6558
>notice that after navigating back to the page
 you entered what was previously an XSS issue,
 you'll see that it does not appear anymore

Change-Id: I90057aaa9322ebaf434b6f9cc2154b54a36bee13
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/302966
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Jake Oeding <jake.oeding@instructure.com>
2022-10-18 17:01:22 +00:00
Dave Wenzlick 68562033f1 Merge OS data with Canvas Data in admin report
closes OUT-5167
flag=outcome_service_results_to_canvas

Test plan
- create an outcome at the account level and import it into a course
- create a classic quiz and align the outcome with it
- create a new quiz and align the outcome with it
- create a 2nd  new quiz and align the outcome with multiple questions
- Go to account settings, reports, and generate the
  "Outcome Results" report.
  - Verify that the report is empty because no one has taken the
    quizzes yet.
- log in as a student and take all three quizzes
- log in as an admin and go to account settings, reports, and
  generate the "Outcome Results" report.
- download the report and verify
    - Report has 1 row for the classic quiz
    - Report has 1 row for first new quiz
    - Report has 1 row for each question of 2nd new quiz
    - Default ordering is by user id, outcome id, course id
    - Canvas data appears first in the report followed by os data
      (this happens because if user, outcome, and course are all
       equal, we put canvas data first)

Change-Id: I3dd86d72c3e26061f9e3cd77beec1a5458e99501
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300790
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
Reviewed-by: Martin Yosifov <martin.yosifov@instructure.com>
2022-10-10 22:16:17 +00:00
Aaron Ogata 97dffd25ee introduce bootsnap
refs DE-1383

Change-Id: I6ab3efff2328717a74626a4fc2b4e171e41bcb06
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293150
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-10-04 13:18:03 +00:00
miles.nerenberg b421a1bf37 amend write_outcomes_report config
Refactoring the write_outcomes_report method to
help Learning Outcomes team avoid merge conflicts and
accommodate future enhancements more easily. Arg for
custom message when report scope is empty has been
replaced with a config_options hash, and that hash
has its default empty scope message set if one isn't
provided via the hash passed by the caller.

Test plan:
1. Make sure outcome reports and GSD student
   outcomes report specs still pass, functionality
   should not have changed.

* Note: also fixed one minor comment in application
  controller that had inaccurate path information,
  unrelated to this specific project

flag=none
refs: PFS-20577

Change-Id: I2eb76f71136489eabaf519ee6bb5de7a36f2e68e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/302428
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mark Valentine <mvalentine@instructure.com>
QA-Review: Miles Nerenberg <miles.nerenberg@instructure.com>
Product-Review: Miles Nerenberg <miles.nerenberg@instructure.com>
2022-10-03 19:59:08 +00:00
Angela Gomba dcec20c951 Remove old outcome assessments for an alignment
closes OUT-5202
flag=none

Test Plan:
- Launch the rails console
- Make note of the number of LearningOutcomeResults you have:
  LearningOutcomeResult.count
- If you don't have any LearningOutcomeResults, you can create
  one in Canvas:
  - Create an outcome
  - Create a rubric and align the outcome to the rubric
  - Create an assignment and align the rubric to the assignment
  - Act as a student and take the assignment
  - Stop acting as the student and grade the student using the
    rubric in SpeedGrader
  - Verify that a LearningOutcomeResult exists in the rails
    console for that student, outcome, and alignment
- Find any LearningOutcomeResult and save it to a variable:
  res = LearningOutcomeResult.first # or whichever result
- Save a copy of that result with a different score:
  same_res = res.clone
  same_res.score = 1 # or some score that is different
  same_res.save!
- Observe that the LearningOutcomeResult.count has gone up by
  one
- Observe the LOR clone has workflow_state = "deleted"
- Observe the original LOR has workflow_state = "active" and
  the score is set to the score we set for the clone
- In Canvas, open the student's assignment in SpeedGrader
  - Note: You will see that the rubric grade is different
    than the current LOR score. This is fine because of how
    we simulated a clone LOR being created. In real life,
    these duplicate LORs would be created by the rubric
    assessment and the score would stay consistent between
    the assessed rubric and LOR.
- Change the rubric score to 4 (or something different from
  the LOR score)
- Observe in the rails console that the LOR was updated with
  the score from the rubric and that no other LORs for that
  student, outcome, and assignment are active

Change-Id: I14780f1be36cb50075d09704abcba227ecc0bc79
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/299263
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Martin Yosifov <martin.yosifov@instructure.com>
QA-Review: Martin Yosifov <martin.yosifov@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2022-09-20 21:02:50 +00:00
miles.nerenberg 59794ecffe custom message on outcome results reports w/ no results
these changes don't change the current functionality of any
pre-existing outcome reports at all, however new reports
inheriting from the base outcome reports can now customize
the text that appears in the csv file if no results are found

Test Plan:
1. Make sure you have the corresponding patchsets
   from custom_reports and professional_services.
2. Run an outcomes report w/ parameters that would
   return no results.
3. Download the resulting CSV and it should say
   'No outcomes found' by default.

flag = none
refs: PFS-20577

Change-Id: If39252b3f734c593823c20d1d4b428616647c1cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301229
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Sean Mikkelsen <smikkelsen@instructure.com>
QA-Review: Mark Valentine <mvalentine@instructure.com>
Product-Review: Mark Valentine <mvalentine@instructure.com>
2022-09-19 19:23:30 +00:00
Aaron Ogata c9c0dd3d95 make extract_js task optional
refs DE-1379

Change-Id: I89b3598e1e6154bc4165e0b9999cb31860df7177
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301331
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-09-19 17:59:41 +00:00
Aaron Ogata 27eea9334c allow reusing previously compiled JS translations
refs DE-1336

Change-Id: I98e1e61e8a2f4796a2c76b8725c964ff4616987f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300907
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-09-13 20:32:09 +00:00
Jacob Burroughs 620de1b8c0 Drop explicitly empty community translations
fixes FOO-2999

Change-Id: Idd0362bb41f27a68951a7b5cc77a1719d9c8d6ed
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300655
Reviewed-by: August Thornton <august@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-09-09 15:30:41 +00:00
Dave Wenzlick c4d39e1ccf Query canvas for newQuiz assignments and call OS with results
refs OUT-5150
flag=outcome_service_results_to_canvas

Test Plan:
- Tests pass since this code is not used yet

Change-Id: Ia08ab5b7edadfcabcb8bbdeb4ce6f7e1f0b23434
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/299528
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2022-09-06 19:50:57 +00:00
Jacob Burroughs ae51c95095 Safer jobs moves
only clear the shard cache from multicache, and therefore
support distributed `delete_matched`

Change-Id: Iebda2e8b2df0a1aa85997c2ede47b113f0fadc15
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300099
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-09-01 19:29:17 +00:00
ferenc.marcso 62283a3085 fix plurazitation of translations
flag = none

fixes: QO-895
fixes: QO-896

test plan:
- delete translation files in web conatiner
  rm -rf public/javascripts/translations/*
- stop your docker environment
  docker-compose down
- run update script
  script/docker_dev_update.sh
- change your profile settings to another language
  for example catalan ca
- visit /courses/1/quizzes
- you should see points and number of questions in the
  selected language

Change-Id: I1ce3c79145dba71e2d4f5e2e2b7d7ea8fca1b025
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/298756
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Endre Berki <endre.berki@instructure.com>
Product-Review: Endre Berki <endre.berki@instructure.com>
2022-08-22 15:17:27 +00:00
Jacob Burroughs 53953aaf4b Replace our homegrown link finder with twitter-text
While I am at it, decaffinate and typescriptify TextHelper

fixes FOO-2987

Change-Id: I0b8f33a610bee737ea79ad24d8aec8f8e8051c49
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/299013
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Bobby Buten <bobby.buten@instructure.com>
2022-08-19 17:01:10 +00:00
Isaac Elliott d1aa3366ef raise error when QTI Migration Tool is missing
On a system where the QTI Migration Tool is not installed, Canvas still
tries to run it.

In this situation `@migration_executable` is `nil`, so
`Qti.get_conversion_command` returns a bogus command string. This leads to
unhelpful error messages in `run_qti_converter`. The error cases in said
function assume that a *valid* command failed (and therefore look to the
command's standard output for information about the failure).

When `@migration_executable` is `nil`, raising the error in
`Qti.get_conversion_command` tells user that they haven't installed the tool.

closes: gh-2057

Change-Id: I03a332897966acbf6e302353f33ea61751021cfa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294672
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2022-08-19 08:37:43 +00:00
Mysti Lilla 1101cbb1dd Fix "Cannot be referred to" errors in cache in development
Test plan
- Go to the account permissions and set the "Users - view
  primary email address" permission for the teacher role to
  "enabled" (not "Use Default")
- In a course with a teacher, add an HTML file
- Clear your redis cache
- Load the file like <canvas>/courses/:id/files/:file_id
- Change some code in your models or controllers (so it reloads)
- Load the file again from <canvas>/courses/:id/files/:file_id
- Ensure it doesn't error and can load the file the second time

Change-Id: Ib000af7bfa258d5bd27826aafc4229037cc5008d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/298004
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-08-12 20:54:59 +00:00
Dave Wenzlick 634f6d4cc7 Fetch OS results for CSV export in Canvas.
The data is retrieved but not used yet. That will happen in
OUT-5167: Merge and Order results for CSV in Canvas

closes OUT-5149

flag=outcome_service_results_to_canvas

Test Plan:
- Prereq: Canvas is provisioned with Outcomes Service see
  https://instructure.atlassian.net/l/c/BDA1nXEX
- In canvas, start the rails console
- Switch to your shard (i.e account = switch_to_shard!
  'wenzlick.canvas.docker')
- Populate test data using the canvas UI
        - Create a course and assign two students to it
        - Create an outcome
        - Create a quiz and associate that outcome with it
        - Take the quiz as both students
        - Validate that you have authoritative results for those
          studnts
                - Go to http://pgweb.outcomes.docker/
                - select the shard of the account that you are using
                - Under the tables, click on authoritative_results
                - Validate that there are authoritative_results for
                  the quizzes you just took
- We need to add a call to outcomes_lmgb_results and some print
  statements to validate the the code is working as expected.
  Place the following code in
  gems/plugins/account_reports/lib/account_reports/outcome_reports.rb
  This should be the first few lines in the outcome_results_scope
  method (around line 214)
      results = outcomes_lmgb_results
      # These print statements are here so we can test
      # OUT-5149 independently
      if results.blank?
        p "OUT-5149 results not found"
      else
        p "OUT-5149 results found"
        ap results
      end
- Test Case 1: Verify that we get no results when flag is disabled
        - In canvas, start the rails console
        - Switch to your shard (i.e account = switch_to_shard!
          'wenzlick.canvas.docker')
        - Ensure
          account.feature_enabled?(:outcome_service_results_to_canvas)
          returns false
        - Run the report outcome_reports =
          AccountReports::OutcomeReports.new(AccountReport.find(1))
          outcome_reports.outcome_results
        - In the output, verify that you see the message "OUT-5149
          results not found" (this will be towards the top of the
          output so you'll have to scoll up past all the sql in your
          console)
        - Exit the console
- Test Case 2: Verify that we get results when flag is enabled
        - Enable Outcome Service Results to Canvas Reporting FF
        - In canvas, start the rails console
        - Switch to your shard (i.e account = switch_to_shard!
          'wenzlick.canvas.docker')
        - Ensure
          account.feature_enabled?(:outcome_service_results_to_canvas)
          returns true
        - Run the report outcome_reports =
          AccountReports::OutcomeReports.new(AccountReport.find(1))
          outcome_reports.outcome_results
        - In the output, verify that you see the message "OUT-5149
          results found" (this will be towards the top of the output
          so you'll have to scoll up past all the sql in your console)
        - Underneath "OUT-5149 results found", verify that you have
          the json representation of the authoritative results created
          when populating the test data

Change-Id: I48946cc824305a9dae6c26ef1c3312f3c8fcb0e4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/296461
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2022-08-11 20:07:12 +00:00
Steve McGee 6f67186989 kinesis publishing for `internal failure`s
fixes INTEROP-7027
flag-none

test plan:
* since we can't intentionally cause an "InternalFailure" we can only run the associated test `async_worker_spec.rb:110`

Change-Id: I42105c0475ea8036bdc955472bce8953c659cfa8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/296842
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-07-28 21:05:44 +00:00
Jeremy Stanley 5108f00d03 remove escape_unmatched_brackets
this function that parses HTML (badly) with regexes seems
not to be needed after the Nokogiri 5 update, which deals
with unmatched angle brackets in HTML much better than
the old version did

the tests written for previous iterations of this function
still pass, and manual checks of CORE-1510, CNVS-21544,
and CNVS-9919 seem good too

test plan:
 - a tag such as `<img alt="1 < 2" src="blah">` in
   question text should copy properly
 - less than / greater than symbols in question text
   or answer comments should copy properly

fixes LS-3248

Change-Id: If7ff7387e061836165322738a9285cd962cb5597
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/295312
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-07-01 20:51:00 +00:00
Mysti Lilla 4fd3580156 Fix failed file deletion retries
fixes MAT-894
flag=none

[ignore-stage-results=Flakey Spec Catcher]

Test plan
- Using both local storage and s3 storage
  (and InstFS would be nice, but I don't
  know how to set that up locally)
- In destroy_content_and_replace (app/models/attachment.rb)
  set up a debugger before the Attachment::Storage line
- Delete a file using the API like this
  DELETE http://<canvas>/api/v1/files/:id?replace=true
- Raise an error that causes the file deletion to fail
  partway through
- Then delete the file again, but make sure it succeeds
  and verify that the file looks like the "file_removed"
  file and that the purgatory object looks like the
  previously removed file

Change-Id: I73053a365376afc2ddbfc26d445c45c6b9152773
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294835
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gonzalo Penaranda <gonzalo.penaranda@instructure.com>
QA-Review: Gonzalo Penaranda <gonzalo.penaranda@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2022-06-29 23:10:03 +00:00
Ahmad Amireh 6edd1fc788 (i18n-js:5) flatten translation files
refs FOO-2801
flag = none

[change-merged][build-registry-path=jenkins/canvas-lms/foo-2801]
[pin-commit-analytics=4fd9e2fbb7fc2790ba7985bb4025e901bf33a9e3]

this part reaches the goal of this series where we turn the locale
files that are used by our JS engine into plain JSON files that don't
need any special processing and are also of a simpler structure

before, translations were stored in a tree structure that we needed to
traverse in order to look up a translation, which we did by
deconstructing keys through the "." operator:

    I18n.lookup("foo.bar.baz")

    {
      en: {
        foo: {
          bar: {
            baz: "Hello!" // <-- this
          }
        }
      }
    }

now, translations are stored in a flat dictionary structure where the
keys are not processed in any special way but are instead "fully
qualified":

    I18n.lookup("foo.bar.baz")

    {
      en: {
        "foo.bar.baz": "Hello!"
      }
    }

this is nice when you consider that the previous structure contained a
mixture of nested keys and flat ones, based on different conditions:

    {
      en: {
        "asdf_1234": "ASDF", // inferred, so it was never "nested"
        "foo": {
          "bar": {
            "baz": {
              "one": "One banana",
              "other": "Many many bananas"
            }
          }
        }
      }
    }

because, for example, keys that are inferred by i18nliner end up at
the root level and not nested. You also never knew whether a key was a
container or a phrase that was pluralized, because they both had the
shape of an object.

Now these distinctions are gone; a key is always fully-qualified
regardless of how it was specified:

1)   inferred: I18n.t("Inferred key")
               // => inferred_key_c49e3743
2)   absolute: I18n.t('#buttons.cancel')
               // => buttons.cancel
3)   relative: I18n = useScope('outer')
               I18n.t('something', 'Something')
               // => outer.something
4)     nested: I18n = useScope('outer');
               I18n.t('something.inside', 'Something inside')
               // => outer.something.inside
5) pluralized: I18n.t({
                 one: 'One banana',
                 other: 'Many bananas'
               })
               // => many_many_bananas_ce8e7fb7.one
               // => many_many_bananas_ce8e7fb7.other

Change-Id: I7c33fbd2321d7d56994223d65f2572db0ac12ed5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293675
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-06-27 18:35:04 +00:00
Ahmad Amireh 14faf088c0 (i18n-js:4) use i18nliner-canvas from npm
refs FOO-2801
flag = none

[change-merged][build-registry-path=jenkins/canvas-lms/foo-2801]

gems/canvas_i18nliner is now a package @instructure/i18nliner-canvas and
lives in the same repo on github along with the 3 other i18nliner
libraries.. this was done to make it easier for maintainers to deal with
this code, since changing one part may break the other due to how
they're architected

the source on github: https://github.com/instructure/i18nliner-js

~ test plan ~

build is still OK, this only affects the generation of files, and those
i manually verified to be identical before and after

Change-Id: I78afa8a808f1699c10aced8466cfade066848bc9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294209
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-06-23 18:42:23 +00:00
Ahmad Amireh 372780a53a (i18n-js) alias i18n:extract to i18n:generate
for backwards compat until we upgrade all the callsites to use
i18n:extract

refs FOO-2801
flag = none

~ test plan ~

you can call "rake i18n:generate" to do what "rake i18n:extract" does

Change-Id: I0a4cd9a1fe8273aad0a570c3dc5beaf61bc8554c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294619
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-06-23 17:28:10 +00:00
Ahmad Amireh f13c21ecd2 (i18n-js:2) rename i18n:generate to i18n:extract
refs FOO-2801
flag = none

this patch renames the rake task i18n:generate to i18n:extract to better
reflect what it does and to be consistent with the rest of the codebase

this might not be significant for 99% of users, but for maintainers who
deal with i18n code - i18nliner on ruby, i18nliner on js, i18n_tasks -
this particular Rake API is disorienting because everywhere in the code
the routine is referred to as "extraction" except for the api --
"i18n:generate", it's also compounded by the other api
"i18n:generate_js" which is significantly different in terms of logic,
so you always had to keep that in mind

now we have:

- i18n:extract - extract translations from all source code; Ruby, JS,
  Handlebars into a single YAML file with a tree structure
- i18n:generate_js - generate translation files for the JS *runtime*

~ test plan ~

you can still run i18n:extract and i18n:generate_js, and Jenkins runs
them too

Change-Id: I0216206b46c225e101dcd2112d9f84b773a84d04
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294207
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-06-22 18:53:09 +00:00
Charley Kline f5d33bb174 Fix post-merge build error in i18n Rake tasks
Refs FOO-2801
flag=none

[change-merged]
[build-registry-path=jenkins/canvas-lms/foo2801]

Fixes bad filename in a Rake task

Test plan:
* Post-merge build passes (these flags should force it to run)

Change-Id: I12c10634439828ffd703b5a52e081c13f3371c2d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294538
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
Reviewed-by: Ben Rinaca <brinaca@instructure.com>
2022-06-22 18:45:57 +00:00
Ahmad Amireh a80415e931 (i18n-js:1) reorganize rake tasks
refs FOO-2801
flag = none

move implementation of Rake tasks into their own Ruby modules so that we
may more easily test them; the Rake tasks will do any necessary IO while
the stuff in lib/ will be confined to the logic

~ test plan ~

we can still run i18n:check and i18n:generate_js

Change-Id: I14526acb41d3efec3a27cd6435a853a515ba41b6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292205
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-06-22 16:57:33 +00:00
Ahmad Amireh 0301bb58aa remove canvas's i18n clone in RCE
refs FOO-2801
flag = none

the code has since been ported to use format-message and the only
straggler was the natcompare module, which really only needed the active
locale, which is now exposed to it by the entrypoint

~ test plan ~

the file browser in the RCE continues to work

Change-Id: Iaf6fc588fe86117f9cc63701f70992987be547ba
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293551
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-06-09 17:08:16 +00:00
Jacob Burroughs 4ed2affa4c Fix cross-shard message delivery
fixes VICE-2848

Change-Id: I14e4468d00201e7b4409e9752fbf3ae11e9ee2dd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293449
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
2022-06-07 23:14:30 +00:00
Jacob Burroughs 5dcd66d8c6 Some rails 7 tests passing
Change-Id: Iad400936d7e53a5f92644f260c95bfb5bf9e972f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293144
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
Migration-Review: Alex Slaughter <aslaughter@instructure.com>
2022-06-06 14:23:03 +00:00
Jacob Burroughs 133165106b Boot on rails 7.0
Change-Id: I61d5ba9f6ef5e0837da2ec22b695b9a56b88acb5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293104
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-06-06 13:55:46 +00:00
Jacob Burroughs c7bf5fba48 Remove rails 6.0 support
Change-Id: I0df8f625c119b2622e358a5d663c158e2d7d7cb8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292904
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-05-31 22:13:22 +00:00
Clint Pelish 8778ac085d add retry to failed report runners, delete all account
report rows to not have duplicates when failure occurs

refs: PFS-20002

flag = custom_report_experimental

Test Plan:
- Deploy to production and turn on feature flag for individual
  customer experiencing issues
- Verify that job is retrying when failing

Change-Id: I4272bdfd960814ecd366bdf07ce82ea20663ead0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292102
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ben Rinaca <brinaca@instructure.com>
Reviewed-by: Mark Valentine <mvalentine@instructure.com>
QA-Review: Clint Pelish <clint.pelish@instructure.com>
Product-Review: Clint Pelish <clint.pelish@instructure.com>
2022-05-31 17:04:43 +00:00
Mark Valentine 5507153158 adjust logic for verifying report_db presence
TEST PLAN: Dev verified in rails console that new
  method of checking report db seems to work.

Change-Id: I96eacab4c18b9bf2e1a2cde64ce27272da864601
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292787
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark Valentine <mvalentine@instructure.com>
Product-Review: Mark Valentine <mvalentine@instructure.com>
2022-05-27 19:47:13 +00:00
Luis Oliveira bd54dd5ea9 Avoid raising unnecessary and unclear kaltura errors
closes LS-3015
flag=none

Test plan:
- Check that when kaltura reaches a 503 it
  will properly log that the service is unavailable

Change-Id: I2a3ee4d8cbc39a650292787be0d1647af6a06bc0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/291840
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
2022-05-19 17:16:42 +00:00
Weston Dransfield 738dfc9c18 Add flag indicating acceptance of "prioritizeNonToolGrade" data
This flag indicates allows LTI 1.1 tool providers to check
if an LMS supports this new extension.

closes QUIZ-9501
flag=none

Test Plan:
- Associate an LTI 1.1 tool (like Quiz LTI) to an assignment
  in Canvas
- Launch the tool via the assignment and observe the post
  request made for the tool launch
- Valide "ext_outcome_submission_needs_additional_review_accepted"
  is sent in the post request and is set to true

Change-Id: Ife10f09af5bdef1f958ac0c6d6a55ed6e81e9e3a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/290387
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2022-04-27 00:52:53 +00:00
Weston Dransfield c7d4dbc1cb Add flag indicating acceptance of additional review outcome data
closes QUIZ-9497
flag=none

Test Plan:
- Launch an LTI 1.1 tool assocaited to an assignment (like New
  Quizzes) with the browser's network inspector open
- Find the POST request that was the LTI launch
- Validate ext_outcome_submission_needs_additional_review_accepted
  was sent with a value of "true"

Change-Id: I9b1691143bb4796472cf7a83634c82c02229efeb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/290240
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Stephen Kacsmark <skacsmark@instructure.com>
Reviewed-by: Jorge Arteaga <jorge.arteaga@instructure.com>
Reviewed-by: Ricardo Oliveira <ricardo.oliveira@instructure.com>
QA-Review: Jared Crystal <jcrystal@instructure.com>
2022-04-27 00:26:39 +00:00
Weston Dransfield 66763fdfd5 Add enum-style references for model workflow state
refs QUIZ-9495
flag=none

This change allows referencing a Model's workflow_state
values an an enum-like way.

For example, let's pretend I want to conditinally set the
workflow_state in a Submission based on some condition.

In the current version of Canvas, I would write:

```
workflow_state = "graded" if something_is_true?
```

With the new code, I can instead write

```
workflow_state =
  Submission.workflow_states.graded if something_is_true?
```

While the syntax is longer, we can avoid mistyping the
desired workflow_state string. Additionally, we can
begin to DRY up references to workflow_state values

Test Plan
- Pick an ActiveRecord model (like Submission)
- Call the new .workflow_states class method
- Validate each valid workflow_state for the chosen
  model is represented in the returned OpenStruct

Change-Id: Ieeabcbb9956808a963f1c4a5e0c67d1082a36015
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/290181
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Stephen Kacsmark <skacsmark@instructure.com>
QA-Review: Jared Crystal <jcrystal@instructure.com>
Reviewed-by: Ricardo Oliveira <ricardo.oliveira@instructure.com>
Reviewed-by: Dustin Cowles <dustin.cowles@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
2022-04-26 19:55:34 +00:00
Ethan Knapp 75fa608fc9 add a timeout to report DB catchup
refs PFS-19686

Change-Id: Iefe573bca964217f2403e425f635babaed5cfad2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/289849
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark Valentine <mvalentine@instructure.com>
Product-Review: Mark Valentine <mvalentine@instructure.com>
Reviewed-by: Mark Valentine <mvalentine@instructure.com>
2022-04-22 21:35:17 +00:00
Jackson Howe 53d433019b Increase depth limit for syllabus
User content with deeply nested html elements couldn't be parsed by
Nokogiri when the depth exceeded the DEFAULT_MAX_TREE_DEPTH of 400.
The depth limit has already been increased in other places (quizzes,
wiki pages), so we'll do the same for syllabus content to prevent making
the entire syllabus inaccessible if deeply nested content is saved. This
change also prevents content that can't be parsed from being saved in
the syllabus.

fixes LS-3114
flag = none

Test plan:
 - Get my document with deeply-nested html and save the content to a
   course's syllabus_body in a rails console
 - Go to that course's syllabus in the UI
 - Expect the page to load fine
 - Lower the max_tree_depth constant in
   gems/canvas_sanitize/lib/canvas_sanitize/canvas_sanitize.rb (L75) to 1
 - Restart rails server
 - In a new course, go to the syllabus and in the html editor, paste
   <div><div><p>hi</p></div></div>
 - Click save and expect to get a 4xx response

Change-Id: Ib97ab86c102162f8efdc29c1122e0aa6d9801026
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/289992
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-04-20 19:38:27 +00:00
fernandorpm e615c389d0 Add friendly_description to Outcome Export
closes OUT-5025
flag=none

Test Plan:
- Navigate to Admin > Settings
- Click on the "?" button right next to the Outcome Export
- Observe that there is a new column called friendly_description
- Observe that there is the expected content in each of the rows

Change-Id: I6e9b736c477a8922f120cb5d5f97078173d5c278
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288402
Reviewed-by: Angela Gomba <angela.gomba@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Ben Friedman <ben.friedman@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-03-31 14:40:15 +00:00
Juan Chavez 3a4b953430 Fix quiz statistics issue when displaying answer formula
fixes MAT-620

flag=none

test plan:
- Create a new quiz
- Add a multiple answer question
- On answer body, add a formula using Equation Editor
- Save quiz
- Take quiz as a student
- Open Quiz Statistics (in Quiz page)
> Verify that the answer you added shows the formula
correctly

Note: I needed to remove the strip_tags calls because it
clears all HTML code to an empty string. This method is
used for word count and converting HTML to plain text.
Due we have only html code (p, img) and no words, it
returns empty.

Current example HTML:
<p><img class=\"equation_image\" title=\"f\"
src=\"/equation_images/f?scale=1\" alt=\"LaTeX: f\"
data-equation-content=\"f\" data-ignore-a11y-check=\"\"></p>

Current example output : ""

So nothing to do here. Also answer body is not "converted"
in othernsites (e.g. Quiz page preview) so I'm keeping
the same way we handle question body in backend and
render in frontend.

Change-Id: I0916bc38e388ef0e182f2d529ce57f6bf964ba1b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287963
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Joe Hernandez <joe.hernandez@instructure.com>
QA-Review: Joe Hernandez <joe.hernandez@instructure.com>
Product-Review: Juan Chavez <juan.chavez@instructure.com>
2022-03-28 21:12:41 +00:00
Aaron Ogata 0e13f0d033 replace CANVAS_RAILS6_x variables with CANVAS_RAILS
refs DE-523

Test Plan

1. Ensure CANVAS_RAILS override works
2. Ensure file override works
3. Ensure consul override works

Change-Id: I6eea63bba5c401428c02179a3d6187c8265ce33e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287849
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-03-24 18:14:52 +00:00
Aaron Ogata 9098145ff5 use Rails.version check instead of CANVAS_RAILS variable
refs DE-523

Change-Id: I7baff2f4a6dee7beb518c6d1151a3027a7572f57
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287809
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-03-23 20:33:24 +00:00
Jacob Burroughs 4253bed58b Use zeitwerk everywhere always
Change-Id: Ide7490f4e8d2447b147328b6f7e2afc545941c14
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287599
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-03-22 18:54:50 +00:00
Jacob Burroughs 56954b54b0 Don't break if created_at is nil
Change-Id: I638b51ee690780e48ef99ebf9213a0134fb46cc6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287436
Reviewed-by: August Thornton <august@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-03-18 16:50:10 +00:00
Luis Oliveira 9447663ce2 Start logging unexpected responses in kaltura
refs LS-3015
flag=none

Change-Id: I5ce3a0934b30ddc3a07058c68bcebe718435d260
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286836
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
2022-03-11 02:42:06 +00:00
Ahmad Amireh f9833d40fb cutover to the ESM extractor away from AMD's
refs FOO-2696
flag = none

Change-Id: Ia3a3921ef146cf23db8d20cbfde84ef472f7bade
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286705
Tested-by: James Butters <jbutters@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-03-10 21:38:43 +00:00
Ahmad Amireh d87a02825a canvas_i18nliner: implement ESM extractor
refs FOO-2696
flag = none

this new extractor is tailored for ES modules away from the previous AMD
implementation. It will be put to use once we add support for the
useScope interface in @canvas/i18n and adjust webpack/source files to
use it.

This is how i18n extraction works for ESM:

(1) import the "useScope" function from @canvas/i18n

    import { useScope } from '@canvas/i18n'
    import { useScope as useI18nScope } from '@canvas/i18n' // ALSO OK

(2) use that function to define your I18n receiver and supply a scope:

    const I18n = useScope('foo')

(3) proceed to call I18n.t or I18n.translate as usual:

    I18n.t('my_key', 'Hello') // => foo.my_key

the implementation required an upstream change to i18nliner-js; see
4040b1c979

~ test plan ~
  ---- ----

- read through the extractor code and rely on the tests since it's not
  wired yet

Change-Id: I5c1ff0c23983c0e61a649c9fb3f4673724d6e468
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286652
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
2022-03-10 19:44:08 +00:00
Ahmad Amireh 0e982454f9 use @instructure/i18nliner and upgrade to ^2
refs FOO-2696
flag = none

Change-Id: I14af121632c996c7536b781bf804b21832e30863
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286698
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-03-10 13:40:06 +00:00
Jacob Burroughs 0886e3d2c3 More minor rails 6.1 fixes
[pin-commit-multiple_root_accounts=2e369db182628605f55941d294388919783bfe50]

Change-Id: Ic30cb7ccf352d02a85424302e511deb9fa080f79
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286724
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-03-09 23:40:47 +00:00
Jacob Burroughs 160b958761 Fix vendored gems for rails 6.1
[skip-crystalball]

Change-Id: Iddc9432298ce756927c356fd319fec0631dcf6c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286589
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-03-09 17:16:53 +00:00
Ed Schiebel f79fc795b9 Add support for webp images
[skip-crystalball]

closes LS-1734
flag=none

test plan:
  - upload a webp image from the Files page
  > expect it to work like all other images
  > expect to be able to preview it
  - upload a webp image from the RCE's image upload dialog
  > expect it to get embedded in the RCE
  - open the course images tray
  > expect it to be there, with a thumbnail
  > expect to be able to adjust its size using the image options tray

Change-Id: I621a3f5fc455bc3aaf19928a5cfa7931a1694277
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286027
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2022-03-08 23:56:11 +00:00
Jacob Burroughs d499d836cb Cache dynamic settings in request cache
fixes FOO-2727

Change-Id: I64c5d7ddaed195a84da93e8b4b49231a7c3a30de
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286494
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ben Rinaca <brinaca@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-03-07 22:38:17 +00:00
Brian Watson 6b1a30dcdf Remove AB importer upgrade warning in AB Plugin config page
This warning was for an upgrade that took place in Feb 2021

flag=none

Test-plan:
- Navigate to SiteAdmin > Plugins > Academic Benchmark Importer
- In the dropdown select a few different options
- Select |Create Config| to make sure the whole form is present
- Verify the red text with "The importer will be migrating from API
  v3 to v4.1. Credentials will not change...." is NOT present

Change-Id: I31d3a6f7c0f226d42b5b00bda74ef5d9f935fece
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286413
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
QA-Review: Martin Yosifov <martin.yosifov@instructure.com>
Product-Review: Ben Friedman <ben.friedman@instructure.com>
2022-03-07 18:54:18 +00:00
Mark Valentine fdd9c25dc6 propogate replicate through the account_report process
- currently we swap back to :report db even if upstream
  we timed out from using it and are using :secondary.
  Result is missed data in the output report.

flag = none
test plan:  This is tricky to test as it is a race
  condition between primary and report db and requires
  report db to timeout on being up to date.  For now,
  just verify specs pass and monitor if empty reports
  continue to happen in prod.

Change-Id: I92f0024593cd497949747378b8c8792e4cc047b3
refs:  PFS-18941
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286338
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Matt Maruri <mmaruri@instructure.com>
QA-Review: Mark Valentine <mvalentine@instructure.com>
Product-Review: Mark Valentine <mvalentine@instructure.com>
2022-03-03 22:40:58 +00:00
Xander Moffatt 3b15bdfc28 support lti_storage_target in 1.3 login request
refs INTEROP-7087
flag=lti_platform_storage

why:
* signals to tools that Canvas supports a cookie-less launch process and
is listening for postMessages on the window designated by this param

* default value is `_parent`, which means tools should send postMessages
to `window.parent || window.opener`
* can be set to something else, in which case the tool should expect
to have a sibling frame named with this value, to which it should send
postMessages - not implemented yet since there are some kinks, so always
send `_parent`
* there are other specs that check for this list of params
in a login request - once the flag is flipped on for good,
these specs will fail and will need to be changed then

test plan:
* open the Network tab of the browser dev tools
* launch an LTI 1.3 tool
* in the login request (for the 1.3 test tool it's a POST to `/login`)
look for the lti_storage_target param - it should *not* be there
* enable the lti_platform_storage feature flag
* you may need to restart the web container and/or clear cache using
`GuardRail.activate(:deploy) { Rails.cache.clear }` to get
the flag enabling to stick
* launch an LTI 1.3 tool
* in the login request, lti_storage_target should be present in the form
data and set to `_parent`

Change-Id: Ic7539d3fdc381857c435cf7fb77f0a87ffc7c605
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274516
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2022-02-23 17:36:57 +00:00
Aaron Ogata 0babdc39f1 fix webpack memory regression from locale change
refs DE-1022

There have been reports of a memory regression caused by 1e8f45e ("use per-language instead of per-scope translation files"). This is indeed the case from the profiling steps below.

```
apt update && apt install -y time
rm -rf public/javascripts/translations/* && bundle exec rake i18n:generate_js

for run in {1..5}; do
  rm -rf node_modules/.cache/* && rm -rf public/dist/webpack-dev/*
  (/usr/bin/time -v yarn run webpack-development) 2>&1 >/dev/null | grep "Maximum resident set size"
done
```

Before 1e8f45e:
Maximum resident set size (kbytes): 3785704
Maximum resident set size (kbytes): 3991196
Maximum resident set size (kbytes): 3894452
Maximum resident set size (kbytes): 3858516
Maximum resident set size (kbytes): 3768916

After 1e8f45e:
Maximum resident set size (kbytes): 4556988
Maximum resident set size (kbytes): 4711868
Maximum resident set size (kbytes): 4862212
Maximum resident set size (kbytes): 4763156
Maximum resident set size (kbytes): 4803300

With this change, the memory usage drops to below the previous value, which would be expected from this change.

Maximum resident set size (kbytes): 3627176
Maximum resident set size (kbytes): 3608840
Maximum resident set size (kbytes): 3961552
Maximum resident set size (kbytes): 3887148
Maximum resident set size (kbytes): 3863004

The root cause appears to be that webpack is using a significant amount of memory to translate the many setLazyTranslation calls for each scope.

For the quick fix, we choose to do the fastest fix of wrapping these calls in an IIFE. A longer term fix would be to re-write the mergeI18nTranslations API to require only one call. This is work already scheduled for this project that will be handled later as it requires consensus and testing on different file formats.

Additionally, we could also convert the file to a JSON file, but we would lose the ability to lazy load each translation scope, and would require further performance testing. If we chose to do that work, we may be able to have a memory usage like:

Maximum resident set size (kbytes): 3285508

Change-Id: I827643a6706c163ab9b0f2a8a597c4d668c36e32
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285584
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2022-02-22 14:08:53 +00:00
Angela Gomba ad026fd848 Add Friendly Description to Outcome Export Report
closes OUT-4933
flag=none

test-plan:
- create two outcomes at the account level
- create a friendly description for one outcome at
the account level (I did this through the rails
 console)
- go to settings > reports and run a report for
the outcome export
- observe the report contains a friendly
description header
- observe outcomes with no friendly descriptions
are blank
- observe outcomes with friendly descriptions
include those friendly descriptions
- import outcomes with a friendly description to
a sub-account
- run an outcome export report from the sub-
account and observe there's a friendly
description from the account-level
- edit one of the friendly descriptions in the
sub-account
- run an outcome export report from the sub-
account and observe that the friendly
description created at the sub-account level is
present

Change-Id: I8c577a0220ad12ccc2d6d632a20dd670b699243a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284892
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Martin Yosifov <martin.yosifov@instructure.com>
QA-Review: Martin Yosifov <martin.yosifov@instructure.com>
Product-Review: Ben Friedman <ben.friedman@instructure.com>
2022-02-18 14:10:58 +00:00
Aaron Ogata 1e8f45e3ed use per-language instead of per-scope translation files
refs FOO-2720
refs DE-1022

Currently, translations are compiled on a per-scope level. The primary problem by doing this is that each generated scope file contains the translations for all languages, leading users to needing to download translations for languages they will never use.

Instead, we now generate a single translations file per language. This file is loaded and cached by the browser at the beginning of page load.

[change-merged]
[build-registry-path=jenkins/canvas-lms/de-1022]

Change-Id: I64b0d054b04e3d81bb7263650481d1d3fe9a4868
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284285
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-02-18 00:10:23 +00:00
Aaron Ogata d3ba157e43 remove translations/_core_en.js in production try 2
refs FOO-2720
flag = none

Short version: the "_core_en.js" file is no longer loaded in production
as its contents have been merged (there) with the super "core.js" file,
which is targeted for removal later in this series.

Change-Id: I05eb76a2f1cac12b4ab953bad0ca5a49b6ffd37b

---

The problem as I understand it: there are certain phrases that are
marked as "core" because they are used by shared/logic code like
DateTime formatters and are pre-defined in config/locales.yml. These
phrases were being supplied in two distinct files:

- _core_en.js, which includes only the phrases for the "en" language
- _core.js, which includes the phrases for the rest of the supported
  locales

_core_en was split because it was deemed necessary to be loaded always,
regardless of the active locale, and that is - as it appears to me, at
least - because some code attempts to look up those phrases at the
time their modules are evaluated. This patch corrects those modules to
defer their lookups until the point where the translations are used,
and when the translations have become available -- just like the rest of
the codebase does.

But if this is true, this begs the question, how come those modules
weren't presenting bugs by using translations for "en" and not for the
target locale? My thinking is that it is only coincidental that they
weren't: should _any_ module that uses I18n be evaluated _before_ any of
those modules, the Webpack plugin will have already loaded the "core"
file, which includes the translations for those phrases in the target
locale. _core_en may not have been loaded by then, but that doesn't
matter because the resolver is gonna look for what's in _core first when
it's available, and it is.

---

What happens in this patch is a slight change to prepare for the full
removal of both _core and _core_en: _core_en is now loaded only in
builds that don't load actual translations because we need the default
values that that file provides. The alternative would've been to go to
each call-site that looks up the phrases provided in _core_en and have
them supply default values, but it's untenable at this point.

This is the list of call-sites and the phrases they look up:

    ui/features/calendar/jquery/index.js: time.formats.tiny_on_the_hour
    ui/features/quiz_statistics/util/parse_number.js: number.format.delimiter
    ui/features/quiz_statistics/util/parse_number.js: number.format.separator
    ui/shared/day-substitution/backbone/views/DaySubstitutionView.coffee: date.day_names
    ui/shared/syllabus/jquery/calendar_move.js: date.month_names
    ui/shared/datetime/jquery/DatetimeField.js: date.formats.medium
    ui/shared/datetime/jquery/DatetimeField.js: date.abbr_month_names
    ui/shared/datetime/jquery/DatetimeField.js: date.day_names
    ui/shared/datetime/jquery/DatetimeField.js: date.abbr_day_names
    ui/shared/datetime/jquery/DatetimeField.js: date.datepicker.column_headings
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.hour
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.minute
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.am_pm
    ui/shared/handlebars-helpers/dateSelect.js: date.order
    ui/shared/handlebars-helpers/dateSelect.js: date.*
    ui/shared/i18n/i18nObj.js: number.format
    ui/shared/i18n/numberHelper.js: number.format.delimiter
    ui/shared/i18n/numberHelper.js: number.format.separator

dateSelect.js is the gnarly one because it seems to be passing through
everything under date.* to God knows who.

The list above was generated with a command similar to this:

    grep -rnP "I18n.(t|lookup)\(['\"](date|datetime|number|support|time)\S" ui

---

~ test plan ~
  ~~~~ ~~~~

- you can still activate a different locale and use something like the
  datepicker to normal effect

[change-merged]
[build-registry-path=jenkins/canvas-lms/foo-2720-01]

Change-Id: Ifd5d2d888edc9b89a9930824f2c55fd9c275b03f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284102
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-02-18 00:08:38 +00:00
Ahmad Amireh 0d644dffa8 Revert "remove translations/_core_en.js in production"
This reverts commit 70976cc7f8.

Change-Id: Iae38dbb199b66bdc5f45123b65a8494d5a1b8557
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285348
Tested-by: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-02-16 23:01:07 +00:00
Isaac Moore 448d316c28 Enable Redis tracing in Sentry APM
This change causes `db.redis.command` spans to be recorded by Sentry when
APM is enabled. It also makes slight improvements to the Sentry
initializer.

flag=none
closes DE-1055

test plan:
- verify that Sentry and Canvas initialize OK, and both errors and APM
  transactions are recorded OK
- verify that controllers which interface with Redis record spans in
  their APM transactions
- verify that Redis commands are not recorded as breadcrumbs (we did not
  enable this feature)

Change-Id: I7955b3ad5d6b59e6fd96c801881671814064d622
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285255
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
2022-02-16 22:46:29 +00:00
Ahmad Amireh 70976cc7f8 remove translations/_core_en.js in production
refs FOO-2720
flag = none

Short version: the "_core_en.js" file is no longer loaded in production
as its contents have been merged (there) with the super "core.js" file,
which is targeted for removal later in this series.

Change-Id: If97f75066aea32dd74c3899db7aec8fcf4cd93db

---

The problem as I understand it: there are certain phrases that are
marked as "core" because they are used by shared/logic code like
DateTime formatters and are pre-defined in config/locales.yml. These
phrases were being supplied in two distinct files:

- _core_en.js, which includes only the phrases for the "en" language
- _core.js, which includes the phrases for the rest of the supported
  locales

_core_en was split because it was deemed necessary to be loaded always,
regardless of the active locale, and that is - as it appears to me, at
least - because some code attempts to look up those phrases at the
time their modules are evaluated. This patch corrects those modules to
defer their lookups until the point where the translations are used,
and when the translations have become available -- just like the rest of
the codebase does.

But if this is true, this begs the question, how come those modules
weren't presenting bugs by using translations for "en" and not for the
target locale? My thinking is that it is only coincidental that they
weren't: should _any_ module that uses I18n be evaluated _before_ any of
those modules, the Webpack plugin will have already loaded the "core"
file, which includes the translations for those phrases in the target
locale. _core_en may not have been loaded by then, but that doesn't
matter because the resolver is gonna look for what's in _core first when
it's available, and it is.

---

What happens in this patch is a slight change to prepare for the full
removal of both _core and _core_en: _core_en is now loaded only in
builds that don't load actual translations because we need the default
values that that file provides. The alternative would've been to go to
each call-site that looks up the phrases provided in _core_en and have
them supply default values, but it's untenable at this point.

This is the list of call-sites and the phrases they look up:

    ui/features/calendar/jquery/index.js: time.formats.tiny_on_the_hour
    ui/features/quiz_statistics/util/parse_number.js: number.format.delimiter
    ui/features/quiz_statistics/util/parse_number.js: number.format.separator
    ui/shared/day-substitution/backbone/views/DaySubstitutionView.coffee: date.day_names
    ui/shared/syllabus/jquery/calendar_move.js: date.month_names
    ui/shared/datetime/jquery/DatetimeField.js: date.formats.medium
    ui/shared/datetime/jquery/DatetimeField.js: date.abbr_month_names
    ui/shared/datetime/jquery/DatetimeField.js: date.day_names
    ui/shared/datetime/jquery/DatetimeField.js: date.abbr_day_names
    ui/shared/datetime/jquery/DatetimeField.js: date.datepicker.column_headings
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.hour
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.minute
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.am_pm
    ui/shared/handlebars-helpers/dateSelect.js: date.order
    ui/shared/handlebars-helpers/dateSelect.js: date.*
    ui/shared/i18n/i18nObj.js: number.format
    ui/shared/i18n/numberHelper.js: number.format.delimiter
    ui/shared/i18n/numberHelper.js: number.format.separator

dateSelect.js is the gnarly one because it seems to be passing through
everything under date.* to God knows who.

The list above was generated with a command similar to this:

    grep -rnP "I18n.(t|lookup)\(['\"](date|datetime|number|support|time)\S" ui

---

~ test plan ~
  ~~~~ ~~~~

- you can still activate a different locale and use something like the
  datepicker to normal effect

Change-Id: I12ff180da35dcf916137818ab91296dab469f3c0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284582
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-02-16 20:48:16 +00:00
Jacob Burroughs 209cea8027 Rails 6.1 basic spec functionality
Change-Id: I89129633731a68c38a5026b6b26318d1f3699a2a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284968
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-02-16 17:31:11 +00:00
Isaac Moore c3f03e6186 Add Sentry trace ID to X-Canvas-Meta response header
This change adds Sentry's distributed trace ID to the `X-Canvas-Meta`
response header, so that it may be ingested by the logging pipeline and
accessed downstream.

flag=none
refs DE-1032

test plan:
- with Sentry initialized with a valid DSN, verify that the
  `X-Canvas-Meta` header contains a `st` value containing the Sentry
  trace ID
- verify that the trace ID present in the response header matches the one
  in the `meta` tag inside the body's `<head>`
- verify that when Sentry is not initialized with a valid DSN, the value
  is omitted from the response header, and the app still renders
  responses correctly

Change-Id: I63580b4d5057cebf55e6a4fdbc628d58ed7973f7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284991
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2022-02-15 23:48:15 +00:00
Jacob Burroughs bb7797b4ed Revert "Cache dynamic settings in request cache"
This reverts commit b9d45dbc1d.

Reason for revert: breaks prod database.yml because of the to_prepare

Change-Id: I3db4c5cbad77168ede014f9924049f458f05cb3f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284097
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
Product-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
2022-02-15 18:19:12 +00:00
Jacob Burroughs b9d45dbc1d Cache dynamic settings in request cache
Change-Id: I148bc0ebd4b623af650ee27ea6ee73c8ed64c11c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284870
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ben Rinaca <brinaca@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-02-15 17:02:19 +00:00
Jeremy Stanley afc1ee95d9 update specs for qti_migration_tool change
qti_migration_tool decided that object ids need to start with a
letter or underscore and are not allowed to start with a digit.
this isn't consistent with non-QTI packages and it can cause
imported quizzes to lose their Canvas metadata (including the
quiz description and due dates)

the fix is in qti_migration_tool but some Canvas specs need to
be adjusted to match the new behavior

test plan: specs

flag=none
refs LS-2980

[pin-commit-qti_migration_tool=fed7c13a5b0cd54a2d43a1085e365b93b9243ac5]

Change-Id: I902c265f200637dfeb45961d94b5e2102f733c6b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284571
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-02-07 21:45:30 +00:00
Luis Oliveira 50515ff9bd Stop duplicating files on repeat cartridge imports
fixes LS-2897
flag=none

test plan:
- Have the INST-FS plugin ON
- Have a canvas export package with at least one file
- Import the export package into a fresh course
- Import the same export package again.
- Check that the file wasn't duplicated
- (You could, after the first import, alter the
  attachment md5 column and put it's sha512 there,
  then theorically you'd be testing this, but Ideally
  you want instfs ON)

Change-Id: I0de79032d2ccd64e51cc09dea61b410aad43756f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282779
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
2022-02-03 15:07:56 +00:00
Alex Slaughter 1f24bf41ba override default max_tree_depth from 400 to 10,000
Fixes: EVAL-2219

flag = none

Test plan:
  - Specs Pass
  - Assessment Essay Questions Still Parse

Change-Id: I2eb4f7aec58c28c364d9363b12914947e72bffa0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284228
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Diaz <adrian.diaz@instructure.com>
2022-02-02 20:58:07 +00:00
Xander Moffatt a09aab728a keep track of missing live events context
why:
* to see if this is a problem, since events sent out without a context
will pose a problem to live events consumers

refs INTEROP-7187
flag=none

test plan:
* follow the instructions in doc/live_events.md to set up live events
and print them to stdout logs
* follow the instructions in doc/lti_manual/11_testing.md under
`Stubbing Statsd Calls` to monkey-patch Statsd for easy metric viewing
* (a good place to put that is in the ApplicationController)
* comment out the call to `LiveEvents.set_context` in the
ApplicationController
* trigger any live event - navigating through course pages should be
enough, though creating an assignment is always a good one
* for every event triggered there should be a Statsd call for
`missing_context`
* add back the call to `set_context`
* trigger more live events
* the Statsd calls should not continue

Change-Id: Ib87952e208885ef15b00561731769f808cdcd066
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284053
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2022-02-02 16:45:46 +00:00
Jeremy Stanley 5747b1add0 lint root_account_id requirements for new tables
test plan:
 - create a migration and stage it for commit (no need to
   actually commit or run it) that creates a new table
 - start without having a root_account_id column or a
   replica identity index
 - run script/rlint and it should complain that you need
   a root_account reference and a replica identity index
   and provide example lines for both
 - if you create the root_account_id column in any of the
   following less-desired ways, it should point out your
   error and give you an example of what the line should
   look like:
   - `t.bigint :root_account_id` instead of
     't.references :root_account`
   - missing `{ foreign_key: { to_table: :accounts} }`
   - missing `index` option or `index` option other than
     `index: false` (the replica identity index is
     generally sufficient)
   - missing `null: false`
   (if multiple deficiencies exist, it'll only log one;
    it's not possible for one cop to log multiple errors
    per line, but it will give an example that checks all
    the boxes so following that should avoid back-and-forth)
 - create more than one table in the migration and verify
   that it detects which table(s) is/are missing the
   `add_replica_identity` call

flag=none
closes DE-951

Change-Id: I582608c8792767c2b51f69d90afd777e3c7a0981
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283076
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-31 22:56:05 +00:00
Evan Battaglia 583f813092 Fix parsing of kid for key rotation
Fixes INTEROP-7269
flag=none

The problem was introduced in
https://gerrit.instructure.com/c/canvas-lms/+/275160 which added a UUID,
to the KID. If the UUID happens to have something that looks like a
date, Time.zone.parse picks that up and doesn't return the date in the
first part of the kid. For example:

  > Time.parse "2022-01-25T17:46:59Z_d2fe13a4-b3f7-4feb-9"
  => -0009-02-04 17:46:59 UTC

This resulted in a flaky spec. It could also cause rotate_keys to rotate
keys multiple times on the first of the month (which can happen but
we're not sure why, see 89941a1d). It could also cause the keys to not
rotate (if the timestamp is in the future):

  > Time.zone.parse "2022-01-25T17:46:59Z_2feb2023-aaaa-aaaa-a"
  => Thu, 02 Feb 2023 17:46:59 UTC +00:00

Test plan:
- run Lti::KeyStorage.retrieve_keys to see the keys; then Lti::KeyStorage.rotate_keys
- retrieve keys again to see they rotated
- run rotate_keys again and make sure they haven't rotated
- class << Lti::KeyStorage; def min_rotation_period; 10.seconds; end; end
- run rotate_keys again and make sure they've rotated
- class << SecureRandom; def uuid; "2feb2023-aaaa-aaaa-a"; end; end
- run rotate_keys again and make sure they only rotate 10 seconds after
  the last time and that the kid includes that string

Change-Id: Ia67cafe3d04a650d8c6735835bb170b8dc8980ee
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283562
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-01-26 16:24:40 +00:00
Jeremy Stanley 0bf6a4b4c8 lint: ensure id columns use bigint type
test plan:
 - create a migration that adds an integer column whose name
   ends in "_id" and stage it for commit (no need to actually
   run the migration)
 - `script/rlint` should warn you to use bigint types for
   id columns
 - using type `:integer` with `limit: 8` is acceptable
   as is using type `:bigint`
 - no complaints are issued in `down`

flag=none
closes DE-953

Change-Id: Ifd1f4ff1cc74368b99ac2eda42181bcec25b94c8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282668
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-13 22:13:42 +00:00
Jeremy Stanley c53205b265 lint calls that should appear in predeploy
per our migration guidelines, tables, columns, and indexes
should be created in predeploy migrations

test plan:
 - create a migration and stage it for commit (no need to
   actually commit it or run it) and ensure `script/rlint`
   flags issues for a postdeploy migration that:
   (1) tries to `create_table`
       (I don't bother flagging all the index or column
        creation inside this block, since the table is enough)
   (2) tries to create columns or indexes inside `change_table`
       (e.g., with `t.index`, `t.text`, `t.boolean` etc.)
       (2a) a postdeploy migration that uses a change_table
            block to remove columns or indexes is ok
   (3) tries to `add_column`
   (4) tries to `add_index`
   (5) tries to `add_reference`
 - the above things should not be errors in a predeploy migration
   and should not be flagged if they appear in `down` regardless

flag=none
closes DE-949

Change-Id: I209f44289f3a21f80d3d1c063600c009fc406d7c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282588
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
2022-01-13 22:13:25 +00:00
Jeremy Stanley 233bb6b2e9 lint DataFixup migration tag
test plan: a call to DataFixup::(Something).run should be flagged
unless the migration is tagged :postdeploy

flag=none
closes DE-948

Change-Id: I5c1deb43267f00d4a042bb3bae9db906a2e3673a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282570
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-13 16:55:49 +00:00
Jeremy Stanley 19df9c2118 lint boolean columns
per our migration best practices, boolean columns should have
a default value and should not be nullable

test plan:
 - create a migration that adds new boolean columns and stage it
   for commit (no need to actually commit run the migration)
 - run script/rlint and you should be warned if your column
   does not have a default type or is nullable
 - test various ways of doing this:
   - with `add_column`
   - with `t.boolean` in a `create_table` or `change_table` block
   - with `t.column :foo, :boolean` in one of those blocks
 - try both the :boolean and :bool spellings (the latter isn't
   documented but is used in a few places anyway)

flag=none
refs DE-948

Change-Id: I305d2d146c1cca8fae80532416e0b8d5ded7e5c2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282302
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-13 16:55:22 +00:00
Aaron Ogata 2f386d104a rename Canvas::DynamicSettings => DynamicSettings
Change-Id: Ia2c1754ce729d95bcbf194f6b31a5a2b36d42bbb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282694
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-01-12 21:54:51 +00:00
James Butters 9e46664eaf Revert "Revert "rspecq/rspec separate build""
This reverts commit 7dd287adea.

Reason for revert: try again

Change-Id: Ie0eededa8465a7fb79bbd221c777646ab2640fa7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282036
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2022-01-12 18:21:47 +00:00
Jeremy Stanley aa4a4b1b76 lint adding not-null constraint
test plan:
 - create a database migration and add it to a commit
   (no need to push the commit or run the migration))
   that tries to add a not-null constraint to a column. e.g.

   change_column_null :table, :column, false

 - run script/rlint
 - you should be warned to use `disable_ddl_transaction!` if
   this is not present in the migration class definition
 - you should be warned to use DataFixup::BackfillNulls to
   backfill null values if this is not present

   (note that the linter can't actually tell if your arguments
   to BackfillNulls are correct, because it takes an AR class name
   instead of a table name and the cop has no way of linking
   the two, and also the arguments are dynamic in many places;
   it's just looking for the presence of that call)

closes DE-944

Change-Id: I8b79f8d0a44ae1bbf8de86c1a7e89c50cfe2b702
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282137
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-10 21:22:12 +00:00
Jeremy Stanley 5d257d5e7a rubocop: move add-index non-transactional warning to the class node
which is nicer because
(1) that's where the `disable_ddl_transaction!` needs to be, and
(2) the message doesn't preempt the `algorithm: :concurrently` note

test plan:
 - add a migration to a commit (no need to actually run it or push
   the commit) that adds an index to an existing table, and does
   not use `algorithm: :concurrently` or `disable_ddl_transaction!`
 - run script/rlint and you should see both warnings
   (the transaction one at the top, under the class, and the
   algorithm one on the index line)

flag=none
refs DE-945

Change-Id: Ibfc55b26387d3520c2de9fde5491869a9033b2c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282461
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-10 21:09:43 +00:00
Jeremy Stanley 211af6ddb1 lint adding index to existing tables
test plan:
 - create a commit containing a migration that adds an index
   to a table with add_index (no need to actually run the migration
   or push the commit)
 - run script/rlint and verify:
   1. it wants `disable_ddl_transaction!` in the migration class
   2. it wants `algorithm: :concurrently` in the index line
   3. it doesn't care about 1 and 2 if the table was also created
      in the same migration
 - repeat with `add_reference` instead of `add_index`, except for
   part 2, the option is spelled `index: { algorithm: :concurrently }`
   and if you put `index: false` it doesn't complain (but it still
   does if you put `index: true` or omit the option, as it defaults
   to true)
 - repeat with a `change_table` block using `t.index`,
   e.g. `t.index [:columns], algorithm: :concurrently` is fine,
   without the option results in the warning. (but note that
   inside `create_table` the option is not needed!)
 - repeat with a `change_table` block using `t.references`
   (as with `add_reference`, `index: false` is fine, as is
    `index: { algorithm: :concurrently }`, but `index: true`
    or no `index` option result in the warning.)

flag=none
closes DE-945

Change-Id: If95ce2d930bdf41d0bc863a065f2447ec01d2271
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282227
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-10 19:25:05 +00:00
Jeremy Stanley 36a6009934 lint rename_table
test plan:
 - create a migration that renames a table and `git add` it
   (no need to actually run the migration or push the commit)
 - run script/rlint
 - it should tell you that renaming a table requires a multi-
   deploy process and link you to our migration best practices page
 - if your migration uses the process from that page and drops a view
   before renaming the table, no warning is issued
 - it doesn't warn you about the `down` half of the above pattern

flag=none
closes DE-947

Change-Id: Ic19807af210940df60e8b72952db297d71ac7dfa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282292
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2022-01-10 19:22:29 +00:00
Isaac Moore 3e748c1c7e Upgrade Sentry SDKs
This commit replaces `sentry-raven` with the more modern Sentry SDKs.

Settings related to this change:

- `sentry_disabled`: completely disables Sentry, in case anything goes
  sideways (defaults to `false`)

refs DE-922
flag=none

test plan:
- make sure to check out the correct patchset in the
  `gems/plugins/uuid_provisioner` directory (see the tag below for ref)
- create a new project in Sentry (it may be easiest to set up Sentry to
  run locally; check out `getsentry/onpremise` on GitHub for setup
  details; it's not too onerous. note that you will need to add
  `VIRTUAL_HOST` and `VIRTUAL_PORT` to the `nginx` container in that
  `docker-compose.yml` in order to have your Sentry accessible via Dory
  at `sentry.docker`)
- configure `config/sentry.rb` with your DSN
- restart rails and job servers
- confirm that, by default:
  - any errors raised in controllers appear in the "Issues" section
  - any errors raised in jobs appear in the "Issues" section
  - user context associated with issues includes user IP and global ID
  - job issues contain context from the job under the "INST-JOBS" section
- set `sentry_disabled` setting to true and restart rails/jobs servers
- confirm that the app/jobs start fine and there are no issues
  - also confirm that Sentry is disabled (no errors received)
- remove `config/sentry.yml` and restart rails and jobs servers
- confirm that the app/jobs start fine and there are no issues

[pin-commit-uuid_provisioner=735c2102fb0020ac5aa80734a323bf08322d002d]

Change-Id: Id0fa4b4ee57ab812cd75d21d2e8ab5e21177af1a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279454
Reviewed-by: Ben Rinaca <brinaca@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-01-10 16:58:07 +00:00
Aaron Ogata b51d0f3a77 Revert "help fix RespondusSoapEndpoint getting unloaded"
This reverts commit 5ebb4a62fa.

Reason for revert: maybe broke build

Change-Id: Ied06d05de2f04eaccb98bb27acc30f6cfbf8bb3a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282034
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Tested-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-01-06 22:26:56 +00:00
James Butters 5ebb4a62fa help fix RespondusSoapEndpoint getting unloaded
flag = none

Change-Id: Ica343736fa2cdc31307b57c2aed841659d1fea52
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282274
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2022-01-06 20:38:15 +00:00
James Butters 7dd287adea Revert "rspecq/rspec separate build"
This reverts commit 276eb49f8e.

Reason for revert: Something in here is failing deploys

Change-Id: I615a90e6a4edf743ba47a2673bc14483ad141b3d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282032
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
Tested-by: James Butters <jbutters@instructure.com>
2022-01-06 17:47:50 +00:00
James Butters 276eb49f8e rspecq/rspec separate build
run rspecq/rspec tests in separate sub-build.

flag = none
refs: DE-929

Test Plan:
-Jenkins passes
  -test count is consistent

Change-Id: Ia62730c32d1793d591555c0fd034538254efffc3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282016
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2022-01-06 16:45:56 +00:00
Jeremy Stanley 7725a45a04 add warning for change_column/rename_column
test plan:
 - create a migration that changes a column data type
   using change_column (no need to run it)
 - `git add` the migration file (no need to actually
   commit it)
 - run script/rlint and it should tell you that
   changing a column type usually requires a multi-
   deploy process and link you to our best practices
   document
 - repeat with `rename_column` and the same warning
   should appear

flag=none
closes DE-943
closes DE-946

Change-Id: I21b4c4296441cfe5e7252827341ac4e48a2eec7f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/281349
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-16 20:00:13 +00:00
Jacob Burroughs 1c0d111be7 Ensure bundled gems don't break with rails 7.0 out
Change-Id: Ia22860eab7aa520f9ebafb06f9e01d279e673d24
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/281402
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-12-16 16:26:36 +00:00
Jeremy Stanley 7f5b70e27f add linter warning for raw SQL in migrations
test plan:
 - create a migration and add it to a commit (no need to actually
   run the migration or push the commit) that performs raw SQL
   via `execute` or `connection.execute`
 - run `script/rlint` and you should see an "info" message that
   raw SQL in migrations must be approved by a migration reviewer

flag=none
closes DE-941

Change-Id: Icfddda67f134aee9922d22c8c092836da09fc29d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280808
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-13 20:04:52 +00:00
Jeremy Stanley af8d0fe079 lint use of add_foreign_key
test plan:
 - create a migration (locally) and add it to a commit
   (no need to actually commit, push, or even run the migration)
   that adds a foreign key to an existing table, e.g.

   add_foreign_key :users, :eportfolios

 - run script/rlint, and it should complain that you should
   use a non-transactional migration and add `delay_validation: true`
   to the arguments
 - do those things, run script/rlint again, and it should not
   complain
 - add a foreign key to a table created in the same migration,
   e.g.

   create_table :foo do |t|
   end
   add_foreign_key :foo, :bar

 - run script/rlint again, and it shouldn't complain

flag=none
closes DE-940

Change-Id: I3f235cbf1ff4011e20d74bdaa8953b857c7e330a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280514
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-13 20:04:44 +00:00
Jeremy Stanley bc1b897c64 add linter reminder for adding dropped columns to ignored_columns
test plan:
 - an `info` message should be logged when a column is removed
   reminding the engineer to use ignored_columns
 - the message doesn't occur in `down`

flag=none
closes DE-942

Change-Id: If46c2d325f2e2d3b32964f23fed1ba25520efabd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280381
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-08 20:22:14 +00:00
Jeremy Stanley 73f2bc8be6 allow Migration cops to set their own severity
since planned cops may provide different severity levels
depending on circumstances

refs DE-942

flag = none

Change-Id: I7501c13ea350241c47debceb7440cc8ce3d43925
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280532
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-08 20:10:41 +00:00
Jeremy Stanley c1e5597ce0 require if_not_exists for non-transactional add_reference
migrations that disable the DDL transaction should use if_not_exists
when adding a reference to a table

test plan: specs

closes DE-935

Change-Id: I3ccb9786446995c22c9cf2b8b1fa9da9e24e184e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280182
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-12-07 22:52:11 +00:00
Ryan Hawkins 5f42c46208 Add Resource Link LTI migration parameter
Added in the "resource_link_id" migration parameter for resource link
launches. This parameter is included when the LTI 1.3 resource_link_uuid
is different than the LTI 1.1 lti_context_id. It helps tools migrating
from 1.1 to 1.3 map old ids in their databases to the new ids.

flag=none

closes INTEROP-6796

test-plan:
* Install an LTI 1.1 tool and create an assignment that launches that
  tool, then launch it. Note the resource_link_uuid that is provided. It
  should look like a hash, not a UUID. Xander likely knows of a good LTI
  1.1 tool that would work for testing, or a way to make the 1.3 tool
  work for this.
* Install the LTI 1.3 Test Tool in at least the assignment submission
  and course menu placement. I'm lazy, so I have it installed everywhere :)
* Migrate your previous LTI 1.1 assignment to use the LTI 1.3 Test Tool.
  You can do this by updating the assignment's external_tool_tag.url to
  the launch url of the LTI 1.3 Test Tool which is typically
  http://lti13testtool.docker/launch.
* Launch the assignment. You should see under the
  "https://purl.imsglobal.org/spec/lti/claim/lti1p1" a value for
  resource_link_id. This should match the hash you saw earlier when you
  launched the 1.1 tool.
* Now for some monkey-patching :). Place a byebug breakpoint at the
  beginning of the include_lti1p1_claims? method in
  lib/lti/messages/resource_link_request.rb. Then, launch the 1.3 tool
  from the assignment. When you hit the breakpoint, monkey-patch
  Assignment with the following code:

  class Assignment < ActiveRecord::Base
    def lti_resource_link_id
      primary_resource_link.resource_link_uuid
    end
  end

  This makes sure that the code thinks that the LTI 1.1 and 1.3
  resource_link_ids are the same, even though that can basically
  never happen in real life. This way though, we know that only
  include the claim when we absolutely need to.

  Continue the launch after monkey-patching and you should see there is
  no resource_link_id claim in the lti1p1 claims section.
* Launch the tool from the course menu and make sure that you *don't*
  see a key-value pair for resource_link_id. It should only be included
  on assignment launches.

Change-Id: I85bbd977f4aa0809b2b031492bf58c0c86fea4bc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275459
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
2021-12-01 19:00:32 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer e73cf9ddf4 RuboCop: Style/HashSyntax
[skip-stages=Flakey]

auto-corrected

Change-Id: I9371a61046aee6b148f89dd434114a8ba2b1188c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:02:35 +00:00
Cody Cutrer eaca556b81 RuboCop: Style/NumericLiterals
[skip-stages=Flakey]

auto-corrected

Change-Id: I88363d87d5a70be941aa81b4ffe5306ce7506b98
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279207
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:31:34 +00:00
Cody Cutrer 8c37fa9ac3 RuboCop: RSpec/LetBeforeExamples, RSpec/LeadingSubject
[skip-stages=Flakey]

auto-corrected

Change-Id: Ia794667280669652b7da12f8e351f25bed25e32b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279460
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:30:52 +00:00
Cody Cutrer 8ee4c4777a RuboCop: RSpec/RepeatedExampleGroupDescription
[skip-stages=Flakey]

manual, mostly by fixing copy/paste name problems,
combining groups that didn't need separating, or creating
new groups to contain contiguous top level groups that can't
be combined due to having different setup

Change-Id: I5b21664eabd8c3a62e22c09a28ba8bf519371aa5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279428
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:29:56 +00:00
Cody Cutrer c1bfffa8df RuboCop: RSpec/VoidExpect
manual

Change-Id: Ia1e83f9e901a27aaa02135a82cfe0ad5a3e3bf7e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279421
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:31:50 +00:00
Cody Cutrer 379d5d7611 rubocop: default to error severity
means we can remove a whole bunch of specific cop configurations that
now inherit the proper settings. cops that still have violations need
to be explicitly named to make them not error. this means that the
list of remaining cops is explicitly in our config now. also combined
the don't-auto-correct lists with the not-yet-fixed lists, so that
it's only a "permanent" section and a "todo" section

the final computed configuration is unchanged by this commit, with one
exception - Bundler/OrderedGems was moved to the Gemfile.d/.rubocop.yml
override, and some of the internal gems violated that so their
gemfiles have been autocorrected

Change-Id: I100884a96dbe9eb9d4bfc0692663c271daa9de16
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279413
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:31:26 +00:00
Cody Cutrer e0600a99a4 rubocop: remove .rubocop.common.yml
we're far enough along that the generated disablings are no longer useful

Change-Id: Iec341384f7a5f6eeb42bad4ae1ea12f433d270a4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279397
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:31:12 +00:00
Cody Cutrer 9b71ed2054 RuboCop: Style/BlockDelimiters, Style/Lambda
[skip-stages=Flakey]

auto-corrected

Change-Id: I642f868d75c079e698f1fe4161bbbe419dbe1827
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279374
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:30:47 +00:00
Cody Cutrer 300ca66f2d RuboCop: Style/MultilineIfModifier
[skip-stages=Flakey]

auto-corrected

Change-Id: Iaa83f08bec769fc687db68fe11a6bd4f5f0e3d4a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279271
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:30:24 +00:00
Cody Cutrer c302dd8bc1 RuboCop: Style/SymbolArray, Style/WordArray
[skip-stages=Flakey]

auto-corrected

Change-Id: Id187ed60c5590025e780d81b85b5212f51368f27
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279196
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:30:08 +00:00
Cody Cutrer 04e28fd25c RuboCop: Style/Next
[skip-stages=Flakey]

auto-corrected

Change-Id: Ia842e948dc2f6f0eb2d39a66e1c56cc4fe90bd5c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279168
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:29:04 +00:00
Cody Cutrer 25b301e97d RuboCop: Style/IfInsideElse, Style/SoleNestedConditional
[skip-stages=Flakey]

auto-corrected with post review ensuring line breaks continue to
convey original meaning of separated conditions, and cleaning up
some now-duplicated conditions

Change-Id: Ib9b31226de0665a2e4427fe595639d0d91a33f83
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279151
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:28:35 +00:00
Cody Cutrer efc87c595a RuboCop: Style/LineEndConcatenation
[skip-stages=Flakey]

auto-corrected, with post review looking for opportunities to convert
to heredocs

Change-Id: Ic163882ebb5f4d2d28b5e5fd65188781d8eef3c8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279287
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 03:13:13 +00:00
Cody Cutrer b07e9bb880 RuboCop: Style/EmptyElse
manual

Change-Id: I15ced2ebeddc71371a7bfb694284e4483b849bf4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279176
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 02:50:28 +00:00
Cody Cutrer 0957de01c9 RuboCop: Style/StderrPuts
[skip-stages=Flakey]

auto-corrected

Change-Id: I98d48156cdff1f015d0c9dfdc53e3ece8bc6abe4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279172
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 02:50:08 +00:00
Cody Cutrer fd8ac19412 add missing activesupport require in gem
Change-Id: Ied2cde6af2372cca474e4cac8a70877890f2cf78
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279102
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-11-21 17:56:37 +00:00
Cody Cutrer c776b6ef3a RuboCop: Style/CommentAnnotation
[skip-stages=Flakey]

auto-corrected

Change-Id: Ic82dbc22b8e63cc5f2ccb9b561cb3b9ed6628966
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279100
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-21 00:50:46 +00:00
Cody Cutrer 687a81dc8e RuboCop: Style/GlobalStdStream
auto-corrected

Change-Id: Ia61715c7b8f51f1688880525f4a7d68ee91a1726
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279092
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-21 00:50:35 +00:00