Bookmarks panel - design

The design of the JupyterLab extension @stellarshenson/jupyterlab-bookmarks-manager-extension (PyPI jupyterlab-bookmarks-manager-extension) as it is built. Every statement was checked against src/, jupyterlab_bookmarks_manager_extension/, schema/plugin.json, style/base.css and ui-tests/ on 2026-10-28.

An id such as ACC-LINK-37-OPEN-TAB names an acceptance criterion in docs/acc-crit.md. Only closed criteria are cited, and each names the test that proves it. An id that starts with DEF- names a defect in docs/defects.md.

1. Overview

A side-bar panel with four sections. Links, Files and Sessions are each a tree of folders and bookmarks, kept in one JupyterLab setting; Proxy is a flat list of the pages opened through the lab's server proxy, kept in the application state database. Five server routes read the foreground process of each terminal, fetch the favicon of a page on another origin, answer the pages the server's proxy tap saw, answer the settings saved under the old npm name and save the settings only while the file holds the text the writer read.

  • Frontend: one plugin, @stellarshenson/jupyterlab-bookmarks-manager-extension:plugin, that adds a SidePanel, the tab-menu command, the drag of a tab onto the panel, the tab marks and the row commands; the tree functions of model/tree.ts are pure; Jest tests them with the store, the filter, the Proxy section's list, the marks and the drop target against fakes
  • Server: GET terminals, POST terminals, POST favicon, GET proxy-opens, GET old-settings, POST old-settings and POST settings-write under <base_url>/jupyterlab-bookmarks-manager-extension/, all authenticated
  • Storage: the setting bookmarks of the plugin @stellarshenson/jupyterlab-bookmarks-manager-extension:plugin ACC-STORE-77-SETTING; the Proxy section's list under the state key jupyterlab_bookmarks_manager_extension:recent-proxy, outside the settings file ACC-RECENT-93-SECTION
  • Proxy: a wrapper of the tornado log_function setting sees each page opened through the lab's server proxy, by any route, the lab itself excepted ACC-RECENT-109-ANY-OPEN ACC-RECENT-110-NOT-LAB; a row reopens the page the way it was first opened, and an entry leaves the list after recentProxyTtlDays days, 3 by default ACC-RECENT-94-OPEN ACC-RECENT-95-TTL; the section's + button opens the Open Proxy Page dialog ACC-RECENT-111-POPUP
  • Marks: a main-area tab whose page, file or terminal a bookmark records carries a ribbon on its top edge, its panel row a dot, and the current tab's row is tinted; the colour is the setting markColour ACC-MARK-96-TAB-MARK ACC-MARK-97-OPEN-ROW ACC-MARK-98-MARK-COLOUR
  • Top bar: the title with Filter and Refresh; Refresh checks every file bookmark and reads the running terminals again, Filter narrows the sections to a typed text ACC-PANEL-86-REFRESH ACC-PANEL-87-FILTER
  • Drag: a main-area tab dropped on the panel is added as a bookmark of its kind, inside the folder row under the pointer ACC-PANEL-99-DRAG-TAB
  • Side: the panel starts in the left side bar; JupyterLab's own command sidebar:switch (Switch Sidebar Side in the context menu of the panel's side-bar tab) moves it to the right; the extension has no code for this ACC-PANEL-1-LEFT ACC-PANEL-2-RIGHT
Figure 1. Components The frontend modules in the browser, grouped into UI modules and logic modules, and the five server parts they call: the settings registry, the contents API, the three routes of this extension, the terminals API and the state database that holds the Proxy section's list. Browser: JupyterLab frontend, src/ UI LOGIC AND SERVER ACCESS index.ts the plugin; wires the parts panel/ bookmarks_panel.ts section_view.ts row_view.ts fold_state.ts tab_drop.ts tab_menu.ts tab_add.ts Add or Remove Tab commands.ts dialogs/ form.ts, folder_select.ts edit_link.ts, edit_file.ts edit_session.ts open_proxy.ts icons.ts bookmarksIcon, the panel icon model/ types.ts, tree.ts store.ts, names.ts BookmarkStore: queued writes classify/ tab_kind.ts bookmark_match.ts tab kind to its bookmark file/ file_status.ts file_icon.ts link/ link_url.ts favicon.ts open_link.ts request.ts requestAPI session/ shell_quote.ts env_filter.ts terminal_snapshot.ts open_session.ts mark/ marks.ts recent/ recent.ts, proxy_feed.ts open_recent.ts Jupyter server Settings registry /lab/api/settings/<plugin id> setting bookmarks, validated on save Contents API /api/contents/<path> This extension, routes.py /jupyterlab-bookmarks-manager-extension/ GET terminals terminals_handler.py process_reader.py reads /proc for the shell and its foreground job POST favicon favicon_handler.py favicon_fetch.py fetches the page and its icon GET proxy-opens: the pages proxy_tap.py holds reads the terminal list Terminals API, jupyter_server_terminals POST /api/terminals terminals/websocket/<name> terminal_manager.terminals State database, per workspace IStateDB, the workspace state the Proxy section's list, outside the settings file reload, set get, content: false GET, POST GET terminals fetch, save
Figure 1. Components. The UI modules on the left column call the logic modules on the right column; the arrows are the extension's calls to the server's APIs. The Proxy section's list goes to the application state database, which JupyterLab's workspace plugin writes to the workspace file. terminal:open and terminal:create-new are JupyterLab's own terminal commands; the tab they open connects to the terminal's websocket. On a narrow screen the figure scrolls sideways.

2. Decisions taken

The questions the design had to answer, the decision as it is built, and the reason for it.

QuestionDecisionReason
Name of the section for web pages Links The section was meant to hold lab-served pages, pages on other origins and a PNG file path; the working name Webpages did not fit the PNG path. The PNG path itself is out of scope
What a web tab is and how its URL is read A tab whose widget has no document context and whose node holds exactly one <iframe> with an http or https address. The URL is iframe.contentWindow.location.href when it is readable and http(s), else iframe.src ACC-LINK-19-WEB-TAB ACC-LINK-21-URL All four producers of web tabs installed on the workstation - server-proxy:open, help:open, proxy-launcher:open and iframe:open - keep the URL in the iframe src, so one rule covers all of them. A frame on another origin refuses access to its location; src is then the address
How a link reopens A page on the lab's origin opens in the extension's own MainAreaWidget around an IFrame with the sandbox allow-same-origin allow-scripts allow-popups allow-forms allow-downloads allow-modals and the widget id bookmarks-link-<id>; a second click activates that tab. A page on another origin opens with window.open(url, '_blank', 'noopener') ACC-LINK-37-OPEN-TAB ACC-LINK-38-OPEN-AGAIN ACC-LINK-39-OPEN-OTHER The frame that help:open makes has a sandbox that blocks cookies. The lab's Content-Security-Policy blocks a frame of another origin. The cost of the one code path: the tab does not come back after a lab reload
Where favicons are cached In the link record, as a data URL of at most 32768 characters, fetched after the link is added and after its URL changes; a page that serves no icon takes the tab's widget icon, and the page's own icon wins when both exist ACC-LINK-25-FAVICON ACC-LINK-26-FAVICON-CACHE ACC-LINK-27-FAVICON-EDIT ACC-LINK-32-FAVICON-CAP ACC-LINK-142-TAB-ICON The browser fetches a page on the lab's origin and its icon with the lab's credentials. A page on another origin cannot be fetched from the browser, so POST favicon fetches it on the server ACC-LINK-28-FAVICON-OTHER. Without an icon link the icon is favicon.ico beside the page, never at the origin root ACC-LINK-30-FAVICON-BESIDE. The Star Colonel kept the cap at 32768 characters on 2026-10-27. The tab's title.icon is the fallback of the owner's ruling of 2026-11-04: a help:open tab carries none, so the row keeps linkIcon; a tab that carries one gives the row its icon, converted from a LabIcon's SVG source to a data: URL
Where bookmarks are stored The setting bookmarks of the plugin @stellarshenson/jupyterlab-bookmarks-manager-extension:plugin in the settings registry ACC-STORE-76-RELOAD ACC-STORE-77-SETTING The registry keeps the value on the server and validates every save against schema/plugin.json; Galata's mockSettings gives each test its own value
What a file path is relative to The Jupyter server root, as a contents API path: context.path, forward slashes, no leading slash; the file edit dialog strips leading slashes from a typed Location ACC-FILE-44-LOCATION docmanager:open and the contents API take paths in this form
How the terminal process is read and which variables are stored os.tcgetpgrp(ptyproc.fd) gives the foreground process group of the terminal's pty. The group leader's argv comes from /proc/<pgid>/cmdline, joined by shlex.join; its cwd from readlink /proc/<pgid>/cwd; its variables are the ones added or changed against /proc/<shell pid>/environ. Never recorded: _, PWD, OLDPWD, SHLVL, LINES, COLUMNS and any name that contains TOKEN, SECRET, PASSWORD, PASSWD, API_KEY or CREDENTIAL in any case ACC-SESS-54-COMMAND ACC-SESS-55-CWD ACC-SESS-56-ENV ACC-SESS-57-SECRETS Measured on a live server. LINES and COLUMNS are excluded because LINES appeared in the measured diff. The handler reads manager.terminals and never calls get_terminal, which creates a terminal that does not exist
What "the same setup" means and how a session reopens Figure 3 shows the click. The first match is a terminal this bookmark started whose shell has not yet read the typed recipe: GET terminals reports bookmark, the shell's JUPYTERLAB_BOOKMARK, equal to the bookmark id, and pending true, which holds while the line has not been typed and while it waits unread. Otherwise a running terminal, with or without a tab, matches when its foreground process has the same shell-quoted command and the same cwd, read from a fresh GET terminals on the click. Of several matches, the one whose tab is open wins, otherwise the first listed. A match runs terminal:open {name}. No match: POST api/terminals {cwd, extra_env: {JUPYTERLAB_BOOKMARK: <id>}}, then terminal:create-new {name}, then a wait for the terminal's ready and its session's connected, then POST terminals {name, line} types export K='v' ...; <command> and Enter. A bookmark with no line starts with no marker and types nothing. A click while an earlier click of the same bookmark still runs gets that click's promise ACC-SESS-63-MATCH ACC-SESS-64-MATCH-SHELL ACC-SESS-65-OPEN-ACTIVE ACC-SESS-66-OPEN-START ACC-SESS-67-OPEN-CWD ACC-SESS-68-QUOTE ACC-SESS-79-OPEN-ATTACH ACC-SESS-84-OPEN-FRESH ACC-SESS-85-START-ONCE The click never uses the tab-menu snapshot: a process stopped or started in an open tab changes no terminal name, and runningChanged is meant to fire on a change of names only (@jupyterlab/services/src/terminal/manager.ts L240-251). Closing a terminal tab leaves the terminal running, because shutdownOnClose defaults to false; terminal:open looks for a tab by session name and otherwise runs terminal:create-new {name}, which connects to the running terminal. terminal:create-new {cwd} strips the leading slash of an absolute cwd, so the terminal is started with POST api/terminals. For about 3 s after a start the server reports only the shell, so without the marker a second click started a second terminal (DEF-SESS-7-START-TWICE). After Ctrl-C the marker stays but pending is false, so a click starts a new terminal. session.send only queues the line until the terminal's socket connects, and a click before that found no match and started a second terminal (DEF-SESS-34-SECOND-START), so the server writes the line to the pty, and the first click's open runs until that answer. The line follows the tab's ready and connected, because a program started before the socket sends set_size runs at the pty's default 24 rows 80 columns. A click in another lab page reads pending from the server, which holds it for a marked terminal until the POST writes
Does editing the environment and the command make sense Yes. The bookmark is a launch recipe, text typed into a new terminal; an edit changes the bookmark and never a running process ACC-SESS-70-EDIT-COMMAND ACC-SESS-71-EDIT-ENV ACC-SESS-72-EDIT-CWD ACC-SESS-74-EDIT-ONLY Recognition then uses the edited recipe, so a terminal still running the old command offers Add Tab to Bookmarks ACC-SESS-75-EDIT-MATCH
What the panel header holds and how large the title is The title Bookmarks, then Filter (filterIcon) and Refresh (refreshIcon) as 24 px icon buttons, as in the header of the AI code assistants panel; Filter shows or hides a search box above the sections, Refresh re-checks every file bookmark and reads the running terminals again with its glyph spinning. The title takes the size of the section labels ACC-PANEL-86-REFRESH ACC-PANEL-87-FILTER The reference is the header of jupyterlab_ai_code_assistants_extension. .jp-SidePanel-header sets --jp-ui-font-size0 itself and the title set it again, so the title shrank twice to about 9 px; the header resets its font size to --jp-ui-font-size1 (DEF-PANEL-9-TITLE-SIZE)
How a bookmark or a folder is created in a section The section header holds a + button that opens a menu with New Bookmark... and New Folder; New Bookmark opens the section's edit dialog with empty fields, and Save adds the bookmark in the Folder field's choice, None at the section root ACC-TREE-89-PLUS-MENU ACC-TREE-90-NEW-BOOKMARK One button for the two creations of a section; the dialog is the edit dialog, so the checks of an edit apply to a new bookmark too - the favicon of a link is fetched, a missing file is marked, and an excluded name disables Save
How a whole section is emptied An eraser beside the +, rightmost + kept, opens a confirmation titled Clear <Section> whose body names the section's contents; Cancel changes nothing and a destructive Clear removes every bookmark and folder of Links, Files or Sessions, or every page of the Proxy list. The eraser is disabled while the section holds nothing, and a filter does not narrow the clear ACC-PANEL-143-CLEAR-SECTION The eraser is the workspace manager's glyph and the confirmation its Danger outline: the destructive action stands unfilled in --jp-error-color1 at the far left, Cancel at the right. A themed clear goes through the store's compare-and-set, never a raw settings write, and the Proxy list announces each removal so a feed read in flight keeps the pages out
Which names a captured environment leaves out The names of process_reader.py and the secret pattern, plus every name matching an expression of the setting sessionEnvExclude (* any run, ? one character, [...] one of a set, case kept; 29 expressions by default). A name typed in the edit dialog is kept; the dialog refuses only the built-in names and the secret pattern, not the expressions of the setting ACC-SESS-88-ENV-FILTER ACC-SESS-91-ENV-SETTING ACC-SESS-92-ENV-MANUAL The setting is read where the frontend stores a capture, so the server needs no settings access, and an edited list applies without a page reload. The default is the accepted 36-entry list merged into wildcards: PS? also matches PS3 and TERM* also matches TERMINFO
Which pages the Proxy section lists Each page the server's proxy tap sees opened through jupyter-server-proxy, by any route: server-proxy:open, the launcher's tile, a typed URL, also while no lab page is open. One entry per URL, the lab itself not listed. The popup and a row click also record their page, because a closed port gives the tap no open and a reused tab sends no request. The section shows the pages opened within recentProxyTtlDays days that no link bookmarks, newest first, and a click activates the lab tab that shows the page, else runs server-proxy:open with the stored arguments ACC-RECENT-109-ANY-OPEN ACC-RECENT-110-NOT-LAB ACC-RECENT-93-SECTION ACC-RECENT-94-OPEN ACC-RECENT-95-TTL The Star Colonel's words of 2026-10-30: "tap to the proxy, not hook on the proxy open command", "react on any proxy open". The command misses a typed URL and the launcher's tile, which runs no command. A page first opened in a browser tab opens in a browser tab again. He accepted two kinds of listed page: a notebook IFrame of a proxied page, whose headers equal those of a popup lab tab, and a PDF, image, JSON or CSV opened directly, because a content type check needs the private handler._headers. Filtering by the links at render takes the row away while the page is bookmarked and brings it back while the entry lives
How an open bookmark shows on its tab and in its row A 7 by 11 px ribbon hangs from the bookmarked tab's top edge, 3 px from its right border, with a notch at the bottom; a 7 px dot marks the open bookmark's row at its right end, and the current tab's row takes the brand selection tint. The setting markColour picks brand (--jp-brand-color1) or red (--jp-error-color1) ACC-MARK-96-TAB-MARK ACC-MARK-97-OPEN-ROW ACC-MARK-98-MARK-COLOUR The ribbon is the tab label's ::after: jupyterlab_colourful_tab_extension paints a background with !important on every element of a coloured tab, and a pseudo-element is not an element. The mark stays in the marker colour on such a tab

Further decisions

  • A shell in the foreground gives an empty command; such a bookmark reopens a shell in its cwd, and any idle shell in that cwd matches it ACC-SESS-58-SHELL ACC-SESS-64-MATCH-SHELL
  • Variables that login scripts set appear in the diff and are kept; the edit dialog lets the user delete their lines
  • Terminal tabs are recognised by duck typing (widget.content.session.name is a string), not through ITerminalTracker, so @jupyterlab/terminal is not a dependency
  • Every terminal is bookmarkable; a terminal whose foreground process cannot be read (sudo, an exited group leader) is recorded as a plain shell ACC-SESS-59-UNREADABLE
  • Processes that rewrite their argv (npm, npx) stay out of scope: the Star Colonel rejected DEF-SESS-6-ARGV-TITLE on 2026-10-28, because a process title cannot give back the true command line
  • The terminal tab-menu label also refreshes when the context menu opens on a terminal tab, so the label right after Add reads Remove once that read has answered, with no wait for the 10 s poll ACC-SESS-61-MENU-LABEL
  • The server part imports on Windows: process_reader.py imports fcntl and termios inside the pty read, so the package loads without them and no unread input is recorded (DEF-SESS-10-WINDOWS-IMPORT)

3. Data model

The types of src/model/types.ts:

export type SectionKey = 'links' | 'files' | 'sessions';

export interface IFolder {
  kind: 'folder';
  id: string;
  name: string;
  children: Node[];
}

export interface ILink {
  kind: 'link';
  id: string;
  name: string;
  /** Absolute http(s) URL, or a path relative to the lab base URL for a lab-served page. */
  url: string;
  /** Favicon data URL, absent when the page has none or it exceeds the cap. */
  icon?: string;
}

export interface IFileBookmark {
  kind: 'file';
  id: string;
  name: string;
  /** Contents API path, relative to the server root. */
  path: string;
}

export interface ISessionBookmark {
  kind: 'session';
  id: string;
  name: string;
  cwd: string;
  /** Shell-quoted command line; empty for a plain shell. */
  command: string;
  env: Record<string, string>;
}

export type Node = IFolder | ILink | IFileBookmark | ISessionBookmark;

export interface IBookmarks {
  version: 1;
  links: Node[];
  files: Node[];
  sessions: Node[];
}
Figure 2. The stored node format The setting bookmarks holds version 1 and three arrays of nodes. A node is one of four kinds: link, file bookmark, session bookmark or folder; a folder's children are nodes again. Settings registry → plugin @stellarshenson/jupyterlab-bookmarks-manager-extension:plugin → setting bookmarks bookmarks IBookmarks version: 1 links: Node[] files: Node[] sessions: Node[] Node #/definitions/node oneOf the four kinds below ILink kind: 'link' id: string name: string url: string icon?: string url: relative under the lab base URL, else absolute http(s) icon: data URL, at most 32768 characters IFileBookmark kind: 'file' id: string name: string path: string path: contents API path, relative to the server root, forward slashes, no leading / ISessionBookmark kind: 'session' id: string name: string cwd: string command: string env: {string: string} command: shell-quoted, empty for a plain shell; env: the added or changed variables IFolder kind: 'folder' id: string name: string children: Node[] children: any depth in the format; the UI makes folders at the section root only children → Node, recursive
Figure 2. The stored node format. Every node object has additionalProperties: false in the schema, and the schema checks the kind of a node, not whether that kind belongs to the section that holds it.
  • A stored URL is relative when it does not match ^https?:// (any case). toStoredUrl stores a URL under the lab base URL relative to it and any other URL absolute; the relative form survives a change of host name ACC-LINK-24-RELATIVE
  • id is UUID.uuid4() from @lumino/coreutils
  • The UI adds only bookmarks of a section's kind to that section and its folders. It creates folders at the section root only, and the Folder field lists root folders only; the type and the tree functions accept any depth ACC-TREE-13-ONE-LEVEL ACC-TREE-14-DEPTH
  • The file-exists state is computed at run time and never stored
  • Default name: a link takes the tab title; a file takes the file name; a session takes <first word of the command, or "shell"> - <base name of the cwd> ACC-LINK-20-MENU-ADD ACC-FILE-40-MENU-ADD ACC-SESS-60-NAME

An example value of the setting:

{
  "version": 1,
  "links": [
    {
      "kind": "link",
      "id": "7b1f",
      "name": "Resources",
      "url": "proxy/7681/",
      "icon": "data:image/png;base64,iVBORw0KGgo..."
    },
    {
      "kind": "folder",
      "id": "c20a",
      "name": "Apps",
      "children": [
        { "kind": "link", "id": "91de", "name": "MLflow", "url": "mlflow/" }
      ]
    }
  ],
  "files": [
    {
      "kind": "file",
      "id": "4a77",
      "name": "README.md",
      "path": "private/jupyterlab/jupyterlab_bookmarks_extension/README.md"
    }
  ],
  "sessions": [
    {
      "kind": "session",
      "id": "e5c3",
      "name": "python3 - tmp",
      "cwd": "/tmp",
      "command": "python3 -m http.server 8000",
      "env": { "BM": "a b" }
    }
  ]
}

The key jupyterlab_bookmarks_manager_extension:recent-proxy-taken of the same database holds the watermark, the newest server openedAt the list has taken, and opensAfter takes only newer opens, so a removed page stays removed although the server still holds it ACC-RECENT-119-REMOVED. mergeSeen keeps a listed page's name, mode and id, and an openedAt newer than the observation ACC-RECENT-118-NAMED. listedUrl is the form a page is listed under: encoded as a browser sends it, with no fragment and no secret, so a popup's page and the proxy's observation of it compare equal under any base URL.

The key jupyterlab_bookmarks_manager_extension:last-present of the same database holds each bookmark's last-present time, a millisecond number by bookmark id. The panel records the open set and the set that was open before each change from TabMarks.changed, so adding a bookmark to an open tab records now and closing its tab records the close, and it stamps again every 30 s while a tab stays open. The times stay out of the settings file ACC-PANEL-140-AGE.

The Proxy section's list is stored outside this setting, under the state key jupyterlab_bookmarks_manager_extension:recent-proxy, as an array of IRecentProxyEntry of src/recent/recent.ts, newest first:

export interface IRecentProxyEntry {
  /** The absolute URL of the page. */
  url: string;
  /** The title the command ran with. */
  title: string;
  /** The page opened in a browser tab, never in a lab tab. */
  newBrowserTab: boolean;
  /** The widget id the command opened, for a lab tab. */
  id?: string;
  /** Milliseconds since the epoch of the last open. */
  openedAt: number;
}
  • One entry per URL: a new open of a known page moves its entry to the top and replaces its fields ACC-RECENT-93-SECTION
  • pruneRecent keeps the entries whose age is at most recentProxyTtlDays × 86400000 ms; an entry exactly at the limit stays, and a TTL of 0 keeps only an entry opened at the same millisecond ACC-RECENT-95-TTL
  • No link filter runs at render: a page that a link bookmarks stays listed, because the Proxy list records what the proxy saw and a link is a separate record DEF-PROXY-57-CAPTURE. REPLACED: the earlier recentWithoutBookmarks dropped such a page
  • The workspace plugin saves the state database to the workspace file, so the list survives a page reload

Setting schema, schema/plugin.json

  • Property bookmarks: an object with the required properties version (const: 1), links, files and sessions, each an array of #/definitions/node; additionalProperties: false; default { "version": 1, "links": [], "files": [], "sessions": [] } ACC-STORE-77-SETTING
  • definitions/node is a oneOf of folder, link, file and session; a folder's children refer back to node, so the format accepts folders inside folders ACC-STORE-78-NESTED
  • A link's icon carries maxLength: 32768
  • Property sessionEnvExclude: an array of strings, title Session environment filter, default the 29 expressions of ACC-SESS-88 - JUPYTER*, JPY_*, PYXTERM_*, BASH_*, TERM*, HIST*, PS?, TMUX*, SSH_*, XDG_*, DBUS_*, _CE_*, _CONDA_*, VIRTUAL_ENV_*, PATH and CUDA_VISIBLE_DEVICES among them; the Settings Editor shows it as a list of entries ACC-SESS-88-ENV-FILTER ACC-SESS-91-ENV-SETTING
  • Property recentProxyTtlDays: a number, minimum 0, default 3, title Proxy days ACC-RECENT-95-TTL
  • Property markColour: a string, enum ["brand", "red"] with the names Brand and Red, default brand, title Marker colour ACC-MARK-98-MARK-COLOUR
  • jupyter.lab.setting-icon names the extension's own LabIcon, jupyterlab_bookmarks_manager_extension:bookmarks, with the label Bookmarks
  • The registry validates every save against the schema
  • Unverified: how the Settings Editor form renders the recursive $ref
  • Load cost: the registry sends the whole setting to the browser at lab start; 100 links at the cap add up to 3.2 MB (calculated, not measured)

4. Server API

Base: <base_url>/jupyterlab-bookmarks-manager-extension/, registered by routes.py. Every verb method carries @tornado.web.authenticated; .github/scripts/check_auth.py fails make test when a handler lacks it, and an unauthenticated GET terminals answers 403.

RouteVerbRequestResponse
terminals GET none 200 {"terminals": [{"name", "cwd", "command", "env", "bookmark", "pending"}]}, one entry per terminal in terminal_manager.terminals; env maps names to strings, bookmark is a string, pending a boolean
terminals POST {"name": str, "line": str}, the text to type 204 the line is on the pty; 400 when the body has no such strings; 403 without the execute permission on terminals, which the terminal's socket asks for; 404 no running terminal of that name
favicon POST {"url": str}, the URL of a page, scheme http or https 200 {"icon": str | null}; 400 when the body is not JSON, has no url, or the url is not a string with the scheme http or https ACC-LINK-33-FAVICON-INPUT
proxy-opens GET none 200 [{"url": str, "openedAt": int, "newBrowserTab": bool | null}], the opens the proxy tap holds, oldest first; [] when the tap is not installed
old-settings GET none 200 {"keys": {key: value}, "raw": str}: keys of the settings file saved under the old npm name, {} when the file is absent or cannot be read, or the marker carried exists; raw, the settings text as the settings API answers it
old-settings POST none 204; writes the empty marker carried beside the old file, and nothing when the old file is absent
settings-write POST {"base": str, "raw": str}, the text read and the new text 204 saved; 409 the file no longer holds base, nothing written; 400 when the body has no such strings or the schema refuses raw

