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

refactor: LEAP-1785: remove obsolete feature flag FF_LSDV_4988 #7219

Open
wants to merge 2 commits into
base: develop
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
29 changes: 1 addition & 28 deletions web/libs/editor/src/stores/Annotation/Annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
FF_LLM_EPIC,
FF_LSDV_3009,
FF_LSDV_4583,
FF_LSDV_4988,
FF_REVIEWER_FLOW,
isFF,
} from "../../utils/feature-flags";
Expand Down Expand Up @@ -1047,34 +1046,8 @@ const _Annotation = types
if (obj.type.endsWith("labels")) {
const keys = Object.keys(obj.value);

for (let key of keys) {
for (const key of keys) {
if (key.endsWith("labels")) {
const hasControlTag = tagNames.has(obj.from_name) || tagNames.has("labels");

// remove non-existent labels, it actually breaks dynamic labels
// and makes no reason overall — labels from predictions can be out of config
if (!isFF(FF_LSDV_4988) && hasControlTag) {
const labelsContainer = tagNames.get(obj.from_name) ?? tagNames.get("labels");
const value = obj.value[key];

if (value && value.length && labelsContainer.type.endsWith("labels")) {
const filteredValue = value.filter((labelName) => !!labelsContainer.findLabel(labelName));
const oldKey = key;

key = key === labelsContainer.type ? key : labelsContainer.type;

if (oldKey !== key) {
obj.type = key;
obj.value[key] = obj.value[oldKey];
delete obj.value[oldKey];
}

if (filteredValue.length !== value.length) {
obj.value[key] = filteredValue;
}
}
}

// detect most relevant label tags if that one from from_name is missing
// can be useful for predictions in old format with config in new format:
// Rectangle + Labels -> RectangleLabels
Expand Down
3 changes: 0 additions & 3 deletions web/libs/editor/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ export const FF_OUTLINER_OPTIM = "fflag_feat_front_lsdv_4620_outliner_optimizati
*/
export const FF_LSDV_4711 = "fflag_fix_all_lsdv_4711_cors_errors_accessing_task_data_short";

/** Fix "No Label" for Dynamic Labels by switching off missing labels removal */
export const FF_LSDV_4988 = "fflag_fix_front_lsdv_4988_dynamic_no_label_120523_short";

/**
* Fixing issues related to selection tool functional (selecting hidden regions, onClick in Konva, interaction with regions inside selection area)
*
Expand Down
38 changes: 0 additions & 38 deletions web/libs/editor/tests/e2e/tests/empty-labels.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,6 @@ function isLabels(val, key) {
examples.forEach((example) => {
const { annotations, config, data, result = annotations[0].result, title } = example;

Scenario(`Nonexistent label -> ${title}`, async ({ I, LabelStudio, AtSidebar, AtImageView, AtAudioView }) => {
LabelStudio.setFeatureFlags({
ff_front_dev_2715_audio_3_280722_short: true,
});

let { result = annotations[0].result } = example;

result = result.filter((res) => isLabelType(res.type));
const params = { annotations: [{ id: "test", result }], data };
const configTree = Utils.parseXml(config);

Utils.xmlFilterNodes(configTree, (node) => {
return !node["#name"].toLowerCase().endsWith("label");
});
params.config = Utils.renderXml(configTree);
const regionsCount = Utils.countRegionsInResult(result);

I.amOnPage("/");
LabelStudio.init(params);
AtSidebar.seeRegions(regionsCount);

if (Utils.xmlTreeHasTag(configTree, "Image")) {
AtImageView.waitForImage();
}
if (Utils.xmlFindBy(configTree, (node) => node["#name"] === "Audio")) {
await AtAudioView.waitForAudio();
}

if (regionsCount) {
const restored = await LabelStudio.serialize();

Asserts.notDeepEqualWithTolerance(result, restored, 1);
for (let i = result.length; i--; ) {
Asserts.deepEqualWithTolerance(Helpers.omitBy(result[i], isLabels), restored[i], 1);
}
}
});

Scenario(`Different from_name -> ${title}`, async ({ I, LabelStudio, AtSidebar, AtImageView, AtAudioView }) => {
let { result = annotations[0].result } = example;

Expand Down
Loading
Loading