Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove seemingly useless rubrics #1759

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thick-jokes-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Clear seemingly useless widget rubrics
2 changes: 1 addition & 1 deletion packages/perseus/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ export type FilterCriterion =
// and Rubric is what we use to score the widgets (which not all widgets need validation)
export type WidgetProps<
RenderProps,
Rubric,
Rubric = Empty,
// Defines the arguments that can be passed to the `trackInteraction`
// function from APIOptions for this widget.
TrackingExtraArgs = Empty,
Expand Down
37 changes: 1 addition & 36 deletions packages/perseus/src/validation.types.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
import type {
GrapherAnswerTypes,
PerseusDefinitionWidgetOptions,
PerseusDropdownChoice,
PerseusExplanationWidgetOptions,
PerseusExpressionAnswerForm,
PerseusGradedGroupSetWidgetOptions,
PerseusGradedGroupWidgetOptions,
PerseusGraphType,
PerseusGroupWidgetOptions,
PerseusIFrameWidgetOptions,
PerseusImageWidgetOptions,
PerseusInteractionWidgetOptions,
PerseusLabelImageWidgetOptions,
PerseusMatcherWidgetOptions,
PerseusMatrixWidgetOptions,
PerseusNumberLineWidgetOptions,
PerseusNumericInputWidgetOptions,
PerseusOrdererWidgetOptions,
PerseusPassageRefWidgetOptions,
PerseusPassageWidgetOptions,
PerseusPlotterWidgetOptions,
PerseusRadioWidgetOptions,
PerseusSorterWidgetOptions,
PerseusTableWidgetOptions,
PerseusVideoWidgetOptions,
} from "./perseus-types";
import type {InteractiveMarkerType} from "./widgets/label-image/types";
import type {Relationship} from "./widgets/number-line/number-line";
Expand All @@ -50,9 +43,6 @@ export type PerseusCSProgramUserInput = {
message: string | null;
};

// TODO (LEMS-2396): remove validation logic from widgets that don't validate
export type PerseusDefinitionRubric = PerseusDefinitionWidgetOptions;

export type PerseusDropdownRubric = {
choices: ReadonlyArray<PerseusDropdownChoice>;
};
Expand All @@ -61,9 +51,6 @@ export type PerseusDropdownUserInput = {
value: number;
};

// TODO (LEMS-2396): remove validation logic from widgets that don't validate
export type PerseusExplanationRubric = PerseusExplanationWidgetOptions;

