Skip to content

test: require run settings for new results - #676

Merged
KennethEnevoldsen merged 11 commits into
embeddings-benchmark:mainfrom
GioiaZheng:test/require-run-settings-version
Oct 5, 2026
Merged

KennethEnevoldsen merged 11 commits into
embeddings-benchmark:mainfrom
GioiaZheng:test/require-run-settings-version

Conversation

@GioiaZheng

@GioiaZheng GioiaZheng commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Why

New result submissions can still omit run settings or be produced with older MTEB versions, which makes submitted scores harder to reproduce. This adds a diff-scoped guard for new result files only.

Close embeddings-benchmark/mteb#5031.

What changed

  • Added a PR-diff test for newly added task result JSON files under results/.
  • Required a same-directory run_settings.jsonl for each new task result.
  • Checked matching (task, split, subset) entries and MTEB >2.14.0 in result metadata, score blocks, and matching run settings.

Validation

  • python -m pytest tests/test_new_results_run_settings.py - 6 passed, 1 skipped
  • python -m py_compile tests/test_new_results_run_settings.py
  • git diff --check

Risk / follow-up

Existing historical results are not migrated or checked. Future result PRs that omit run settings will fail this guard, which is intentional for new submissions; maintainers can relax the threshold if a staged rollout is preferred.

@Samoed Samoed left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also some changes would be needed after embeddings-benchmark/mteb#5099 (and already existing

def collapse_run_settings():
, you can check nomic-ai__nomic-embed-text-v2-moe

Can you also add test that all tasks that subbmitted in PR are present in run_settings.jsonl.

Also test do not cover experiments/ subdirectories

Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
@Samoed

Samoed commented Aug 16, 2026

Copy link
Copy Markdown
Member

UPD embeddings-benchmark/mteb#5099 was merged

@GioiaZheng

GioiaZheng commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, updated this PR to cover the post-#5099 subsets-style run_settings format and to keep the diff-scoped check tied to the current base branch rather than a stale pull request base SHA. I also added regression coverage for experiments/ paths and for multi-task submissions where every added result needs a matching run_settings entry. The latest CI is green.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.

@github-actions github-actions Bot added the stale label Sep 13, 2026
@ayush1298

Copy link
Copy Markdown
Collaborator

@Samoed Can you take a look at this one?

@github-actions github-actions Bot removed the stale label Sep 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Resolve the inconsistent MTEB version threshold before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Adds a diff-scoped guard requiring new result files to include matching run_settings.jsonl metadata and supported MTEB versions.

Changes:

  • Validates result and run-settings matches.
  • Adds version and tuple checks.
  • Adds regression tests and error reporting.

The implementation enforces >=2.14.0 in three locations, conflicting with the stated >2.0.0 requirement.

File Description
tests/​test_new_results_run_settings.py Tests validation behavior and edge cases.
tests/​run_settings_check.py Implements result, run-settings, tuple, and version validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/run_settings_check.py Resolved

@KennethEnevoldsen KennethEnevoldsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about this PR. For what it is testing I am not sure you need to add 16 tests

I general it seems like more effort to review that it is correct than to implement, at a quick glance simple stuff like version check is incorrect so it would require a lot of effort to check if everything it correct.

Comment thread tests/run_settings_check.py Resolved
Comment thread tests/run_settings_check.py Resolved
Comment thread tests/run_settings_check.py Resolved
Comment thread tests/run_settings_check.py Resolved
Comment thread tests/run_settings_check.py Resolved
Comment thread tests/test_new_results_run_settings.py Resolved
@ayush1298

Copy link
Copy Markdown
Collaborator

@Samoed there are some more things which can be fixed/made short, should I take this PR and pushed changes?

@Samoed

Samoed commented Sep 27, 2026

Copy link
Copy Markdown
Member

I simiplified checks

