Skip to content

fix(integrations): name Harbor env groups by content, not position - #524

Merged
jdchawla29 merged 1 commit into
mainfrom
jaideep/harbor-env-naming
Jul 31, 2026
Merged

fix(integrations): name Harbor env groups by content, not position#524
jdchawla29 merged 1 commit into
mainfrom
jaideep/harbor-env-naming

Conversation

@jdchawla29

@jdchawla29 jdchawla29 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #523 (which moves these files). Review that one first; the base will retarget to main once it merges.

The bug

Env group names were positional — -g1, -g2, assigned largest group first — so a name did not denote any particular environment:

ordered = sorted(groups.values(), key=lambda group: -len(group))
return [(f"{base_name}-g{idx}", group) for idx, group in enumerate(ordered, start=1)]

The env name is the join key between rows and images. Growing one group past another swaps their numbers, while every row still carries the old name — so rows join an environment that has since come to mean a different image, and nothing signals it. Editing one task's declared policy is enough to trigger it, since policy is part of the grouping key.

At benchmark scale this produces wrong scores rather than extra rebuilds, and it gets worse if deploy ever writes rows itself.

The fix

Names derive from what decides the image — the environment/ build context and the workspace policy baked into it:

terminal-bench-2-c7353dd48a9f   # a, b   (FROM alpine)
terminal-bench-2-367b665f6714   # c      (FROM debian)

A name denotes one image forever, so adding, editing or removing a task cannot re-point a row that did not itself change.

Behavior change worth flagging

This drops the bare-name case for single-group datasets (terminal-bench-sampleterminal-bench-sample-<digest>).

That case was the same disease: an env's name depending on how many groups the dataset happens to have, so a dataset growing a second group renamed the first. Keeping it would have left a smaller version of the bug in place. The cost is that a row's env name is now the taskset name plus a suffix rather than the taskset name itself, and single-env datasets lose a tidy name.

Test

test_env_name_survives_other_tasks_joining_the_dataset goes through load(), grows the smaller group past the larger one, and asserts the untouched rows keep their env. Verified it fails on the old code with the actual swap:

AssertionError: assert 'bench-g1' == 'bench-g2'

uv run pytest -q — 825 passed. ruff and pyright clean.


Note

Medium Risk
Fixes incorrect row-to-image joins that could skew benchmark scores, but changes published env name strings (including single-env datasets), so anything caching old -gN or bare names must realign with adapt/load.

Overview
Harbor environment group names are no longer positional (-g1, -g2, ordered by group size). Each group is named &lt;dataset-slug&gt;-&lt;digest&gt;, where the digest is a stable 12-character hash of the environment/ build context and the serialized workspace policy—the same inputs that define the adapted image.

That makes the env name a stable join key between load() task rows and adapt() images: adding, removing, or reshuffling tasks in a dataset cannot renumber groups and silently point unchanged rows at a different environment.

Behavior change: single-group datasets no longer use the bare dataset slug as the env name; they always get the digest suffix (e.g. terminal-bench-sampleterminal-bench-sample-&lt;digest&gt;).

Tests are updated to assert env names start with the taskset prefix plus suffix, and a new regression test confirms env names stay fixed when another group grows past an existing one.

Reviewed by Cursor Bugbot for commit de1493b. Bugbot is set up for automated code reviews on this repo. Configure here.

@jdchawla29
jdchawla29 changed the base branch from jaideep/integrations-outside-core to main July 31, 2026 03:22
Group names were positional — `-g1`, `-g2`, assigned largest group first —
so a name did not denote any particular environment. Editing one task's
declared policy re-partitions the groups, and growing one group past
another swaps their numbers, while every row still carries the old name.
Rows then join an environment that has come to mean a different image, with
nothing to signal it.

Names are now derived from what decides the image: the `environment/` build
context and the workspace policy baked into it. A name denotes one image
forever, so adding, editing or removing a task can never re-point a row
that did not change.

This drops the bare-name case for single-group datasets. That case was the
same disease — an env's name depending on how many groups the dataset
happens to have — so a dataset growing a second group renamed the first.
Every env name now carries its digest, and a row's env name is the taskset
name plus a suffix rather than the taskset name itself.
@jdchawla29
jdchawla29 force-pushed the jaideep/harbor-env-naming branch from c25bb57 to de1493b Compare July 31, 2026 03:24
@jdchawla29
jdchawla29 merged commit 0603b01 into main Jul 31, 2026
8 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.

1 participant