Commit Graph

15321 Commits

Author SHA1 Message Date
Jeremy Stretch 742f4b4330 Release v4.6.2 2026-06-02 10:11:34 -04:00
Jeremy Stretch 0ea6e334a0 Revert "Fixes #22310: Restore tracked placeholder in project-static/docs to prevent staticfiles warning (#22337)"
This reverts commit a72ab9007e to fix the pre-commit workflow.
2026-06-02 09:44:15 -04:00
bctiemann 5b5e821fbb
Merge pull request #22348 from netbox-community/22180-custom-script-data-source-bypass
Closes #22180: Validate scripts added via a data source
2026-06-02 06:56:46 -04:00
Jason Novinger e44d5d3855 Drop issue reference from data source validation comment
Per AGENTS.md conventions, comments should not reference the current
task or issue number, which rot as the codebase evolves.
2026-06-02 12:03:35 +02:00
Jason Novinger 0ba2fdade0 Fixes #22180: Validate scripts added via a data source
ScriptFileForm only validated uploaded scripts, so a script added by
selecting a data file bypassed validate_script_content. A script that
failed to load was committed as a broken module that showed as missing
and could not be corrected, since re-adding it tripped the file path
uniqueness constraint.

Validate the data file's content in the form's clean() the same way
uploaded files are validated, so a script that cannot be loaded is
rejected before any module is created.
2026-06-02 11:49:59 +02:00
github-actions 03fc20d202 Update source translation strings 2026-06-02 06:31:16 +00:00
Jason Novinger 8c2c6f2349
Fixes #22158: Cache empty config revision state to avoid per-request queries (#22342)
When no ConfigRevision exists, the empty state was never cached, so every
request re-queried core_configrevision. Distinguish a genuine cache miss from
a cached-empty state via a sentinel, seed the empty state on first load, and
only consult the database on a true miss.

Treat the cache as warm only when both 'config' and 'config_version' are
present. A missing 'config_version' (evicted or never written) now re-queries
the database instead of leaving Config.version as None when a ConfigRevision
exists. The no-revision branch writes both keys, so the intentional empty
state remains a cache hit.

The config tests shared a single Redis instance (keyed only by a static
prefix) across parallel test workers, so a no-revision test in one worker
could seed empty config/config_version keys that another worker's test then
read, causing intermittent failures. Use a per-process LocMemCache so the
shared cache keys cannot be contaminated across workers.
2026-06-01 20:18:30 +02:00
Martin Hauser 6724c29ffb
test(core): Clear RQ queues before and after tests (#22320)
Add RQQueueTestMixin to centralize RQ queue cleanup for test cases that
interact with background jobs. The mixin clears all RQ queues in setUp()
and tearDown(), preventing jobs created by one test from leaking into
later unrelated test runs.

Replace duplicate queue cleanup logic in core and netbox tests with the
shared mixin for better maintainability.

Fixes #22318
2026-06-01 10:10:13 -07:00
Martin Hauser bcfeb762e8 refactor(tests): Rename test base classes for clarity
Rename `CablePathTestCase` to `BaseCablePathTestCase` and
`JobRunnerTestCase` to `BaseJobRunnerTestCase` to clearly indicate
their role as abstract base classes rather than concrete test cases.

Fixes #22338
2026-06-01 08:58:21 -04:00
Jason Novinger a72ab9007e
Fixes #22310: Restore tracked placeholder in project-static/docs to prevent staticfiles warning (#22337) 2026-06-01 14:31:51 +02:00
bctiemann bc75706b24
Fixes #22328: Add missing else branch to DynamicMultipleChoiceField.get_bound_field() (#22329) 2026-05-29 09:23:01 -04:00
github-actions fd35c36901 Update source translation strings 2026-05-29 06:24:30 +00:00
bctiemann cc78ebf347
Merge pull request #22331 from netbox-community/22270-delete
#22270 - Skip cascade-deleted objects when clearing reverse SET_NUL relations
2026-05-28 20:05:30 -04:00
bctiemann 14f5a2ed7c
Merge pull request #22322 from netbox-community/22319-eventruletestcase-lacks-teardown-leaks-enqueued-events
Closes #22319: Clear RQ queue after Event Rule tests
2026-05-28 20:03:42 -04:00
bctiemann 14c3c573e3
Merge pull request #22314 from netbox-community/21091-render-config-openapi
Fixes #21091: Correct OpenAPI schema for rendering config contexts
2026-05-28 20:02:59 -04:00
Arthur 46f7293143 claude review cleanup 2026-05-28 16:36:47 -07:00
Arthur 499397139b #22270 - Skip cascade-deleted objects when clearing reverse SET_NULL relations 2026-05-28 15:43:21 -07:00
bctiemann 352860daf0
Fixes #22325: AttributeError when creating choice set with base choices (#22326)
CHOICE_SETS values (IATA, ISO_3166, UN_LOCODE) are lists of (value, label)
tuples, not dicts.  The .values() call introduced by #21984 treated them as
dicts, raising AttributeError: 'list' object has no attribute 'values' when
full_clean() was invoked during choice set creation.

Replace with a generator expression that extracts the first element from
each tuple, matching the same pattern used elsewhere in the same model.

Also covers the save() path when order_alphabetically=True but
extra_choices is None (base-only choice set), preventing a TypeError
when sorted() receives None.
2026-05-28 21:47:55 +02:00
Martin Hauser 3ee228f69a
Closes #22317: Clear background queues in tearDown for isolation (#22321) 2026-05-28 13:57:53 -05:00
Jeremy Stretch 4eb0e727b9
Fixes #22301: Avoid reverse relation name collision among tagged models (#22323) 2026-05-28 20:26:00 +02:00
Martin Hauser 9930245f44 test(extras): Use cleanup handlers for config test teardown
Replace manual `clear_config()` and `cache.clear()` calls at test end
with `addCleanup()` registered in `setUp()`. Ensures cleanup runs even
if assertions fail mid-test, preventing Redis pollution across tests.

Fixes #22290
2026-05-28 12:57:30 -04:00
Martin Hauser 4b1dc729e0 fix(extras): Use ContentTypeFilter for EventRule action_object_type
Change action_object_type field in EventRuleFilter from StrFilterLookup
to ContentTypeFilter for proper content type filtering in GraphQL API.

Fixes #22287
2026-05-28 12:52:59 -04:00
Martin Hauser 77a991711e
fix(graphql): Make ConfigContextProfile filter fields optional (#22313) 2026-05-28 08:47:26 -07:00
bctiemann 1c3ddcd97a
Closes #22305: Allow test cases to declare a stable query-count key prefix (#22306)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 10:41:37 -05:00
Martin Hauser 8f5d54c284
test(extras): Clear RQ queue after event rule tests
Add tearDown method to empty the default queue after each test. Prevents
leftover jobs from leaking into later test suites that may reuse
the same queue instance.

Fixes #22319
2026-05-28 17:37:53 +02:00
Jeremy Stretch 8a8c7ee7f3
Fixes #22283: Improve resolution of file path for imported S3 objects (#22284) 2026-05-28 08:29:26 -07:00
Jeremy Stretch 877ba8bf9e
Fixes #22187: Fix cable trace when entering profiled cable via single-position pass-through ports (#22316) 2026-05-28 10:02:03 -05:00
Jeremy Stretch 004178a299 Fixes #21091: Correct OpenAPI schema for rendering config contexts 2026-05-28 09:50:20 -04:00
Jeremy Stretch ae8bc6e6a2
Fixes #22307: Ensure consistent treatment of grant_token in web UI (#22308) 2026-05-28 15:07:58 +02:00
github-actions 99b3e7873b Update source translation strings 2026-05-28 06:23:28 +00:00
bctiemann de5d12860b
Merge pull request #22304 from netbox-community/21945-duplicate-migration-indexes-test
Closes #21945: Introduce a test for duplicate migration indexes
2026-05-27 15:30:21 -04:00
bctiemann 3b21753cfb
Merge pull request #22285 from netbox-community/22283-ScriptResultView-queryset
Fixes #22283: Restrict ScriptResultView queryset to current user
2026-05-27 15:27:48 -04:00
Jeremy Stretch 6e7211e27f Closes #21945: Introduce a test for duplicate migration indexes 2026-05-27 15:01:39 -04:00
Jeremy Stretch 7022bb7eac
Closes #22109: Add template object counts to ModuleType representation in REST & GraphQL APIs (#22302) 2026-05-27 09:38:47 -07:00
github-actions d13f5e8214 Update source translation strings 2026-05-27 06:28:59 +00:00
Jeremy Stretch 4d8dbc6ffe
Closes #22212: Support for exposing environment parameters in Jinja template context (#22289) 2026-05-26 13:47:04 -05:00
Jeremy Stretch 88eac5b37d
Closes #22239: Rename apply button for table configs (#22266) 2026-05-26 08:47:57 -07:00
Jeremy Stretch 19451649fa Fixes #22283: Restrict ScriptResultView queryset to current user 2026-05-26 11:27:02 -04:00
Jeremy Stretch a89feaf856 Closes #22090: Extend test cases to analyze the number of SQL queries executed 2026-05-26 09:10:03 -04:00
bctiemann 648d56010d
Closes: #19336 - Replace JS interface table toggles with server-side URL filters (#22263) 2026-05-26 08:38:10 -04:00
github-actions 2a19eb9901 Update source translation strings 2026-05-23 06:01:24 +00:00
mburggraf 57e7884d83
Closes #21261: add quick_add parameter to ObjectVar (#22271) 2026-05-22 13:38:58 -05:00
Arthur 7fff472436 review feedback 2026-05-22 14:12:17 -04:00
Arthur 97be961df7 Scope serializer resolvers per-app and drop default discovery path
Address review feedback on #22253:

- Registry stores resolvers as {app_label: resolver} dict instead of a
  flat list, so each app can only register a resolver for its own models.
- register_serializer_resolver() now takes (app_label, resolver) and
  get_serializer_for_model() only consults the resolver registered for
  the model's own app.
- Remove 'serializer_resolver' from DEFAULT_RESOURCE_PATHS so this niche
  resource is loaded only when a plugin explicitly defines it. The
  PluginConfig.ready() path imports the configured path directly and
  registers it under self.label.
- Update tests for the new per-app scoping; verify a resolver registered
  for one app does not affect lookups in another.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 14:12:17 -04:00
Arthur ff26cbd521 cleanup 2026-05-22 14:12:17 -04:00
Arthur 42d0d4458a cleanup 2026-05-22 14:12:17 -04:00
Arthur b09e8a1808 cleanup 2026-05-22 14:12:17 -04:00
Arthur 0499bb7616 allow plugins to override get_model_serializer 2026-05-22 14:12:17 -04:00
bctiemann 659d6d1f85
Closes #17127: Add user preference for metric/imperial measurements (#22246)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 11:16:10 -05:00
Jeremy Stretch 19df80fe77
Fixes #22233: Fix site & location filtering for cables connecting circuit terminations (#22262) 2026-05-22 09:17:28 -05:00