Skip to content

feat(api): Custom rules subdomains rule#60

Merged
MaciejTe merged 16 commits intomainfrom
feat/custom-rules-subdomain-blocking
Feb 11, 2026
Merged

feat(api): Custom rules subdomains rule#60
MaciejTe merged 16 commits intomainfrom
feat/custom-rules-subdomain-blocking

Conversation

@MaciejTe
Copy link
Copy Markdown
Collaborator

PR type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other... Please describe:

Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
@MaciejTe MaciejTe requested a review from Copilot February 10, 2026 11:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a per-profile custom_rules_subdomains setting to control whether newly created custom rules automatically include subdomains (by storing *.domain), and expands the generated API clients/docs to cover new/updated endpoints and schemas.

Changes:

  • Add custom_rules_subdomains to profile privacy settings (API model, validation, migration) and apply it during custom rule creation.
  • Extend API/client surface with services catalog + profile services enable/disable endpoints, plus sort_by query params for list endpoints.
  • Update web UI settings + FAQ copy and add DNS integration tests covering subdomain/custom-rule precedence behavior.

Reviewed changes

Copilot reviewed 60 out of 309 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/moddns_client/test/test_requests_create_profile_custom_rules_batch_body.py Adjusts test stub to satisfy newly-required action field
tests/moddns_client/test/test_requests_create_profile_custom_rule_body.py Adjusts test stub to satisfy newly-required action field
tests/moddns_client/test/test_profile_api.py Adds stub tests for new profile services endpoints
tests/moddns_client/test/test_model_services_settings.py Adds model test stub for new ModelServicesSettings
tests/moddns_client/test/test_model_profile_settings.py Updates test stub data for new privacy fields (custom_rules_subdomains, services)
tests/moddns_client/test/test_model_profile.py Updates test stub data for new privacy fields (custom_rules_subdomains, services)
tests/moddns_client/test/test_model_privacy.py Updates test stub data for new privacy fields (custom_rules_subdomains, services)
tests/moddns_client/test/test_api_services_updates.py Adds model test stub for new ApiServicesUpdates
tests/moddns_client/test/test_api_create_profile_body.py Updates test stub to satisfy newly-required name constraints
tests/moddns_client/moddns/models/servicescatalog_service.py Adds generated model for services catalog service entries
tests/moddns_client/moddns/models/servicescatalog_catalog.py Adds generated model for services catalog response
tests/moddns_client/moddns/models/requests_create_profile_custom_rules_batch_body.py Makes action required + adds enum validation
tests/moddns_client/moddns/models/requests_create_profile_custom_rule_body.py Makes action required + adds enum validation
tests/moddns_client/moddns/models/model_services_settings.py Adds generated model for privacy service settings
tests/moddns_client/moddns/models/model_profile_update.py Adds new patch path enum entry for custom_rules_subdomains
tests/moddns_client/moddns/models/model_profile.py Adds stricter validation constraint for profile name length
tests/moddns_client/moddns/models/model_privacy.py Adds custom_rules_subdomains and services with validation/serialization
tests/moddns_client/moddns/models/api_services_updates.py Adds generated request model for services updates (ids list)
tests/moddns_client/moddns/models/api_create_profile_body.py Makes name required and constrained (min/max length)
tests/moddns_client/moddns/models/api_blocklists_updates.py Adds min/max length constraints to blocklist_ids
tests/moddns_client/moddns/models/init.py Exposes new generated models via package init
tests/moddns_client/moddns/api/services_api.py Adds generated Services API client
tests/moddns_client/moddns/api/query_logs_api.py Adds sort_by query param to query logs endpoint
tests/moddns_client/moddns/api/profile_api.py Adds enable/disable services endpoints to Profile API client
tests/moddns_client/moddns/api/blocklists_api.py Adds sort_by query param to blocklists endpoint
tests/moddns_client/moddns/api/init.py Exposes ServicesApi in API package
tests/moddns_client/moddns/init.py Exposes ServicesApi and new models at top-level client
tests/moddns_client/docs/ServicescatalogService.md Adds generated docs for ServicescatalogService
tests/moddns_client/docs/ServicescatalogCatalog.md Adds generated docs for ServicescatalogCatalog
tests/moddns_client/docs/ServicesApi.md Adds generated docs for Services API
tests/moddns_client/docs/RequestsCreateProfileCustomRulesBatchBody.md Updates docs to reflect required action
tests/moddns_client/docs/RequestsCreateProfileCustomRuleBody.md Updates docs to reflect required action
tests/moddns_client/docs/QueryLogsApi.md Updates docs to include sort_by
tests/moddns_client/docs/ProfileApi.md Updates docs with profile services enable/disable endpoints
tests/moddns_client/docs/ModelServicesSettings.md Adds generated docs for ModelServicesSettings
tests/moddns_client/docs/ModelPrivacy.md Documents new privacy fields (custom_rules_subdomains, services)
tests/moddns_client/docs/BlocklistsApi.md Updates docs to include sort_by
tests/moddns_client/docs/ApiServicesUpdates.md Adds generated docs for ApiServicesUpdates
tests/moddns_client/docs/ApiCreateProfileBody.md Updates docs to reflect required name
tests/moddns_client/README.md Lists new endpoints/models in client README
tests/moddns_client/.openapi-generator/FILES Tracks new generated files
tests/dns_tests/test_subdomain_blocking.py Adds E2E DNS tests for blocklist subdomain behavior
tests/dns_tests/test_custom_rules_precedence.py Adds E2E DNS tests for custom rule precedence + custom subdomain semantics
tests/dns_tests/test_custom_rules.py Updates expectation: include-mode custom rules block subdomains by default
app/src/pages/settings/ProfileManagementSection.tsx Adds UI toggle for custom_rules_subdomains
app/src/pages/settings/CustomRulesSection.tsx New UI component for custom rules setting
app/src/pages/legal/FAQ.tsx Explains difference between blocklist vs custom-rule subdomain settings
app/src/pages/custom_rules/MainContentSection.tsx Updates copy to reflect include-mode default behavior
app/src/api/client/api.ts Updates generated TS types/enums for new fields + required properties
api/service/profile/service.go Adds PATCH handling for custom_rules_subdomains
api/service/profile/error.go Adds error for invalid custom_rules_subdomains
api/service/profile/custom_rules.go Implements include/exact behavior during bulk custom rule creation
api/model/profile_settings.go Adds constants + default value for custom_rules_subdomains
api/model/profile.go Extends patch path validation to include custom_rules_subdomains
api/model/privacy.go Adds CustomRulesSubdomains field with validation
api/docs/swagger.yaml Updates API schema (enums, min/max lengths, required fields, new path)
api/docs/swagger.json Updates generated swagger JSON accordingly
api/docs/docs.go Updates embedded swagger doc template
api/db/mongodb/migrations/015_profiles_add_custom_rules_subdomains.up.json Sets custom_rules_subdomains=include for existing profiles
api/db/mongodb/migrations/015_profiles_add_custom_rules_subdomains.down.json Removes custom_rules_subdomains on rollback

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/service/profile/custom_rules.go Outdated
Comment thread app/src/pages/settings/ProfileManagementSection.tsx
Comment thread tests/moddns_client/docs/QueryLogsApi.md
Comment thread tests/moddns_client/docs/BlocklistsApi.md
Comment thread tests/moddns_client/docs/ServicescatalogService.md
Comment thread tests/moddns_client/moddns/api/query_logs_api.py
Comment thread tests/moddns_client/moddns/api/blocklists_api.py
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
Signed-off-by: Maciek <tomczukmaciej@gmail.com>
@MaciejTe MaciejTe requested a review from Copilot February 10, 2026 14:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 73 out of 73 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/service/profile/service.go
Comment thread tests/moddns_client/docs/ServicescatalogCatalog.md
Comment thread api/service/profile/service_test.go
Comment thread tests/dns_tests/test_subdomain_blocking.py
Comment thread tests/dns_tests/test_subdomain_blocking.py
Comment thread tests/dns_tests/test_custom_rules_precedence.py
Comment thread app/src/pages/settings/ProfileManagementSection.tsx
<div className="flex flex-col gap-6 w-full">
{customRulesSettings.map((setting, index) => (
<div
key={index}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Using the array index as a React key can cause incorrect state retention if the settings list ever changes order or items are added/removed. Prefer a stable key (e.g., setting.title or an explicit id field) since these settings appear semantically identifiable.

Suggested change
key={index}
key={setting.title}

Copilot uses AI. Check for mistakes.
Comment on lines +328 to 334
// Update custom rules settings
setCustomRulesSettings([
{
...customRulesSettings[0],
value: profile.settings?.privacy?.custom_rules_subdomains_rule ?? "include",
},
]);
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This update reuses customRulesSettings[0] from the current render closure, which can become stale if state updates are batched or if additional settings are added later. Prefer the functional form (setCustomRulesSettings(prev => ...)) to ensure you always base the next state on the latest value.

Copilot uses AI. Check for mistakes.
Comment on lines +171 to +174
const handleCustomRulesSettingsChange = async (idx: number, value: string) => {
if (value === "") return;
if (customRulesSettings[idx].value === value) return;
if (!activeProfile) return;
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This introduces new UI behavior (patching custom_rules_subdomains_rule) that isn’t exercised by the existing Playwright e2e suite shown in this PR. Consider adding an e2e test that toggles the setting and asserts the PATCH request payload and UI state update, to prevent regressions in request shape and path enums.

Copilot uses AI. Check for mistakes.
@MaciejTe MaciejTe merged commit ce461fd into main Feb 11, 2026
9 checks passed
@MaciejTe MaciejTe deleted the feat/custom-rules-subdomain-blocking branch April 1, 2026 14:08
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