Skip to content

refactor(reorg): extract endpoint + tool_type/tool_config/tool_product modules [7/10]#14982

Draft
valentijnscholten wants to merge 2 commits into
reorg/peripheral-userfrom
reorg/peripheral-tools-endpoint
Draft

refactor(reorg): extract endpoint + tool_type/tool_config/tool_product modules [7/10]#14982
valentijnscholten wants to merge 2 commits into
reorg/peripheral-userfrom
reorg/peripheral-tools-endpoint

Conversation

@valentijnscholten

@valentijnscholten valentijnscholten commented Jun 8, 2026

Copy link
Copy Markdown
Member

Stacked PRs

This is one of a stacked series that reorganizes dojo/ into self-contained dojo/{module}/ packages (matching the dojo/url/ reference). They are stacked — each PR is based on the previous one — so review and merge bottom-up in this order:

  1. refactor(product_type): Extra ProductType models into dojo/product_type/ module [1/10] #14970 — product_type
  2. refactor(test): Extract Test models into dojo/test/ module [2/10] #14971 — test
  3. refactor(engagement): Extract Test models into dojo/test/ module [3/10] #14972 — engagement
  4. refactor(product): Extract Product module into dojo/product/ [4/10] #14973 — product
  5. refactor(finding): Reorganize finding into self-contained dojo/finding/ package [5/10] #14974 — finding (+ CWE & BurpRawRequestResponse fold-in)
  6. refactor(reorg): extract user + system_settings modules [6/10] #14981 — peripheral: user + system_settings
  7. refactor(reorg): extract endpoint + tool_type/tool_config/tool_product modules [7/10] #14982 — peripheral: endpoint + tool_type/tool_config/tool_product ◀ this PR
  8. refactor(reorg): extract survey + benchmark modules [8/10] #14983 — peripheral: survey + benchmark
  9. refactor(reorg): extract notes/note_type/file_uploads/reports/risk_acceptance [9/10] #14986 — peripheral: notes/note_type + file_uploads + reports + risk_acceptance
  10. refactor(reorg): extract regulations/banner/announcement/development_environment/object [10/10] #14987 — peripheral: regulations + banner + announcement + development_environment + object

Merge #14970 first; each following branch is rebased onto the updated base and merged in turn. This PR continues the stack on top of #14981 — full implementation brief is the Phase 10 section in AGENTS.md.

Summary

Reorganizes the endpoint, tool_type, tool_config, and tool_product domains into self-contained dojo/{module}/ packages with ui/ and api/ sub-packages, matching the dojo/url/ reference layout. Pure code-movement: no behaviour or migration changes; backward-compat re-exports keep external consumers working.

endpoint (dojo/endpoint/)

  • Move Endpoint_Params, Endpoint_Status, Endpoint into dojo/endpoint/{models,admin}.py. All FKs use string references; the dojo.models re-export keeps Endpoint resolvable for the remaining FKs that target it.
  • Move the endpoint forms into ui/forms.py and the endpoint UI filters (EndpointFilterHelper, EndpointFilter, EndpointFilterWithoutObjectLookups) into ui/filters.py; the dojo/filters.py re-exports are dropped (they cycle with DojoFilter) and consumers in search/reports repoint to the new path. EndpointReportFilter is report-domain and stays in dojo/filters.py. ApiEndpointFilter moves to api/filters.py.
  • Move the endpoint DRF serializers into api/serializer.py. EndpointSerializer.tags (a TagListSerializerField, which stays in api_v2/serializers.py) is resolved lazily in a get_fields() override so the module carries no top-level api_v2.serializers import. The moved ModelSerializers are re-exported from api_v2/serializers.py for prefetcher discovery and because ReportGenerateSerializer nests EndpointSerializer.
  • Move EndPointViewSet, EndpointStatusViewSet, EndpointMetaImporterView into api/views.py and add dojo/endpoint/api/urls.py. The dojo/urls.py registration preserves the exact routes/basenames and the V3_FEATURE_LOCATIONS conditional: endpoint_meta_import is always registered; under V3 the location-compat viewsets serve endpoints/endpoint_status, otherwise add_endpoint_urls registers the legacy viewsets.
  • Move views.py/urls.py into ui/; queries.py/signals.py/utils.py stay.

tool_type / tool_config / tool_product

  • Move Tool_Type, Tool_Configuration, Tool_Product_Settings, Tool_Product_History into their {models,admin}.py (string-ref FKs). The ToolConfigForm_Admin (ModelForm) and Tool_Configuration_Admin (ModelAdmin) helpers move from dojo/models.py into dojo/tool_config/admin.py.
  • Move the tool forms into each module's ui/forms.py, the serializers into api/serializer.py (re-exported for prefetcher discovery), and ToolConfigurationsViewSet/ToolProductSettingsViewSet/ToolTypesViewSet into api/views.py with add_*_urls, preserving routes/basenames.
  • Move each module's views.py/urls.py into ui/; tool_config/factory.py and tool_product/queries.py/signals.py stay.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant