Skip to content

Autocomplete the scope full name in the permission window request form - #159

Merged
YongGoose merged 6 commits into
jenkinsci:mainfrom
YongGoose:feat/8-scope-autocomplete
Nov 22, 2026
Merged

YongGoose merged 6 commits into
jenkinsci:mainfrom
YongGoose:feat/8-scope-autocomplete

Conversation

@YongGoose

Copy link
Copy Markdown
Member

What this changes

The item field of the permission window request form now suggests full names while the requester types, so nobody has to know the exact full name of a job or folder by heart. It offers only jobs and folders the requester may read: names that start with the typed text first, then names that contain it, each group in alphabetical order, at most 20.

This finishes #104 by @SunilKumarPradhan, who wrote the feature. Their two commits are here unchanged and keep their authorship (cherry-picked with -x): f244d06 and ef32ff4. I closed #104 only because the branch had fallen behind main. On top of their commits, this PR adds the SPEC sentence and tests for the clauses #104 did not pin yet.

Anchor

Testing done

  • mvn -q test -Dtest=ItemScopeUiTest: 18 tests, 0 failures, 0 errors.
  • New rows:
    • T-08-299: names that start with the typed text come before names that only contain it, each group in case-insensitive alphabetical order. The exact list is asserted, in a case that a case-sensitive sort, creation order and plain alphabetical order each get wrong.
    • T-08-300: the cap of 20 applies after ranking, so names that start with the text are kept; the exact list is asserted.
    • T-08-301: an item the requester may only discover (Item/Discover without Item/Read) is not offered.
    • T-08-302: the configurations of a multi-configuration project are not offered; the project itself is.
    • T-08-303: the suggestion request changes nothing and writes no record (hashes of the store before and after, with change control on and off, with guards that see a real change).
  • On Autocomplete the scope full name in the permission window request form #104, the e2e coverage run of 30 October showed a real browser calling the endpoint: 24 of the 26 changed lines in GrantsSection ran; the other two are covered by the unit tests.
  • Not covered: Maven modules (the Maven plugin is not a test dependency), and the dropdown in a real browser beyond the field wiring that T-08-265 checks.

Checks

  • The pull request title represents the desired changelog entry.
  • Opened from a topic branch, not from the main branch of my fork.
  • The build and e2e workflows passed on the fork before this pull request was opened.
  • mvn clean verify passed locally. Only ItemScopeUiTest ran locally; the fork and this PR run the full suite.
  • Behaviour change? docs/SPEC.md says so (346ff8c, b2e4fd0).
  • New behaviour? It has rows in docs/TEST-MATRIX.md and the row IDs are in the test names. T-08-299..303 were written after the feature commits; each fails on main at its first suggestion request (404), which I checked by reading, not by running.
  • Touched src/main/resources/**? The form change was exercised in a real browser by the e2e run on Autocomplete the scope full name in the permission window request form #104.
  • This PR does not disclose a security vulnerability.

Suggested label: enhancement.

🤖 Generated with Claude Code

YongGoose and others added 6 commits November 14, 2026 22:34
…#8)

Adds the acceptance sentence for autocompleting the item of a permission
window request, written by the maintainer ahead of the implementation
from jenkinsci#104.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The item field of the permission window request form now suggests full
names as the requester types. Suggestions come from
GET batch-control/grants/autoCompleteScopeFullName, which requires the
permission to request a window and offers only jobs and folders the
caller may read (Item/Read) and that a window can name, so it neither
discloses an invisible item nor offers a name the item check would
refuse. Names that start with the typed text come first, matching is
case-insensitive, and at most 20 names are offered.

Adds matrix rows T-08-262..265.

Fixes #8

(cherry picked from commit 6674904)
doAutoCompleteScopeFullName is a read-only GET that core's autocomplete
calls, so it cannot take @RequirePOST. It checks REQUEST_GRANT first and
offers only items the caller can read. Suppress the Jenkins Security
Scan alert the same way HistorySection#doSummary does.

Refs #8

(cherry picked from commit b39338c)
The SPEC 8 sentence for #8 has clauses that T-08-262..265 do not reach.
ItemScopeUiTest now also checks them:

- T-08-299: names that start with the typed text come before names that
  only contain it, ignoring case. Typing x with x-job, XL-report,
  batch-x and pipe-x is a case that alphabetical order gets wrong.
- T-08-300: the limit of 20 keeps a name that starts with the text
  ahead of 25 names that only contain it.
- T-08-301: a job or folder the requester may only discover
  (Item/Discover without Item/Read) is not offered.
- T-08-302: the configurations of a multi-configuration project are not
  offered, although the requester may read them.
- T-08-303: the suggestion request changes nothing under
  $JENKINS_HOME/batch-control/ and writes no record, with change control
  on and off, for permitted and refused callers. Guards show the
  comparison can see a real change.

All 18 tests of the class pass on the jenkinsci#104 implementation. Matrix rows
T-08-299..303 and note 373, which maps each clause to its rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The implementation sorts both groups case-insensitively, and T-08-262 and
T-08-263 from jenkinsci#104 rely on that order. The spec now says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SPEC 8 now fixes the order inside each group (b2e4fd0). T-08-299 adds
Max-x and asserts the whole list, an order that a case-sensitive sort
gets wrong in both groups and creation order gets wrong in the second.
T-08-300 asserts a-zz-01 .. a-zz-19 in order. Note 373 records the
maintainer's decision; T-08-262 and T-08-263 are now within the spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YongGoose
YongGoose requested a review from a team as a code owner November 22, 2026 11:39
@YongGoose YongGoose added the enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Nov 22, 2026
@YongGoose
YongGoose merged commit cef15f4 into jenkinsci:main Nov 22, 2026
53 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autocomplete the scope full name in the permission window request form

2 participants