Fix the causes of the REST self link console warnings - #1440
Merged
Conversation
The frontend strips embed params from its own url before comparing it to the self link the API returns, but not from the self link itself, so it reported a mismatch it had created. The API also percent decodes values it has no reason to escape - ':' and '/' are legal in a query component - which looked like another difference. Both sides are now brought to the same form before the comparison: embed params stripped, values percent decoded. A difference in an actual value still warns. Only the warning is affected. The condition that rewrites _links.self is unchanged, so the url a response is cached under stays the same. Adds the first spec this service has had, 17 cases covering both what is now tolerated and what still has to warn. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Spring Data REST caps a page at spring.data.rest.max-page-size, which DSpace leaves at its default of 1000 - it is set nowhere in DSpace/DSpace nor in our fork. So asking for 9999 or 10000 returns the same 1000 rows it would have returned anyway, while making the request claim something the API never honours, and leaving the self link legitimately different from the requested url. Adds MAX_PAGE_SIZE and uses it wherever a caller needs "everything": bundle-data.service.ts 9999 browse.service.ts 9999 relationship-type-data.service.ts 9999 registry.service.ts 10000 item-bitstreams.service.ts 9999 filtered-items.component.ts 4 x 10000 Same rows returned in every case; only the number in the request changes. browse-by-geospatial-data.component.ts is left alone on purpose: its 99999 is a Discovery facet limit, not a Spring Data REST page size, so it is not capped at 1000 and lowering it would drop points off the map. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR reduces noisy REST self-link mismatch warnings by (1) normalizing how requested URLs and API self links are compared (embed params stripped on both sides and percent-decoding applied), and (2) replacing oversized page-size requests (e.g. 9999/10000) with an explicit MAX_PAGE_SIZE = 1000 to align with Spring Data REST’s server-side cap.
Changes:
- Introduces
MAX_PAGE_SIZEand updates multiple “fetch everything” call sites to use it instead of arbitrary large values. - Refines
ensureSelfLinkwarning logic to only warn on meaningful differences after normalization, while keeping the self-link rewrite/caching behavior intact. - Adds a new Jasmine spec file covering
ensureSelfLinkbehavior with 17 targeted cases.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/app/core/data/find-list-options.model.ts |
Adds MAX_PAGE_SIZE constant with documentation to avoid arbitrary oversized page-size requests. |
src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.service.ts |
Uses MAX_PAGE_SIZE for bundle pagination requests (behavior-preserving vs server cap). |
src/app/core/registry/registry.service.ts |
Replaces elementsPerPage: 10000 with MAX_PAGE_SIZE for schema retrieval. |
src/app/core/data/relationship-type-data.service.ts |
Uses MAX_PAGE_SIZE for the single-page “load all relationship types” request. |
src/app/core/data/bundle-data.service.ts |
Uses MAX_PAGE_SIZE as the default “load all bundles” fallback pagination size. |
src/app/core/browse/browse.service.ts |
Uses MAX_PAGE_SIZE for browse definition retrieval. |
src/app/admin/admin-reports/filtered-items/filtered-items.component.ts |
Uses MAX_PAGE_SIZE in several report-related findAll calls to avoid capped oversizing. |
src/app/core/data/dspace-rest-response-parsing.service.ts |
Adds URL-part normalization helpers and filters console.warn to only unexpected self-link mismatches. |
src/app/core/data/dspace-rest-response-parsing.service.spec.ts |
Adds comprehensive unit tests for ensureSelfLink mismatch/warning/normalization scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7 tasks
milanmajchrak
added a commit
that referenced
this pull request
Aug 11, 2026
The generic wording ends with "This could mean there's an issue with the REST endpoint", which points at the backend. For a reduced page size that is the wrong place to look: the API did nothing wrong, the caller asked for a bigger page than it will serve. The request for '.../bundles?size=9999' asked for a page of 9999 elements, but the REST API served 1000. Ask for at most MAX_PAGE_SIZE elements Anything else keeps the generic message, including a page that came back larger than requested. Also drops a stray note from the spec that was left in by #1440. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
milanmajchrak
added a commit
that referenced
this pull request
Aug 11, 2026
The generic wording ends with "This could mean there's an issue with the REST endpoint", which points at the backend. For a reduced page size that is the wrong place to look: the API did nothing wrong, the caller asked for a bigger page than it will serve. The request for '.../bundles?size=9999' asked for a page of 9999 elements, but the REST API served 1000. Ask for at most MAX_PAGE_SIZE elements Anything else keeps the generic message, including a page that came back larger than requested. Also drops a stray note from the spec that was left in by #1440. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
milanmajchrak
added a commit
that referenced
this pull request
Aug 11, 2026
…1448) The generic wording ends with "This could mean there's an issue with the REST endpoint", which points at the backend. For a reduced page size that is the wrong place to look: the API did nothing wrong, the caller asked for a bigger page than it will serve. The request for '.../bundles?size=9999' asked for a page of 9999 elements, but the REST API served 1000. Ask for at most MAX_PAGE_SIZE elements Anything else keeps the generic message, including a page that came back larger than requested. Also drops a stray note from the spec that was left in by #1440. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
References
customer/jcudtq-dev, 7.6.5) to 9.39999as this may bypass pagination DSpace/dspace-angular#2513 (closed by Prevent request with page size of 9999 DSpace/dspace-angular#3694, which missed several call sites)Description
dspace.logfills up withThe response for '…' has the self link '…'. These don't match. Two causes,both fixed here:
embedfrom one side only. The frontend removesembedparams from itsown url before comparing, but not from the self link the API echoes back — so it reported a
difference it created itself. Both sides are now normalized the same way (embed stripped, percent
decoded).
9999/10000are silently reduced to1000 by Spring Data REST, so the self link legitimately came back different. Those call sites now use
the new
MAX_PAGE_SIZE = 1000. This is not filtered out of the comparison — a reduced page sizestill warns, so the next caller who writes
9999finds out.Instructions for Reviewers
The change to
ensureSelfLinkis warning-only: the outer condition that rewrites_links.selfisunchanged, so caching behaves exactly as before. Only the
console.warngained a second condition.Page sizes are behaviour-preserving: the API already capped every one of these at 1000
(
spring.data.rest.max-page-size, which DSpace leaves at its default — verified: it is set nowhere inDSpace/DSpacenor in our fork). Requesting 1000 returns the same page as requesting 9999.Call sites changed (9.3 has more of them than 7.6.5 did):
core/data/bundle-data.service.tscore/browse/browse.service.tscore/data/relationship-type-data.service.tscore/registry/registry.service.tsitem-page/edit-item-page/item-bitstreams/item-bitstreams.service.tsadmin/admin-reports/filtered-items/filtered-items.component.tsDeliberately left alone:
browse-by-geospatial-data.component.tssetspageSize = 99999andfacetLimit = 99999. That is a Discovery facet limit, not a Spring Data REST page size, so it is notcapped at 1000 and lowering it would drop points off the map.
How to test: open an item page, the home page and
/browse/titlewith the console open. Before:These don't matchwarnings. After: none.Checklist
mainbranch — no: base iscustomer/jcu, as requested. Thesame fix is already merged into
dtq-dev(Fix the causes of the REST self link console warnings #1415).untouched lines).
dspace-rest-response-parsing.service.spec.ts(17 cases, the first spec this service has ever had);full suite green.
Not verified here
The browser before/after (3 warnings → 0) was measured on the
dtq-devversion against a local DSpace9.1 backend. It was not re-run against a 9.3 stack for this branch — the
ensureSelfLinklogic isbyte-identical between the two branches, but say the word and I'll do the run.