Fix correction import schema and update dependencies#290
Conversation
Bumps the npm-production group with 3 updates: [better-sqlite3](https://github.com/WiseLibs/better-sqlite3), [vue-i18n](https://github.com/intlify/vue-i18n/tree/HEAD/packages/vue-i18n) and [vue-router](https://github.com/vuejs/router). Updates `better-sqlite3` from 12.9.0 to 12.10.0 - [Release notes](https://github.com/WiseLibs/better-sqlite3/releases) - [Commits](WiseLibs/better-sqlite3@v12.9.0...v12.10.0) Updates `vue-i18n` from 11.4.2 to 11.4.4 - [Release notes](https://github.com/intlify/vue-i18n/releases) - [Changelog](https://github.com/intlify/vue-i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/intlify/vue-i18n/commits/v11.4.4/packages/vue-i18n) Updates `vue-router` from 5.0.6 to 5.0.7 - [Release notes](https://github.com/vuejs/router/releases) - [Commits](vuejs/router@v5.0.6...v5.0.7) --- updated-dependencies: - dependency-name: better-sqlite3 dependency-version: 12.10.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-production - dependency-name: vue-i18n dependency-version: 11.4.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-production - dependency-name: vue-router dependency-version: 5.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-production ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps the npm-development group with 4 updates: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node), [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/HEAD/packages/plugin-vue), [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) and [vue-tsc](https://github.com/vuejs/language-tools/tree/HEAD/packages/tsc). Updates `@types/node` from 25.7.0 to 25.9.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@vitejs/plugin-vue` from 6.0.6 to 6.0.7 - [Release notes](https://github.com/vitejs/vite-plugin-vue/releases) - [Changelog](https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite-plugin-vue/commits/plugin-vue@6.0.7/packages/plugin-vue) Updates `vite` from 8.0.12 to 8.0.13 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v8.0.13/packages/vite) Updates `vue-tsc` from 3.2.9 to 3.3.0 - [Release notes](https://github.com/vuejs/language-tools/releases) - [Changelog](https://github.com/vuejs/language-tools/blob/master/CHANGELOG.md) - [Commits](https://github.com/vuejs/language-tools/commits/v3.3.0/packages/tsc) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-development - dependency-name: "@vitejs/plugin-vue" dependency-version: 6.0.7 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-development - dependency-name: vite dependency-version: 8.0.13 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-development - dependency-name: vue-tsc dependency-version: 3.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-development ... Signed-off-by: dependabot[bot] <support@github.com>
…roduction-dc5a7c37a3 chore(deps): bump the npm-production group with 3 updates
…evelopment-b8bad99843 chore(deps-dev): bump the npm-development group with 4 updates
…contract Include correction import schema in ChatGPT export prompt
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
Code Review
This pull request introduces support for batch importing correction bundles by adding a new executeMany method to the ImportKbrCorrectionBundleUseCase and updating the exams bridge composable to handle arrays of bundles. It also updates the default rule pack prompt templates to specify that Ende Korrektur should return a JSON array of import bundles, and includes corresponding unit tests. The review comments point out opportunities to clean up payload objects by destructuring unused properties (such as removing the redundant bundle or bundles array when forwarding inputs) and raise a critical architectural consideration regarding transaction handling and partial failures during sequential batch imports.
| importCorrectionBundle: (input) => { | ||
| if (Array.isArray(input.bundle)) { | ||
| return importKbrCorrectionBundleUseCase.executeMany({ | ||
| ...input, | ||
| bundles: input.bundle | ||
| }); | ||
| } | ||
|
|
||
| return importKbrCorrectionBundleUseCase.execute(input); | ||
| }, |
There was a problem hiding this comment.
When input.bundle is an array, spreading input directly into executeMany means the duplicate bundle property (which is the array) is still passed along with the new bundles property. Destructuring bundle out of input first keeps the payload clean and avoids passing redundant properties.
| importCorrectionBundle: (input) => { | |
| if (Array.isArray(input.bundle)) { | |
| return importKbrCorrectionBundleUseCase.executeMany({ | |
| ...input, | |
| bundles: input.bundle | |
| }); | |
| } | |
| return importKbrCorrectionBundleUseCase.execute(input); | |
| }, | |
| importCorrectionBundle: (input) => { | |
| if (Array.isArray(input.bundle)) { | |
| const { bundle, ...rest } = input; | |
| return importKbrCorrectionBundleUseCase.executeMany({ | |
| ...rest, | |
| bundles: bundle | |
| }); | |
| } | |
| return importKbrCorrectionBundleUseCase.execute(input); | |
| }, |
| async executeMany(input: ImportKbrCorrectionBundleBatchInput): Promise<ImportKbrCorrectionBundleBatchResult> { | ||
| const results: ImportKbrCorrectionBundleResult[] = []; | ||
|
|
||
| for (const bundle of input.bundles) { | ||
| results.push(await this.execute({ ...input, bundle })); | ||
| } | ||
|
|
||
| return { | ||
| results, | ||
| importedBundleCount: results.length, | ||
| importedTaskScoreCount: results.reduce((sum, result) => sum + result.importedTaskScoreCount, 0), | ||
| skippedTaskScoreCount: results.reduce((sum, result) => sum + result.skippedTaskScoreCount, 0), | ||
| uncertainties: results.flatMap((result) => result.uncertainties) | ||
| }; | ||
| } |
There was a problem hiding this comment.
Spreading input directly into this.execute passes the entire bundles array to each individual execute call as an extra property, which is unnecessary and can be avoided by destructuring bundles first.
Additionally, since this method processes multiple bundles sequentially using await in a loop, any error thrown by a single bundle (e.g., validation failure or database error) will abort the entire batch import midway. This can leave the database in a partially imported state. Consider wrapping the batch execution in a database transaction if atomicity is required, or catching errors per bundle to allow successful ones to complete while returning a list of failed imports.
| async executeMany(input: ImportKbrCorrectionBundleBatchInput): Promise<ImportKbrCorrectionBundleBatchResult> { | |
| const results: ImportKbrCorrectionBundleResult[] = []; | |
| for (const bundle of input.bundles) { | |
| results.push(await this.execute({ ...input, bundle })); | |
| } | |
| return { | |
| results, | |
| importedBundleCount: results.length, | |
| importedTaskScoreCount: results.reduce((sum, result) => sum + result.importedTaskScoreCount, 0), | |
| skippedTaskScoreCount: results.reduce((sum, result) => sum + result.skippedTaskScoreCount, 0), | |
| uncertainties: results.flatMap((result) => result.uncertainties) | |
| }; | |
| } | |
| async executeMany(input: ImportKbrCorrectionBundleBatchInput): Promise<ImportKbrCorrectionBundleBatchResult> { | |
| const { bundles, ...rest } = input; | |
| const results: ImportKbrCorrectionBundleResult[] = []; | |
| for (const bundle of bundles) { | |
| results.push(await this.execute({ ...rest, bundle })); | |
| } | |
| return { | |
| results, | |
| importedBundleCount: results.length, | |
| importedTaskScoreCount: results.reduce((sum, result) => sum + result.importedTaskScoreCount, 0), | |
| skippedTaskScoreCount: results.reduce((sum, result) => sum + result.skippedTaskScoreCount, 0), | |
| uncertainties: results.flatMap((result) => result.uncertainties) | |
| }; | |
| } |
This pull request introduces several improvements and fixes across the codebase, with a focus on enhancing the exams correction import/export workflow, updating dependencies, and clarifying documentation for multi-bundle correction exports. The most significant changes include support for batch importing correction bundles, clearer prompt and contract templates for multi-bundle exports, and dependency updates for security and compatibility.
Exams Correction Import/Export Improvements:
executeManymethod inImportKbrCorrectionBundleUseCaseand corresponding input/output types. This allows importing multiple bundles in a single operation, improving efficiency and consistency. (modules/exams/src/use-cases/import-kbr-correction-bundle.use-case.ts,apps/teacher-ui/src/composables/useExamsBridge.ts, [1] [2] [3] [4]modules/exams/tests/import-kbr-correction-bundle-batch.use-case.test.ts, modules/exams/tests/import-kbr-correction-bundle-batch.use-case.test.tsR1-R172)Prompt and Contract Template Clarifications:
Ende Korrekturcommand must export a JSON array of import bundles (one per resolved Leistung), not a single object or wrapper. Added stricter requirements for output format and included the import bundle schema in the prompt for better guidance. (modules/exams/rule-packs/default/contract.template.md,modules/exams/rule-packs/default/prompt.template.md,modules/exams/src/rule-packs/default-pack.ts,modules/exams/src/use-cases/export-correction-session.use-case.ts, [1] [2] [3] [4] [5] [6] [7] [8] [9]modules/exams/tests/export-correction-session.use-case.test.ts, modules/exams/tests/export-correction-session.use-case.test.tsR211-R217)Dependency Updates:
@types/node,better-sqlite3,vite,vue-i18n,vue-router, and others across multiplepackage.jsonfiles. [1] [2] [3] [4] [5] [6] [7]## SummaryLinked issue(s)
Checklist
npm run lint:docspassesnpm run typecheckpassesnpm run testpassesnpm run buildpassesTesting evidence
Architecture and risk notes
apps -> modules -> packages)Module proposal impact (if applicable)
Screenshots / recordings (if UI change)