export type PerseusExpressionRubric = {
answerForms: ReadonlyArray<PerseusExpressionAnswerForm>;
functions: ReadonlyArray<string>;
Expand All @@ -90,9 +77,6 @@ export type PerseusIFrameUserInput = {
message: string | null;
};

// TODO (LEMS-2396): remove validation logic from widgets that don't validate
export type PerseusImageRubric = PerseusImageWidgetOptions;

export type PerseusInputNumberRubric = {
answerType?:
| "number"
Expand All @@ -113,9 +97,6 @@ export type PerseusInputNumberUserInput = {
currentValue: string;
};

// TODO (LEMS-2396): remove validation logic from widgets that don't validate
export type PerseusInteractionRubric = PerseusInteractionWidgetOptions;

export type PerseusInteractiveGraphRubric = {
// TODO(LEMS-2344): make the type of `correct` more specific
correct: PerseusGraphType;
Expand Down Expand Up @@ -167,12 +148,6 @@ export type PerseusOrdererUserInput = {
current: ReadonlyArray<string>;
};

// TODO (LEMS-2396): remove validation logic from widgets that don't validate
export type PerseusPassageRubric = PerseusPassageWidgetOptions;

// TODO (LEMS-2396): remove validation logic from widgets that don't validate
export type PerseusPassageRefRubric = PerseusPassageRefWidgetOptions;

export type PerseusPlotterRubric = PerseusPlotterWidgetOptions;

export type PerseusPlotterUserInput = ReadonlyArray<number>;
Expand All @@ -198,38 +173,28 @@ export type PerseusTableRubric = PerseusTableWidgetOptions;

export type PerseusTableUserInput = ReadonlyArray<ReadonlyArray<string>>;

// TODO (LEMS-2396): remove validation logic from widgets that don't validate
export type PerseusVideoRubric = PerseusVideoWidgetOptions;

export type Rubric =
| PerseusCategorizerRubric
| PerseusCSProgramRubric
| PerseusDefinitionRubric
| PerseusDropdownRubric
| PerseusExplanationRubric
| PerseusExpressionRubric
| PerseusGroupRubric
| PerseusGradedGroupRubric
| PerseusGradedGroupSetRubric
| PerseusGrapherRubric
| PerseusIFrameRubric
| PerseusImageRubric
| PerseusInputNumberRubric
| PerseusInteractionRubric
| PerseusInteractiveGraphRubric
| PerseusLabelImageRubric
| PerseusMatcherRubric
| PerseusMatrixRubric
| PerseusNumberLineRubric
| PerseusNumericInputRubric
| PerseusOrdererRubric
| PerseusPassageRubric
| PerseusPassageRefRubric
| PerseusPlotterRubric
| PerseusRadioRubric
| PerseusSorterRubric
| PerseusTableRubric
| PerseusVideoRubric;
| PerseusTableRubric;

export type UserInput =
| PerseusCategorizerUserInput
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/widgets/__shared__/noop-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {PerseusScore} from "../../types";
* Several widgets don't have "right"/"wrong" validation logic,
* so this just says to move on past those widgets
*
* TODO(LEMS-2396) widgets that use this probably shouldn't have any
* TODO(LEMS-2543) widgets that use this probably shouldn't have any
* validation logic and the thing validating an exercise
* should just know to skip these
*/
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets/definition/definition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import type {
PerseusDefinitionWidgetOptions,
} from "../../perseus-types";
import type {Widget, WidgetExports, WidgetProps} from "../../types";
import type {PerseusDefinitionRubric} from "../../validation.types";

type RenderProps = PerseusDefinitionWidgetOptions;

type DefinitionProps = WidgetProps<RenderProps, PerseusDefinitionRubric> & {
type DefinitionProps = WidgetProps<RenderProps> & {
widgets: PerseusRenderer["widgets"];
};

Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets/explanation/explanation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import noopValidator from "../__shared__/noop-validator";

import type {PerseusExplanationWidgetOptions} from "../../perseus-types";
import type {Widget, WidgetExports, WidgetProps} from "../../types";
import type {PerseusExplanationRubric} from "../../validation.types";

type RenderProps = PerseusExplanationWidgetOptions; // transform = _.identity

type Props = WidgetProps<RenderProps, PerseusExplanationRubric>;
type Props = WidgetProps<RenderProps>;

type DefaultProps = {
showPrompt: Props["showPrompt"];
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets/image/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import noopValidator from "../__shared__/noop-validator";

import type {Range, PerseusImageWidgetOptions} from "../../perseus-types";
import type {ChangeFn, WidgetExports, WidgetProps, Widget} from "../../types";
import type {PerseusImageRubric} from "../../validation.types";

const defaultBoxSize = 400;
const defaultRange: Range = [0, 10];
Expand All @@ -28,7 +27,7 @@ const DEFAULT_ALIGNMENT = "block";

type RenderProps = PerseusImageWidgetOptions; // there is no transform as part of exports

type ExternalProps = WidgetProps<RenderProps, PerseusImageRubric>;
type ExternalProps = WidgetProps<RenderProps>;

type Props = ExternalProps & {
alignment: NonNullable<ExternalProps["alignment"]>;
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets/interaction/interaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import type {
PerseusInteractionWidgetOptions,
} from "../../perseus-types";
import type {Widget, WidgetExports, WidgetProps} from "../../types";
import type {PerseusInteractionRubric} from "../../validation.types";

// @ts-expect-error - TS2339 - Property 'Label' does not exist on type 'typeof Graphie'.
const Label = Graphie.Label;
Expand Down Expand Up @@ -97,7 +96,7 @@ const KAScompile = (
};

type RenderProps = PerseusInteractionWidgetOptions; // There's no transform function in exports
type Props = WidgetProps<RenderProps, PerseusInteractionRubric>;
type Props = WidgetProps<RenderProps>;

type DefaultProps = {
graph: Props["graph"];
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets/passage-ref/passage-ref.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {isPassageWidget} from "../passage/utils";

import type {PerseusPassageRefWidgetOptions} from "../../perseus-types";
import type {ChangeFn, Widget, WidgetExports, WidgetProps} from "../../types";
import type {PerseusPassageRefRubric} from "../../validation.types";

const EN_DASH = "\u2013";

Expand All @@ -19,7 +18,7 @@ type RenderProps = {
summaryText: PerseusPassageRefWidgetOptions["summaryText"];
};

type Props = WidgetProps<RenderProps, PerseusPassageRefRubric>;
type Props = WidgetProps<RenderProps>;

type DefaultProps = {
passageNumber: Props["passageNumber"];
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets/passage/passage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type {
PerseusWidget,
} from "../../perseus-types";
import type {WidgetExports, WidgetProps, Widget} from "../../types";
import type {PerseusPassageRubric} from "../../validation.types";
import type {SingleASTNode} from "@khanacademy/simple-markdown";

// A fake paragraph to measure the line height of the passage,
Expand Down Expand Up @@ -71,7 +70,7 @@ type RenderProps = {
type FindWidgetsCallback = (id: string, widgetInfo: PerseusWidget) => boolean;

type PassageProps = ChangeableProps &
WidgetProps<RenderProps, PerseusPassageRubric> & {
WidgetProps<RenderProps> & {
findWidgets: (arg1: FindWidgetsCallback) => ReadonlyArray<Passage>;
highlights: SerializedHighlightSet;
};
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets/video/video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import VideoTranscriptLink from "./video-transcript-link";

import type {PerseusVideoWidgetOptions} from "../../perseus-types";
import type {Widget, WidgetExports, WidgetProps} from "../../types";
import type {PerseusVideoRubric} from "../../validation.types";

// Current default is 720p, based on the typical videos we upload currently
const DEFAULT_WIDTH = 1280;
Expand All @@ -29,7 +28,7 @@ const IS_KA_SITE = /(khanacademy\.org|localhost)/;
const IS_VIMEO = /(vimeo\.com)/;

type RenderProps = PerseusVideoWidgetOptions; // exports has no 'transform'
type Props = WidgetProps<RenderProps, PerseusVideoRubric> & {
type Props = WidgetProps<RenderProps> & {
alignment: string; // Where does this get set?
};

Expand Down