Skip to content

[PER-10476] [1] Extend getWithChildren toward replacing navigateLean/navigateMin (Stela migration groundwork) - #996

Open
aasandei-vsp wants to merge 1 commit into
mainfrom
PER-10476-replace-navigate-lean
Open

[PER-10476] [1] Extend getWithChildren toward replacing navigateLean/navigateMin (Stela migration groundwork)#996
aasandei-vsp wants to merge 1 commit into
mainfrom
PER-10476-replace-navigate-lean

Conversation

@aasandei-vsp

@aasandei-vsp aasandei-vsp commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Issue: PER-10476
Subtask: https://permanent.atlassian.net/browse/PER-10677

Why I'm doing this

I'm migrating our folder navigation off the v1 endpoints
(/folder/navigateLean and /folder/navigateMin) and onto getWithChildren,
which is backed by Stela. getWithChildren reshapes its response to match
v1's Results/error shape on purpose, so I can move call sites over
gradually rather than rewriting every consumer in one go.

Heads up: this PR is groundwork, not the switchover. It closes the gaps
between what Stela gives back and what the current navigate consumers
rely on, so getWithChildren is closer to being a drop-in replacement. I
haven't repointed any call sites here.

What's in it

  • Mapped the fields I was still dropping in the Stela → FolderVO
    conversion: archiveNumber, folderLinkId, parentFolderLinkId, the
    breadcrumb path arrays, and the created/updated timestamps.
  • Resolve a missing folderId via the legacy /folder/get endpoint, then
    fetch folder + children in parallel.
  • Convert failures into v1-shaped error responses so the existing error
    handlers keep working.
  • Hardcoded accessRole to owner on the converted folders/records (the
    backend removed the item-level field, and without it permission gates
    like the sidebar share button treated items as inaccessible).

What's not in it

  • Repointing the navigateLean/navigateMin consumers to getWithChildren.
  • Removing the v1 endpoints.

The tests are only to make sure we didn't make any regressions, as it does not bring any new functionality.

Manual test cases — Stela conversion in getWithChildren and record mapping

Setup: log in on an archive that has folders with images, records with metadata, and at least one unlisted share link.
EXPECTED: private/public navigation is unaffected by this PR (still uses navigateLean) — only the flows below need testing.


Unlisted share link — folder

  1. Open an unlisted share link to a folder in an incognito window.
    • EXPECTED: The folder contents load correctly.
  2. Navigate into a subfolder, then go back up using the breadcrumbs.
    • EXPECTED: Breadcrumb labels are correct and each breadcrumb link navigates to the right folder.
  3. Open the same share link while logged in.
    • EXPECTED: The folder contents load correctly.

Unlisted share link — error handling

  1. Open an invalid or revoked unlisted share link.
    • EXPECTED: A graceful error message is shown — no blank page, no errors in the console.

Sidebar — record

  1. Select a record and wait for the sidebar to finish loading.
    • EXPECTED: Full metadata is shown (dates, description, tags, location).
  2. Click the Share button.
    • EXPECTED: The button is enabled and the sharing dialog opens. (Bug fix in this PR — the v2 record conversion previously dropped accessRole, leaving the button permanently disabled.)

Sidebar — folder

  1. Select a folder and wait for the sidebar to finish loading.
    • EXPECTED: Full metadata is shown and the Share button is enabled.

Record and folder edits (v2 endpoints)

  1. Edit a record's date/time via the edit modal.
    • EXPECTED: The value saves and redisplays correctly after the sidebar refreshes.
  2. Edit a folder's date.
    • EXPECTED: The value saves and redisplays correctly.

@aasandei-vsp aasandei-vsp self-assigned this Apr 21, 2026
@aasandei-vsp
aasandei-vsp marked this pull request as draft April 21, 2026 13:13
@codecov

codecov Bot commented Apr 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.18%. Comparing base (3dbec72) to head (01c70e9).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #996      +/-   ##
==========================================
- Coverage   52.19%   52.18%   -0.02%     
==========================================
  Files         354      354              
  Lines       12089    12099      +10     
  Branches     2185     2187       +2     
==========================================
+ Hits         6310     6314       +4     
- Misses       5555     5559       +4     
- Partials      224      226       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aasandei-vsp aasandei-vsp changed the title [WIP] [PER-10476] Replace navigateLean with getWithChildren [WIP] [PER-10476] [BLOCKED BY BE] Replace navigateLean with getWithChildren Jun 4, 2026
@aasandei-vsp
aasandei-vsp force-pushed the PER-10476-replace-navigate-lean branch from b65fcfb to bb0a021 Compare July 8, 2026 13:30
@aasandei-vsp
aasandei-vsp force-pushed the PER-10476-replace-navigate-lean branch from bb0a021 to e54b14f Compare July 16, 2026 08:56
@aasandei-vsp aasandei-vsp changed the title [WIP] [PER-10476] [BLOCKED BY BE] Replace navigateLean with getWithChildren [PER-10476] Extend Stela conversion in getWithChildren and record mapping Jul 16, 2026
@aasandei-vsp
aasandei-vsp marked this pull request as ready for review July 16, 2026 09:08
@aasandei-vsp aasandei-vsp changed the title [PER-10476] Extend Stela conversion in getWithChildren and record mapping [PER-10476] [1] Extend Stela conversion in getWithChildren and record mapping Jul 23, 2026
@slifty

slifty commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@aasandei-vsp I'm back in action and coming back to review things!

I'm finding this PR / commit hard to review as written. Would you be able to take a stab at updating the commit message + PR title / description to make it clear what the purpose of these changes are?

I think it's basically Migrate record lookup to use stela, right? Or maybe it's just a partial implementation of that overall epic?

@aasandei-vsp
aasandei-vsp force-pushed the PER-10476-replace-navigate-lean branch from e54b14f to 45f656e Compare July 28, 2026 10:20
This is one step toward the bigger migration: I'm moving folder
navigation off the v1 /folder/navigateLean and /folder/navigateMin
endpoints and onto getWithChildren, which is backed by Stela. The idea
is that getWithChildren returns the same shape those v1 endpoints do, so
I can move consumers over gradually instead of all at once. This commit
just closes some of the gaps between what Stela hands back and what
those consumers expect — it doesn't finish the migration.

What I did:

- Mapped the fields I was still dropping from the Stela folder response:
  archiveNumber, folderLinkId, parentFolderLinkId, the breadcrumb path
  arrays, and the created/updated timestamps.
- When a folderId is missing, I resolve it through the legacy
  /folder/get endpoint first, then fetch the folder and its children in
  parallel.
- Shaped failures to look like v1 errors so the existing error handlers
  keep working without me touching them.
- Hardcoded accessRole to owner on the converted folders and records.
  The backend dropped the item-level field, and without it permission
  gates like the sidebar share button were treating items as
  inaccessible.

Issue: PER-10476
@aasandei-vsp
aasandei-vsp force-pushed the PER-10476-replace-navigate-lean branch from 45f656e to 01c70e9 Compare July 28, 2026 10:55
@aasandei-vsp aasandei-vsp changed the title [PER-10476] [1] Extend Stela conversion in getWithChildren and record mapping [PER-10476] [1] Extend getWithChildren toward replacing navigateLean/navigateMin (Stela migration groundwork) Jul 28, 2026
@aasandei-vsp

Copy link
Copy Markdown
Contributor Author

@aasandei-vsp I'm back in action and coming back to review things!

I'm finding this PR / commit hard to review as written. Would you be able to take a stab at updating the commit message + PR title / description to make it clear what the purpose of these changes are?

I think it's basically Migrate record lookup to use stela, right? Or maybe it's just a partial implementation of that overall epic?

@slifty That makes perfect sense! Because I was deep into this story, I forgot that other people need to understand the context :)))

Together with @cecilia-donnelly , we have decided that making smaller PRs if possible, for the ease of review would be better, so that's why the big story of migrating to getWithChildren has been split across multiple subtasks.

I've updated the commit message and the description.
TL;DR Basically there were some properties missing from the stela record and folder that were stopping the full migration to getWithChildren. After @liam-lloyd added them on BE, I've also made the mapping on the FE.

Hope this helps, otherwise I can definitely provide more details.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Groundwork for migrating folder navigation from legacy v1 endpoints (/folder/navigateLean / /folder/navigateMin) to the Stela-backed getWithChildren by expanding Stela→VO field mapping, adding a legacy folderId fallback, and aligning success/error shapes with existing v1 consumers.

Changes:

  • Expanded Stela→FolderVO mapping (archive/link IDs, breadcrumb path arrays, created/updated timestamps) and added an item-level accessRole default.
  • Added resolveFolderId fallback via legacy /folder/get, then fetches folder + children in parallel.
  • Added/updated unit tests for the new mapping, fallback behavior, and v1-shaped error handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/app/shared/services/api/record.repo.ts Sets a default accessRole during Stela→RecordVO conversion to preserve existing UI permission gates.
src/app/shared/services/api/folder.repo.ts Extends Stela folder shape + mapping, adds folderId resolution fallback, and wraps errors into a v1-like FolderResponse.
src/app/shared/services/api/folder.repo.spec.ts Adds tests covering error shaping, folderId resolution fallback, and newly-mapped fields used by breadcrumbs/metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +232 to 236
// accessRole is intentionally always owner, matching the folder
// conversion: the backend removed item-level accessRole because all
// non-owner values were deprecated in 2020. Real access is on ShareVOs.
accessRole: 'access.role.owner',
});
Comment on lines +154 to +156
// accessRole is intentionally always owner: the backend removed item-level accessRole
// because all non-owner values were deprecated in 2020. Real access is on ShareVOs.
accessRole: 'access.role.owner',
Comment on lines +325 to +327
const response = await this.get([folderVO]);
const resolvedFolder = response.getFolderVO();
return new FolderVO({ ...folderVO, folderId: resolvedFolder.folderId });
return folderResponse;
} catch (err) {
// We need the error to look the way v1 errors look too,
// Changing all the error handlers would be errror prone
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.

3 participants