Skip to content

Update CLAUDE.md with detailed info about pulp-service#955

Open
decko wants to merge 1 commit intomainfrom
claude_rules_update
Open

Update CLAUDE.md with detailed info about pulp-service#955
decko wants to merge 1 commit intomainfrom
claude_rules_update

Conversation

@decko
Copy link
Member

@decko decko commented Feb 25, 2026

Summary by Sourcery

Improve and expand the CLAUDE.md contributor guide with detailed architecture, component index, and operational reference for the pulp-service plugin.

Documentation:

  • Document core plugin components, deployment assets, and their locations in the repository.
  • Add high-level architecture overview including services, request flow, middleware stack, authentication classes, and context variables.
  • Document key environment variables, common development tasks, and coding standards for working on pulp-service.
  • Add build, ephemeral deployment, and contributor task-completion checklist guidance, pointing to ARCHITECTURE.md for full reference.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 25, 2026

Reviewer's Guide

Expands and restructures CLAUDE.md to provide a richer, task-oriented reference for the pulp-service plugin, including architecture, middleware, auth, context vars, environment and development workflows, while adding deployment and style/checklist guidance.

Sequence diagram for request flow through pulp-service middleware and viewsets

sequenceDiagram
  actor Client
  participant LoadBalancer
  participant Gunicorn as Gunicorn_WSGI
  participant UserExtraction as UserExtractionMiddleware
  participant DjangoMW as DjangoMiddlewareStack
  participant ViewSet as DRF_ViewSet

  Client->>LoadBalancer: HTTP request
  LoadBalancer->>Gunicorn: Forward request
  Note over LoadBalancer,Gunicorn: Sets X_Forwarded_For and X_RH_IDENTITY

  Gunicorn->>UserExtraction: Call WSGI app
  UserExtraction->>UserExtraction: Decode base64 X_RH_IDENTITY
  UserExtraction->>UserExtraction: Set REMOTE_USER and ORG_ID
  UserExtraction->>DjangoMW: Pass request to Django

  DjangoMW->>DjangoMW: ProfilerMiddleware (optional)
  DjangoMW->>DjangoMW: RhEdgeHostMiddleware
  DjangoMW->>DjangoMW: RHSamlAuthHeaderMiddleware (pulp_mgmt paths)
  DjangoMW->>DjangoMW: RequestPathMiddleware (set request_path_var)
  DjangoMW->>DjangoMW: ActiveConnectionsMetricMiddleware

  DjangoMW->>ViewSet: Dispatch to DRF ViewSet
  ViewSet->>ViewSet: Authentication using X_RH_IDENTITY
  ViewSet->>ViewSet: Authorization with DomainOrg and ContextVars
  ViewSet-->>Client: HTTP response
Loading

File-Level Changes

Change Details Files
Add quick-reference index and architecture overview for core pulp-service components.
  • Introduce Quick Reference Index section that maps major components (settings, models, viewsets, serializers, auth, middleware, storage, signals, tasks, content, admin) to their primary implementation files with short descriptions.
  • Add detailed Architecture section describing three-service model, end-to-end request flow, key design patterns (authentication, multi-tenancy, context vars, storage backends, tasks), and upstream plugins extended by pulp-service.
CLAUDE.md
Document middleware stack, authentication classes, and supporting context variables for request handling.
  • Add breakdown of WSGI, Django, and aiohttp middleware components, including their order and responsibilities.
  • List and describe all custom and upstream authentication classes, including expected X-RH-IDENTITY header formats for standard and Turnpike registry identities.
  • Document key ContextVar instances used to propagate org/user and request-specific data across layers.
CLAUDE.md
Enhance operational and development guidance including env vars, workflows, and code style.
  • Document key environment variables for auth, OTEL, ClamAV, feature service, uvloop, and Sentry, and point to docs/ARCHITECTURE.md for full reference.
  • Add common development task recipes (adding endpoints, auth, middleware, tasks, logging changes, metrics, models) and clarify pytest-based testing dependencies.
  • Refresh Code Style section to emphasize Black with line length 100, pytest+pytest-django, plugin pattern, and entry point configuration.
CLAUDE.md
Add container build, ephemeral deployment commands, and contributor checklist to CLAUDE.md.
  • Add docker build command and bonfire-based ephemeral deployment instructions tied to deploy/clowdapp.yaml.
  • Introduce Task Completion Checklist covering formatting, tests, towncrier changelog entries, migrations, patches, and keeping deployment scripts and ClowdApp config in sync.
  • Add upstream and source repository links, and a pointer to docs/ARCHITECTURE.md as the full reference.
CLAUDE.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

| **Authentication** | `pulp_service/app/authentication.py` | X.509 cert, SAML, registry auth backends |
| **Authorization** | `pulp_service/app/authorization.py` | Domain-based RBAC permissions |
| **Middleware** | `pulp_service/app/middleware.py` | Profiler, edge host, SAML, OTEL metrics |
| **Storage** | `pulp_service/app/storage.py` | AIPCCStorageBackend, OCIStorageBackend |
Copy link
Member

Choose a reason for hiding this comment

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

i don't think we have an AIPCCStorageBackend

**Three-service model:**
1. **pulp-api** — Gunicorn WSGI serving Django REST API (port 24817 local, 8000 prod)
2. **pulp-content** — Gunicorn + aiohttp async content delivery (port 24816 local, 8000 prod)
3. **pulp-worker** — Celery workers for background tasks (Redis broker)
Copy link
Member

Choose a reason for hiding this comment

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

Celery is not used. We use a RedisWorker that is in this repository. Though I am working on contributing it upstream.

- **Authentication**: `X-RH-IDENTITY` header (base64-encoded JSON) → custom auth classes in `app/authentication.py`
- **Multi-tenancy**: `DomainOrg` model maps org_id → Pulp domain; domain-based routing for content APIs
- **Context variables**: `ContextVar` instances in `app/middleware.py` carry request-scoped data (org_id, user_id, request_path) across layers
- **Storage backends**: `AIPCCStorageBackend` (S3) and `OCIStorageBackend` (OCI/ORAS) in `app/storage.py`
Copy link
Member

Choose a reason for hiding this comment

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

There is no AIPCCStorageBackend.

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.

2 participants