Repository navigation
Direct entry at the root, workshop hub under /workshop, LTI 1.3 launch - #66
Merged
Merged
Conversation
A browser that opens NodeGrade directly gets its own BROWSER workspace again (ADR-0011). SPEC-0022's workshop behaviour stays as it is. - POST /api/workspaces mints a BROWSER workspace behind the same per-address WorkspaceCreationThrottle as the workshop join; WorkspaceService.resolveByToken resolves BROWSER tokens again and retention still sweeps idle BROWSER rows. - GET /api/templates takes ?kind=WORKFLOW|BLOCK and serves both kinds while staying workspace-scoped; GET /api/templates/:slug serves either kind; GET /api/templates/revisions/:id is back. - POST /api/workflows/from-template copies a published workflow template's current revision (WorkflowService.createFromTemplateSlug); a block template is refused with template_not_workflow. - Unit tests for the controller, service, gallery and copy paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
SPEC-0002/FR-001, FR-003a. The workshop is over, so the browser's own anonymous workspace is a first-class session again. - workspaceStore keeps the browser session (browser, saveBrowser, clearBrowser) next to the per-code workshop sessions, remembers the workshop joined last for the way back to it, and no longer drops a stored browser session on read. - workspaceSession bootstraps the browser workspace once per page view behind one shared promise: the stored token when the server still honours it, a fresh POST /api/workspaces otherwise. The bootstrap makes that session active, so a workflow created from the start page opens with the token that owns it. describeBootstrapError turns the throttle's 429 into a readable message. - useWorkspaceSession exposes the bootstrap with a retry. - api gains createWorkspace, fromTemplate, templateRevision and the kind filter on templates, per the agreed contract. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
SPEC-0002/FR-001, FR-003, FR-003a, FR-004, FR-007, FR-008. - AppShell is a layout route around every page except the editor routes and /lti/register: MUI AppBar with the brand linking to "/", the destinations Workflows, Templates, Workshop and Facilitator (the current one marked, collapsed into a menu on narrow screens) and the appearance picker, which leaves the start page. - StartPage bootstraps the browser workspace and offers New workflow, My workflows and Templates, pointing participants to the workshop hub. - WorkshopPage (/workshop) holds the "Start workshop" code entry and the way back to the workshop joined last in this browser. - WorkflowListPage (/workflows) and TemplatesPage (/templates) return: the gallery lists published workflow templates with a structure preview and "Use template" copies one into the browser workspace. - TemplateCard gains the shared TemplateStructureDialog and names each card as an article; the workshop overview uses the dialog too and loses its Back button, as do the restored pages. - The editor treats a BROWSER session as valid, shows "Workshop" only for workshop sessions, "Home" for browser sessions and neither in LTI mode, and asks the palette for BLOCK templates explicitly now that the endpoint serves both kinds. - WorkshopJoin's failure states lead back to the hub. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
…kshop joinFromLandingPage opens "/", follows the title bar's Workshop link and joins from the hub, so the conference smoke test keeps walking the real UI. direct-entry.spec.ts creates a workflow in a BROWSER workspace, keeps it across a reload, lists it under My workflows, and copies a template from the gallery into the editor. The SPEC-0022 start-page test now asserts the new split: direct use at the root, the code on the hub, templates still workspace-scoped. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
…shop SPEC-0002: FR-001, FR-003, FR-004, US-002, US-003 and AC-003 are live requirements again with the browser workspace; FR-003a/AC-003a (template gallery), FR-007/AC-008 (title bar and the editor's way home), FR-008/AC-009 (the workshop hub) and AC-010 (retryable bootstrap) are added; FR-001a and AC-006 move to the hub. The module map's frontend section, the frontend session rule and the CLAUDE.md routing rows follow. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
SPEC-0023. A platform launches NodeGrade over OpenID Connect and a signed id_token, into the same LTI workspace, cookie and redirect as the 1.1 basic launch. @haski/lti (pure TypeScript, no new dependency): - claim URIs, message types, role vocabulary and isEditorRole - LtiPlatformRegistration, readOidcLoginRequest, buildOidcAuthorizationUrl - verifyIdToken (signature with jsonwebtoken + createPublicKey from the platform JWK, iss, aud/azp, exp, iat, nonce, message type, version, deployment) and mapLaunchClaims - typed AGS and NRPS claim readers replace the console.log stubs; the signing launch stub and dead registration config are removed Backend LtiModule (controller and service leave the AppModule lists): - GET /lti/config, GET|POST /lti/login, POST /lti/launch, GET /lti/jwks, all outside the api prefix; POST /lti/basiclogin stays and logs a deprecation line per launch - LtiLoginStateStore: server-side state + nonce, 10 minutes, single use; state cookie SameSite=None when cookies are secure - JwksFetcher with a short cache and one refresh for an unknown kid - LtiService.establishLaunch shared by both launch kinds - LTI_PLATFORMS parsed and validated at startup (config/lti-platforms.ts), LTI_TOOL_PRIVATE_KEY, LTI_TOOL_URL; passed through the compose files and documented in stack.env.example and .env_template - jest: login URL, refusals (unknown issuer/client/deployment, forged, stale, replayed, wrong kid/type/version), role mapping, module wiring, config and jwks endpoints Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
- docs/adr/0011-direct-browser-access-restored.md supersedes the withdrawal in ADR-0010; read-only closed workshops, the join throttle and entry-based revision resolution stay in force. - SPEC-0022 FR-013/FR-014, AC-010/AC-011 restated for direct browser access; SPEC-0004 FR-003 live again, BROWSER first-class, FR-008 covers both launch kinds; new SPEC-0023 (LTI 1.3 launch) with the roadmap as deferred requirements; specs/index.md wave 12 and status row. - docs/lti.md: what LTI is, 1.1 versus 1.3, what NodeGrade implemented, what this change adds, registering in Moodle and Canvas, every environment variable, the roadmap, sources. - docs/architecture.md (three workspace origins, entry flows for direct, workshop and LTI, the /lti routes), docs/module-map.md (Workspaces, Workflow, Templates, LTI sections), README, CLAUDE.md invariants and LTI row, .claude/rules/backend.md LTI conventions. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
…and LTI Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
…ilure Only a 401 from GET /api/workspaces/me means the stored token is gone; any other failure is shown with the retry, so a passing server error cannot cost a visitor the workspace that holds their workflows. nginx serves the single-page /lti/register route itself instead of proxying it to the backend with the launch routes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
…rap's The memoized browser-workspace bootstrap wrote the active session only when it ran. A participant who opened "/", joined a workshop from the hub and returned to "My workflows" got the browser's list but an editor that opened the workflow with the workshop token; a mint that resolved after the participant had joined a workshop also overrode the workshop session. workspaceStore.saveBrowser is split into rememberBrowser (the browser workspace only) and activate (the active session only). ensureWorkspaceSession remembers, useWorkspaceSession activates on every mount while the page is still mounted, and the handlers that open the editor from the start page, the gallery and the list activate the session they used right before navigating. saveWorkshop keeps activating the workshop session (SPEC-0002 business rules). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
The editor's load effect ran before the session check redirected a session-less visit to the start page, so /editor/:id without a token still issued an unauthenticated GET /api/workflows/:id. The effect now returns early outside an LTI launch when there is no token, and the FR-005 routing tests assert what the specification says: the start page is presented without a graph load attempt. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
POST /lti/basiclogin skipped the OAuth check whenever LTI_CONSUMER_KEY or LTI_CONSUMER_SECRET was unset, which the compose files default to, and both launch kinds shared the issuer|context|resource_link key. A form post naming a 1.3 issuer as its consumer key therefore opened that platform's course workspace as an editor. The 1.1 launch now answers 503 lti_11_not_configured while either credential is unset; LTI_11_ALLOW_UNSIGNED=true reopens it for local testing and logs a warning per launch. A 1.3 launch is keyed as lti13:<iss>|<client_id>|<deployment_id>|<context.id>|<resource_link.id> (ltiWorkspaceKey); 1.1 keys stay as they were so existing rows keep resolving, and a 1.1 key that would begin with the lti13: namespace is refused. mapLaunchClaims carries the verified deployment id for this. SPEC-0023 FR-004/FR-005/AC-005 and SPEC-0004 FR-008 name the two key forms and the refusal; docs/lti.md, stack.env.example, the compose files and the env templates document LTI_11_ALLOW_UNSIGNED. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
The launch accepted a login on the server-side record alone when the browser sent no state cookie, so an attacker could finish their own login inside a victim's browser with a hidden form posting id_token and state within the ten-minute TTL and plant their LTI identity there. The cookie is now required whenever cookies are secure: a launch without it is refused with 401 lti_state_cookie_missing, telling the person to start the tool from the course again in its own window, and the login record is spent by the attempt. Only COOKIE_INSECURE stacks (plain HTTP, where the cookie falls back to Lax and is absent on the cross-site post) accept the record alone, with a warning per launch. The cookie is named per login (lti_nodegrade_state_<state>, path /lti, same TTL) so parallel logins keep their own state, and it is cleared on the launch with the attributes it was set with. SPEC-0023 FR-002, FR-003, AC-002, AC-004 and the edge case describe the rule; docs/lti.md explains why the cookie matters. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
The editor has no title bar, and its Home and Workshop buttons were hidden at xs, so a phone had no way out of the editor. Below the sm breakpoint the way back now renders as an icon button under the same accessible name, so a participant and the e2e selectors find it at every width (SPEC-0002/FR-007). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
isEditorRole fell back to the bare name of any URN, which made urn:lti:instrole:ims/lis/Instructor an editor. That changed the 1.1 path (a Learner who teaches another course used to open the student view) and contradicted the 1.3 rule that an institution Instructor stays a learner. The 1.1 URNs are now parsed by namespace: urn:lti:role:ims/lis/<X> edits when X is Instructor, Administrator or an Instructor/ sub-role; the instrole and sysrole Administrator edit; every other instrole or sysrole URN does not; the bare names Instructor and Administrator stay editors. SPEC-0023 FR-005 and AC-005 state the rule, with the Learner plus institution-Instructor case in lti-claims.spec.ts and lti.service.spec.ts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
The launch cookie of SPEC-0023/FR-004 is SameSite=Lax, so a launch inside the course page's frame ends without it and the editor's first request answers 401. In LTI mode, with a 401 and window.self !== window.top, the editor now says that NodeGrade has to open in its own window and that the course should open the tool in a new window; every other load failure keeps the server's message. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
…rkshop The README still described the code-only product of the conference. The overview mirrors the CLAUDE.md project paragraph: a browser gets its own workspace at "/", participants enter the code on the Workshop page or open /workshop/<code>, LTI launches open a course-bound workspace. The workshop flow, the Templates feature bullet, the template-authoring note, the retention and throttle descriptions and the participant handout follow suit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
A visitor creates a browser workflow, goes Home, joins the WAIE workshop from the title bar (its single entry opens the copy in a workspace of its own, with Workshop present and Home absent), then returns to "/" and opens the browser workflow from "My workflows": the editor loads it with the BROWSER workspace, not with the workshop session used last (SPEC-0002 business rules). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
JwksFetcher refetched the platform key set on every unknown kid, so a loop of
self-signed tokens hammered the platform's key endpoint; /lti/login was
unthrottled, and every call records a pending login, so one address could
evict everyone else's logins from the store.
The fetcher records the last forced refresh per key set URI and serves the
cached set for a forced refresh within 60 s of it. LtiLoginThrottle caps login
initiations per address with the repository's sliding window (60 a minute by
default, LTI_LOGIN_MAX and LTI_LOGIN_WINDOW_MS), answering 429 with Retry-After
and the { code, message } payload like the workspace and facilitator throttles.
SPEC-0023 FR-002, FR-003 and AC-002 name both; docs/lti.md and the module map
list the new file and variables.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
LtiBasicLaunchValidationPipe logged the whole posted form at debug when validation failed, which put names, e-mail addresses and the OAuth signature into the log. A rejected form is now described by its error list alone; the lis_result_sourcedid parse failure logs nothing either, because JSON.parse quotes the value in its message. pipes/lti-validation.pipe.spec.ts asserts that nothing logged for a rejected form carries a field value, lti.controller.spec.ts asserts the same for every line logged during a 1.1 launch, and SPEC-0023 NFR-001's verification line now says exactly that. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
isBasicLtiLaunchValid required numeric user, context and resource link ids, so it rejected every real 1.1 form, and nothing imported it: the backend validates the form field by field in LtiBasicLaunchValidationPipe. The Dynamic Registration guards stay for the roadmap. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
docs/lti.md told the admin to paste GET /lti/config into Canvas's "Paste JSON"
form, but Canvas's LTI 1.3 configuration schema wants title, description,
oidc_initiation_url, target_link_uri, public_jwk_url, scopes, privacy_level,
custom_fields and its placements under a canvas.instructure.com extension.
GET /lti/config?format=canvas now answers that shape: privacy_level public,
custom_fields { activityname }, and one course_navigation placement with
windowTarget _blank, because the launch cookie is first-party only. The
generic configuration stays the default. SPEC-0023 FR-006 and AC-006 cover
it; docs/lti.md points Paste JSON at the new format and documents Manual Entry
field by field, placements included.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
The /lti/ location set "Host $host", which drops the port, so the backend derived http://localhost/lti/launch for the yarn dev:up stack on 8080 and published it in /lti/config and as the OIDC redirect_uri, which the platform then refused. The location now passes $http_host, the header as the browser sent it; the other locations keep $host, since nothing behind them derives a public URL from it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
…iew fixes docs/lti.md presented Moodle "Embed" and Canvas iframe placements as working, but the launch cookie is SameSite=Lax and so first-party only: embedded in the course page it never reaches the frontend. The guide now says to register every placement to open in a new window (Moodle "Default launch container: New window", Canvas "Open in a new tab"), explains why, and lists the embedded launch session (SameSite=None with a CSRF defence, or a one-time code exchanged for a bearer token) as a roadmap item; SPEC-0023 carries it as FR-013 (deferred) with the matching edge case. The LTI_TOOL_URL row names it as the override for a proxy that rewrites the origin. CLAUDE.md's LTI invariant, .claude/rules/backend.md, docs/architecture.md and docs/module-map.md record the rules this review introduced: the 1.1 launch is refused without credentials, 1.3 keys live in the lti13: namespace through ltiWorkspaceKey, the state cookie is per login and required when secure, and /lti/login is throttled per address. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The conference workshop is over. NodeGrade is a directly usable application at its main URL again, the workshop features live under
/workshopbehind a titlebar, LTI launches keep working, and LTI 1.3 launches are supported next to the LTI 1.1 basic launch.Direct entry and the app shell (frontend)
/gives the browser its own anonymous workspace (typeBROWSER, token in localStorage) with New workflow, My workflows (/workflows) and Templates (/templates, the workflow-template gallery with Use template).AppShelllayout route) on every page outside the editor and the LTI registration popup: brand, Workflows, Templates, Workshop, Facilitator, appearance menu./workshopis the workshop hub (code entry, way back to the last joined workshop);/workshop/:codestays the join and overview page. Every SPEC-0022 behaviour stays: template entries, pinned or newest revision, closed or expired workshops are read-only, join throttle, readiness preflight.Browser workspaces and template access (backend)
POST /api/workspacesmints aBROWSERworkspace again (shared per-address throttle with workshop joins);WorkspaceService.resolveByTokenresolvesBROWSERtokens; retention still sweeps idle browser workspaces.GET /api/templates?kind=WORKFLOW|BLOCKserves both kinds, workspace-scoped;GET /api/templates/:slugandGET /api/templates/revisions/:idrestored;POST /api/workflows/from-templaterestored.LTI
docs/lti.md. The 1EdTech specification hosts are blocked from the build container, so the guide was cross-checked against reference implementations and search results; a check against a live platform is the next step.@haski/ltiis now a pure protocol library: claims and role vocabulary,LtiPlatformRegistration,readOidcLoginRequest,buildOidcAuthorizationUrl,verifyIdToken(RS256 family pinned,kidrequired,iss,aud/azp,exp,iat,nonce, message type, version, deployment),mapLaunchClaims. The old launch-signing stub is gone: a tool verifies, it never signs a launch.LtiModule:GET /lti/config(plus?format=canvasfor the Canvas developer-key JSON),GET|POST /lti/login(server-side single-use state and nonce, a per-login state cookie, per-address throttleLTI_LOGIN_MAX/LTI_LOGIN_WINDOW_MS),POST /lti/launch(the state cookie is required whenever cookies are secure; JWKS refreshes are capped),GET /lti/jwks;POST /lti/basicloginstays for LTI 1.1 and now requiresLTI_CONSUMER_KEYandLTI_CONSUMER_SECRET(LTI_11_ALLOW_UNSIGNED=truefor local testing only). 1.3 workspaces live in their ownltiKeynamespace (lti13:<iss>|<client_id>|<deployment_id>|<context>|<resource_link>), so a 1.1 post can never address a 1.3 course. Platforms are configured throughLTI_PLATFORMS. Launches open in a new window because the launch cookie is first-party only;docs/lti.mdsays so and lists embedded launches as the next step.docs/architecture.md,docs/module-map.md,README.md,CLAUDE.mdand the rules follow.Verification
Run on the merged branch:
yarn build,yarn typecheck,yarn lint:checkyarn test:backend(768 tests),yarn test:frontend(299 tests)yarn lint:specs,yarn test:specsyarn playwright test --list(every spec parses)The Playwright suite and the Postgres integration tests need the Docker debug stack, which the build container lacks; the PR workflow runs them here. Two independent adversarial reviews of the merged diff ran before this PR; every verified finding is fixed in the last commits.
Branching
devandmaincarry the same content (PR #65), so this branch is based onmainand targetsmainas requested;devcan be fast-forwarded after the merge.🤖 Generated with Claude Code
https://claude.ai/code/session_01LZNoLWTKppZoDGBCgE6r4z
Generated by Claude Code