terminals

  • Reads a copy of self.settings["terminal_manager"].terminals; an absent manager gives {"terminals": []}
  • Each entry is read by read_terminal(pid, fd) of process_reader.py in an executor, because /proc reads block
  • POST writes line with ptyproc.write, as the terminal's socket does with typed input, and answers after the write
  • bookmark: the shell's JUPYTERLAB_BOOKMARK, or "". pending: a terminal with the marker whose line POST terminals has not written yet, recorded as line_typed on the terminal object and read before the pty; or FIONREAD on /proc/<shell pid>/fd/0 reports unread input, the recipe line typed before the shell was ready
  • A page closed or a tab that cannot connect between the terminal's start and the POST leaves a marked terminal pending with no line typed: a later click attaches to its shell, and the bookmark's recipe does not run in it
  • The shell gives no event between reading a line and starting the program, so a click in that moment starts a second terminal
  • Two lab pages clicked within one GET terminals answer each start a terminal, because neither answer holds the terminal of the other page
  • The fitted size and the line travel on two connections. The page sends set_size on the socket before it sends the POST, and no event says that the server has handled set_size. A socket slower than the POST, forced by relaying the socket through the test process, starts the program at the size the pty had, 24 rows 80 columns in that run; the program then receives SIGWINCH
  • The foreground group leader is the shell, or cannot be read: command is "", cwd is the shell's cwd, env is {} ACC-SESS-58-SHELL ACC-SESS-59-UNREADABLE
  • Otherwise command is shlex.join(argv), cwd is the leader's cwd, and env is the added-or-changed diff without the excluded names of section 2
  • The excluded names of process_reader.py are applied on the server; the expressions of sessionEnvExclude are not, because the setting is read in the frontend where a capture is stored ACC-SESS-88-ENV-FILTER
  • The package imports where fcntl and termios are absent: both are imported inside the pty read, and a missing one gives pending false, so the server part loads on Windows (DEF-SESS-10-WINDOWS-IMPORT)
  • Everything else reads /proc. Where it is absent, or os.tcgetpgrp is, the shell gives an empty cwd, command, env and bookmark, so each terminal is listed with empty fields rather than an error

favicon

  • Fetches the page with its own Tornado AsyncHTTPClient: 5 s timeout per request, 1 MB body limit
  • Parses the HTML with html.parser and takes the href of the first <link> whose rel holds the word icon, so rel="shortcut icon" counts; an href that starts with data:image/ is returned as it is, within the same cap ACC-LINK-29-FAVICON-ROUTE
  • No icon link: urljoin(<page URL after redirects>, "favicon.ico"), beside the page ACC-LINK-30-FAVICON-BESIDE
  • The icon answer must have an image/* content type and fit in 32768 characters as a data URL; otherwise icon is null ACC-LINK-32-FAVICON-CAP
  • A fetch error or an HTTP error answer gives {"icon": null}, not an error, because the icon is optional ACC-LINK-31-FAVICON-NONE
  • The server fetches any http(s) URL for an authenticated user; this grants nothing that a terminal does not

proxy-opens and the proxy tap

  • _load_jupyter_server_extension wraps the tornado log_function setting, which tornado calls once per finished request. The wrapper is installed only when jupyter_server_proxy.handlers is in sys.modules; without the proxy the setting stays as it was and the list stays empty. An open counts when its request finishes, so a page whose request finishes after its row was removed brings the row back once, and a second removal keeps it out. When ProxyHandler or NamedLocalProxyHandler is missing after an upgrade, the server logs one warning and installs nothing ACC-RECENT-121-INERT
  • The wrapper always calls the wrapped function, and catches and logs every exception of its own, because an exception there makes tornado finish the request a second time
  • A request counts as an open by these rules, in order: the handler is a ProxyHandler; the backend port differs from serverapp.port, read at request time, so the lab through the proxy on its own port is dropped, its redirects too, and a service on another allowlisted host on that port number is dropped with it ACC-RECENT-110-NOT-LAB; the method is GET; Sec-Fetch-Dest is document, iframe or frame, or, when the header is absent on a plain HTTP origin, Accept holds text/html; Sec-Purpose is absent; the status is 2xx or 304; the path of Referer does not start with <base>proxy/ or <base><name>/ of a configured or an entry-point server ACC-RECENT-109-ANY-OPEN
  • The backend port is handler.port for a named server, else path_args[-2], by the proxy's route patterns. Neither is a documented API of the proxy, so test_proxy_tap.py asserts them against handlers built from the proxy's real routes ACC-RECENT-122-TAP-API
  • scrub_query removes each query parameter whose name holds token, auth, key, code, state or xsrf, the keys of jupyter_server.log, before the URL is held. It removes the parameter and does not mask its value, so a reopen still loads ACC-RECENT-117-NO-SECRET
  • The held list is a dict in web_app.settings, one entry per URL, at most 100, the oldest dropped; a restart of the server empties it. Each entry holds the scrubbed path and query, the server's openedAt and newBrowserTab: Sec-Fetch-Dest document is true, the others false, and an absent header, as on a plain HTTP origin, null ACC-RECENT-120-REOPEN-MODE
  • After each open the server emits an event of the schema events/proxy_open.yaml, with no data, so a secret cannot leave through it. The event is only the signal; the route is the source, because an open with no lab page listening is lost on the bus ACC-RECENT-123-LAB-CLOSED

old-settings and the carry-over

  • The rename to the scoped npm name moved the settings file, which holds the bookmarks, from <settings dir>/jupyterlab_bookmarks_manager_extension/ to <settings dir>/@stellarshenson/jupyterlab-bookmarks-manager-extension/. The old file is only read; nothing writes, moves or deletes it
  • The route reads the old file with json5, so comments are fine, from user_settings_dir of the running lab. A file that is absent answers {} in silence; a broken file answers {} with a warning in the server log
  • carryOldSettings in model/carry_over.ts applies the answer through the settings registry, one key at a time, and activate awaits it before the store reads the settings and before the panel is added. A key the schema does not declare is skipped. A key with a saved value stays, which also keeps a copy the server extension of stellars_jupyterlab_extensions made at server start. A rejected key is a warning and the registry reloads, because it keeps a rejected value in its copy of the file. A failure of the route, the reload or the post is a console warning and a notification that stays until closed, and the panel loads: a lab whose labextension was upgraded while its server still runs old code answers 404 on the route, the panel looks empty, and an add would hide the old bookmarks, so the notification says to restart the Jupyter server before adding a bookmark
  • Two lab pages that load at once carry at the same moment, and one saves its older copy of the file over a key of the other; bookmarks is safe from that, because every save takes it from a fresh read (below). After a carry the file is read once more and a key that is gone is set again. The post runs after these passes, so a page that asks the route before the post gets the keys. A page that read the settings file before the other page saved, and asks the route after that page's post, gets no keys. The registry reads the settings before the plugin activates, so the route's answer also holds the settings text: a text other than the page's own read makes the page read the file again. The marker and the text come from one synchronous handler, so a page that gets no keys because of the post gets a text that holds what the other page saved, and the panel is right in every order. An unchanged file costs no request, so a load with nothing to carry sends no extra request
  • The carry runs once. When the route answered at least one key, carryOldSettings posts to it after its passes, also when every key already had a saved value or a key was rejected: a rejected value will never pass, and a key already saved may later be removed. A save that fails as a request, with ServerConnection.ResponseError or NetworkError, is not a rejected value: it gives the warning and no post, so the next load carries again. The post writes the empty file <settings dir>/jupyterlab_bookmarks_manager_extension/carried, and read_old_settings, the one reader, answers nothing while that file exists, so Restore to Defaults does not bring the old bookmarks back, in the panel or through the CLI. The marker sits in the settings folder, so a lab with its own settings folder has its own marker
  • With no key answered there is no post, and a post with no old file writes nothing, so a fresh install has no marker folder and a file that appears later is still carried

settings-write and the writers

  • The lab's PUT has no version check, so two writers that read the same text lose one write, with no error. Every writer of this extension saves through this route instead: the store, the Settings Editor, the carry-over and the CLI. A page of an older labextension or another caller of the lab's PUT still writes with no compare
  • The handler compares base with the text jupyterlab_server.settings_utils.get_settings gives, the text the settings API answers, so an absent file and a file the schema rejects count as {}, and writes with save_settings, which validates. The method is synchronous: no other request of the server runs between the compare and the write. jupyterlab_server is imported where it is used, so the package still imports without a lab
  • A writer reads, builds its text from that read and posts it with the text read as base. On 409 it reads and builds again, at most 32 times: a refusal means another writer saved, and 32 saves during one write means something writes in a loop. After the last refusal the page shows an error notification and the CLI exits 1, and nothing is written. No timer is involved
  • A server without the route answers 404. The page shows the restart warning of the carry and the CLI says to restart the Jupyter server; neither falls back to the PUT. A server that answers GET old-settings in the shape it had before raw gives the same warning
  • guardSaves (model/guarded_saves.ts) replaces save on registry.connector for this plugin, because the registry has no other point to reach the saves of the Settings Editor. The form saves the page's whole copy, bookmarks included, so a bookmark written outside this page would be removed, and one removed outside would return. A save whose bookmarks equal a value this page read takes them from a fresh read; the page keeps a 53-bit digest of every value it read since it loaded, not a copy, because each value holds every favicon, up to 32768 characters each; the digest is over a text with sorted keys, so two values that differ only in key order are the same. It keeps them because the form holds its copy while a change waits for its debounce or stays invalid, so a copy can be of any age. A save whose bookmarks differ from all of them, or that removes the key while the page's user settings hold it, is a hand edit in the JSON Settings Editor or Restore to Defaults. Restore to Defaults is kept. A hand edit is kept while the file holds the page's last read; on an old read it is refused, the raw editor shows Your changes were not saved. with the message to copy only the part that changed, reload the page and make that change again, and the file stays, because saving the text would delete what another writer saved. The message also says that pasting the whole old text deletes the outside change, because that paste after the reload is a hand edit on a current read and saves as typed: the code cannot tell it from a deliberate edit. A known limit: a hand edit whose bookmarks are exactly a value the page read before, or share a digest with one, counts as a copy, so the fresh value stays, nothing is lost, and the edit does not apply until a reload or through the panel. A text whose bookmarks are replaced is saved as plain JSON, without its comments
  • With no lab found the CLI holds fcntl.flock on plugin.jupyterlab-settings.lock beside the settings file from the read to the write, so parallel runs write one after another; the lock is on a file of its own because the write replaces the settings file, and it stays there. On a platform without fcntl the add is refused and says to start the lab. The route does not take this lock, so a run that finds no lab while one runs on the same folder is not ordered against that lab

Server files under jupyterlab_bookmarks_manager_extension/: routes.py (registration), terminals_handler.py, process_reader.py (/proc reading, the diff, the exclusions, the marker and the unread input), favicon_handler.py, favicon_fetch.py, proxy_tap.py, proxy_opens_handler.py, events/proxy_open.yaml, old_settings.py, old_settings_handler.py and settings_write_handler.py.

5. Frontend

Modules under src/:

ModulePurpose
index.tsThe plugin: loads the setting, builds the store, the Proxy section's list, the terminal snapshot, the marks and the panel, adds the panel to the left side bar, registers the commands, the tab menu and the drag, and starts followProxyOpens
request.tsThe template helper requestAPI: calls a route under <base_url>/jupyterlab-bookmarks-manager-extension/ and parses the JSON answer
icons.tsbookmarksIcon, the panel's own LabIcon, named jupyterlab_bookmarks_manager_extension:bookmarks and painted with jp-icon3. Every other icon is a stock icon of @jupyterlab/ui-components: folderIcon, linkIcon, terminalIcon, fileIcon, addIcon, filterIcon, refreshIcon; the caret is a text glyph (▾ or ▸)
commands.tsThe ids of the nine commands; registers New Bookmark, New Folder, Rename Folder, Delete Folder, Edit Bookmark, Remove Bookmark, Add to Bookmarks and Remove from Proxy, the row context menus and blank(section), the empty bookmark of a section's kind
tab_menu.tsThe toggle-tab command and its two tab-bar context-menu items; its Add runs addTabBookmark
tab_add.tsaddTabBookmark, the one add the tab menu and the drag onto the panel run: into the kind's section or into the folder a drop landed in, kept when the section already holds the bookmark, a terminal read again, the captured env filtered and a link's favicon fetched, with the tab's widget.title.icon as the fallback ACC-LINK-142-TAB-ICON
model/types.tsThe types of section 3
model/tree.tsPure functions over one section: findNode, bookmarksIn, countBookmarks, updateNode, addNode, removeNodes, moveNode, and the filter's matchesFilter and filterNodes; none mutates its input, every one accepts any depth
model/settings_write.tscompareAndSet: read, build, POST settings-write, read and build again after a 409; settingsText, the text the store and a merged save write; RESTART_WARNING
model/guarded_saves.tsguardSaves: sends the saves of the Settings Editor and the carry-over through compareAndSet and keeps their bookmarks from overwriting a newer value
model/carry_over.tscarryOldSettings: applies the keys of GET old-settings through the registry
model/store.tsBookmarkStore: reads settings.composite.bookmarks. update(section, change) queues the write on one promise chain; each write reads with registry.reload(plugin), applies change to the fresh section, saves through compareAndSet and reads again; a failed write is logged and the next one runs. changed is the setting's own signal, emitted after every reload. The compare keeps another lab window or a CLI run from losing a bookmark in any order ACC-STORE-83-OTHER-WINDOW ACC-STORE-127-WRITERS. The getters sessionEnvExclude, recentProxyTtlDays and markColour read the composite at each access, so an edit applies without a page reload
model/names.tsDefault names: fileName(path) and sessionName(command, cwd)
classify/tab_kind.tsclassifyTab(widget, contextForWidget) gives {kind: 'file', path}, {kind: 'terminal', name}, {kind: 'link', url} or null; terminalName(widget) by duck typing
classify/bookmark_match.tstabMatches(kind, terminals, baseUrl), the bookmark that records a tab's file, page or terminal, and SECTION, the section of each tab kind; the tab menu, the drag and the marks share both
link/link_url.tstoStoredUrl, toAbsoluteUrl and isSameOrigin
link/favicon.tsfetchFavicon: the lab's origin from the browser with a plain fetch, so the proxy passes no token to the service; another origin through POST favicon; capIcon at 32768 characters; storeFavicon writes the icon only while the link still has the URL it was fetched for, and takes an optional tabIcon as the fallback - a string already a data: URL, or a LabIcon's SVG source converted to data:image/svg+xml;utf8,<encoded>, other strings ignored; the page's own icon wins ACC-LINK-142-TAB-ICON
link/open_link.tsopenLink: a lab tab for the lab's origin, a browser tab for any other origin
file/file_status.tsisFileMissing: contents API get(path, {content: false}); only a 404 counts as missing, any other error is logged and leaves the file unmarked ACC-FILE-50-CHECK-ERROR
file/file_icon.tsfileTypeIcon: registry.getFileTypeForModel({path}).icon, else fileIcon
session/shell_quote.tsshellQuote, exportLine(env, command), parseEnvLines (refuses an invalid line and the excluded names of section 2) and formatEnvLines
session/env_filter.tsThe setting sessionEnvExclude: matchesEnvName on *, ? and [...] with case kept, and filterCapturedEnv, applied where a captured env is stored ACC-SESS-88-ENV-FILTER ACC-SESS-91-ENV-SETTING
session/terminal_snapshot.tsITerminalInfo, sameSetup, findOpenTerminal(recipe, terminals, openNames), fetchTerminals, and TerminalSnapshot: one snapshot shared by the tab menu's label and the marks, refreshed on runningChanged, when the context menu opens on a terminal tab, on Add and after a change of the setting
session/open_session.tsopenSession: the click on a session bookmark, figure 3
mark/marks.tsmarkValue, the setting's value as brand or red; TabMarks, which classifies every main-area tab, matches the bookmarks with tabMatches, writes data-bookmark on the tab element for the ribbon, and exposes open and current with changed for the panel ACC-MARK-96-TAB-MARK ACC-MARK-97-OPEN-ROW
recent/recent.tsSERVER_PROXY_OPEN, the popup's proxyPageUrl, fallbackName and parseTitle, IRecentProxyEntry, pruneRecent (TTL), recordRecent (newest first, one entry per URL), matchesRecent, formatAgo, mergeSeen, opensAfter, listedUrl, seenFallbackName, readServiceName, and RecentProxyStore over IStateDB: load, record, remove, take pages the proxy saw with the watermark, changed; no link filter ACC-RECENT-93-SECTION ACC-RECENT-95-TTL DEF-PROXY-57-CAPTURE
recent/open_recent.tsopenRecent: a row click activates the lab tab whose address, or the address it opened at, is the page, because a tab another route opened has another widget id; otherwise it runs server-proxy:open again with the stored url, title, newBrowserTab and id ACC-RECENT-94-OPEN ACC-RECENT-120-REOPEN-MODE
recent/proxy_feed.tsfollowProxyOpens: loads the list, then reads GET proxy-opens at that point, on the event of events.stream and on visibilitychange, one read at a time; a page not yet listed is named by readServiceName, else seenFallbackName ACC-RECENT-109-ANY-OPEN ACC-RECENT-118-NAMED ACC-RECENT-123-LAB-CLOSED
panel/bookmarks_panel.tsBookmarksPanel, a SidePanel: the top bar (title, Filter, Refresh), the filter box, the body with the three bookmark sections and the Proxy section, the + menu of the bookmark section headers, the Clear confirmation dialog, the + button that opens the Open Proxy Page dialog, click, keyboard and focus handling, the missing-file state and the fold state
panel/press_gate.tsPressGate: holds a render while a pointer is pressed, because a row replaced under a pressed pointer loses its click and a tab drag's drop mark. The render due runs at the click of the release, on the document in the bubble phase; at auxclick or pointercancel; or at the next pointermove. A press whose pointerdown a handler prevented, as Lumino's tab drag does, ends with no click, so the render runs at its release. A new pointerdown leaves it due to the end of that press. A browser pointermove with no button during a press ends the press, for a release the browser did not report. The listeners exist only while a press is held or a render is due
panel/section_view.ts, panel/row_view.tsDOM of one section (its header with the fold toggle, the label -sectionLabel and the count -sectionCount, and the Clear button and the + button), one folder or bookmark row with the open dot, the last-present time and the current-tab state; renderRecentSection, its + button and its row with the age column ACC-PANEL-138-COUNT ACC-PANEL-140-AGE
panel/last_present.tsLastPresentStore: each bookmark's last-present time in the state database under jupyterlab_bookmarks_manager_extension:last-present; load, record, save ACC-PANEL-140-AGE
panel/tab_drop.tsThe pointer drag of a main-area tab onto the panel: dropTarget resolves the section or the folder under the pointer, and the release adds through addTabBookmark ACC-PANEL-99-DRAG-TAB
panel/fold_state.tsThe collapsed ids in localStorage, read and written in try/catch
dialogs/form.tsThe dialog body table, textInput, showEditDialog (which sends one input event once the dialog is ready, so a New Bookmark dialog starts with Save disabled) and the Cancel and Save or Open buttons
dialogs/open_proxy.tsThe Open Proxy Page dialog: its fields, the Name field following the service name, the read through the proxy, the record of the page and the run of server-proxy:open ACC-RECENT-111-POPUP ACC-RECENT-112-OPEN-PAGE ACC-RECENT-115-SERVICE-NAME ACC-RECENT-116-SET-NAME
dialogs/folder_select.tsThe Folder <select> of the three dialogs, dialogTitle (New Bookmark for a bookmark the section does not hold), saveEdit, which writes the edited fields over the bookmark, so an icon that arrived while the dialog was open stays, and folderChoice
dialogs/edit_link.ts, edit_file.ts, edit_session.tsThe three dialog bodies and their showEditDialog calls; the same dialog opens for New Bookmark... with empty fields

Plugin

  • Requires ISettingRegistry, IDocumentManager and IStateDB; ILayoutRestorer is optional
  • Activation: registry.load(PLUGIN_ID), then the BookmarkStore, the RecentProxyStore, one TerminalSnapshot, the TabMarks and the BookmarksPanel; then followProxyOpens starts recent.load() and does not await it, because the state database's fetch waits for the workspace load, which runs after every plugin has activated, so awaiting it inside activation would deadlock the start; then app.shell.add(panel, 'left', { rank: 600, type: 'Bookmarks' }), restorer.add(panel, panel.id), addCommands, addTabMenu and addTabDrop
  • Dependencies in package.json: @jupyterlab/application, apputils, docmanager, docregistry, settingregistry, statedb and ui-components at ^4.6.0; @jupyterlab/coreutils ^6.6.0; @jupyterlab/services ^7.6.0; @lumino/coreutils ^2.2.0; @lumino/signaling ^2.1.6; @lumino/widgets ^2.10.0. @jupyterlab/terminal is not a dependency

Commands

All in the namespace jupyterlab_bookmarks_manager_extension:.

IdLabelWhere
toggle-tabAdd Tab to Bookmarks or Remove Tab from BookmarksTab context menu, rank 25
editEdit Bookmark...Bookmark row context menu, first group
removeRemove BookmarkBookmark row context menu, last group below a separator, class jp-BookmarksContextMenu-danger ACC-TREE-18-REMOVE
new-bookmarkNew Bookmark...The + menu of a bookmark section header, which runs it with {section} ACC-TREE-90-NEW-BOOKMARK
new-folderNew FolderThe + menu of a bookmark section header, which runs it with {section} ACC-TREE-89-PLUS-MENU
rename-folderRename Folder...Folder row context menu, first group ACC-TREE-15-RENAME-FOLDER
delete-folderDelete FolderFolder row context menu, last group below a separator, danger class; removes the folder and its bookmarks after a confirmation dialog that names their number ACC-TREE-16-DELETE-FOLDER ACC-TREE-17-DELETE-CANCEL
add-recentAdd to BookmarksProxy section row context menu, first group; adds the page at the Links root and fetches its favicon ACC-RECENT-94-OPEN
remove-recentRemove from ProxyProxy section row context menu, last group below a separator, class jp-BookmarksContextMenu-danger; its label and icon are --jp-error-color1 at rest and while selected, and the selection background is the menu's own ACC-RECENT-94-OPEN ACC-PANEL-144-PROXY-DANGER

The row menus use the selectors .jp-BookmarksPanel-row:not(.jp-BookmarksPanel-folder):not(.jp-BookmarksPanel-recent) for bookmarks, .jp-BookmarksPanel-folder for folders and .jp-BookmarksPanel-recent for Proxy section rows, so the three menus never mix. The bookmark and folder menus carry edit or rename-folder at rank 1, a separator at rank 2 and the destructive entry at rank 3; the Proxy section menu carries add-recent at rank 1, a separator at rank 2 and the destructive remove-recent at rank 3.

Tab menu, toggle-tab

  • Items on #jp-main-dock-panel .lm-DockPanel-tabBar .lm-TabBar-tab and #jp-down-stack .lm-TabBar-tab[data-id], rank 25
  • The widget: app.contextMenuHitTest(node => !!node.dataset.id) gives the tab's data-id, looked up in app.shell.widgets('main') and app.shell.widgets('down')
  • The kind, by classifyTab: a document context from IDocumentManager.contextForWidget → file, path context.path; widget.content.session.name a string → terminal; exactly one iframe with an http(s) address → link; anything else → isVisible is false, and Lumino renders the item with lm-mod-hidden ACC-PANEL-5-NO-ITEM
  • The label reads Remove Tab from Bookmarks when a bookmark of that kind matches - a link with the same absolute URL, a file with the same path, a session with the same command and cwd as the snapshot entry of that terminal name - and Add Tab to Bookmarks otherwise ACC-LINK-22-MENU-LABEL ACC-FILE-41-MENU-LABEL ACC-SESS-61-MENU-LABEL
  • Execute performs the verb the label showed. Add never removes, and it adds nothing when a match exists by then; Remove removes every match. The tab menu and the drag of a tab onto the panel run the same add, addTabBookmark of tab_add.ts ACC-LINK-23-MENU-REMOVE ACC-FILE-42-MENU-REMOVE ACC-SESS-62-MENU-REMOVE
  • Add of a terminal reads GET terminals fresh and records that entry's cwd, command and env, so the recipe is current even when the snapshot was old; the captured env passes filterCapturedEnv with the setting sessionEnvExclude, read at that moment, so an edited list applies without a page reload ACC-SESS-53-MENU-ADD ACC-SESS-88-ENV-FILTER
  • Add of a link stores the tab title as the name and the URL in stored form, then fetches the favicon ACC-LINK-20-MENU-ADD
  • The snapshot refreshes on serviceManager.terminals.runningChanged (a failed refresh is dropped, DEF-SESS-8-ROUTE-MISSING), when the context menu opens on a terminal tab (app.contextMenu.opened), on Add of a terminal, and after every change of the setting, because the tab menu and the marks share one snapshot. After each refresh and each change of the setting the code calls commands.notifyCommandChanged and app.contextMenu.menu.update(), because a Lumino menu redraws only on update()

Drag a tab onto the panel

  • A press on a main-area tab that moves 5 px is a drag, the threshold of Lumino's own tab drag; the drop is followed by capture-phase pointerdown, pointermove and pointerup on the document, because Lumino moves a tab by pointer events, and the tab's own move between dock areas is left alone ACC-PANEL-99-DRAG-TAB
  • Where it lands: a folder row of the tab kind's section takes the bookmark inside that folder; every other part of the panel takes it at the tab kind's section root, including a folder row of another section, because a folder holds the bookmarks of one kind; outside the panel nothing lands
  • The release adds through addTabBookmark, so the checks are the tab menu's: a bookmark the section already holds is kept, a terminal is read again, the captured env is filtered and a link gets its favicon
  • While the pointer rests over the panel the target section header or folder row carries jp-mod-dropTarget, a 2 px --jp-brand-color1 outline inset by 2 px over an 8% brand wash; the mark goes on the release and when the pointer leaves the panel, and Escape and the context menu abort the drag
  • elementFromPoint reads the panel because Lumino's tab drag covers the pointer with its cursor backdrop; the lookup drops the backdrop behind the page for the call, as Lumino's own drop code does

Opening a link

  • openLink turns the stored URL into the absolute URL; another origin → window.open(url, '_blank', 'noopener')
  • The lab's origin: the main-area widget with the id bookmarks-link-<id> is activated when it is open, its URL set again when it differs; otherwise a new MainAreaWidget around a sandboxed IFrame, titled with the link name and linkIcon, closable
  • The favicon of a page on the lab's origin: a plain fetch with cache: 'no-store' for the page and the icon; when the page answers OK with an HTML content type, DOMParser and link[rel~="icon" i], else favicon.ico resolved against the page URL; a data: href is taken as it is; the icon must answer OK with an image/* type and at most 32768 bytes, and is read as a data URL with FileReader, then capped at 32768 characters
  • Any error while fetching a favicon gives a console warning and no icon; the row keeps linkIcon ACC-LINK-31-FAVICON-NONE

Opening a session bookmark

A click or Enter on a session row runs openSession(app, bookmark). The match is made against a fresh GET terminals, never against the snapshot of the tab menu: click → match → switch, or click → no match → new terminal.

Figure 3. The click on a session bookmark Three checks in order: an open of the same bookmark still running, a terminal with the bookmark marker and a line not typed yet or pending input, and a terminal with the same command and cwd. A match runs terminal:open; no match starts a new terminal through POST api/terminals, terminal:create-new, a wait for the tab to connect, and POST terminals. Click or Enter on a session row the second click of a double-click is ignored (event.detail > 1) Is an open of this bookmark still running? opening: a map of promises by bookmark id yes Return that open's promise this click starts nothing no Read GET terminals now, never the snapshot and the names of the open terminal tabs, main and down areas A terminal with bookmark = this id and pending = true? JUPYTERLAB_BOOKMARK marks it; pending: line not typed or input unread yes no findOpenTerminal: the same command and the same cwd? an empty command matches any idle shell in that cwd of several matches: the one with an open tab, else the first listed yes no Switch terminal:open {name} activates the terminal's tab, or opens a tab on the running terminal when its tab was closed; starts no terminal POST api/terminals {cwd, extra_env: {JUPYTERLAB_BOOKMARK: id}} terminal:create-new {name} opens a tab connected to the new terminal then waits for its terminal's ready and session's connected POST terminals: the export line and Enter, on the pty export K='v' ...; <command> New terminal starts in the stored cwd, also an absolute path outside the server root its shell carries JUPYTERLAB_BOOKMARK, so a click before the line is typed or read finds it through pending and starts no second one after Ctrl-C the marker stays, pending is false, and a click starts a new terminal env and command both empty: no marker, no line
Figure 3. The click on a session bookmark, from the marker-and-pending match to a switch or a new terminal. The marker check exists because for about 3 s after a start the server reports only the shell, so the command check does not yet find the new terminal. On a narrow screen the figure scrolls sideways.

Proxy

  • Recording: followProxyOpens reads GET proxy-opens at the lab's load, on each event of the schema .../events/proxy-open and when the page shows again, because a hidden page can lose its socket. Each open newer than the watermark becomes an entry with url = new URL(open.url, baseUrl).href, newBrowserTab: open.newBrowserTab === true, id: server-proxy:<url> and the server's openedAt, and takeSeen merges them and saves the watermark. A removal adds one read to the same queue and holds the page's URL until that read has finished; take drops a page with a held URL at its last step, in the same synchronous run as the merge, and the watermark still passes that page's opens. So a removal covers every open the server holds when a read that starts after the removal arrives, and an open after that read has finished brings the row back. Two lab pages each receive the event and each take the page, one row per URL. The list and the watermark are per workspace, so a removal or a typed name stays in that lab page, and a lab page with a new workspace takes every held open. No code observes server-proxy:open any more ACC-RECENT-109-ANY-OPEN ACC-RECENT-119-REMOVED ACC-RECENT-123-LAB-CLOSED
  • The name of a page not yet listed is readServiceName, else seenFallbackName: Proxy :<port><path> for a URL that holds a port, else its path under the lab. A listed page keeps its name ACC-RECENT-118-NAMED
  • Reading: each render prunes the list with recentProxyTtlDays and Date.now(), drops the pages a link bookmarks and applies the filter box's text; the panel redraws on RecentProxyStore.changed, so a record, a removal, a bookmark and a change of the setting show without a page reload
  • A click records the page at once, because a lab tab that is open sends no request and the tap sees nothing. It then activates the main-area tab whose address, or the address it opened at, is the page, and otherwise runs server-proxy:open with the stored arguments: an open lab tab whose id is id is activated, otherwise created, and newBrowserTab opens a browser tab and nothing else ACC-RECENT-94-OPEN ACC-RECENT-120-REOPEN-MODE
  • A restored proxy tab loads its page, so the tap sees that load too, and its row moves to the top
  • Add to Bookmarks adds a link at the Links root, named with the entry's title and with its URL in stored form, then fetches its favicon; a URL the fresh Links value already holds adds nothing, so a second click while the save runs, or another window that still lists the row, makes no second link; the Proxy section row stays listed, because a link adds its own record DEF-PROXY-57-CAPTURE. Remove from Proxy removes the entry; the page stays open and a later open records it again. A lab tab of that page still open is restored at a reload and loads its page, which counts as a later open

Open Proxy Page

  • Open runs server-proxy:open with url = <base URL>proxy/<port>/<path without its leading slash>, title, newBrowserTab and id = server-proxy:<url>, so opening the same page again activates its tab. The command's url keeps what Path holds, because the page needs it, and the proxy's tab restore saves it in the workspace file. The popup records the page itself just before the run, not awaited, because window.open needs the click's user activation: a page on a closed port has a row, and the observation that follows merges with it and keeps the name. The popup records nothing when Port is the port of the lab page's own address, so the lab has no row; a lab behind a port map or a hub still gets a row for its real port. The URL recorded is listedUrl of the URL the read ended at, so a page that redirects and a path holding a secret are still one row. The proxy's command does not retitle a found tab and sets the id on the tab's content, so the popup then sets title.label on the main-area widget whose content.id is that id; the tab and the row take the new name. A lab reload returns that tab to the title of the first open, because the proxy's tracker saves a tab's restore data only when it adds the tab; the row keeps the new name ACC-RECENT-112-OPEN-PAGE
  • The service name is the <title> of the page, read with a plain same-origin fetch and stopped after 3 s. The fetch has cache: 'no-store', because Chromium's HTTP cache holds a second GET of one URL until the first ends, and the read on Open, which follows the read of the change by a moment, would spend its limit waiting; a page that answers in 2.9 s then gets its title. The read sends what the browser sends when the page loads in a tab, and not the token and XSRF header of ServerConnection.makeRequest, because jupyter-server-proxy passes them to whatever listens on the entered port; the body is read only for an OK text/html answer and parsed with DOMParser, which runs no scripts; white space is collapsed and the value is set as value, never as HTML. A page with no title, another answer or a timeout gives the fallback Proxy :<port><path with its leading slash>, taken from listedUrl of the URL, so it holds no secret of the Path field. The read has a 3 s limit, after which the row keeps its fallback name ACC-RECENT-115-SERVICE-NAME
  • The Name field follows the service name on a change of Port or Path: the field is empty with the fallback as its placeholder during the read, so a name typed then does not join it, and holds the title or the fallback when the answer comes, selected while the field has the focus, so the next key replaces it; an answer for a port or path since changed is dropped, and an invalid Port empties the field
  • A typed name stays when Port or Path changes; a field the user emptied counts as not typed; Reset Name returns the field to the service name and to following it ACC-RECENT-116-SET-NAME
  • On Open the answer of the last finished read is used when it belongs to the URL on Open, so the tab opens at once; a typed name replaces only its title. With no answer for that URL yet, the case of Enter before a change event or of a name typed before Port and Path, Open reads the page and the tab opens when the read ends. The 3 s limit stays under the 5 s for which browsers keep the click's user activation, which window.open needs for a browser tab

Marks

  • TabMarks reads every main-area widget, classifies it as the tab menu does and matches the bookmarks with tabMatches; a match writes data-bookmark - brand or red, the setting markColour - on the tab element, and the stylesheet paints the ribbon from it ACC-MARK-96-TAB-MARK
  • The ribbon is the tab label's ::after, 7 px wide and 11 px tall, hanging from the tab's top edge 3 px from its right border with a notch at the bottom; a marked tab takes 14 px of right padding where an unmarked one takes 8, so the tab is 6 px wider, and its close glyph is 15 px where the stock glyph is 16 px
  • The pseudo-element keeps the ribbon in the marker colour on a tab that jupyterlab_colourful_tab_extension colours, because that extension paints a background with !important on the elements of the tab, not on a pseudo-element
  • The mark follows the tabs and the bookmarks: TabMarks syncs on currentChanged, on the shell's layoutModified (the shell is a DockPanel), on the snapshot's changed and after every change of the setting, so a tab shows or loses its ribbon without a page reload ACC-MARK-96-TAB-MARK
  • open holds the ids of the bookmarks with an open tab and current the current tab's bookmark; the panel redraws on TabMarks.changed and paints the row dot and the tint ACC-MARK-97-OPEN-ROW
  • markValue reads any value but red as brand; the two map to --jp-brand-color1 and --jp-error-color1, through the tab element's data-bookmark and the panel root's data-mark ACC-MARK-98-MARK-COLOUR

6. Panel UI

Every visible part follows the Extension Design System of the jupyterlab-extension skill: classes jp-BookmarksPanel-<component> with jp-mod-<state>, colours from --jp-* variables chosen by role.

Figure 4. Panel anatomy The panel beside its side-bar tab: the top bar with the title, Filter and Refresh; four sections with sticky headers and the + button on each, a folder row, a bookmark row inside it, the current tab's tinted row with the open dot, a file row, a missing file row and a collapsed section; below, the section + menu and the bookmark, folder, Proxy and tab context menus. BOOKMARKS ▾ LINKS (2) ▾ Apps MLflow Resources ▾ FILES (2) README.md notes.md ▸ SESSIONS (1) ▾ PROXY (2) MLflow UI now Proxy 7681 2h ago -header: the top bar with the title, Filter and Refresh -sectionHeader: sticky band with the -sectionToggle, the Clear eraser and the + button -folder row: caret ▾ or ▸, folderIcon; a click folds it -row in a folder: 24 px high, indented 16 px a level jp-mod-current: the current tab's row, tinted; -rowMark the open dot -clear / -plus: Clear and New Bookmark or Folder, 18 px band controls, 14 px glyphs file row: the file-type icon; the tooltip is the path jp-mod-missing: muted, struck through; aria-label adds File not found jp-mod-collapsed section: the body is not rendered, the count stays PROXY: + opens Open Proxy Page; the age in -rowTime a Proxy section row: jp-mod-recentlyActive under a minute, jp-mod-stale over seven days a row: hover --jp-layout-color3, but the current tab's row keeps its tint; focus jp-mod-active Section header: + menu New Bookmark... New Folder Bookmark row: context menu Edit Bookmark... Remove Bookmark Folder row: context menu Rename Folder... Delete Folder Proxy section row: context menu Add to Bookmarks Remove from Proxy Document, web or terminal tab: context menu Add Tab to Bookmarks reads Remove Tab from Bookmarks when a bookmark matches hidden on a tab that shows no page, file or terminal
Figure 4. Panel anatomy. Class names without a prefix start with jp-BookmarksPanel. The rows of a section sit in jp-BookmarksPanel-sectionBody, the section's scroller; the filter box, when its top-bar button shows it, stands between the header and the sections. The panel's tab on the side-bar rail shows bookmarksIcon. On a narrow screen the figure scrolls sideways.

Layout

  • app.shell.add(panel, 'left', { rank: 600, type: 'Bookmarks' }); panel id jupyterlab_bookmarks_manager_extension-panel; title.icon is bookmarksIcon, title.caption is Bookmarks; ILayoutRestorer.add(panel, panel.id) when the restorer is present; the side-bar rail is not styled
  • BookmarksPanel extends SidePanel with { content: new Panel() } and house DOM sections inside; no AccordionPanel
  • The header widget jp-BookmarksPanel-header in the SidePanel header, on --jp-layout-color2, holds the title jp-BookmarksPanel-title with the text Bookmarks - weight 600, uppercase, 1 px letter spacing, --jp-ui-font-size0, margin-left: 8px, flex: 1 1 auto - and the Filter and Refresh buttons at its right. .jp-BookmarksPanel .jp-SidePanel-header resets the header's font size to --jp-ui-font-size1: the SidePanel header sets --jp-ui-font-size0 itself and the title set it again, so without the reset the title computed at about 9 px (DEF-PANEL-9-TITLE-SIZE). It now computes to the size of the section labels
  • Root jp-BookmarksPanel: flex column, height: 100%, min-width: 0, --jp-layout-color1, --jp-ui-font-size1
  • Body jp-BookmarksPanel-body: flex column; it scrolls vertically when the four sections are taller than the panel
  • One stylesheet, style/base.css: the panel rules are scoped under .jp-BookmarksPanel, the dialog rules carry the extension's own classes (jp-BookmarksPanel-dialogBody, -form, -banner, -dialogButton), and the dialog's width, --jp-bookmarks-line and --jp-bookmarks-field sit on .jp-Dialog-content:has(.jp-BookmarksPanel-dialogBody), while --jp-bookmarks-secondary and --jp-bookmarks-secondary-hover sit on .jp-Dialog-content:has(.jp-BookmarksPanel-dialogButton); the danger class of the context menu is not scoped, because a Lumino menu attaches to the page body, and the tab-mark rules are scoped to .lm-DockPanel-tabBar, because a tab lives outside the panel. Colours come from --jp-* variables, apart from the black of the recessed input surface; font sizes are --jp-ui-font-size0 and --jp-ui-font-size1; no font-family on labels

Top bar

  • Two icon buttons, Filter (filterIcon) then Refresh (refreshIcon), class jp-BookmarksPanel-iconButton: a 24 px box with a 14 px glyph, title and aria-label Filter bookmarks and Refresh. The header has no right padding, so the last button stands in the column of the section headers' buttons ACC-PANEL-86-REFRESH ACC-PANEL-87-FILTER
  • States: hover --jp-layout-color3; jp-mod-active with aria-pressed="true" on Filter while its box shows, background --jp-layout-color3 and glyph --jp-brand-color1; a disabled button takes opacity 0.4, a default cursor and no hover background. The buttons never hide
  • Refresh: the click disables the button and adds jp-mod-spinning, which turns the glyph (@keyframes jp-bookmarks-spin, 0.9 s). It checks every bookmarked file path again, reads the running terminals again (serviceManager.terminals.refreshRunning()) and waits at least 500 ms, then redraws the four sections and enables the button; a failed terminal read is logged and the files still redraw ACC-PANEL-86-REFRESH
  • Filter: the click shows or hides the box jp-BookmarksPanel-filter, a Lumino widget in the SidePanel content above the sections that starts hidden; showing it focuses the input, hiding it clears the text. The input jp-BookmarksPanel-filterInput is type="search", 24 px high, on the recessed surface of the dialog inputs, 1 px --jp-border-color2 and --jp-brand-color1 on focus, with the placeholder and aria-label Filter bookmarks
  • Every input event redraws. A non-empty trimmed text narrows each section to filterNodes(nodes, node => matchesFilter(node, text)): a bookmark whose name, or URL (the stored form), path or command contains the text, case ignored; a folder stays when it holds a match. The count spans count the matches, and a section without one shows No matching bookmarks. ACC-PANEL-87-FILTER ACC-PANEL-138-COUNT
  • While a text narrows the sections the view's collapsed set holds only the section keys, so every folder shown is open; a click or Enter on a folder row does not fold it then, and the saved fold state returns when the box is empty or hidden

Sections

  • Four div.jp-BookmarksPanel-section[data-section] in the order links, files, sessions, recent; a section has no border of its own ACC-PANEL-3-SECTIONS ACC-RECENT-93-SECTION
  • Section band dividers ACC-PANEL-137-DIVIDER: a 1 px --jp-layout-color3 bottom border on :not(:has(> .jp-BookmarksPanel-sectionBody)):has(+ .jp-BookmarksPanel-section), so only a folded section with a section below it takes it; an expanded section and the last section take none. The title band above the first section takes the same line through .jp-BookmarksPanel:has(> .jp-SidePanel-content > .jp-BookmarksPanel-body > .jp-BookmarksPanel-section):not(:has(> .jp-SidePanel-content > .jp-BookmarksPanel-filter:not(.lm-mod-hidden))) > .jp-SidePanel-header, which sets its border-bottom-color to --jp-layout-color3, because both bands paint --jp-layout-color2; while the filter box shows it sits between them, and the title band keeps the --jp-border-color2 rule of .jp-SidePanel-header. The body has no top border, and the first band stands at its top
  • Header jp-BookmarksPanel-sectionHeader: a sticky band on --jp-layout-color2 with the toggle <button class="jp-BookmarksPanel-sectionToggle" aria-expanded> - the caret, the label jp-BookmarksPanel-sectionLabel LINKS in --jp-ui-font-color1, and the count jp-BookmarksPanel-sectionCount (N), N the number of rows shown after the filter with folders not counted, shown also when collapsed and when 0 - and, on the three bookmark sections, a sibling Clear eraser and + button; no button nests in a button ACC-TREE-9-SECTION-FOLD ACC-PANEL-138-COUNT ACC-PANEL-143-CLEAR-SECTION
  • The count span takes flex: 0 0 auto, margin-left: 6px, --jp-ui-font-color2 and tabular figures, so the label keeps --jp-ui-font-color1 ACC-PANEL-138-COUNT
  • The band is content-sized: 4 px padding plus one --jp-ui-font-size0 line, 21 px in the stock themes ACC-PANEL-141-BAND. Every control in a band, the + and the Clear eraser, is an 18 px square centred in the 21 px band, its 14 px glyph inside it and its hover and active background exactly that square, so no hit area covers the neighbour band; the top bar's jp-BookmarksPanel-iconButton keeps its 24 px box. The rule is scoped to the section header's icon buttons, not the icon button at large DEF-PANEL-59 DEF-PANEL-63-HOVER-OVERLAY
  • The Clear button jp-BookmarksPanel-iconButton jp-BookmarksPanel-clear: the 14 px eraserIcon (24 viewBox, two 2 px stroked paths), data-clear-section the section key, title and aria-label Clear <Section>, disabled while the section holds nothing; it stands before the +, which keeps the rightmost place. The click opens one dialog titled Clear <Section> whose body reads Remove every bookmark and folder from <Section>?, or Remove every page from Proxy?; the buttons are a destructive Clear at the far left, an unfilled --jp-error-color1 outline and label, and Cancel at the right. Clear empties the section through BookmarkStore.update(section, () => []), with the same compare-and-set and retry as every other writer, or RecentProxyStore.clear() for the Proxy list, which emits removed per URL so a feed read in flight keeps the pages out and saves the empty list; Cancel changes nothing and a filter does not narrow the clear ACC-PANEL-143-CLEAR-SECTION
  • The + button jp-BookmarksPanel-iconButton jp-BookmarksPanel-plus: the 14 px addIcon in the 18 px band box, title New Bookmark or Folder, aria-label New Bookmark or Folder in <Section>, aria-haspopup="menu" and aria-expanded; it replaces the single New Folder button of ACC-TREE-10-NEW-FOLDER ACC-TREE-89-PLUS-MENU. The Proxy section header's + button has the title and aria-label Open Proxy Page and aria-haspopup="dialog", opens that dialog instead of a menu, and while the command server-proxy:open does not exist it keeps its place, disabled, with the tooltip Open Proxy Page needs jupyter-server-proxy (IViewState.canOpenProxy); the panel renders again on app.commands.commandChanged for that id, because the server proxy's plugin registers its command after a request ACC-RECENT-111-POPUP ACC-RECENT-114-NO-PROXY
  • The + menu: one MenuSvg of the panel, emptied and filled on each click with new-bookmark and new-folder and the args {section}, opened at the button's rect.left and rect.bottom. While the menu is open the button carries jp-mod-active, the open state of the top bar buttons, and aria-expanded="true"; aboutToClose removes both and focuses the button, so the focus returns to it
  • Body jp-BookmarksPanel-sectionBody with role="tree": the section's scroller, overflow-y: auto; max-height: clamp(5 rows, 33vh, 10 rows) at 24 px a row; not rendered while the section is collapsed; no scrollbar-gutter, so no reserved strip stands beside a row and a row's surface, the current tab's tint included, reaches the panel's right edge when no scrollbar shows ACC-PANEL-139-EDGE
  • Empty section: jp-BookmarksPanel-empty, italic, --jp-ui-font-color2, --jp-ui-font-size0, with the text No links. Use Add Tab to Bookmarks on a tab., and the same with files and sessions; the Proxy section reads No proxy pages. and a section without a match under the filter reads No matching bookmarks. ACC-PANEL-4-EMPTY
  • Every section and every folder starts expanded ACC-TREE-6-EXPANDED

Rows and folders

  • Row jp-BookmarksPanel-row: role="treeitem", aria-level, data-id the node id, 24 px high. All rows of a section are siblings in its body; a row at depth d is indented by 4px + d × 16px through --jp-bookmarks-depth
  • Parts in order: the caret jp-BookmarksPanel-caret (an 8 px column, ▾ or ▸ on a folder, empty on a bookmark so that the icons line up), the icon jp-BookmarksPanel-rowIcon (16 px), the name jp-BookmarksPanel-rowName (flex: 1 1 auto; min-width: 0) with the text span jp-BookmarksPanel-rowText, the only part that ellipsises, and, at the right end, either the 7 px dot jp-BookmarksPanel-rowMark of an open bookmark's row, aria-hidden, whose aria-label gains , open, or the time jp-BookmarksPanel-rowTime of a bookmark whose tab is closed, formatAgo(now - lastPresent) at --jp-ui-font-size0, --jp-ui-font-color2 and tabular figures, whose aria-label gains , <time>; a bookmark never present shows neither ACC-PANEL-140-AGE
  • Folder row jp-BookmarksPanel-row jp-BookmarksPanel-folder with aria-expanded and folderIcon; a click folds or unfolds it; jp-mod-collapsed marks a folded folder or section ACC-TREE-7-FOLD
  • Fold state: the collapsed section keys and folder ids in the localStorage key jupyterlab_bookmarks_manager_extension:collapsed, read and written in try/catch; an unreadable value means all expanded; it stays out of the settings file ACC-TREE-8-FOLD-KEPT
  • Icons: a link row shows its stored icon in an <img>, else linkIcon; a file row shows the icon of its file type, which falls back to the text type and then to fileIcon; a session row shows terminalIcon ACC-LINK-25-FAVICON ACC-FILE-43-ICON
  • Tooltip (title): a link shows its absolute URL; a file its path, or File not found: <path>; a session <cwd>: <command> ACC-FILE-47-MISSING-ROW ACC-SESS-53-MENU-ADD
  • Click: a link opens as in section 5; a session runs openSession; a file is checked first - missing: the row is marked, showErrorMessage shows File not found: <path> and no tab opens; found: the mark clears and docmanager:open {path} runs ACC-FILE-45-OPEN ACC-FILE-81-OPEN-MISSING
  • The second click of a double-click (event.detail > 1) is ignored, so a double-click neither starts a session twice nor folds a folder back (DEF-SESS-5-DOUBLE-CLICK)
  • Per-row actions live in the row context menu - Edit and Remove on bookmarks, Rename and Delete on folders - and never in inline buttons, because a row click navigates. The bookmark selector excludes folders and Proxy section rows (.jp-BookmarksPanel-row:not(.jp-BookmarksPanel-folder):not(.jp-BookmarksPanel-recent)), and the Proxy section rows carry Add to Bookmarks and the destructive Remove from Proxy. Every destructive entry carries jp-BookmarksContextMenu-danger and stands last below a separator; its label and its icon are --jp-error-color1 at rest and while selected, over the menu's own selection background
  • Keyboard: the rows of a section are one tab stop (roving tabindex; the last focused row keeps the stop); Up and Down move the focus across the visible rows of the section, folder children included; Enter acts as a click, so it opens a bookmark, folds or unfolds a folder, and reopens a Proxy section page ACC-TREE-82-KEYBOARD
  • States: jp-mod-missing (the name in --jp-ui-font-color2 and struck through; the aria-label <name>, File not found and the tooltip carry the words, so colour is never the only sign), jp-mod-collapsed, jp-mod-active (the focused row, --jp-layout-color3), jp-mod-current (the current tab's bookmark row, color-mix(in srgb, var(--jp-brand-color1) 14%, var(--jp-layout-color1)); the focused row paints over it, and hover leaves it), jp-mod-dropTarget (the section header or folder row a dragged tab would land in, a 2 px --jp-brand-color1 outline inset by 2 px over an 8% brand wash); hover --jp-layout-color3 on every row but the current tab's, which keeps its tint (owner ruling 2026-11-04, DEF-PANEL-60-HOVER)
  • The open dot, the last-present time and the tint follow the tabs: the panel redraws on TabMarks.changed, so a tab opening, closing or switching adds, moves or removes them without a page reload; on that signal the panel also stamps the open set and the set open before the change into LastPresentStore, and it stamps again every 30 s while a tab stays open, updating each shown age text in place on that tick so a closed row's age advances while the panel is idle ACC-MARK-97-OPEN-ROW ACC-PANEL-140-AGE
  • File existence: each path is checked once when it first appears - on panel load, after Add, after a location change - and again on every click and on Refresh ACC-FILE-46-MISSING-ADD ACC-FILE-49-MISSING-SAVE

Proxy section rows

  • One flat list, newest first, no folders: jp-BookmarksPanel-row jp-BookmarksPanel-recent, data-id the page's absolute URL, aria-level 1, 24 px high; the empty caret spacer that every bookmark row has, so the icon stands in the column of the other sections DEF-PANEL-19-PROXY-INDENT, the link icon, the title in -rowName, and the age in -rowTime, a fixed right column at --jp-ui-font-size0, --jp-ui-font-color2 and tabular figures ACC-RECENT-93-SECTION
  • The age is formatAgo(now - openedAt) - now, Nm ago, Nh ago, Nd ago, Nmo ago, Ny ago with whole-number floors; the row's title is the page URL and its aria-label is <title>, <age>
  • Recency emphasis: under 60 s the row carries jp-mod-recentlyActive and the title and the age paint --jp-brand-color1; over seven days it carries jp-mod-stale and the title takes opacity 0.65, never the row, which would dim the age
  • The filter box narrows this section as it narrows the others, matching the title and the URL; the count is the number of rows shown
  • A click reopens the page as section 5 describes; the fold key recent lives in the same localStorage value as the section keys and the folder ids

Open Proxy Page dialog

  • Built from formBody, textInput and showEditDialog like the edit dialogs, with the buttons of editButtons, labelled Cancel and Open ACC-RECENT-111-POPUP
  • The rows in this order, because Name depends on Port: Port (required type="number", min 1, max 65535, step 1, placeholder 8501, focused on open, its native spin buttons removed in CSS because they draw an unthemed box in the field), Path (optional, placeholder /api/docs), Name (optional, with the Reset Name button of the file edit dialog), New browser tab (a checkbox, off, jp-BookmarksPanel-checkbox, drawn to the design system: 15 px, --jp-border-radius, ticked in --jp-brand-color1 with the tick in --jp-ui-inverse-font-color0, a 1 px --jp-brand-color1 outline at 1 px offset on :focus-visible; its unticked border is --jp-ui-font-color2, which holds 3:1 on the field in both themes where the border colours do not). Port and Path carry jp-mod-mono and render in --jp-code-font-family; Name keeps the UI font ACC-PANEL-146-MONO-FIELDS
  • The dialog's :invalid check disables Open while Port is empty, not a whole number or outside the range, and Enter then opens nothing, because the dialog's _resolve refuses an accepting button while the check fails ACC-RECENT-113-PORT

Edit dialogs

  • showEditDialog opens a JupyterLab Dialog with the title Edit Bookmark or New Bookmark, the body, the buttons and focusNodeSelector: 'input', so the dialog opens on the first field. The dialog checks its required fields only on an input event, so the helper waits for dialog.ready and sends one, and Save starts disabled while a required field is empty. The body root jp-BookmarksPanel-dialogBody holds the table jp-BookmarksPanel-form: a 42 % label column and a 58 % field column, 40 px rows, 28 px controls, each row's text a label tied by id to the row's first control, so a click on it ticks the box or focuses the field; the dialog is min(560px, 100vw - 32px) wide
  • Footer: Cancel, then Save. Save is the only filled button (--jp-brand-color1) and stands last, so Enter resolves it; Cancel is a surface button; the focus rim shows for keyboard focus only
  • Inputs: a recessed surface, 4% black over --jp-layout-color1, never the theme's input colour; jp-mod-error, or :invalid while no placeholder shows, gives an --jp-error-color1 border; under the caret jp-mod-error and a wrong number keep it, and other fields take the focus ring. The JupyterLab dialog disables Save while a field is :invalid or carries jp-mod-error. The technical fields - Working directory, Command and Environment in the session dialog, Location in the file dialog, URL in the link dialog - carry jp-mod-mono and render in --jp-code-font-family; Name and Folder keep the UI font ACC-PANEL-146-MONO-FIELDS
KindFields
LinkName (required); URL (required; shows the absolute URL, and Save stores it again in the stored form of section 3); Folder ACC-LINK-34-EDIT-NAME ACC-LINK-35-EDIT-URL ACC-LINK-36-URL-EMPTY
FileName (required) with a type="button" Reset Name beside it that writes the file name of the Location into Name - a footer button would resolve the dialog; Location (required; leading slashes are stripped on Save); Folder; the banner File not found (jp-BookmarksPanel-banner: padding: 6px 12px; background: var(--jp-layout-color2); border-left: 2px solid var(--jp-warn-color1)), checked when the dialog opens and on each change of Location ACC-FILE-48-MISSING-EDIT ACC-FILE-51-EDIT-NAME ACC-FILE-52-RESET-NAME ACC-FILE-80-LOCATION-EMPTY
SessionName (required); Working directory; Command; Environment, a 6-row textarea of KEY=VALUE lines in which Enter stays a newline and a longer environment scrolls inside the box; Folder ACC-SESS-69-EDIT-NAME ACC-SESS-70-EDIT-COMMAND ACC-SESS-71-EDIT-ENV ACC-SESS-72-EDIT-CWD ACC-SESS-145-ENV-BOX
  • Folder <select>: None plus the root folders of the section, set to the folder that holds the bookmark; a changed choice moves the bookmark, None to the section root; the Folder field is the only way a bookmark moves between folders, because a row is not draggable ACC-TREE-11-MOVE-IN ACC-TREE-12-MOVE-OUT ACC-TREE-13-ONE-LEVEL
  • An Environment line must match ^[A-Za-z_][A-Za-z0-9_]*= and must not name a variable that the recording excludes; otherwise the textarea gets jp-mod-error and Save is disabled. Blank lines are skipped. The exclusion applies to typed variables too, so secrets never reach the settings file ACC-SESS-73-ENV-INVALID. The expressions of sessionEnvExclude do not apply to a typed name: PATH=/opt/tool/bin is kept and exported on the next start ACC-SESS-92-ENV-MANUAL
  • Saving a changed Link URL drops the old icon and fetches the icon of the new page; a new link gets its icon after the add, and the row shows linkIcon until then ACC-LINK-27-FAVICON-EDIT
  • New Folder and Rename Folder use InputDialog.getText; the name is trimmed, and an empty name changes nothing. Delete Folder asks Delete the folder "<name>" and the N bookmarks in it? (bookmark for one) with Cancel and a warn button, Delete
  • New Bookmark... opens the dialog of the section's kind on blank(section): a new id and empty fields - Links Name and URL, Files Name and Location, Sessions Name, Working directory, Command and Environment - with the Folder field at None. The title is New Bookmark; a Name and a URL or Location are required, so Save starts disabled. Save runs the edit's own path: the bookmark the section does not hold is added in the Folder field's choice, None at the section root, and the checks are the edit's - the link's favicon is fetched, a file path the panel has not seen is checked and marked, an excluded name keeps Save disabled ACC-TREE-90-NEW-BOOKMARK

7. Tests

Three tiers. Every criterion in docs/acc-crit.md names its test; each closed one was closed with the passing test run as evidence. make test runs Jest, pytest and .github/scripts/check_auth.py.

Pytest, jupyterlab_bookmarks_manager_extension/tests/

  • test_process_reader.py: exclusions by exact name and by pattern; the kept name (PATH) and the user's variable survive a capture while the secret pattern match goes; the shipped default of sessionEnvExclude is the accepted 29 expressions; the added-or-changed diff; an empty command when the shell is in the foreground; an unreadable group leader recorded as a shell; a shell-quoted command; the marker and the unread input of a real pty; the package importing with fcntl and termios blocked, giving an empty command, an empty env and pending false ACC-SESS-88-ENV-FILTER (DEF-SESS-10-WINDOWS-IMPORT)
  • test_terminals.py: an unauthenticated GET terminals answers 403; a real terminal started with POST api/terminals {"cwd": tmp} and ptyproc.write("export K=v; sleep 30\r") is listed with the command sleep 30, that cwd and K in env; teardown manager.terminate(name, force=True); server configuration jpserver_extensions["jupyter_server_terminals"] = True and terminado_settings = {"shell_command": ["/bin/sh"]}
  • test_favicon.py, against a local http.server thread: a rel="shortcut icon" link and a data: href; no icon link → favicon.ico beside the page, not the one at the root; no icon at all → null; an oversize icon → null; 400 for a body that is not JSON, for {}, for an ftp: URL and for a URL that is not a string
  • test_proxy_tap.py: the filter table and the scrub table; newBrowserTab true, false and unknown; the held list keeps one entry per URL and its bound; the prefixes hold the configured and the entry-point servers; the wrapper calls through and survives an exception; the setting is unchanged without the proxy, and one warning when its classes are gone ACC-RECENT-121-INERT; the port read and the lab rule on handlers built from the proxy's real routes ACC-RECENT-122-TAP-API; real requests through the real proxy to a real service and to the lab's own port; an unauthenticated GET proxy-opens answers 403. A proxied request in a later test of one process hangs, also without this extension, so the real requests share one test
  • test_settings_write.py: the text is saved while the base is the file's text; a changed base answers 409 and writes nothing; an absent file and a file the schema rejects have the base {}; a text that is not JSON5 or that the schema refuses and a malformed body answer 400 and write nothing; an unauthenticated post that passes the XSRF check answers 403 and writes nothing
  • test_old_settings.py: an unauthenticated GET old-settings answers 403; the answer holds the text the settings API answers; a file with comments is parsed and stays byte-identical; absent answers {} with no warning; broken, not an object and empty answer {} with a warning; the file is read from user_settings_dir of the running lab; the route and the CLI's bookmarks_setting read nothing once the marker exists; a post writes an empty marker and leaves the old file byte-identical; a post with no old file writes nothing; an unauthenticated post that passes the XSRF check answers 403 and writes nothing; the CLI's settings file equals the path jupyterlab_server.settings_utils._path builds from the name in package.json, and the old file is built the same way
  • check_auth.py: every verb carries the decorator
  • The test extras of pyproject.toml hold coverage, pytest, pytest-asyncio, pytest-cov, pytest-jupyter[server], jupyterlab and jupyter-server-proxy

Jest, src/__tests__/

  • tree.spec.ts: add to the section root and to a folder; add to a folder that does not exist → root; remove a bookmark, and a folder with its contents; rename; move between folders and back to the root; count bookmarks, not folders; find a node with its folder; a folder two levels deep; no mutation of the input; filterNodes keeps the matches and the folders that hold them and drops a folder without a match; matchesFilter matches the name, the URL, the path and the command, case ignored, and not the cwd ACC-PANEL-87-FILTER
  • carry_over.spec.ts: nothing to carry is silent and reads nothing; a settings text other than the page's read reads the file again; an answer in the shape from before raw warns; declared keys are applied; an undeclared key is skipped; a saved value stays, also a falsy one; a rejection warns once, reloads before the next save and carries the rest; a key another lab page saved over is set again after a reload; a failed route, reload or post warns, calls Notification.warning and resolves; one post follows the passes when a key was answered, also when all were already saved, rejected or undeclared; no key answered sends no post
  • guarded_saves.spec.ts: other plugins go to the connector; bookmarks come from a fresh read when a save holds the page's copy, also a copy older than the last read; a hand edit on an old read is refused and the file stays; a removal is kept, also after an outside write; the text is built again after a refusal
  • store.spec.ts: with a fake server whose reload returns a setting that holds a bookmark another window saved, a write keeps it; two writes started together both land; a writer that saved between a read and its write is kept; a save refused every time ends with the error notification; a 404 gives the restart warning and no second request; a failed write does not stop the next one; sessionEnvExclude is read at each access, so a replaced list applies without a reload ACC-SESS-91-ENV-SETTING
  • tab_kind.spec.ts: link only for one http(s) iframe, not for two iframes, a javascript: or file: iframe or a plain widget; the address the frame shows, its src when unreadable; a document widget gives file, also with an iframe inside; a terminal gives terminal
  • link_url.spec.ts: a lab URL is stored relative, a remote one and one on another port absolute; a relative one joins back on another base URL; a path typed with a leading slash resolves on the origin
  • shell_quote.spec.ts: exportLine quotes values and leaves out an empty part; parseEnvLines accepts K=a=b and rejects 1K=x, GITHUB_TOKEN=x and a line without =; formatEnvLines reads back through parseEnvLines
  • env_filter.spec.ts: * any run, ? one character and [...] one of a set, case kept, a dot literal; filterCapturedEnv keeps the names no expression matches and leaves the input unchanged for an empty list ACC-SESS-88-ENV-FILTER ACC-SESS-91-ENV-SETTING
  • terminal_snapshot.spec.ts: findOpenTerminal matches on command and cwd, not on name; an empty command matches any shell in the cwd; of two matches, the one with an open tab wins, otherwise the first listed; a poll answered 404 leaves no unhandled rejection
  • marks.spec.ts: markValue keeps red and reads an absent or unknown value as brand ACC-MARK-98-MARK-COLOUR
  • recent.spec.ts: at a fixed clock with a TTL of 3 an entry opened 2 or 3 days ago stays and one opened 4 days ago goes, and a TTL of 0 drops the entries opened before the render; a reopened page moves to the top and one URL keeps one row; a page a link bookmarks at the root or in a folder stays listed, because no link filter runs ACC-RECENT-93-SECTION ACC-RECENT-95-TTL DEF-PROXY-57-CAPTURE; the age labels now, 1m ago, 2h ago, 3d ago, 1mo ago, 1y ago
  • recent.spec.ts, the popup's pure functions: proxyPageUrl keeps one slash after the port; fallbackName gives the path one leading slash; parseTitle collapses white space, gives an empty string for a page without a title and keeps markup in a title as text ACC-RECENT-112-OPEN-PAGE ACC-RECENT-115-SERVICE-NAME
  • recent.spec.ts, a page the proxy saw: mergeSeen keeps a listed page's name, mode and id and moves it to the top, keeps a newer browser-side openedAt, and gives one row for the same observation twice; a server clock ahead of the browser shows now and does not expire the row; opensAfter takes only opens newer than the watermark, oldest first; a removed page stays out after a reload and a later open brings it back; a row click leaves the watermark on the server's clock. listedUrl of a popup page equals the observed URL under a base URL, with a space, a non-ASCII path, a secret, a fragment and an empty query; seenFallbackName for each form of the proxy's URLs ACC-RECENT-117-NO-SECRET ACC-RECENT-118-NAMED ACC-RECENT-119-REMOVED
  • proxy_feed.spec.ts: takes the held pages at the start, named by their title, a null newBrowserTab as false; reads on its own event only, two events give one row and one title read; a listed page keeps its name and is not read; a removed page stays out at the next start; a row removed during a title read, during a held read of the server list or before an earlier read's title read ends stays out, and so does one whose reopen's event comes after the removal, with the watermark past each; an open after the removal's read has finished brings the row back; a failed read warns and the next one works ACC-RECENT-120-REOPEN-MODE
  • section_view.spec.ts: renderSection writes the label -sectionLabel and the count -sectionCount as two spans, the count holding (N) of the rows shown; a folded section keeps its count and an empty section shows (0) ACC-PANEL-138-COUNT; renderRecentSection names the section Proxy, enables the + button with canOpenProxy on and disables it, with its tooltip, with it off, and puts the caret spacer before a row's icon ACC-RECENT-106-NAME ACC-RECENT-114-NO-PROXY DEF-PANEL-19-PROXY-INDENT
  • last_present.spec.ts: the stored times load by bookmark id; a time recorded before the read finishes stays, because it is newer; record writes every id at one time and save uses the state key jupyterlab_bookmarks_manager_extension:last-present ACC-PANEL-140-AGE
  • tab_drop.spec.ts: dropTarget reads a folder row of the tab kind's section as that folder, any other part of the panel as the section root - a folder row of another section included - and an element outside the panel as no drop ACC-PANEL-99-DRAG-TAB
  • favicon.spec.ts: storeFavicon takes a tab icon that is already a data: URL; converts a LabIcon's SVG source to data:image/svg+xml;utf8,<encoded>; ignores a string that is not a data URL; keeps the page's own favicon when the page serves one ACC-LINK-142-TAB-ICON; the 32768-character cap; no icon when favicon.ico beside the page answers 404. The rest of the file list: only 404 counts as missing; an unreadable or malformed fold state means all expanded; the default names

Galata, ui-tests/tests/

Everything visible; assertions are on text, attributes and counts, never on snapshots alone. The specs with mocked settings import test from helpers.ts, whose page goes offline before Galata's teardown, so a settings write still running when a test ends never reaches the shared test server.

  • panel.spec.ts: the panel on the left; Switch Sidebar Side moves it to the right; four section headers with labels LINKS, FILES, SESSIONS, PROXY and counts (0) each, the count as its own span; the empty hints; the item on the Launcher tab is hidden (toBeHidden()) ACC-PANEL-3-SECTIONS ACC-PANEL-5-NO-ITEM ACC-PANEL-138-COUNT
  • Section layout (panel.spec.ts): the title band's line is 1 px --jp-layout-color3 with the filter hidden and --jp-border-color2 with the filter shown, the body has no top border and the first band stands at its top ACC-PANEL-137-DIVIDER; a folded section with one below takes a 1 px --jp-layout-color3 line, an expanded section and the last take none; the count span sits 6 px after the label, in --jp-ui-font-color2 with tabular figures, the label in --jp-ui-font-color1 ACC-PANEL-138-COUNT; a section band is its label's line box plus 8 px, and its + and Clear buttons are 18 px squares no taller than the band, the hovered and the active one painting exactly that square in --jp-layout-color3, while a top-bar icon button is 24 px ACC-PANEL-141-BAND DEF-PANEL-59 DEF-PANEL-63-HOVER-OVERLAY; no stable scrollbar gutter and a row reaches the body's right edge with no scrollbar; a section of more rows than its box shows its scrollbar at the panel's right edge, and the current tab's tinted row reaches that edge ACC-PANEL-139-EDGE; a hovered row that is not the current tab's takes --jp-layout-color3, and the current row keeps its tint on hover (owner ruling 2026-11-04, DEF-PANEL-60-HOVER); a row of an open tab shows the dot and no time, and the row of a closed tab shows the time instead ACC-PANEL-140-AGE
  • The top bar (panel.spec.ts): the title's computed font size equals a section label's and a probe at --jp-ui-font-size0 inside --jp-ui-font-size1 (DEF-PANEL-9-TITLE-SIZE); Refresh on a bookmark of bookmarks-refresh/note.txt, a folder of its own in the server root because the mocked setting is fixed before the page loads - marked missing on load, the file uploaded, Refresh spins disabled, then the mark clears, and after the file is deleted the mark stays until Refresh sets it (ACC-PANEL-86-REFRESH); Filter on a folded folder and one bookmark per section - aria-pressed, a part of one name in another case leaves that row and its open folder with the counts of the matches, the URL, the path and the command each match one row, and an empty box and a hidden box bring every row and the folded folder back (ACC-PANEL-87-FILTER)
  • Drag (panel.spec.ts): a page tab dragged onto the Links section and a file tab dragged onto a folder row, each with the pointer resting on the target while jp-mod-dropTarget is asserted on the section header or the folder row; the release adds the row at aria-level 1 in Links and inside the folder in Files (ACC-PANEL-99-DRAG-TAB); the drag is Playwright's mouse down, move and up, because Lumino moves a tab by pointer events
  • A render during a press (panel.spec.ts): a left click acts and the render follows; the render after a release waits for the click, with events the test sends; a press released elsewhere renders at the next move; a right-button press and release renders; a move with no button from the browser ends a press whose release went unreported, and one from a script does not (DEF-PANEL-38-PRESS-RENDER)
  • Session start order (sessions.spec.ts): a bookmark that writes stty size to a file records the size of its tab with the socket held until the shell is at its prompt, and with xterm's chunk held until the socket is connected, and the page's log shows the fitted set_size before the line; a click in a second lab page while the first page's socket and line are held attaches to the one terminal (DEF-SESS-34-SECOND-START)
  • files.spec.ts: Add on a document tab, the label turns to Remove, Remove; the file-type icon; the location relative to the server root; a click opens the file; a bookmark of a deleted file is marked missing, on Add and on load; the banner for a missing location; a location change updates the mark; Edit of the name; Reset Name; an empty Location disables Save; a click on a missing file opens no tab
  • links.spec.ts: web tabs opened with help:open on pages under /files/; Add, the recorded URL, the Remove label, Remove; the favicon on the row; the favicon after a reload with no request for the page or the icon (the tab closes before the reload, because a restored help:open tab requests its page again); a URL edit refetches the favicon; a page without a favicon keeps linkIcon, because a help:open tab carries no widget icon ACC-LINK-142-TAB-ICON; a tab carrying a widget icon with no page favicon stores that icon in the row ACC-LINK-142-TAB-ICON; Edit of the name and the URL; an empty URL disables Save; a click opens a lab tab and a second click activates it. Another origin: a Node http server on a free port of 127.0.0.1 serves a page and its icon; a link edited to that page gets its favicon through POST favicon, and a click opens it in a browser tab
  • sessions.spec.ts, the only spec that starts terminals: a terminal running cd /tmp; export K=v; sleep 300 is added as sleep - tmp with the tooltip /tmp: sleep 300; the edit dialog shows the recipe; Remove label and Remove; a bookmarked terminal tab carries the ribbon ACC-MARK-96-TAB-MARK; a click activates the running terminal; after DELETE api/terminals/<name> a click starts a terminal whose screen shows export K='v'; sleep 300; a double-click starts it once; a second click while it starts opens no second terminal; a plain shell bookmark reopens in its cwd; a capture of export JPY_ONE=x K=v stores only K=v, so the shipped default JPY_* applies, and with sessionEnvExclude set to FILTER_* a capture of export FILTER_ONE=x K=v stores only K=v ACC-SESS-88-ENV-FILTER ACC-SESS-91-ENV-SETTING; Edit to PATH=/opt/tool/bin and a click starts a terminal whose echo $PATH prints it ACC-SESS-92-ENV-MANUAL; a new bookmark starts with empty fields, GITHUB_TOKEN=x disables Save, and a click starts a terminal whose screen shows the typed recipe ACC-TREE-90-NEW-BOOKMARK; Edit of the name, the command, the environment and the cwd; an invalid environment line disables Save; an edit leaves the running terminal alone; the edited recipe is used for recognition; a click reopens a running terminal whose tab was closed; a click after Ctrl-C starts the session. Terminal waits have their own 20 s timeout
  • tabmark.spec.ts: the ribbon on a bookmarked file tab and on a help:open web tab, removed with the bookmark; markColour set through the registry repaints the ribbon and the row dot without a page reload; with two bookmarked files open both rows carry the dot, the current tab's row is tinted, the tint moves with the tab switch and the closed file's dot is gone; a jp-colourful-tab-mint class on a marked tab leaves the ribbon in the marker colour ACC-MARK-96-TAB-MARK ACC-MARK-97-OPEN-ROW ACC-MARK-98-MARK-COLOUR
  • The real service: ui-tests/proxy_backend.py, started through webServer in playwright.config.js on JUPYTER_TEST_BACKEND_PORT, default 18889, answers any path with a page titled by its last segment, holding an image and a fetch; the page marks its body when both have answered, and a path ending in echo is a WebSocket that sends each message back, which only the WebSocket test opens, from its own process. A request that never reaches the server is not observed, so every test that asserts a row from an open uses this service; page.route stays where a test is about the popup's own read. The test of helpers.ts starts the state with a watermark of now and no ?reset, because the server holds the opens of earlier tests
  • recent.spec.ts: a page opened by running server-proxy:open with a proxy URL of the real service shows the Proxy section with the count (1), its title and the age now; the section folds with its count kept; a reload keeps the list; a link naming that page's URL makes a Links row and leaves the Proxy section row listed with its count ACC-RECENT-93-SECTION DEF-PROXY-57-CAPTURE; a closed page's row reopens its tab and a second click reuses it, Add to Bookmarks makes a Links row and leaves the Proxy section row, Remove from Proxy drops the entry, in its own group below a separator with its item carrying jp-BookmarksContextMenu-danger and the --jp-error-color1 label, and a click moves the row to the top ACC-RECENT-94-OPEN ACC-PANEL-144-PROXY-DANGER; the setting Proxy days shows in the Settings Editor, and setting it to 0 through the registry empties the section without a page reload ACC-RECENT-95-TTL; the section's visible names are asserted together ACC-RECENT-106-NAME, and the icon of a Proxy section row has the left edge of a Links row icon DEF-PANEL-19-PROXY-INDENT. A page opened by server-proxy:open, by proxy-launcher:open of jupyterlab_proxy_launcher_command_extension and by its URL has one row each, after its image and fetch have answered, and a WebSocket on the service adds none ACC-RECENT-109-ANY-OPEN; the lab through the proxy on its own port gets no row ACC-RECENT-110-NOT-LAB; ?token=FAKE&keep=1 gives a row and a server list with keep=1 and no FAKE ACC-RECENT-117-NO-SECRET; a page is named by its title, else Proxy :<port>/untitled ACC-RECENT-118-NAMED; a removed row stays away after a reload and a new open brings it back ACC-RECENT-119-REMOVED; a page seen in a browser tab reopens in a browser page, and a page opened by the command under a widget id of its own reuses its tab on two clicks ACC-RECENT-120-REOPEN-MODE; two lab pages each list one open once; a page opened with no lab page open gets its row later with the age 1m ago, after a real wait of 61 s ACC-RECENT-123-LAB-CLOSED; the section's Clear eraser opens one confirmation naming Proxy and its pages, Cancel keeps both rows, Clear empties the list, the eraser turns disabled and the empty hint shows, the empty list reaches the settings, and it stays empty after a reload of the page with its proxy tabs closed, because a restored tab requests its page again and an open lists it again ACC-PANEL-143-CLEAR-SECTION
  • proxy.spec.ts: the + button opens Open Proxy Page with its fields and buttons, Cancel opens nothing, a screenshot of the dialog is saved in the light and the dark theme, a click on a label ticks the box or focuses the field in the popup and in a file edit dialog, the checkbox has its size, radius, ticked fill and keyboard focus ring in both themes, and a click where Port's up arrow would stand leaves the value unchanged ACC-RECENT-111-POPUP; Open makes a lab tab and a row, the same page reuses the tab, and New browser tab opens a browser page and a row ACC-RECENT-112-OPEN-PAGE; empty, 0, 65536 and 80.5 keep Open disabled and Enter opens nothing: 5555 enables it, and its Enter opens the only new tab and the only row ACC-RECENT-113-PORT; with the plugin @jupyterhub/jupyter-server-proxy:add-launcher-entries added to disabledExtensions by a route over the lab page, the + button is disabled with its tooltip and opens nothing until a stub command is added ACC-RECENT-114-NO-PROXY; page.route answers the proxy URL, so Name follows My Service with no Authorization or X-XSRFToken header on the read and with the fetch option cache: 'no-store', read by a wrapper over fetch because a route turns the HTTP cache off, a 502, a non-HTML answer, a page without a title and an answer that never comes give the fallback, Enter before a change event still titles the tab, Open with a known answer sends no second read, Enter after a new path titles the tab from a read of that path, and a late answer for a changed path is dropped ACC-RECENT-115-SERVICE-NAME; a typed name stays when Port or Path changes and titles the tab and the row, also when the same page reuses its tab, Reset Name returns to the service name, and a name typed straight after Path by a click or the Tab key is the whole name, before and after the answer ACC-RECENT-116-SET-NAME. On the real service: one open is one row, and a page loaded later by URL keeps the typed name and its lab tab ACC-RECENT-118-NAMED; a secret in Path is one row without the secret ACC-RECENT-117-NO-SECRET; a page that redirects is one row at its final URL; a closed port still gets its row from the popup ACC-RECENT-112-OPEN-PAGE; a secret in Path is not in the name of a page with no title ACC-RECENT-117-NO-SECRET; the popup on the lab port opens the page and lists no row ACC-RECENT-110-NOT-LAB
  • tree.spec.ts: the tree starts expanded; a folder folds and unfolds; the fold state survives a reload; a section header folds the section; in each section the + button opens a menu whose items read New Bookmark... and New Folder, with aria-expanded="true" on the button, and New Folder adds the folder at the root ACC-TREE-89-PLUS-MENU; New Bookmark opens empty fields under the title New Bookmark, a link to a same-origin page becomes a root row with the page's data: icon and opens its tab, and a file at a path that does not exist yet becomes a root row marked missing and opens after the upload ACC-TREE-90-NEW-BOOKMARK; Edit moves a bookmark into a folder and back; the Folder field lists only root folders; Rename Folder; Delete Folder after the confirmation and Cancel; Remove Bookmark; the keyboard: Tab reaches the Files rows, Down moves to the next row, Enter opens its file, Enter on a folder folds it. Clear section: each of Links, Files and Sessions empties through its eraser after one confirmation naming the section and its bookmark and folder contents, the count returns to (0), the eraser turns disabled and the section stays empty after a reload; Cancel keeps every row and the count; with the filter showing one linked row the eraser still empties the whole section, and the hidden filter then shows no row ACC-PANEL-143-CLEAR-SECTION
  • carry_over.spec.ts, on the real settings of the test server: an old file with comments, a rejected key and an undeclared key gives the rows of all three sections and a folder, the same after a reload, and the old file stays byte-identical; a warning names the rejected key and none the undeclared one; with a late answer of the route the panel's first count already holds the carried bookmarks; a file already at the new path stays and only its missing keys are carried; a broken file and no file load the panel and write nothing; after a carry, a settings file with no keys and a reload leave no old rows, with the marker present and the old file byte-identical; a 404 on the route shows the restart notification, the panel loads and no marker is written; a route answer held while another page saves and posts still shows the bookmarks; a load with nothing to carry sends no GET of the plugin's settings
  • storage.spec.ts, on the real settings registry of the test server: the bookmarks survive a reload, they are in the plugin setting, and the setting accepts a folder inside a folder; a save held at the browser while another writer saves keeps both; a 404 on the write route shows the restart notification and writes nothing; the form, with every kind of node, keeps an outside write; a registry.upload of a text older than twenty adds keeps all twenty; a hand edit through registry.upload, the call of the JSON Settings Editor, is saved with its comment; a hand edit in the JSON view after an outside write is refused with the dialog and the file stays

Galata test server and run

  • The suite tests the installed extension: make install first, then in ui-tests/ JUPYTER_TEST_PORT=<free port> jlpm playwright test > <log> 2>&1; make build alone uninstalls the wheel (its clean step), so make install runs again before the suite
  • JUPYTER_TEST_PORT moves the test server and the base URL together; the suite never adopts a server it did not start; serverFiles: 'on' keeps each test folder until the server stops (DEF-SUITE-2-ROOT-LISTING)
  • Playwright's default parallelism: the spec files run in parallel workers, and the tests of one file run in order in one worker; playwright.config.js sets no workers or fullyParallel
  • jupyter_server_test_config.py: a private user-settings folder; deleted folders are removed, not sent to the trash; the shell is /bin/bash --rcfile with PS1="$ ", and a new shell stays in its rc file while the test's file shell-hold exists in the settings folder, as a slow login shell does
  • Terminal screen text: the test settings set screenReaderMode: true for @jupyterlab/terminal-extension:plugin, and the tests read .xterm-accessibility-tree; without it the screen text is not in the DOM
  • The terminal tests need terminals_available, which the lab server provides by default

Out of scope

  • file:// links and a route that serves files outside the server root, such as /tmp/paste-files/...png, because the workstation's jupyter_lab_config.py turned local-file serving off; the Star Colonel decided this on 2026-10-27
  • Pages on another origin inside a lab tab
  • Reopening a link tab after a lab reload
  • Folders deeper than one level in the UI; dragging a bookmark row or a folder to move it; sort and group options
  • Import and export; sync between lab instances; a filter per root folder as in jupyterlab-favorites
  • A check that a stored cwd still exists; a missing cwd opens a terminal in the server's directory
  • Pipelines (only the group leader of the foreground process group is recorded), processes that rewrite their argv, processes under another uid, and support for a platform without /proc
  • Translation strings, an ITerminalTracker dependency, AccordionPanel resizing