Repository navigation
Conversation
Issue create, issue edit, and the issue list label filter resolved label names against repository labels only, so a label defined on the owning organization failed with LABEL_NOT_FOUND even though Forgejo accepts organization label ids in the same list. Names the repository leaves unresolved are now looked up in the owning organization's labels. A repository label wins over an organization label of the same name, and the organization is not asked when the repository resolves every name. A user owner (404 on the organization route) keeps the previous error unchanged; a token that cannot read organization labels (403) gets LABEL_NOT_FOUND with details.organization_labels "forbidden" and a hint naming the read:organization scope. The label family still manages repository labels only.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
issue create --repo org/repo --label NAMEfailed withRepository has no label named NAME(LABEL_NOT_FOUND, exit 2) whenNAMEis a label defined on the owning organization rather than in the repository. Label names were resolved againstGET repos/{owner}/{repo}/labelsonly;GET orgs/{org}/labelswas never consulted. Forgejo itself accepts organization label ids in the samelabelslist (checked in the v15.0 and v16.0 sources: issue create,PUT issues/{n}/labels, and the issue-listlabelsfilter all accept or resolve organization labels), so the fix is in name resolution, not a new flag.What changed
issue create,issue editand theissue list --labelfilter resolve names against the repository's labels first. Only names the repository leaves unresolved are looked up inorgs/{owner}/labels, so a repository label wins over an organization label of the same name and the common case makes no extra request.404on the organization route; that is treated as "no organization labels" and the existingLABEL_NOT_FOUNDwording andhelpare unchanged.helpentry pointing atforgejo-axi api GET orgs/{owner}/labels --paginate.403; Forgejo's/orgsroutes requireread:organization), resolution still fails withLABEL_NOT_FOUND(exit 2) plus the additivedetails.organization_labels: "forbidden"and ahelpentry naming the scope. The hint is conditional ("If<owner>is an organization, ...") because Forgejo checks the token scope before it checks whether the owner is an organization, so a user-owned repository with a narrow token gets the same403.LABEL_AMBIGUOUS, worded "Organization has N labels named X". Any other organization-route failure propagates as that failure.docs/contract.mdand the--labelhelp text for the issue commands describe the resolution order;skills/forgejo-axi/SKILL.mdwas regenerated withnpm run gen:skill;README.mdgained one sentence;docs/live-test-matrix.mdrecords organization label resolution as not yet covered live.Deliberately not changed
labelfamily (list/create/edit/delete) stays repository-only. It manages repository labels; reading or writing organization labels through it is a separate feature.Testing
npm run checkpasses (lint, typecheck, 279 unit tests, skill drift check, smoke test).test/issue.test.tscover: create with an organization label on 15 and 16 fixtures, edit (and its no-op repeat), the list filter, repository-wins shadowing with no organization request, the user-owner404, the name-in-neither-set hint, the403scope error, organization ambiguity, and a500that propagates. They fail before the fix (9 of 10 on the basesrc/forgejo.ts) and pass after it.npm run test:live -- 15/-- 16) was run. My machine cannot decrypt the live-host environment, so a maintainer needs to run both lanes. Real-host behaviour for organization labels is unverified by this PR; the claims above about Forgejo's acceptance of organization label ids come from reading its source.