Comment thread tests/test_new_results_run_settings.py Outdated
Comment on lines +17 to +20
try:
base_ref = get_base_ref()
except RuntimeError as e:
pytest.skip(str(e))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can remove try-except, so broken checkout fails instead of skipping.

Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/run_settings_check.py Outdated
Comment on lines +60 to +90
def load_run_settings(
path: Path, relative_path: str
) -> tuple[set[tuple[str, str, str]], list[str]]:
if not path.exists():
return set(), [f"{relative_path} is missing {RUN_SETTINGS_FILENAME}."]

covered: set[tuple[str, str, str]] = set()
errors = []
for line_number, line in enumerate(path.read_text().splitlines(), start=1):
if not line.strip():
continue

source = f"{relative_path} {RUN_SETTINGS_FILENAME} line {line_number}"
try:
entry = json.loads(line)
except json.JSONDecodeError as e:
errors.append(f"{source} is not valid JSON: {e}")
continue
if not isinstance(entry, dict):
errors.append(f"{source} must be an object.")
continue

keys = [key for key, _, _ in _expand_run_settings_entry(entry)]
if not keys or any(not task for task, _, _ in keys):
errors.append(f"{source} must define task, split(s) and subset(s).")
continue
covered.update(keys)

if not covered and not errors:
errors.append(f"{relative_path} {RUN_SETTINGS_FILENAME} has no entries.")
return covered, errors

@ayush1298 ayush1298 Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can simplify this to:

def load_run_settings(path: Path) -> set[tuple[str, str, str]]:
    covered = set()
    for line_number, line in enumerate(path.read_text().splitlines(), start=1):
        if not line.strip():
            continue
        try:
            entry = json.loads(line)
        except json.JSONDecodeError as e:
            raise ValueError(f"{path} line {line_number} is not valid JSON: {e}") from e
        covered.update(key for key, _, _ in _expand_run_settings_entry(entry))
    return covered

Because other errors like no task, split, or that isn't a dict only for which we are adding checks, will not be occurring

Comment thread tests/run_settings_check.py Outdated
Comment on lines +100 to +105
covered, run_settings_errors = load_run_settings(
result_path.parent / RUN_SETTINGS_FILENAME, relative_path
)
errors += run_settings_errors
if not covered:
return errors

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and instead of this update to:

run_settings_path = result_path.parent / RUN_SETTINGS_FILENAME
if not run_settings_path.exists():
     return errors + [f"{relative_path} is missing {RUN_SETTINGS_FILENAME}."]

covered = load_run_settings(run_settings_path)

@ayush1298

Copy link
Copy Markdown
Collaborator

I simiplified checks

added few more minor comment, and I guess its good

@KennethEnevoldsen KennethEnevoldsen left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

besides a few minor things then I think this is pretty much there -- thanks for cleaning it up!

Comment thread tests/run_settings_check.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would merge into the other (since it is now so small)

Comment thread tests/test_new_results_run_settings.py Resolved
Comment thread tests/test_new_results_run_settings.py Outdated
Comment on lines +62 to +81
def validate(result_path: Path) -> list[str]:
return validate_result_file(result_path, "results/model/revision/DemoTask.json")


@pytest.mark.parametrize(
"fields",
[
pytest.param({"split": "test", "subset": "en"}, id="legacy-singular"),
pytest.param(
{"split": "test", "subsets": ["en", "de"]}, id="collapsed-subsets"
),
pytest.param({"splits": ["test"], "subsets": ["en"]}, id="current-plural"),
pytest.param({"splits": ["test"], "subset": "en"}, id="mixed"),
],
)
def test_accepts_every_run_settings_shape(tmp_path, fields):
result_path = write_result(tmp_path, subsets=("en",))
write_run_settings(tmp_path, **fields)

assert validate(result_path) == []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed? As I understand it it is test of the test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also applied to the below)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these are tests for run_settings_check.py. I think they could be helpful, but have test for test is a bit strange, agree

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine either way I think - though probably leaning remove and combine the two scripts

@KennethEnevoldsen
KennethEnevoldsen merged commit 76c0234 into embeddings-benchmark:main Oct 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require MTEB >v2.0.0 when submitting new results

5 participants