Skip to content

Many false compatibilities: weak checks on interface members #32

@colin-grant-work

Description

@colin-grant-work

When checking the compatibility of declared interfaces (for example InputBoxOptions), the current code in the comparator checks only for a match with an identical name: other metadata is ignored. For example, when comparing Theia master (0c0f8c7a7aedd67930bf65d6f63d827721707d60) with VSCode main (ef65649326cff17aae488a4fe953f0f4a6d70260), InputBoxOptions.validateInput is marked as compatible even though the declarations differ considerably:

Theia:

validateInput?: (input: string) => Promise<string | null | undefined> | undefined;

VSCode:

validateInput?(value: string): string | InputBoxValidationMessage | undefined | null |
			Thenable<string | InputBoxValidationMessage | undefined | null>;

Where InputBoxValidationMessage (which is marked as missing from Theia) is defined as

	/**
	 * Object to configure the behavior of the validation message.
	 */
	export interface InputBoxValidationMessage {
		/**
		 * The validation message to display.
		 */
		readonly message: string;

		/**
		 * The severity of the validation message.
		 * NOTE: When using `InputBoxValidationSeverity.Error`, the user will not be allowed to accept (hit ENTER) the input.
		 * `Info` and `Warning` will still allow the InputBox to accept the input.
		 */
		readonly severity: InputBoxValidationSeverity;
	}

The problem occurs here:

if (docEntryLatestVsCodeCommand.members && docEntryLatestVsCodeCommand.members.length > 0) {
// ok so here search in all members if it's defined in each vscode version
docEntryLatestVsCodeCommand.members.forEach(member => {
const searchedMember = inCurrent.members?.find(currentMember =>
(currentMember.name === member.name));
// it's there, add it
if (searchedMember) {
member.includedIn.unshift({ version: `theia/${theiaEntry.version}`, available: 'yes' });
} else {
member.includedIn.unshift({ version: `theia/${theiaEntry.version}`, available: 'no' });
}
});
}

When checking for compatibility among members of interfaces, the only check performed is on the name field (l. 290). All other metadata is ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions