diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e02d11d..a245e9ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.2.2] - 2023-09-13 + +- Fixed an "Empty Langs Response Error" that would sometimes occur after submitting an exercise. + ## [2.2.1] - 2023-09-11 - Bumped TMC-langs version to 0.35.0. diff --git a/bin/validateRelease.sh b/bin/validateRelease.sh index 4102fe50..af843628 100755 --- a/bin/validateRelease.sh +++ b/bin/validateRelease.sh @@ -10,8 +10,8 @@ fi # Version in package.json must match with tag version tagVersion=${BASH_REMATCH[1]} -packageVersion=$(grep -Eo '"version":.+$' package.json) -if [[ ! $packageVersion =~ '"version": "'$tagVersion'",' ]] +packageVersion=$(grep -Eo '^ "version": ".+$' package.json | cut -d\" -f4) +if [[ ! $packageVersion =~ $tagVersion ]] then echo "Error: The version in package.json '${packageVersion}' doesn't match with the tag '${tagVersion}." exitCode=1 @@ -42,4 +42,11 @@ then exitCode=1 fi +if [ $exitCode = 0 ] +then + echo "Validated release successfully" +else + echo "Failed to validate release" +fi + exit $exitCode diff --git a/bin/verifyThatLangsBuildsExist.js b/bin/verifyThatLangsBuildsExist.js index ce42a9f5..dbdbdb09 100644 --- a/bin/verifyThatLangsBuildsExist.js +++ b/bin/verifyThatLangsBuildsExist.js @@ -25,7 +25,7 @@ async function main() { console.error("Verification resulted in error:", e.message); process.exit(1); } - console.log("Looks good!"); + console.log("Found all langs builds!"); } main(); diff --git a/package-lock.json b/package-lock.json index a62133ac..bdacb57f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "test-my-code", - "version": "2.2.0", + "version": "2.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "test-my-code", - "version": "2.2.0", + "version": "2.2.2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 3dc6f53e..84c8db85 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "test-my-code", "displayName": "TestMyCode", - "version": "2.2.1", + "version": "2.2.2", "description": "TestMyCode extension for Visual Studio Code", "categories": [ "Other" diff --git a/src/api/langsSchema.ts b/src/api/langsSchema.ts index e938cf8c..f46351dc 100644 --- a/src/api/langsSchema.ts +++ b/src/api/langsSchema.ts @@ -1,53 +1,12 @@ -// https://raw.githubusercontent.com/rage/tmc-langs-rust/0.33.0/crates/tmc-langs-cli/bindings.d.ts +// https://raw.githubusercontent.com/rage/tmc-langs-rust/main/crates/tmc-langs-cli/bindings.d.ts export type Locale = string; -export type Compression = "tar" | "zip" | "zstd"; - export type CliOutput = | ({ "output-kind": "output-data" } & OutputData) | ({ "output-kind": "status-update" } & StatusUpdateData) | ({ "output-kind": "notification" } & Notification); -export interface OutputData { - status: Status; - message: string; - result: OutputResult; - data: DataKind | null; -} - -export type StatusUpdateData = - | ({ "update-data-kind": "client-update-data" } & StatusUpdate) - | ({ "update-data-kind": "none" } & StatusUpdate); - -export interface Notification { - "notification-kind": NotificationKind; - message: string; -} - -export type Status = "finished" | "crashed"; - -export type OutputResult = - | "logged-in" - | "logged-out" - | "not-logged-in" - | "error" - | "executed-command"; - -export type ClientUpdateData = - | { "client-update-data-kind": "exercise-download"; id: number; path: string } - | ({ "client-update-data-kind": "posted-submission" } & NewSubmission); - -export interface StatusUpdate { - finished: boolean; - message: string; - "percent-done": number; - time: number; - data: T | null; -} - -export type NotificationKind = "warning" | "info"; - export type DataKind = | { "output-data-kind": "error"; "output-data": { kind: Kind; trace: Array } } | { "output-data-kind": "validation"; "output-data": StyleValidationResult } @@ -87,13 +46,14 @@ export type DataKind = | { "output-data-kind": "config-value"; "output-data": ConfigValue } | { "output-data-kind": "tmc-config"; "output-data": TmcConfig } | { "output-data-kind": "compressed-project-hash"; "output-data": string } - | { "output-data-kind": "submission-sandbox"; "output-data": string }; - -export interface NewSubmission { - show_submission_url: string; - paste_url: string; - submission_url: string; -} + | { "output-data-kind": "submission-sandbox"; "output-data": string } + | { "output-data-kind": "mooc-course-instances"; "output-data": Array } + | { "output-data-kind": "mooc-exercise-slides"; "output-data": Array } + | { "output-data-kind": "mooc-exercise-slide"; "output-data": TmcExerciseSlide } + | { + "output-data-kind": "mooc-submission-finished"; + "output-data": ExerciseTaskSubmissionResult; + }; export type Kind = | "generic" @@ -110,19 +70,49 @@ export type Kind = }; }; -export interface StyleValidationResult { - strategy: StyleValidationStrategy; - validationErrors: Record> | null; +export interface OutputData { + status: Status; + message: string; + result: OutputResult; + data: DataKind | null; } -export interface ExerciseDownload { - id: number; - "course-slug": string; - "exercise-slug": string; - path: string; +export type OutputResult = + | "logged-in" + | "logged-out" + | "not-logged-in" + | "error" + | "executed-command"; + +export type Status = "finished" | "crashed"; + +export type StatusUpdateData = + | ({ "update-data-kind": "client-update-data" } & StatusUpdate) + | ({ "update-data-kind": "none" } & StatusUpdate); + +export interface Notification { + "notification-kind": NotificationKind; + message: string; } -export type StyleValidationStrategy = "FAIL" | "WARN" | "DISABLED"; +export type NotificationKind = "warning" | "info"; + +export interface StatusUpdate { + finished: boolean; + message: string; + "percent-done": number; + time: number; + data: T | null; +} + +export type ClientUpdateData = + | { "client-update-data-kind": "exercise-download"; id: number; path: string } + | ({ "client-update-data-kind": "posted-submission" } & NewSubmission); + +export interface StyleValidationResult { + strategy: StyleValidationStrategy; + validationErrors: Record> | null; +} export interface StyleValidationError { column: number; @@ -131,6 +121,8 @@ export interface StyleValidationError { sourceName: string; } +export type StyleValidationStrategy = "FAIL" | "WARN" | "DISABLED"; + export interface ExercisePackagingConfiguration { student_file_paths: Array; exercise_file_paths: Array; @@ -141,23 +133,14 @@ export interface LocalExercise { "exercise-path": string; } +export type Compression = "tar" | "zip" | "zstd"; + export interface RefreshData { "new-cache-path": string; "course-options": object; exercises: Array; } -export interface RunResult { - status: RunStatus; - testResults: Array; - logs: Record; -} - -export interface ExerciseDesc { - name: string; - tests: Array; -} - export interface RefreshExercise { name: string; checksum: string; @@ -166,6 +149,28 @@ export interface RefreshExercise { "tmcproject-yml": TmcProjectYml | null; } +export interface TmcProjectYml { + extra_student_files: Array; + extra_exercise_files: Array; + force_update: Array; + tests_timeout_ms?: number; + fail_on_valgrind_error?: boolean; + minimum_python_version?: PythonVer; + sandbox_image?: string; +} + +export interface PythonVer { + major: number; + minor: number | null; + patch: number | null; +} + +export interface RunResult { + status: RunStatus; + testResults: Array; + logs: Record; +} + export type RunStatus = | "PASSED" | "TESTS_FAILED" @@ -181,19 +186,14 @@ export interface TestResult { exception: Array; } -export interface TestDesc { +export interface ExerciseDesc { name: string; - points: Array; + tests: Array; } -export interface TmcProjectYml { - extra_student_files: Array; - extra_exercise_files: Array; - force_update: Array; - tests_timeout_ms?: number; - fail_on_valgrind_error?: boolean; - minimum_python_version?: PythonVer; - sandbox_image?: string; +export interface TestDesc { + name: string; + points: Array; } export interface UpdatedExercise { @@ -206,6 +206,13 @@ export interface DownloadOrUpdateCourseExercisesResult { failed?: Array<[ExerciseDownload, Array]>; } +export interface ExerciseDownload { + id: number; + "course-slug": string; + "exercise-slug": string; + path: string; +} + export interface CombinedCourseData { details: CourseDetails; exercises: Array; @@ -226,6 +233,45 @@ export interface CourseDetails { exercises: Array; } +export interface Exercise { + id: number; + name: string; + locked: boolean; + deadline_description: string | null; + deadline: string | null; + soft_deadline: string | null; + soft_deadline_description: string | null; + checksum: string; + return_url: string; + zip_url: string; + returnable: boolean; + requires_review: boolean; + attempted: boolean; + completed: boolean; + reviewed: boolean; + all_review_points_given: boolean; + memory_limit: number | null; + runtime_params: Array; + valgrind_strategy: string | null; + code_review_requests_enabled: boolean; + run_tests_locally_action_enabled: boolean; + latest_submission_url: string | null; + latest_submission_id: number | null; + solution_zip_url: string | null; +} + +export interface Course { + id: number; + name: string; + title: string; + description: string | null; + details_url: string; + unlock_url: string; + reviews_url: string; + comet_url: string; + spyware_urls: Array; +} + export interface CourseExercise { id: number; available_points: Array; @@ -239,6 +285,13 @@ export interface CourseExercise { unlocked: boolean; } +export interface ExercisePoint { + id: number; + exercise_id: number; + name: string; + requires_review: boolean; +} + export interface CourseData { name: string; hide_after: string | null; @@ -263,18 +316,6 @@ export interface CourseData { organization_slug: string | null; } -export interface Course { - id: number; - name: string; - title: string; - description: string | null; - details_url: string; - unlock_url: string; - reviews_url: string; - comet_url: string; - spyware_urls: Array; -} - export interface ExerciseDetails { course_name: string; course_id: number; @@ -287,6 +328,21 @@ export interface ExerciseDetails { submissions: Array; } +export interface ExerciseSubmission { + exercise_name: string; + id: number; + user_id: number; + course_id: number; + created_at: string; + all_tests_passed: boolean; + points: string | null; + submitted_zip_url: string; + paste_url: string | null; + processing_time: number | null; + reviewed: boolean; + requests_review: boolean; +} + export interface Submission { id: number; user_id: number; @@ -342,66 +398,32 @@ export interface Review { updated_at: string; } -export interface Exercise { - id: number; - name: string; - locked: boolean; - deadline_description: string | null; - deadline: string | null; - soft_deadline: string | null; - soft_deadline_description: string | null; - checksum: string; - return_url: string; - zip_url: string; - returnable: boolean; - requires_review: boolean; - attempted: boolean; - completed: boolean; - reviewed: boolean; - all_review_points_given: boolean; - memory_limit: number | null; - runtime_params: Array; - valgrind_strategy: string | null; - code_review_requests_enabled: boolean; - run_tests_locally_action_enabled: boolean; - latest_submission_url: string | null; - latest_submission_id: number | null; - solution_zip_url: string | null; +export interface NewSubmission { + show_submission_url: string; + paste_url: string; + submission_url: string; } -export interface ExerciseSubmission { - exercise_name: string; - id: number; - user_id: number; - course_id: number; - created_at: string; - all_tests_passed: boolean; - points: string | null; - submitted_zip_url: string; - paste_url: string | null; - processing_time: number | null; - reviewed: boolean; - requests_review: boolean; +export interface SubmissionFeedbackResponse { + api_version: number; + status: SubmissionStatus; } -export interface ExercisePoint { - id: number; - exercise_id: number; - name: string; - requires_review: boolean; -} +export type SubmissionStatus = "processing" | "fail" | "ok" | "error" | "hidden"; -export interface PythonVer { - major: number; - minor: number | null; - patch: number | null; +export interface TmcStyleValidationResult { + strategy: TmcStyleValidationStrategy; + validation_errors: Record> | null; } -export interface TmcConfig { - projects_dir: string; +export interface TmcStyleValidationError { + column: number; + line: number; + message: string; + source_name: string; } -export type ConfigValue = unknown | null | string; +export type TmcStyleValidationStrategy = "FAIL" | "WARN" | "DISABLED"; export interface SubmissionFinished { api_version: number; @@ -426,28 +448,71 @@ export interface SubmissionFinished { feedback_questions: Array | null; feedback_answer_url: string | null; error: string | null; - validations: StyleValidationResult | null; + validations: TmcStyleValidationResult | null; } -export interface SubmissionFeedbackResponse { - api_version: number; - status: SubmissionStatus; +export interface TestCase { + name: string; + successful: boolean; + message: string | null; + exception: Array | null; + detailed_message: string | null; } -export type SubmissionStatus = "processing" | "fail" | "ok" | "error" | "hidden"; - export interface SubmissionFeedbackQuestion { id: number; question: string; kind: SubmissionFeedbackKind; } -export interface TestCase { - name: string; - successful: boolean; - message: string | null; - exception: Array | null; - detailed_message: string | null; +export type SubmissionFeedbackKind = "Text" | { IntRange: { lower: number; upper: number } }; + +export type ConfigValue = unknown | null | string; + +export interface TmcConfig { + projects_dir: string; } -export type SubmissionFeedbackKind = "Text" | { IntRange: { lower: number; upper: number } }; +export interface CourseInstance { + id: string; + course_id: string; + course_slug: string; + course_name: string; + course_description: string | null; + instance_name: string | null; + instance_description: string | null; +} + +export interface TmcExerciseSlide { + slide_id: string; + exercise_id: string; + exercise_name: string; + exercise_order_number: number; + deadline: Date | null; + tasks: Array; +} + +export interface TmcExerciseTask { + task_id: string; + order_number: number; + assignment: unknown; + public_spec: PublicSpec | null; + model_solution_spec: ModelSolutionSpec | null; +} + +export type PublicSpec = + | { type: "browser"; files: Array } + | { type: "editor"; archiveName: string; archiveDownloadUrl: string; checksum: string }; + +export type ModelSolutionSpec = + | { type: "browser"; solutionFiles: Array } + | { type: "editor"; archiveDownloadUrl: string }; + +export interface ExerciseFile { + filepath: string; + contents: string; +} + +export interface ExerciseTaskSubmissionResult { + submission_id: string; +}