Skip to content

Libraries by URL in share links; notes for broken and long links - #29

Merged
cedricvogel-leo merged 1 commit into
feature/tab-projectsfrom
feature/link-libraries
Oct 30, 2026
Merged

cedricvogel-leo merged 1 commit into
feature/tab-projectsfrom
feature/link-libraries

Conversation

@cedricvogel-leo

Copy link
Copy Markdown
Collaborator

P25 decisions 3–5, IDE side. IDE PR 2 of 2. Stacked on #28 (per-tab projects): its base is that branch, so the diff shows only this PR. After #28 is merged, GitHub switches the base to main.

3. Libraries by URL

  • Link format v2: a library is {"path": "parser.py", "url": "https://…/parser.py", "readOnly": true}, without its code. A link without libraries stays version 1, which every IDE reads. Old links with embedded content open as before.
  • Length: an Etappe 4 link (auswerter.py plus parser.py by URL) has 1,202 characters instead of 5,157.
  • Fetching:
    • Once, when the link opens. https only, or http on localhost for testing a course. At most 1 MB, without cookies, 15 s timeout.
    • The text is kept with the tab's project, so a reload (checked: no new request) and offline work use that copy.
    • A corrected library reaches learners when they open a link again.
  • File drawer: a new «Bibliotheken» section: name, «von », lock. The learner's own files are listed above it.
  • Errors (HTTP status, network error, timeout, too large, not https):
    • A notice above the editor and the drawer name the library, with «Erneut versuchen».
    • The project opens anyway. Importing the library raises Python's own ModuleNotFoundError, as in the macro.
    • No network and a server without CORS look the same to a page («Netzwerkfehler»).
  • «Teilen» names the library by URL again. ZIP: contains its code; glpython.json lists "libraries": {"parser.py": "https://…"}. An import keeps it as a library.
  • The unsaved fingerprint ignores read-only files, so a library arriving after its fetch isn't counted as the learner's change.

4. Broken links

A link that can't be decompressed or parsed, or lacks the file to run, opens an empty project (one empty main.py, «Leeres Projekt») with a notice. It never shows another project.

5. Long links

«Teilen» still copies a link longer than 2,083 characters. A note stays until closed (✕), with «Herunterladen».

New wording, please review

Where de en
broken link Dieser Link ist unvollständig oder beschädigt. Möglicherweise wurde er beim Kopieren gekürzt. This link is incomplete or damaged. It may have been shortened when it was copied.
long link Dieser Link ist sehr lang (5157 Zeichen). Manche Programme, z. B. OneNote, kürzen solche Links. Für eine Abgabe das Projekt besser herunterladen. · «Herunterladen» This link is very long (5157 characters). Some programs, e.g. OneNote, shorten such links. For a hand-in, download the project instead. · «Download»
drawer Bibliotheken · von localhost:4188 · wird geladen … Libraries · from … · loading …
library failed (the macro's wording) Die Bibliothek parser.py konnte nicht geladen werden (HTTP 404). · «Erneut versuchen» Could not load library parser.py (HTTP 404). · «Try again»
reasons Netzwerkfehler · Zeitüberschreitung · grösser als 1 MB · keine https-Adresse network error · timeout · larger than 1 MB · not an https address
retry button label parser.py erneut laden Load parser.py again
empty project name Leeres Projekt Empty project

Checked (Chrome against the production build; parser.py served locally with CORS)

# Case Result
1 v2 link 1,202 characters; tabs auswerter.py, parser.py; drawer lists parser.py under «Bibliotheken» «von localhost:4188»; «Tests» 11 von 11
2 404 notice and drawer «… (HTTP 404).»; «Tests» shows ModuleNotFoundError: No module named 'parser'; once the file exists, «Erneut versuchen» loads it and the notice goes
3 Network error (request aborted) «… (Netzwerkfehler).»
4 Reload no new request for the library
5 A1 link cut at 2,083 characters, in a profile with another project the notice; only an empty main.py
6 Old A1 link (parser.py embedded) opens as before; «Teilen» copies 5,148 characters with the note; «Herunterladen» gives auswerter.zip
7 «Teilen» of the v2 project 1,221 characters, v2, parser.py by URL, no note
8 ZIP round trip glpython.json lists the library; after import, the drawer shows it and «Teilen» names it by URL

Build and lint pass.

Your tests

  • Open a v2 link once parser.py has a public URL. Until then: a link with a URL that gives 404 (notice, «Erneut versuchen»).
  • Open a link with the iPad in airplane mode (notice, ModuleNotFoundError on «Ausführen»).
  • Paste the A1 link cut at 2,083 characters (the notice).
  • «Teilen» on an old long link (the note, «Herunterladen»).
  • ZIP round trip.

Order: merge after #28. The macro PR (libraries by URL in «IDE-Link kopieren») only after this one has deployed: an IDE before this PR can't read v2 links.

🤖 Generated with Claude Code

Share links of version 2 name a library by its URL instead of carrying its
code ({path, url, readOnly: true}), so an Etappe 4 link with parser.py has
about 1,200 characters instead of 5,157. The IDE fetches a library once when
the link opens (https or http on localhost, at most 1 MB, without cookies)
and keeps its text with the tab's project, so reload and offline use the
copy. The file drawer lists it under «Bibliotheken» with its host and a
lock; a library that can't be loaded (HTTP status, network error,
timeout, too large) is named in the drawer and a notice with «Erneut
versuchen», and importing it raises Python's own ModuleNotFoundError, as
in the LiaScript macro. «Teilen» names it by URL again; the ZIP holds its
code and lists its URL in glpython.json. Links without libraries stay
version 1, and links of version 1 open as before.

A link that can't be read (cut off, e.g. by OneNote at 2,083 characters,
or damaged) opens an empty project with «Dieser Link ist unvollständig oder
beschädigt. …» - never another project.

«Teilen» still copies a link longer than 2,083 characters, with a note to
download the project for a hand-in and a «Herunterladen» button.

The unsaved-changes fingerprint ignores read-only files: a library
arriving after its fetch is no change of the learner's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo merged commit ab88f51 into feature/tab-projects Oct 30, 2026
1 check passed
cedricvogel-leo added a commit that referenced this pull request Oct 30, 2026
Libraries by URL in share links; notes for broken and long links (#29, onto main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant