While adding unit tests in #1245, the tests surfaced these suspected bugs. They were deliberately not locked into the tests (the suite asserts correct behavior). Ordered by severity.
Medium
quickAddApi.executeChoice proceeds with an undefined choice — src/quickAddApi.ts:215-228. When plugin.getChoiceByName returns undefined, it calls reportError (which only logs) but then still await choiceExecutor.execute(choice) with choice === undefined instead of returning early. Also the const choice: IChoice annotation is dishonest (value can be undefined). Fix: return after reporting.
Low
duplicateChoice drops fields for Multi choices — src/services/choiceService.ts:42-49. The Multi early-return copies only choices/placeholder/collapsed (+ new name/id); unlike the non-Multi path it doesn't copy command/onePageInput, so duplicating a Multi with command: true yields command: false. Asymmetric vs other choice types.
- Dead schema-version check —
src/services/packageImportService.ts:114-118. isQuickAddPackage() already requires schemaVersion === CURRENT exactly, so a newer-version package fails validation first and the user gets the generic "not a valid package" error instead of the helpful version-mismatch message.
isChoiceImportable cycle guard skips bookkeeping — src/services/packageImportService.ts:169-213. On a parent cycle it returns true without finalizeImportable, leaving a stale entry in importableVisiting. Not reachable with valid (acyclic) input; low impact.
- Asset-kind dedup precedence —
src/services/packageExportService.ts:115-132. Script paths are assigned last-write-wins while template/capture paths use if (!has), so a path used as both user-script and template is classified user-script. Likely intended; flagging for confirmation.
utility.getSelectedText returns undefined on error branches — src/quickAddApi.ts:499-519 — while getSelection returns "". Minor API-shape inconsistency for user scripts.
Test coverage for each path now exists (#1245), so fixes can be verified by adjusting the corresponding assertion.
While adding unit tests in #1245, the tests surfaced these suspected bugs. They were deliberately not locked into the tests (the suite asserts correct behavior). Ordered by severity.
Medium
quickAddApi.executeChoiceproceeds with an undefined choice —src/quickAddApi.ts:215-228. Whenplugin.getChoiceByNamereturns undefined, it callsreportError(which only logs) but then stillawait choiceExecutor.execute(choice)withchoice === undefinedinstead of returning early. Also theconst choice: IChoiceannotation is dishonest (value can be undefined). Fix: return after reporting.Low
duplicateChoicedrops fields for Multi choices —src/services/choiceService.ts:42-49. The Multi early-return copies onlychoices/placeholder/collapsed(+ new name/id); unlike the non-Multi path it doesn't copycommand/onePageInput, so duplicating a Multi withcommand: trueyieldscommand: false. Asymmetric vs other choice types.src/services/packageImportService.ts:114-118.isQuickAddPackage()already requiresschemaVersion === CURRENTexactly, so a newer-version package fails validation first and the user gets the generic "not a valid package" error instead of the helpful version-mismatch message.isChoiceImportablecycle guard skips bookkeeping —src/services/packageImportService.ts:169-213. On a parent cycle it returnstruewithoutfinalizeImportable, leaving a stale entry inimportableVisiting. Not reachable with valid (acyclic) input; low impact.src/services/packageExportService.ts:115-132. Script paths are assigned last-write-wins while template/capture paths useif (!has), so a path used as both user-script and template is classified user-script. Likely intended; flagging for confirmation.utility.getSelectedTextreturnsundefinedon error branches —src/quickAddApi.ts:499-519— whilegetSelectionreturns"". Minor API-shape inconsistency for user scripts.Test coverage for each path now exists (#1245), so fixes can be verified by adjusting the corresponding assertion.