Skip to content

CLARIN-DSpace v9/Port #1415 (fix the causes of the REST self link console warnings) to the v9 base - #1494

Merged
milanmajchrak merged 1 commit into
dtq-dev-9-basefrom
ufal/port-1415-9-base
Sep 9, 2026
Merged

CLARIN-DSpace v9/Port #1415 (fix the causes of the REST self link console warnings) to the v9 base#1494
milanmajchrak merged 1 commit into
dtq-dev-9-basefrom
ufal/port-1415-9-base

Conversation

@milanmajchrak

Copy link
Copy Markdown
Collaborator

What

Port of dtq-dev PR #1415 (d0897c2af7) to the v9 base — card FE-06 (tranche T1) of the
dtq-devdtq-dev-9-base sync.

Removes the bogus self link doesn't match console warnings, and stops asking the REST API for
page sizes it does not honour.

Why

ensureSelfLink() stripped embed params from the requested url only, so any request embedding a
subresource compared a url the frontend had normalised against a self link the API had not — and
reported a mismatch it had created itself. The API additionally percent-decodes : and /, which
are legal in a query component, which looked like a further difference.

The second cause is the call sites asking for 9999 / 10000 / 1000 elements to mean
"everything". Spring Data REST caps a page at spring.data.rest.max-page-size (DSpace leaves the
default 1000), so those requests never returned more than 1000 rows — they only made the request
claim something the API does not honour, leaving the self link legitimately different from the
requested url.

Changes

  • both sides are normalised before comparison (urlPartsDiffer, decodeUrlParts,
    isUnexpectedSelfLink); a difference in an actual value still warns
  • MAX_PAGE_SIZE next to FindListOptions, used by every "give me everything" call site
    (15 files; 9999|10000|1000 literals in src/app go 15 → 0)
  • the condition that rewrites _links.self is untouched — the url a response is cached under is
    unchanged; only whether we warn changes
  • first spec this service has had: 17 cases, covering both what is now tolerated and what must
    still warn

v9 adaptations

The text is the 9.3-native original (customer/jcu ca40c3b9c2, jcu PR #1440) — the same change
already formatted for the v9 eslint import rules. registry.service.ts was resolved by hand to keep
the CLARIN MetadataBitstreamDataService import. The six CLARIN-only call sites were hand-applied
from d0897c2af7; the #1400 (ROR) and #1396 (route-aware submission PATCH) hunks in
clarin-item-box-view.component.ts and section-license.component.ts are untouched.

Two call sites exist only on v9 and therefore only in the jcu commit — filtered-items.component.ts
(4 × 10000; the file does not exist on dtq-dev) and relationship-type-data.service.ts (dtq-dev
still pages it with elementsPerPage: 20). browse-by-geospatial-data.component.ts is deliberately
left alone: its 99999 is a Discovery facet limit, not a Spring Data REST page size.

Testing

Local gates (Windows, Node 20.19.0):

npm run lint:nobuild -- --quiet      All files pass linting.                EXIT=0
npx madge (check-circ-deps)          No circular dependency found!          EXIT=0
npm run build:prod                   EXIT=0, dist/{browser,server}
karma (target spec)                  TOTAL: 17 SUCCESS
karma (7 neighbour specs)            TOTAL: 93 SUCCESS

Acceptance greps: MAX_PAGE_SIZE = 1000 → 1; urlPartsDiffer|decodeUrlParts → 2; files using
MAX_PAGE_SIZE → 15; magic 9999|10000|1000 literals in src/app → 0 (was 15); _links.self
rewrite unchanged vs dspace-9.3 → 0 diff.

Sync guards: X1 none of the 15 touched files is byte-identical with dspace-9.3 on the head
(six of them were, on the base — this port is what takes them off that list). X6 clarin*.spec.ts
count unchanged at 5, no removed cy./expect( in cypress/. X5b orphan/fork-only i18n counts
identical to the base (no json5 touched).

Two environmental caveats, both proven pre-existing by re-running on the untouched base:
npm run test:lint:nobuild is 8/169 red (Windows backslash paths in lint/test/fixture, nothing
under lint/ is touched — CI on Linux is the gate), and check-circ-deps cannot run through
cmd.exe, so the identical npx madge invocation was run from Git Bash.

[live] acceptance criteria are verified after merge and deploy on dev-6:8603, per the sync
acceptance document.

Notes for the reviewer

🤖 Generated with Claude Code

…nsole warnings

ensureSelfLink() stripped embed params from the requested url only, so every
request that embeds a subresource compared a url the frontend had normalised
against a self link the API had not, and reported a mismatch it had created
itself. 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 (urlPartsDiffer, decodeUrlParts,
isUnexpectedSelfLink). A difference in an actual value still warns.

The second cause is the call sites that asked for 9999 / 10000 / 1000 elements to
mean "everything". Spring Data REST caps a page at spring.data.rest.max-page-size,
which DSpace leaves at its default of 1000, so those requests never returned more
than 1000 rows anyway - they only made the request claim something the API does
not honour and left the self link legitimately different from the requested url.
MAX_PAGE_SIZE is added next to FindListOptions and used wherever a caller needs
everything.

The condition that rewrites _links.self is untouched, so the url a response is
cached under stays exactly as it was; only whether we warn changes.

Adds the first spec this service has had: 17 cases covering both what is now
tolerated and what still has to warn.

v9 notes:
- The text is the 9.3-native original (customer/jcu ca40c3b), which is the same
  change already formatted for the v9 eslint import rules. registry.service.ts was
  resolved by hand to keep the CLARIN MetadataBitstreamDataService import.
- The six CLARIN-only call sites were hand-applied from d0897c2:
  clarin-zip-download-page, clarin-all-licenses-page, item-license-mapper,
  clarin-item-versions-field, clarin-item-box-view, section-license. The #1400
  (ROR) and #1396 (route-aware submission PATCH) hunks in the last two files are
  untouched.
- Two call sites exist only on v9 and therefore only in the jcu commit:
  filtered-items.component.ts (4 x 10000; the file does not exist on dtq-dev) and
  relationship-type-data.service.ts (dtq-dev still pages it with elementsPerPage 20).
- browse-by-geospatial-data.component.ts is deliberately left alone: its 99999 is a
  Discovery facet limit, not a Spring Data REST page size.

Card FE-06 (tranche T1).

Source: d0897c2 (dtq-dev PR #1415)
Adapted-from: ca40c3b (customer/jcu PR #1440)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@milanmajchrak
milanmajchrak merged commit 2233470 into dtq-dev-9-base Sep 9, 2026
9 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