Angus Hollands
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Improved Error Handling in `nbgitpuller` <!-- BEGIN SHARED BLOCK --> ## Background `nbgitpuller` is a Jupyter Server extension that exposes a mechanism for synchronising remote content with the server's local file-system. In the wild, its primary application lies in connecting JupyterHub _users_ with hub-adjacent _content_ through a simple distributable, user-friendly interface (URLs). By virtue of pulling remote content within an individual user's server, it is often used to facilitate the separation of content from compute-environment definitions in contexts like JupyterHub and BinderHub. There are two distinct personas that use `nbgitpuller`: Link-author : People creating content that can be shared via an `nbgitpuller` link. Link-consumer : People that use an `nbgitpuller` link to access shared content. Between fetching remote content and merging conflicts with local edits, there are many ways in which `nbgitpuller` users can encounter errors during normal operation. Fixing these errors is _neither_ the responsibility of link-author nor link-consumers. Instead, there is a third persona: `nbgitpuller` expert : People with the technical expertise to debug problems encountered during `nbgitpuller` usage. It is an established `nbgitpuller` devlopment goal that this role dissapears in the future. <!-- END SHARED BLOCK --> The existing UX for error handling confuses the persona of `ngitpuller`-experts with that of the link-consumer and link-author personas. As such, it leaves room for improvement, such as through the addition of error recovery mechanisms, or designing error responses that consider the needs of the link-consumer and link-author personas _in addition to_ `nbgitpuller`-expert. <!-- BEGIN SHARED BLOCK --> ## Technical details `nbgitpuller` operates as a Jupyter Server extension that exposes a number of request handlers: - `GET /git-pull/api` — an API service endpoint - `GET /git-pull/` — a user-facing UI for triggering and following a `git` pull operation. The UI served at `/git-pull/` communicates with the API backend from the front-end using [server-sent-events]. When used alongside a JupyterHub, there is a strong separation of concerns between provisioning of the compute environment ([JupyterHub] and e.g. [KubeSpawner]) and provisioning of the file-system ([nbgitpuller]). Using the `/hub/user-redirect/` endpoint, content authors can craft user-agnostic URLs that invoke the nbgitpuller service. The `nbgitpuller` URL handler (e.g. `GET /git-pull?repo=...`) implements several operations to fulfil a request: 1. Remote content is fetched from a Git repository scoped to a specific branch (`fetch`). 2. Fetched content is merged with the local file-system, resolving any conflicts in an opinionated manner to minimise user-input (`merge`). 3. Redirect user to given URL path once (1) and (2) have been completed (`open`). <!-- END SHARED BLOCK --> ## Deliverables ### Add access to a Jupyter frontend following an `nbgitpuller` error #### Overview For some users, `nbgitpuller` links are the *only* way that they are familiar with to access a deployed JupyterHub. At present, when such a user encounters an error after following an `nbgitpuller` link, e.g. because the link is malformed, they find themselves without any navigation links or buttons that will take them to the "preferred"[^pref] frontend e.g. JupyterLab. These users need a way to access the preferred frontend application without modifying the URL bar of their browser or otherwise navigating to the JupyterHub by themselves. We will extend the existing error response of the `nbgitpuller` web UI to provide a means of accessing the preferred frontend, such as through the addition of a clickable link or button. An automatic redirect should not be used, as it hinders the ability of the link *user* to capture debugging information for the link *author* when the link fails. #### Definition of done - Users can navigate through to the preferred frontend from any `nbgitpuller` error response. #### Estimates | Task | Lower Estimate | Upper Estimate | |------------------------------------------------------|----------------|----------------| | Build routine to identify "preferred" UI application | 2h | 3h | | Design and implement UI | 1h | 3h | | Open pull-request and shepherd through to merge | 2h | 4h | | Additional learning and refinement | 1h | 3h | | __Total__ | __6h__ | __13h__ | ### Redesign the error handling response for link-consumers #### Overview The existing error-handling response for `nbgitpuller` is a thin abstraction which exposes many of the error details to the user. In practice, many users may not be familiar with Git, and/or may have limited ability to interpret the error messages. When designing for the link-consumer persona, we should prioritise simple, readable error messages that provide sufficient scope for the link-author (e.g. Teaching Assistants, Lecturers). Crucially, it should be possible for the majority of `nbgitpuller` errors to be understood without the use of the existing console window to read error log output. A convenient way to share the log outputs should be added, such as a <kbd>Copy to clipboard</kbd> button. Fundamental changes to the technology stack, such as introducing a new UI framework, are NOT in scope. #### Definition of done - Users can encounter errors during `nbgitpuller` that provide a clear indication that an error occurred without the use of a console window. - Link authors can recover useful debugging information from screenshots and/or verbal descriptions of the error page. #### Estimates | Task | Lower Estimate | Upper Estimate | |-------------------------------------------------|----------------|----------------| | Design and implement UI | 5h | 8h | | Open pull-request and shepherd through to merge | 2h | 4h | | Additional learning and refinement | 1h | 3h | | __Total__ | __8h__ | __15h__ | ### Identify common `nbgitpuller` errors #### Overview Within the space of possible errors that can occur during typical usage of `nbgitpuller`, there are several common classes, such as invalid links, renamed / deleted files, etc. Through inspection of logs from existing (large) `nbgitpuller` deployments, we will determine which `nbgitpuller` invocations failed, and the mechanism by which they failed (normalised by `nbgitpuller` URL). By analysing the resulting set of events, we will identify the most frequent failure modes normalised by link. #### Definition of done - An array of structured `nbgitpuller` events has been generated from existing large JupyterHub deployments logs. - A set of common error types has been established from analysis of `nbgitpuller` event information. #### Estimates | Task | Lower Estimate | Upper Estimate | |----------------------------------------------------------------------------------|----------------|----------------| | Liaise with appropriate personas associated with existing JupyterHub deployments | 4h | 11h | | Generate structured events from raw logs | 3h | 7h | | Analyse nbgitpuller events to identify common error types | 2h | 4h | | Open pull-request and shepherd through to merge | 2h | 4h | | Additional learning and refinement | 1h | 3h | | __Total__ | __12h__ | __29h__ | ### Design and integrate dedicated error handlers #### Overview For the set of common error classes identified in the previous deliverable, we will design _up to three_ bespoke responses that clearly articulate what went wrong to link _users_ that encounter each error. Although it will be the responsibility of the link *author* to resolve these problems, improving the error message will help guide the user to useful documentation and/or provide more context for the link _author_ when the error is reported. The primary objective of this deliverable is to reduce the requirement for link _authors_ to draw conclusions from inline console tracebacks. The approach taken in this work should naturally extend to alternative content providers, should they be added in future. Once each error class has a dedicated response, `nbgitpuller` will be extended to return these responses when it identifies a particular error class has been encountered. > [!Note] > There is a strong case here to treat `urlPath` errors as an `nbgitpuller` error, because we parse this component and trigger a redirect. Therefore, programatically detecting a failure here seems reasonable, rather than falling back upon the `jupyter-server` 404 handler. Whether this is actioned will follow from the error analysis results. #### Definition of done - Users encountering one of three commonly-encountered errors are presented with a specialised error handler that provides useful context. #### Estimates | Task | Lower Estimate | Upper Estimate | |----------------------------------------------------------------------------|----------------|----------------| | Build error-handling routines to process and identify common failure modes | 3h | 7h | | Design and implement UI | 7h | 12h | | Update nbgitpuller documentation | 1h | 2h | | Open pull-request and shepherd through to merge | 2h | 4h | | Additional learning and refinement | 1h | 3h | | __Total__ | __14h__ | __28h__ | ## Additional overheads In addition to per-deliverable work, there is up-front work that may be paid by each developer: | Task | Lower Estimate | Upper Estimate | |-------------------------------------------------|----------------|----------------| | Become familiar with nbgitpuller architecture | 2h | 4h | | Set up development environment | 1h | 2h | | **Total** | **3h** | **6h** | We will assume that two separate developers incur this cost. ## Relevant GitHub Issues Listed below are pertinent GitHub Issues open in the `jupyerhub/nbgitpuller` repository: - [Missing `.git` directory](https://github.com/jupyterhub/nbgitpuller/issues/354) - [Add a "Proceed to destination" button when pulling fails](https://github.com/jupyterhub/nbgitpuller/issues/278) - [Untracked files that will be overwritten causing failure](https://github.com/jupyterhub/nbgitpuller/issues/277) - [Provide better error messages in the terminal](https://github.com/jupyterhub/nbgitpuller/issues/267) - [Provide helpful error message when git url is wrong](https://github.com/jupyterhub/nbgitpuller/issues/198) - [Document that users shouldn't actively be running git commands along with nbgitpuller ](https://github.com/jupyterhub/nbgitpuller/issues/314) - [Automagically resolve conflicts upon remote deletion/moves](https://github.com/jupyterhub/nbgitpuller/issues/69) ## People working on this This project would require capacity from: 1. App Engineer (1 implementation, 1 review) ## Timeline ```mermaid flowchart TD A[Identify common errors] B[Design & integrate bespoke responses] D[Add access to frontend] E[Make errors user-friendly] A --> B --> X D --> X E --> X X[End] ``` [jupyterhub]: https://github.com/jupyterhub/jupyterhub [kubespawner]: https://github.com/jupyterhub/kubespawner [nbgitpuller]: https://github.com/jupyterhub/nbgitpuller [server-sent-events]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events [^pref]: Where "preferred" refers to *either* the pre-determined singleuser endpoint, or the application indicated in the `urlPath` query.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully