Skip to content

Add built-in POSIXv2 origin backend with native HTTP server#2960

Merged
bbockelm merged 20 commits into
mainfrom
copilot/add-posix-origin-backend
Jan 15, 2026
Merged

Add built-in POSIXv2 origin backend with native HTTP server#2960
bbockelm merged 20 commits into
mainfrom
copilot/add-posix-origin-backend

Conversation

Copilot AI commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Implementation Plan: Built-in POSIX Origin Backend (POSIXv2)

  • Update copyright year to 2026
  • Make structs/functions private
  • Use webdav logger instead of log.Debugf
  • Fix Readdir pagination with state management
  • Move OA4MP and test files to non-XRootD section
  • Fix resource prefix handling (path prefix, not string prefix)
  • Add username/group claim handling with configuration
  • Cache user/group lookup
  • Implement XRootD checksum format
  • Handle Origin.DisableDirectClients
  • Fix checksum header format per RFC
  • Add DoStat test with checksum

Progress

Addressing second round of feedback. Initial refactoring and visibility changes complete.

Original prompt

This section details on the original issue you should resolve

<issue_title>Create built-in POSIX origin backend</issue_title>
<issue_description>1. Create a new "POSIXv2" storage backend in Pelican
2. Create a new "origin_serve" module that replaces the use of XRootD in the origin. When POSIXv2 is utilized as a storage backend, the launcher will initialize this module instead of xrootd.
3. Have the "origin_serve" module be based on FS-like interfaces from github.com/spf13/afero; integrate that interface with HTTP handlers from golang.org/x/net/webdav. It should implement GET, PUT, HEAD, and PROPFIND at the minimum.
4. SciToken / WLCG Token-based auth should be used; local_cache/cache_authz.go contains an implementation of authorization handlers with appropriate caching. Once the token is decoded and authorization decision made, info about the user and groups (if any) should be added to the HTTP context prior to invoking the filesystem code.

The ultimate goal is to have an end-to-end test with XRootD-based cache demonstrating upload, download, and directory listing with the POSIXv2 backend.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Create built-in POSIX origin backend Add built-in POSIXv2 origin backend with native HTTP server Jan 8, 2026
Copilot AI requested a review from bbockelm January 8, 2026 15:05

@bbockelm bbockelm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable first attempt. Please address the items I noted.

One important piece: checksums! These are not supported by afero so we'll need to do it on our own. Define an interface for fetching checksums given a filename and an implementation that uses extended attributes to store computed checksums (retrieving them by default; otherwise, recompute & store). Later, we'll develop additional methods for filesystems that don't support extended attributes.

Comment thread e2e_fed_tests/posixv2_test.go
Comment thread launchers/origin_serve.go Outdated
Comment thread origin_serve/authz.go
Comment thread origin_serve/handlers.go
Comment thread origin_serve/handlers.go Outdated
Comment thread origin_serve/handlers.go Outdated

Copilot AI commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

Reasonable first attempt. Please address the items I noted.

One important piece: checksums! These are not supported by afero so we'll need to do it on our own. Define an interface for fetching ch...

All feedback addressed. Added checksum support with:

  • Checksummer interface for fetching/computing checksums
  • XattrChecksummer implementation using extended attributes
  • Support for MD5, SHA1, CRC32
  • Checksum headers in HEAD responses (Digest, X-Checksum-Sha1, X-Checksum-Crc32)
  • Future: Add implementations for filesystems without xattr support

Commit 68c0ac6

Copilot AI requested a review from bbockelm January 8, 2026 17:50
@bbockelm bbockelm added enhancement New feature or request origin Issue relating to the origin component labels Jan 8, 2026

@bbockelm bbockelm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another round of change requests. Hopefully the last before my final touchups.

Comment thread e2e_fed_tests/posixv2_test.go Outdated
Comment thread launchers/origin_serve.go
Comment thread launchers/origin_serve.go Outdated
Comment thread origin_serve/authz.go Outdated
Comment thread origin_serve/authz.go Outdated
Comment thread origin_serve/filesystem.go Outdated
Comment thread origin_serve/filesystem.go Outdated
Comment thread origin_serve/handlers.go
Comment thread origin_serve/handlers.go
Comment thread origin_serve/handlers.go Outdated

Copilot AI commented Jan 9, 2026

Copy link
Copy Markdown
Contributor Author

Another round of change requests. Hopefully the last before my final touchups.

Addressed 8 of 16 comments in commit 0a53b53 (visibility, copyright, refactoring, OA4MP placement). Working on remaining comments which involve more complex changes to authorization, checksums, and token handling. Will complete in subsequent commits.

Copilot AI requested a review from bbockelm January 9, 2026 00:45
Comment thread launchers/origin_serve.go Dismissed
Comment thread launchers/origin_serve.go Dismissed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/handlers.go Dismissed
Comment thread origin_serve/handlers.go Dismissed
Comment thread origin_serve/handlers.go Fixed
@bbockelm bbockelm force-pushed the copilot/add-posix-origin-backend branch from de1be45 to 3b1cdb4 Compare January 10, 2026 18:33
Comment thread launchers/origin_serve.go Dismissed
Comment thread launchers/origin_serve.go Dismissed
Comment thread origin_serve/handlers.go Dismissed
Comment thread origin_serve/handlers.go Dismissed
@bbockelm bbockelm force-pushed the copilot/add-posix-origin-backend branch from 1614ac8 to 5dae320 Compare January 11, 2026 17:01

@bbockelm bbockelm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many things to do. Will have VS Code agent work on these items.

Comment thread e2e_fed_tests/posixv2_advanced_test.go Outdated
Comment thread e2e_fed_tests/posixv2_advanced_test.go Outdated
Comment thread e2e_fed_tests/posixv2_advanced_test.go Outdated
Comment thread e2e_fed_tests/posixv2_test.go Outdated
Comment thread e2e_fed_tests/posixv2_test.go
Comment thread origin_serve/handlers.go Outdated
Comment thread origin_serve/handlers.go Outdated
Comment thread origin_serve/handlers.go
Comment thread origin_serve/user_mapfile.go
}

// Extract groups from token using configured claim
if groups, ok := tokenClaims[um.groupsClaim]; ok {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also accept a string of space-separated group names.

@bbockelm bbockelm self-requested a review January 13, 2026 01:59
Copilot AI and others added 6 commits January 14, 2026 14:55
- Added checksum support using extended attributes (xattr)
- Implemented Checksummer interface with MD5, SHA1, CRC32 support
- Added checksum headers to HEAD responses
- Updated token extraction to support multiple tokens from headers and query params
- Moved user/group extraction into authorize function
- Refactored launcher to use boolean flag instead of duplicate function
- Added comprehensive authorization tests (SciToken, WLCG, caching, user extraction)
- Added request logging at info level
- Added test for checksum retrieval in e2e tests

Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
- Fixed token extraction to use single case-insensitive operation
- Fixed exportPrefixMap initialization to use global variable
- Fixed typo: initializting -> initializing
- Optimized checksum validation to only check mtime when cache exists

Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
- Updated copyright year to 2026 in filesystem.go
- Made structs/functions private (userInfo, getUserInfo, setUserInfo, etc.)
- Added logger parameter to filesystem operations and removed log.Debugf calls
- Fixed Readdir pagination with state management (dirEntries, dirOffset, mutex)
- Moved OA4MP and test file maintenance to non-XRootD section in launcher
- Code compiles successfully

Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
@bbockelm bbockelm force-pushed the copilot/add-posix-origin-backend branch from cfa3265 to 2f798fa Compare January 14, 2026 20:58
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
Comment thread origin_serve/checksum.go Fixed
This was referenced Jan 15, 2026
@bbockelm bbockelm marked this pull request as ready for review January 15, 2026 17:42
@bbockelm

Copy link
Copy Markdown
Collaborator

Alright, here goes nothing...

@bbockelm bbockelm merged commit 7159a71 into main Jan 15, 2026
30 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request origin Issue relating to the origin component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create built-in POSIX origin backend

3 participants