Skip to content

fix(frontend): stabilize label-set workflows - #2296

Closed
angelo-lacson wants to merge 1 commit into
Open-Source-Legal:mainfrom
angelo-lacson:fix/labelset-workflows
Closed

angelo-lacson wants to merge 1 commit into
Open-Source-Legal:mainfrom
angelo-lacson:fix/labelset-workflows

Conversation

@angelo-lacson

Copy link
Copy Markdown
Contributor

Summary

Fixes the misleading state and validation failures encountered while creating labels and assigning a label set during corpus creation.

Fixes #2295.

Changes

  • Normalize label colors to a backend-compatible #RRGGBB value while keeping native color inputs stable for stored values with or without #.
  • Model and inspect the nested createAnnotationLabelForLabelset mutation payload, report backend failures accurately, and await refreshed label-set data before closing the create form.
  • Keep Add Label beside search for populated text, document, relationship, and span label lists.
  • Return the selected LabelSetType from LabelSetSelector so controlled consumers such as CorpusModal immediately display the user's selection.
  • Add component-test coverage for rejected create mutations and controlled label-set selection.
  • Add a changelog.d fragment.

Test plan

  • NODE_OPTIONS=--max-old-space-size=4096 yarn build via the frontend Docker builder — passed (TypeScript and Vite production build).
  • Prettier check for all changed frontend and test files — passed.
  • python3 scripts/collate_changelog.py --check — passed.
  • Added focused Playwright component tests; the browser component suite was not executed locally.

Checklist

  • Tests pass locally for any code this PR touches (focused coverage added; browser component suite not run locally)
  • pre-commit run --all-files passes (not run locally)
  • TypeScript compiles cleanly (yarn build or yarn lint), if frontend code changed
  • A changelog fragment was added under changelog.d/ for the user-facing fixes
  • No new dependency was introduced

Contributor License Agreement

By submitting this pull request, I agree to license this contribution under the project's Contributor License Agreement.

Normalize label colors for the GraphQL validator, respect mutation results before reporting success, and keep creation controls accessible for populated sets.

Propagate the selected label-set object so the corpus modal reflects controlled selection changes immediately.
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.18182% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...nd/src/components/labelsets/LabelSetDetailPage.tsx 0.00% 12 Missing ⚠️
...d/src/components/widgets/CRUD/LabelSetSelector.tsx 33.33% 4 Missing ⚠️
frontend/src/components/corpuses/CorpusModal.tsx 33.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@JSv4

JSv4 commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks for this — nice cleanup. Can you just make sure the non-Claude actions pass and I'd be happy to merge this?

1. Lint / Check any-baseline — needs a one-line follow-up from you

Your changes removed two explicit anys, which is exactly the right direction, but the ratchet gate fails when the count drops without frontend/.any-baseline.json being lowered to match:

[FAIL] `any` count dropped by 2 but the baseline file was not updated.
       Run `yarn any:write` and commit the result so the gate ratchets down.

From frontend/:

yarn any:write
git add .any-baseline.json && git commit -m "chore(frontend): ratchet any-baseline"

Background on the gate is in docs/frontend/any-baseline.md (issue #1448). This is also why Build, Unit Tests, Component Tests and Docker all show skipping — they're needs: lint, so they never start until Lint is green. One commit should turn the whole column over.

2. claude-review — not your fault, please ignore

Fork-based PRs don't receive repository secrets or an OIDC token, so the review action has nothing to authenticate with. The error it prints (Did you remember to add id-token: write to your workflow permissions?) is misleading — the permission is declared in the workflow; GitHub drops it for fork-triggered runs by design, and no change on your side can restore it.

We're patching the workflow to skip cleanly on forks rather than report a red X you can't act on. Nothing for you to do here.

pull Bot pushed a commit to osamakaram/OpenContracts that referenced this pull request Sep 6, 2026
GitHub clamps pull_request runs whose head is a fork: the id-token: write
this workflow declares is silently dropped and the secret store is
withheld (Secret source: None, claude_code_oauth_token: ""). The action
then dies on "Could not fetch an OIDC token. Did you remember to add
`id-token: write` to your workflow permissions?" — an error that accuses
the workflow file for a permission it already declares, sending anyone
debugging from the message alone to edit correct code. Approving the run
does not restore secrets, and GITHUB_TOKEN is read-only on fork PRs, so
the `gh pr comment` the job is asked to make could not post either.

Guard the job on head.repo.full_name == github.repository so it reports
skipped — which is what actually happens — rather than a red X no
contributor can clear. Dependabot branches live in this repository, so
they pass the guard and the OIDC exchange works unchanged.

Observed on run 33611167884 (PR Open-Source-Legal#2296); dependabot control is run
33788653880.
@JSv4

JSv4 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Sorry wanted to merge this. See PR #2328

@JSv4 JSv4 closed this Sep 10, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Label-set creation and corpus selection provide incorrect frontend state

2 participants