FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

LWS Protocol Mode Support (Draft/Future) · Issue #87 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub

Repository navigation

LWS Protocol Mode Support (Draft/Future) #87

Closed as not planned
Closed as not planned

Description

Summary

Add optional --lws-mode flag to support W3C Linked Web Storage (LWS) protocol semantics alongside the current Solid Protocol/LDP implementation.

Status: 📋 Draft/Exploratory - LWS spec is in early stages (PR #37 just merged Jan 2026)
Priority: Low (monitor ecosystem first)
Related: w3c/lws-protocol#37

Background

What is LWS?

The W3C Linked Web Storage protocol suite defines CRUD operations with different conventions than Solid/LDP:

  • POST for creation (server-assigned URIs with Slug hints)
  • PUT for updates only (not creation)
  • Link headers for metadata (removes slash semantics for containers)
  • Mandatory ETag concurrency control
  • JSON Merge Patch for metadata updates (via separate linkset resources)

Current State: LDP/Solid

JSS implements Solid Protocol conventions based on LDP:

  • ✅ PUT creates or updates resources
  • ✅ Trailing slash indicates containers
  • ✅ POST to containers with Slug support
  • ✅ ETag-based If-Match/If-None-Match
  • ✅ N3 Patch and SPARQL Update for RDF modifications

Key Differences

Aspect Solid/LDP (Current) LWS Protocol (Proposed)
Resource Creation PUT or POST POST only
PUT Semantics Create or update Update only (404 if not exists)
Container Detection Trailing slash (/alice/) Link header: rel="type"
Metadata Updates N3 Patch, SPARQL Update JSON Merge Patch on linkset
Concurrency Control Optional ETag Mandatory ETag
Slash Semantics Standard (containers end with /) Removed (header-based only)

Proposed Implementation

Configuration Flag

# LWS mode
jss start --lws-mode

# Solid/LDP mode (default, current behavior)
jss start

Code Changes Required

1. PUT Handler Split (src/handlers/resource.js)

Effort: 3 hours

export async function handlePut(request, reply) {
  const lwsMode = request.lwsMode || false;
  
  if (lwsMode) {
    // LWS: PUT only for updates
    const stats = await storage.stat(storagePath);
    if (\!stats) {
      return reply.code(404).send({
        error: 'Use POST to create resources in LWS mode'
      });
    }
  } else {
    // LDP: PUT creates or updates (current)
    const existed = stats \!== null;
  }
}

2. Container Detection Toggle (src/utils/url.js)

Effort: 4 hours

export function isContainer(urlPath, request) {
  if (request?.lwsMode) {
    // LWS: Check Link header for Container type
    const linkHeader = request?.headers?.link || '';
    return linkHeader.includes('ldp#Container');
  } else {
    // LDP: Trailing slash
    return urlPath.endsWith('/');
  }
}

Files affected: src/utils/url.js, src/handlers/resource.js, src/handlers/container.js, src/ldp/headers.js

3. Linkset Metadata Endpoints (new)

Effort: 8 hours

New file: src/handlers/linkset.js

  • GET /resource;linkset - Return metadata as JSON
  • PATCH /resource;linkset - JSON Merge Patch for user-managed metadata

4. Config Infrastructure

Effort: 2 hours

Add --lws-mode flag to CLI and config system.

5. Testing Matrix

Effort: 12 hours

Duplicate all CRUD tests for LWS mode (223 tests × 2 modes = 446 tests total).

Complexity Assessment

Component Effort Files Risk
Config flag 2h 3 Low
PUT behavior 3h 1 Medium
Container detection 4h 4 High
Linkset endpoints 8h 1 new Medium
Testing 12h All High
Documentation 2h 2 Low
Total ~31 hours ~15 High

Trade-offs

Pros ✅

  • Future-proof if LWS gains adoption
  • Universal server supporting both protocols
  • Research value for evaluating LWS concepts
  • Subdomain isolation - run Solid + LWS pods on same server

Cons ❌

  • Test burden - doubles maintenance (446 tests)
  • Code complexity - branching logic throughout
  • Premature - LWS ecosystem is tiny (no known apps)
  • Bug risk - less-used mode more error-prone
  • Documentation split - user confusion

Decision Criteria

Do NOT implement until:

  • ✅ At least 3 other servers implement LWS
  • ✅ At least 5 client apps request LWS support
  • ✅ W3C Solid CG shows interest in LWS alignment
  • ✅ LWS spec reaches Candidate Recommendation status

Monitor These Signals

  • Number of servers implementing LWS
  • Client apps using LWS endpoints
  • W3C Solid CG discussions about LWS
  • LWS spec maturity (currently early draft)

Alternative: Plugin Architecture

Instead of core branching, design protocol adapters:

jss start --protocol=lws      # LWS semantics
jss start --protocol=solid    # LDP semantics (default)
jss start --protocol=s3       # Future: S3-compatible

Benefits:

  • Clean core implementation
  • Community experimentation
  • No test matrix explosion

Current LWS Ecosystem (Jan 2026)

  • Servers: Unknown
  • Clients: Likely zero
  • Spec status: Early draft (PR Login with did:nostr #37 just merged)
  • Community: Small W3C working group

Recommendation

Priority: Low - Monitor but don't implement

Timeline:

  • Now: Capture this analysis
  • Q2 2026: Survey LWS ecosystem adoption
  • Q4 2026: Reassess if signals show traction
  • 2027+: Implement if ecosystem warrants

Keep focus on:

References

Activity

  1. melvincarvalho commented on Jan 14, 2026

    ContributorAuthor

    Update from Solid CG Call

    Eric clarified that in the LWS protocol, PUT CAN do creation - it's not forbidden. The spec emphasizes POST for creation (with server-assigned URIs via Slug), but PUT for creation is still allowed.

    Impact on This Issue

    This significantly changes the analysis:

    Original understanding:

    • LWS: PUT for updates only (404 if resource doesn't exist)
    • LDP: PUT creates or updates

    Corrected understanding:

    • LWS: POST emphasized for creation, but PUT creation is allowed
    • LDP: PUT creates or updates (same!)

    What This Means

    The PUT semantics difference is smaller than assumed. The main LWS distinctions are:

    1. POST with Slug - Standard pattern for server-assigned URIs
    2. Link headers for metadata - Container detection, metadata updates
    3. Mandatory ETags - Concurrency control (we already have this)
    4. Linkset resources - Separate metadata endpoints

    Impact on PR #88

    PR #88's current implementation rejects PUT creation in LWS mode - this is too strict based on Eric's clarification.

    Options:

    1. Remove PUT restriction - Make LWS mode primarily about future features (linkset, metadata)
    2. Make it configurable - Add --lws-strict-put for servers that want to enforce POST-only creation
    3. Keep as-is for now - Since LWS mode is draft/experimental anyway

    Recommendation: Remove the PUT restriction from PR #88 and focus LWS mode on the actual differentiators (linkset endpoints, Link header semantics) when we implement them.

    The current PR is marked as draft anyway, so this is a good opportunity to course-correct before any merge consideration.

    cc: This validates the "monitor ecosystem" approach - specs are still evolving!

  2. melvincarvalho commented on Oct 14, 2026

    ContributorAuthor

    Superseded by #621. This issue was written against the Jan 2026 draft (lws-protocol#37: PUT update-only, slashless containers); the current editor's draft (5 Oct 2026) is substantially different — storage descriptions, application/lws+json containers with pagination, linksets + JSON Merge Patch, an authorization server with RFC 8693 token exchange, access grants, signed webhooks. #621 tracks that surface against Touchstone, with a core/plugin split, and references the two reference implementations now available (Jesse Wright's CSS plugin, Erich Bremer's lws-server).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL