A platform for community discussion. Free, open, simple.
DEV: Enforce deprecation-free tests for preinstalled plugins/themes (#36445)
Sérgio Saquetim726fc21187d1
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 95c34fb741d..2efe5353332 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -25,9 +25,26 @@ jobs:build:if: github.event_name == 'pull_request' || github.repository != 'discourse/discourse-private-mirror'name: ${{ matrix.target }} ${{ matrix.build_type }}${{ (matrix.target == 'core' && matrix.build_type == 'frontend' && format(' ({0})', matrix.browser)) || '' }} # Update fetch-job-id step if changing this- runs-on: ${{ (github.repository_owner == 'discourse' && (matrix.target == 'plugins' && matrix.build_type == 'system' && 'debian-12-16core' || 'debian-12-8core')) || 'ubuntu-latest' }}+ runs-on: >-+ ${{+ github.repository_owner == 'discourse' && (+ matrix.build_type == 'system' && (matrix.target == 'core-plugins' || matrix.target == 'official-plugins')+ && 'debian-12-16core'+ || 'debian-12-8core'+ )+ || 'ubuntu-latest'+ }}container: discourse/discourse_test:release- timeout-minutes: ${{ ((matrix.build_type == 'system' && (matrix.target == 'plugins' || matrix.target == 'core')) && 30) || 20 }}+ timeout-minutes: >-+ ${{+ matrix.build_type == 'system' && (matrix.target == 'core-plugins' || matrix.target == 'official-plugins' || matrix.target == 'core')+ && 30+ || 20+ }}++ defaults:+ run:+ shell: bashenv:RAILS_ENV: test@@ -42,7 +59,7 @@ jobs:TESTEM_BROWSER: ${{ (startsWith(matrix.browser, 'Firefox') && 'Firefox') || matrix.browser }}TESTEM_FIREFOX_PATH: ${{ (matrix.browser == 'Firefox Evergreen') && '/opt/firefox-evergreen/firefox' }}EMBER_ENV: development- LOAD_PLUGINS: ${{ (matrix.target == 'plugins' || matrix.target == 'chat') && '1' || '0' }}+ LOAD_PLUGINS: ${{ (matrix.target == 'core-plugins' || matrix.target == 'official-plugins' || matrix.target == 'plugins' || matrix.target == 'chat') && '1' || '0' }}ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}strategy:@@ -55,9 +72,20 @@ jobs:exclude:- build_type: backendtarget: themes+ # Exclude combined plugins from system tests - use split targets instead+ - build_type: system+ target: pluginsinclude:+ # Split plugin targets for system tests only+ - build_type: system+ target: core-plugins+ browser: Chrome+ - build_type: system+ target: official-plugins+ browser: Chrome- build_type: systemtarget: chat+ browser: Chrome# - build_type: frontend# target: core# browser: Firefox Evergreen@@ -93,8 +121,7 @@ jobs:git config --global user.name "Discourse CI"- name: Start redis- run: |- redis-server /etc/redis/redis.conf &+ run: redis-server /etc/redis/redis.conf &- name: Start Postgresrun: |@@ -119,11 +146,11 @@ jobs:run: pnpm install --frozen-lockfile- name: Checkout official plugins- if: matrix.target == 'plugins'+ if: matrix.target == 'official-plugins' || matrix.target == 'plugins'run: bin/rake plugin:install_all_official- name: Symlinking plugin gems from image- if: matrix.target == 'plugins'+ if: matrix.target == 'plugins' || matrix.target == 'core-plugins' || matrix.target == 'official-plugins'run: |for dir in /var/www/discourse/plugins/*/gems; doplugin_name=$(basename "$(dirname "$dir")")@@ -141,7 +168,7 @@ jobs:done- name: Pull compatible versions of plugins- if: matrix.target == 'plugins' && (github.ref_name != 'main' && github.base_ref != 'main')+ if: (matrix.target == 'official-plugins' || matrix.target == 'plugins') && (github.ref_name != 'main' && github.base_ref != 'main')run: LOAD_PLUGINS=0 bin/rake plugin:pull_compatible_all- name: Checkout official themes@@ -183,18 +210,12 @@ jobs:run: rm -rf public/uploads && cp -r tmp/app-cache/uploads public/uploads- name: Create and migrate database- env:- LOAD_PLUGINS: ${{ (matrix.target == 'plugins' || matrix.target == 'chat') && '1' || '0' }}run: |bin/rake db:createscript/silence_successful_output bin/rake db:migrate- name: Create and migrate parallel databases- if: >-- env.USES_PARALLEL_DATABASES == 'true' &&- steps.app-cache.outputs.cache-hit != 'true'- env:- LOAD_PLUGINS: ${{ (matrix.target == 'plugins' || matrix.target == 'chat') && '1' || '0' }}+ if: env.USES_PARALLEL_DATABASES == 'true' && steps.app-cache.outputs.cache-hit != 'true'run: |bin/rake parallel:createscript/silence_successful_output bin/rake parallel:migrate@@ -217,7 +238,7 @@ jobs:restore-keys: rspec-runtime-${{ matrix.build_type }}-${{ matrix.target }}-- name: Check Annotations- if: matrix.build_type == 'backend' && (matrix.target == 'core' || matrix.target == 'plugins' || matrix.target == 'chat')+ if: matrix.build_type == 'backend' && (matrix.target == 'core' || matrix.target == 'plugins')run: |bin/rake annotate:ensure_all_indexes@@ -270,10 +291,6 @@ jobs:if: matrix.build_type == 'backend' && matrix.target == 'core'run: bin/turbo_rspec --use-runtime-info --verbose --format=progress --profile=50- - name: Plugin RSpec- if: matrix.build_type == 'backend' && matrix.target == 'plugins'- run: bin/rake plugin:turbo_spec['*','--verbose --format=progress --use-runtime-info --profile=50']-- name: Core QUnitif: matrix.build_type == 'frontend' && matrix.target == 'core'run: QUNIT_WRITE_EXECUTION_FILE=1 bin/rake qunit:test@@ -283,7 +300,12 @@ jobs:working-directory: frontend/asset-processorrun: pnpm test- - name: Plugin QUnit+ - name: Plugins RSpec+ if: matrix.build_type == 'backend' && matrix.target == 'plugins'+ run: |+ bin/rake plugin:turbo_spec['*','--verbose --format=progress --use-runtime-info --profile=50']++ - name: Plugins QUnitif: matrix.build_type == 'frontend' && matrix.target == 'plugins'run: bin/rake plugin:qunit['*']@@ -311,13 +333,19 @@ jobs:CHECKOUT_TIMEOUT: 10run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation spec/system- - name: Plugin System Tests- if: matrix.build_type == 'system' && matrix.target == 'plugins'+ - name: Core Plugins System Tests+ if: matrix.build_type == 'system' && matrix.target == 'core-plugins'env:CHECKOUT_TIMEOUT: 10run: |RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --exclude-pattern="plugins/chat/*" --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/system- shell: bash++ - name: Official Plugins System Tests+ if: matrix.build_type == 'system' && matrix.target == 'official-plugins'+ env:+ CHECKOUT_TIMEOUT: 10+ run: |+ RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --exclude-pattern="$(script/list_bundled_plugins '/*' | paste -sd, -)" --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/system- name: Chat System Testsif: matrix.build_type == 'system' && matrix.target == 'chat'@@ -329,9 +357,7 @@ jobs:if: matrix.build_type == 'system' && matrix.target == 'themes'env:CHECKOUT_TIMEOUT: 10- run: |- RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --profile=50 --verbose --format documentation tmp/themes/*/spec/system themes/*/spec/system- shell: bash+ run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --profile=50 --verbose --format documentation tmp/themes/*/spec/system themes/*/spec/system- name: Check for failed system test artifactsid: check-failed-system-test-artifacts@@ -342,7 +368,6 @@ jobs:elseecho "exists=false" >> $GITHUB_OUTPUTfi- shell: bash- name: Upload failed system test artifactsuses: actions/upload-artifact@v6@@ -363,7 +388,6 @@ jobs:elseecho "exists=false" >> $GITHUB_OUTPUTfi- shell: bash- name: Fetch Job IDid: fetch-job-iddiff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex 9e0e42e5593..27e04e8d365 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -355,12 +355,9 @@ class GroupsController < ApplicationControllermembers = users.limit(limit).offset(offset)owners = users.where("group_users.owner")- group_members_serializer =- include_custom_fields ? GroupUserWithCustomFieldsSerializer : GroupUserSerializer-render json: {- members: serialize_data(members, group_members_serializer),- owners: serialize_data(owners, GroupUserSerializer),+ members: serialize_data(members, GroupUserWithCustomFieldsSerializer),+ owners: serialize_data(owners, GroupUserWithCustomFieldsSerializer),meta: {total: total,limit: limit,diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rbindex 9bd78810b19..c871ba23d30 100644--- a/app/helpers/application_helper.rb+++ b/app/helpers/application_helper.rb@@ -856,8 +856,18 @@ module ApplicationHelpersetup_data[:mb_last_file_change_id] = MessageBus.last_id("/file-change")end- if Rails.env.test? && ENV["CAPYBARA_PLAYWRIGHT_DEBUG_CLIENT_SETTLED"].present?- setup_data[:capybara_playwright_debug_client_settled] = true+ if Rails.env.test?+ if ENV["CAPYBARA_PLAYWRIGHT_DEBUG_CLIENT_SETTLED"].present?+ setup_data[:capybara_playwright_debug_client_settled] = true+ end++ # Allow controlling deprecation behavior in tests via environment variable+ # Used to enforce or disable deprecation throwing for specific test runs+ if ENV["EMBER_RAISE_ON_DEPRECATION"] == "1"+ setup_data[:raise_on_deprecation] = true+ elsif ENV["EMBER_RAISE_ON_DEPRECATION"] == "0"+ setup_data[:raise_on_deprecation] = false+ endendif guardian.can_enable_safe_mode? && params["safe_mode"]diff --git a/app/serializers/group_user_with_custom_fields_serializer.rb b/app/serializers/group_user_with_custom_fields_serializer.rbindex 10c7291fbbc..03067ddb890 100644--- a/app/serializers/group_user_with_custom_fields_serializer.rb+++ b/app/serializers/group_user_with_custom_fields_serializer.rb@@ -3,17 +3,13 @@class GroupUserWithCustomFieldsSerializer < UserWithCustomFieldsSerializerinclude UserPrimaryGroupMixin- attributes :name, :title, :last_posted_at, :last_seen_at, :added_at, :timezone+ attributes :name, :title, :last_posted_at, :last_seen_at, :added_atdef initialize(object, options = {})superoptions[:include_status] = trueend- def timezone- user.user_option.timezone- end-def include_added_at?object.respond_to? :added_atenddiff --git a/bin/turbo_rspec b/bin/turbo_rspecindex c9dde030e73..f97bc2548a9 100755--- a/bin/turbo_rspec+++ b/bin/turbo_rspec@@ -16,7 +16,7 @@ profile_print_slowest_examples_count = 10use_runtime_info = nilenable_system_tests = nilretry_and_log_flaky_tests = ENV["DISCOURSE_TURBO_RSPEC_RETRY_AND_LOG_FLAKY_TESTS"].to_s == "1"-exclude_pattern = nil+exclude_patterns = []OptionParser.new do |opts|@@ -69,8 +69,8 @@ OptionParseropts.on("--exclude-pattern=pattern",- "Exclude files that matches against the pattern using unix-style pattern matching",- ) { |pattern| exclude_pattern = pattern }+ "Exclude files that matches against the pattern using unix-style pattern matching (comma-separated for multiple patterns)",+ ) { |pattern| exclude_patterns.concat(pattern.split(",").map(&:strip)) }end.parse!(ARGV)@@ -101,7 +101,9 @@ elseuse_runtime_info = false if use_runtime_info.nil?end-files.reject! { |file| File.fnmatch(exclude_pattern, file) } if exclude_pattern+if exclude_patterns.any?+ files.reject! { |file| exclude_patterns.any? { |pattern| File.fnmatch(pattern, file) } }+endrequires.each { |f| require(f) }diff --git a/config/official_plugins.json b/config/official_plugins.jsonnew file mode 100644index 00000000000..0577d4273bf--- /dev/null+++ b/config/official_plugins.json@@ -0,0 +1,87 @@+[+ "discourse-adplugin",+ "discourse-affiliate",+ "discourse-ai",+ "discourse-akismet",+ "discourse-algolia",+ "discourse-apple-auth",+ "discourse-assign",+ "discourse-auto-deactivate",+ "discourse-bbcode",+ "discourse-bbcode-color",+ "discourse-cakeday",+ "discourse-calendar",+ "discourse-categories-suppressed",+ "discourse-category-experts",+ "discourse-characters-required",+ "discourse-chat-integration",+ "discourse-code-review",+ "discourse-data-explorer",+ "discourse-details",+ "discourse-doc-categories",+ "discourse-docs",+ "discourse-follow",+ "discourse-fontawesome-pro",+ "discourse-gamification",+ "discourse-geoblocking",+ "discourse-github",+ "discourse-gradle-issue",+ "discourse-graphviz",+ "discourse-group-tracker",+ "discourse-hcaptcha",+ "discourse-invite-tokens",+ "discourse-jira",+ "discourse-lazy-videos",+ "discourse-local-dates",+ "discourse-login-with-amazon",+ "discourse-logster-transporter",+ "discourse-lti",+ "discourse-math",+ "discourse-microsoft-auth",+ "discourse-narrative-bot",+ "discourse-newsletter-integration",+ "discourse-no-bump",+ "discourse-oauth2-basic",+ "discourse-openid-connect",+ "discourse-patreon",+ "discourse-perspective-api",+ "discourse-policy",+ "discourse-post-voting",+ "discourse-presence",+ "discourse-prometheus",+ "discourse-prometheus-alert-receiver",+ "discourse-push-notifications",+ "discourse-reactions",+ "discourse-restricted-replies",+ "discourse-rss-polling",+ "discourse-salesforce",+ "discourse-saml",+ "discourse-saved-searches",+ "discourse-signatures",+ "discourse-solved",+ "discourse-staff-alias",+ "discourse-steam-login",+ "discourse-subscriptions",+ "discourse-tag-by-group",+ "discourse-teambuild",+ "discourse-templates",+ "discourse-tooltips",+ "discourse-topic-voting",+ "discourse-translator",+ "discourse-user-card-badges",+ "discourse-user-notes",+ "discourse-vk-auth",+ "discourse-whos-online",+ "discourse-yearly-review",+ "discourse-zendesk-plugin",+ "discourse-zoom",+ "discourse-rewind",+ "automation",+ "chat",+ "checklist",+ "docker_manager",+ "footnote",+ "poll",+ "spoiler-alert",+ "styleguide"+]diff --git a/frontend/discourse-plugins/index.js b/frontend/discourse-plugins/index.jsindex aec0e3dc514..6078f125aff 100644--- a/frontend/discourse-plugins/index.js+++ b/frontend/discourse-plugins/index.js@@ -137,6 +137,14 @@ module.exports = {fs.existsSync(path.resolve(root, dirent.name, "plugin.rb")));+ // Load official plugins list+ const officialPluginsPath = path.resolve(+ "../../config/official_plugins.json"+ );+ const officialPlugins = JSON.parse(+ fs.readFileSync(officialPluginsPath, "utf8")+ );+return pluginDirectories.map((directory) => {const directoryName = directory.name;const pluginName = parsePluginName(@@ -165,6 +173,15 @@ module.exports = {const testRequiredPlugins = getTestRequiredPlugins(path.resolve(root, directoryName, "about.json"));++ // Check if plugin is official+ const isOfficial = officialPlugins.includes(pluginName);++ // Check if plugin is preinstalled (bundled in discourse git repo)+ const isPreinstalled = !fs.existsSync(+ path.resolve(root, directoryName, ".git")+ );+return {pluginName,directoryName,@@ -177,6 +194,8 @@ module.exports = {hasTests,hasConfig,testRequiredPlugins,+ isOfficial,+ isPreinstalled,};});},@@ -297,33 +316,35 @@ module.exports = {directoryName,hasJs,hasAdminJs,+ isPreinstalled,+ isOfficial,} of pluginInfos) {- if (hasJs) {+ const pushScript = (suffix) => {scripts.push({- src: `plugins/${directoryName}.js`,+ src: `plugins/${directoryName}${suffix}.js`,name: pluginName,+ isPreinstalled,+ isOfficial,});+ };++ if (hasJs) {+ pushScript("");}if (fs.existsSync(`../plugins/${directoryName}_extras.js.erb`)) {- scripts.push({- src: `plugins/${directoryName}_extras.js`,- name: pluginName,- });+ pushScript("_extras");}if (hasAdminJs) {- scripts.push({- src: `plugins/${directoryName}_admin.js`,- name: pluginName,- });+ pushScript("_admin");}}const scriptTags = scripts.map(- ({ src, name }) =>- `<script src="${config.rootURL}assets/${src}" data-discourse-plugin="${name}"></script>`+ ({ src, name, isPreinstalled, isOfficial }) =>+ `<script src="${config.rootURL}assets/${src}" data-discourse-plugin="${name}" data-preinstalled="${isPreinstalled}" data-official="${isOfficial}"></script>`).join("\n");@@ -341,8 +362,8 @@ module.exports = {return this.pluginInfos().filter(({ hasTests }) => hasTests).map(- ({ directoryName, pluginName }) =>- `<script src="${config.rootURL}assets/plugins/test/${directoryName}_tests.js" data-discourse-plugin="${pluginName}"></script>`+ ({ directoryName, pluginName, isPreinstalled, isOfficial }) =>+ `<script src="${config.rootURL}assets/plugins/test/${directoryName}_tests.js" data-discourse-plugin="${pluginName}" data-preinstalled="${isPreinstalled}" data-official="${isOfficial}"></script>`).join("\n");},diff --git a/frontend/discourse/admin/components/admin-welcome-banner-form.gjs b/frontend/discourse/admin/components/admin-welcome-banner-form.gjsindex f2f373800c7..6ef354ac24c 100644--- a/frontend/discourse/admin/components/admin-welcome-banner-form.gjs+++ b/frontend/discourse/admin/components/admin-welcome-banner-form.gjs@@ -277,7 +277,7 @@ export default class AdminWelcomeBannerForm extends Component {this.originalFormData = { ...data };this.toasts.success({- duration: 3000,+ duration: "short",data: {message: i18n("admin.config.welcome_banner.saved"),},diff --git a/frontend/discourse/admin/components/ip-lookup.gjs b/frontend/discourse/admin/components/ip-lookup.gjsindex 4ec3a0c9693..7e8a2e9646f 100644--- a/frontend/discourse/admin/components/ip-lookup.gjs+++ b/frontend/discourse/admin/components/ip-lookup.gjs@@ -105,7 +105,7 @@ export default class IpLookup extends Component {try {await clipboardCopy(text.trim());this.toasts.success({- duration: 3000,+ duration: "short",data: {message: i18n("ip_lookup.copied"),},diff --git a/frontend/discourse/admin/controllers/admin-config/color-palettes/index.js b/frontend/discourse/admin/controllers/admin-config/color-palettes/index.jsindex bcf62c36848..648e78d636c 100644--- a/frontend/discourse/admin/controllers/admin-config/color-palettes/index.js+++ b/frontend/discourse/admin/controllers/admin-config/color-palettes/index.js@@ -258,7 +258,7 @@ export default class AdminConfigColorPalettesIndexController extends ControllerthemeName,}),},- duration: 4000,+ duration: "short",});}} catch (error) {diff --git a/frontend/discourse/app/controllers/application.js b/frontend/discourse/app/controllers/application.jsindex 0ef56e2a7f8..af2e480fcda 100644--- a/frontend/discourse/app/controllers/application.js+++ b/frontend/discourse/app/controllers/application.js@@ -60,7 +60,7 @@ export default class ApplicationController extends Controller {set showFooter(value) {deprecated(- "showFooter state is now stored in the `footer` service, and should be controlled by adding the {{hide-application-footer}} helper to an Ember template.",+ "showFooter state is now stored in the `footer` service, and should be controlled by adding the {{hideApplicationFooter}} helper to an Ember template.",{ id: "discourse.application-show-footer" });this.footer.showFooter = value;diff --git a/frontend/discourse/app/deprecation-workflow.js b/frontend/discourse/app/deprecation-workflow.jsindex 8d610b8227b..4b2737f35e7 100644--- a/frontend/discourse/app/deprecation-workflow.js+++ b/frontend/discourse/app/deprecation-workflow.js@@ -21,7 +21,12 @@ const VALID_EMBER_CLI_WORKFLOW_HANDLERS = ["silence", "log", "throw"];* Valid handler types for deprecation workflows.* @type {string[]}*/-const VALID_HANDLERS = [...VALID_EMBER_CLI_WORKFLOW_HANDLERS, "counter"];+const VALID_HANDLERS = [+ ...VALID_EMBER_CLI_WORKFLOW_HANDLERS,+ "dont-throw",+ "dont-count",+ "counter",+];/*** Handles deprecation workflows in Discourse.@@ -153,6 +158,7 @@ export class DiscourseDeprecationWorkflow {/*** Checks if a deprecation should be counted.+ ** @param {string} deprecationId - ID of the deprecation* @return {boolean} True if deprecation should be counted*/@@ -162,6 +168,12 @@ export class DiscourseDeprecationWorkflow {return true;}+ // The "dont-count" handler prevents counting specific deprecations+ // even when they would normally be counted (e.g., for test fixtures)+ if (workflow.handler?.includes("dont-count")) {+ return false;+ }+const silenced = workflow.handler?.includes("silence") ?? false;const count = workflow.handler?.includes("counter") ?? false;@@ -170,6 +182,7 @@ export class DiscourseDeprecationWorkflow {/*** Checks if a deprecation should throw an error.+ ** @param {string} deprecationId - ID of the deprecation* @param {boolean} [includeUnsilenced=false] - Whether to throw for unsilenced deprecations* @return {boolean} True if deprecation should throw@@ -177,6 +190,12 @@ export class DiscourseDeprecationWorkflow {shouldThrow(deprecationId, includeUnsilenced = false) {const workflow = this.#find(deprecationId);+ // The "dont-throw" handler prevents raising errors for specific deprecations+ // even when RAISE_ON_DEPRECATION is enabled (e.g., for test fixtures)+ if (workflow?.handler?.includes("dont-throw")) {+ return false;+ }+if (includeUnsilenced) {return !this.shouldSilence(deprecationId);}@@ -241,10 +260,9 @@ export class DiscourseDeprecationWorkflow {* IMPORTANT: The first match wins, so the order of the workflows is relevant.** Each workflow config item should have:- * @property {(string|string[])} handler - Handler type(s): "silence", "log", "throw", and/or "counter"+ * @property {(string|string[])} handler - Handler type(s): "silence", "log", "throw", "dont-throw", "dont-count", and/or "counter"* @property {(string|RegExp)} matchId - ID or pattern to match deprecations* @property {(string|string[])} [env] - Optional environment(s): "development", "qunit-test", "rails-test", "test", "production", "unset"- **/const DeprecationWorkflow = new DiscourseDeprecationWorkflow([{ handler: "silence", matchId: "template-action" }, // will be removed in Ember 6.0@@ -261,7 +279,12 @@ const DeprecationWorkflow = new DiscourseDeprecationWorkflow([handler: "log",matchId: /^discourse\.native-array-extensions\..+$/,},- // widget-related code should fail on all CI tests including plugins and custom themes+ {+ handler: ["dont-count", "dont-throw"],+ matchId: /fake.deprecation.*/,+ env: "test",+ },+ // widget-related code should fail on all CI tests, including plugins and custom themes{handler: "throw",matchId: "discourse.widgets-decommissioned",diff --git a/frontend/discourse/app/initializers/discourse-bootstrap.js b/frontend/discourse/app/initializers/discourse-bootstrap.jsindex 17e0855596c..1fe3c82bc3d 100644--- a/frontend/discourse/app/initializers/discourse-bootstrap.js+++ b/frontend/discourse/app/initializers/discourse-bootstrap.js@@ -7,13 +7,19 @@ import { setIconList } from "discourse/lib/icon-library";import PreloadStore from "discourse/lib/preload-store";import { setURLContainer } from "discourse/lib/url";import Session from "discourse/models/session";+import { setupDeprecationCounter } from "discourse/tests/helpers/deprecation-counter";import I18n from "discourse-i18n";export default {// The very first initializer to runinitialize(app) {- const { isDevelopment, isProduction, isTesting, setEnvironment } =- environment;+ const {+ isDevelopment,+ isProduction,+ isTesting,+ isRailsTesting,+ setEnvironment,+ } = environment;setURLContainer(app.__container__);setDefaultOwner(app.__container__);@@ -24,6 +30,7 @@ export default {}let setupData;+const setupDataElement = document.getElementById("data-discourse-setup");if (setupDataElement) {setupData = setupDataElement.dataset;@@ -51,6 +58,14 @@ export default {setupURL(setupData.cdn, setupData.baseUrl, setupData.baseUri);setEnvironment(setupData.environment);++ if (isRailsTesting()) {+ if (typeof setupData.raiseOnDeprecation !== "undefined") {+ window.EmberENV.RAISE_ON_DEPRECATION = setupData.raiseOnDeprecation;+ }+ setupDeprecationCounter();+ }+DeprecationWorkflow.setEnvironment(environment);I18n.defaultLocale = setupData.defaultLocale;diff --git a/frontend/discourse/app/lib/deprecated.js b/frontend/discourse/app/lib/deprecated.jsindex 5e49c663f4d..e8d64e1b485 100644--- a/frontend/discourse/app/lib/deprecated.js+++ b/frontend/discourse/app/lib/deprecated.js@@ -8,6 +8,7 @@ let emberDeprecationSilencer;/*** Display a deprecation warning with the provided message. The warning will be prefixed with the theme/plugin name* if it can be automatically determined based on the current stack.+ ** @param {String} msg The deprecation message* @param {Object} [options] Deprecation options* @param {String} [options.id] A unique identifier for this deprecation. This should be namespaced by dots (e.g. discourse.my_deprecation)@@ -17,52 +18,37 @@ let emberDeprecationSilencer;* @param {boolean} [options.raiseError] Raise an error when this deprecation is triggered. Defaults to `false`*/export default function deprecated(msg, options = {}) {- const { id, since, dropFrom, url, raiseError, source } = options;+ const { id, source } = options;+ // deprecations explicitly silenced in code using withSilencedDeprecations or+ // withSilencedDeprecationsAsync.+ // These deprecations should not be logged or raised as error because the code that+ // generates them is handled manually. It can be for example a fallback routineif (isDeprecationSilenced(id)) {return;}- msg = ["Deprecation notice:", msg];- if (since) {- msg.push(`[deprecated since Discourse ${since}]`);- }- if (dropFrom) {- msg.push(`[removal in Discourse ${dropFrom}]`);- }- if (id) {- msg.push(`[deprecation id: ${id}]`);- }- if (url) {- msg.push(`[info: ${url}]`);- }- msg = msg.join(" ");-- let consolePrefix = "";- if (require.has("discourse/lib/source-identifier")) {- // This module doesn't exist in pretty-text/wizard/etc.- consolePrefix =- require("discourse/lib/source-identifier").consolePrefix(null, source) ||- "";- }-- handlers.forEach((h) => h(msg, options));-- if (- raiseError ||+ const raiseError =+ options.raiseError ||DeprecationWorkflow.shouldThrow(id,globalThis.EmberENV?.RAISE_ON_DEPRECATION- )- ) {- throw msg;- }+ );++ const formattedMessage = buildDeprecationMessage(msg, options, raiseError);+ const consolePrefix = getConsolePrefix(source);++ // Execute all registered deprecation handlers+ handlers.forEach((h) => h(formattedMessage, options));if (!DeprecationWorkflow.shouldSilence(id)) {- console.warn(...[consolePrefix, msg].filter(Boolean)); //eslint-disable-line no-console+ if (raiseError) {+ raiseDeprecationError(consolePrefix, formattedMessage);+ }++ console.warn(...[consolePrefix, formattedMessage].filter(Boolean)); //eslint-disable-line no-console}}-/*** Register a function which will be called whenever a deprecation is triggered* @param {function} callback The callback function. Arguments will match those of `deprecated()`.@@ -129,6 +115,13 @@ export function isDeprecationSilenced(id) {);}+/**+ * Ensures the Ember deprecation silencer is registered with Ember's debug system.+ * This function sets up a deprecation handler that intercepts Ember deprecations+ * and respects the silencing configuration from disabledDeprecations.+ *+ * The silencer is only registered once, and only if the @ember/debug module is available.+ */function ensureEmberDeprecationSilencer() {if (emberDeprecationSilencer) {return;@@ -146,3 +139,79 @@ function ensureEmberDeprecationSilencer() {);}}++/**+ * Conditionally requires a module if it's available in the require registry.+ *+ * This is a simplified version of the optionalRequire function from discourse/lib/utilities,+ * designed to work in code paths where the full utilities module is not available (e.g., pretty-text).+ *+ * @param {string} path - The module path to require+ * @returns {any|undefined} The required module if available, undefined otherwise+ */+function requireIfAvailable(path) {+ return require.has(path) ? require(path) : undefined;+}++/**+ * Builds the formatted deprecation message with all the metadata+ *+ * @param {String} msg The base deprecation message+ * @param {Object} options Deprecation options+ * @param {boolean} raiseError Whether this is a fatal deprecation+ * @returns {String} The formatted message+ */+function buildDeprecationMessage(msg, options, raiseError) {+ const { id, since, dropFrom, url } = options;+ const parts = [+ raiseError ? "FATAL DEPRECATION:" : "DEPRECATION NOTICE:",+ msg,+ ];++ if (since) {+ parts.push(`[deprecated since Discourse ${since}]`);+ }+ if (dropFrom) {+ parts.push(`[removal in Discourse ${dropFrom}]`);+ }+ if (id) {+ parts.push(`[deprecation id: ${id}]`);+ }+ if (url) {+ parts.push(`[info: ${url}]`);+ }++ return parts.join(" ");+}++/**+ * Gets the console prefix for the deprecation message+ *+ * @param {String} source Optional source identifier+ * @returns {String} The console prefix+ */+function getConsolePrefix(source) {+ return (+ requireIfAvailable("discourse/lib/source-identifier", "*")?.consolePrefix(+ null,+ source+ ) || ""+ );+}++/**+ * Raises a deprecation error with additional context for Rails testing+ *+ * @param {String} consolePrefix The console prefix+ * @param {String} message The full deprecation message+ */+function raiseDeprecationError(consolePrefix, message) {+ const error = new Error([consolePrefix, message].filter(Boolean).join(" "));++ if (requireIfAvailable("discourse/lib/environment", "*")?.isRailsTesting()) {+ // eslint-disable-next-line no-console+ console.trace(`fatal_deprecation:${JSON.stringify(error.stack)}`);+ }++ throw error;+}diff --git a/frontend/discourse/app/lib/discourse-template-map.js b/frontend/discourse/app/lib/discourse-template-map.jsindex 5471ce6b549..e752844b66e 100644--- a/frontend/discourse/app/lib/discourse-template-map.js+++ b/frontend/discourse/app/lib/discourse-template-map.js@@ -20,10 +20,10 @@ function isTemplate(moduleName) {return moduleName.includes("/templates/");}-function appendToCache(cache, key, value) {+function appendToCache(cache, key, moduleName, source) {let cachedValue = cache.get(key);cachedValue ??= [];- cachedValue.push(value);+ cachedValue.push({ moduleName, source });cache.set(key, cachedValue);}@@ -36,9 +36,15 @@ function buildPrioritizedMaps(moduleNames) {if (isInRecognisedNamespace(moduleName) && isTemplate(moduleName)) {let pluginMatch, themeMatch;if ((pluginMatch = moduleName.match(pluginRegex))) {- appendToCache(pluginTemplates, pluginMatch[2], moduleName);+ appendToCache(pluginTemplates, pluginMatch[2], moduleName, {+ type: "plugin",+ name: pluginMatch[1],+ });} else if ((themeMatch = moduleName.match(themeRegex))) {- appendToCache(themeTemplates, themeMatch[2], moduleName);+ appendToCache(themeTemplates, themeMatch[2], moduleName, {+ type: "theme",+ name: themeMatch[1],+ });} else {appendToCache(coreTemplates,@@ -59,6 +65,7 @@ function buildPrioritizedMaps(moduleNames) {*/class DiscourseTemplateMap {templates = new Map();+ sources = new Map();/*** Reset the TemplateMap to use the supplied module names. It is expected that the list@@ -66,17 +73,19 @@ class DiscourseTemplateMap {*/setModuleNames(moduleNames) {this.templates.clear();+ this.sources.clear();for (const templateMap of buildPrioritizedMaps(moduleNames)) {- for (const [path, modulesForPath] of templateMap) {- for (const moduleForPath of modulesForPath) {- this.#add(path, moduleForPath);+ for (const [path, modulesInfoForPath] of templateMap) {+ for (const moduleInfoForPath of modulesInfoForPath) {+ const { moduleName, source } = moduleInfoForPath;+ this.#add(path, moduleName, source);}}}}- #add(path, moduleName) {+ #add(path, moduleName, source) {if (this.templates.has(path)) {const msg = `Duplicate templates found for '${path}': '${moduleName}' clashes with '${this.templates.get(path)}'`;@@ -88,6 +97,7 @@ class DiscourseTemplateMap {}} else {this.templates.set(path, moduleName);+ this.sources.set(path, source);}}@@ -98,6 +108,16 @@ class DiscourseTemplateMap {resolve(name) {return this.templates.get(name);}++ /**+ * Identifies the source (core, plugin, or theme) of a template.+ *+ * @param {string} name - The template path to look up+ * @return {Object|undefined} Source information containing type and name, or undefined if not found+ */+ identifySource(name) {+ return this.sources.get(name);+ }}export default new DiscourseTemplateMap();diff --git a/frontend/discourse/app/lib/source-identifier.js b/frontend/discourse/app/lib/source-identifier.jsindex a1f6461d0f6..42257e01c83 100644--- a/frontend/discourse/app/lib/source-identifier.js+++ b/frontend/discourse/app/lib/source-identifier.js@@ -50,18 +50,29 @@ export default function identifySource(error) {let plugin;- if (DEBUG) {- // Development (no fingerprinting)- plugin ??= stack.match(/assets\/plugins\/([\w-]+)\.js/)?.[1];+ // Build patterns array dynamically to match plugin files in both development and production+ // Order matters: check more specific patterns (_admin) before general ones+ const patterns = [];- // Test files:- plugin ??= stack.match(/assets\/plugins\/test\/([\w-]+)_tests\.js/)?.[1];+ if (DEBUG) {+ patterns.push(+ /assets\/plugins\/([\w-]+)_admin\.js/, // Admin UI Development (no fingerprinting)+ /assets\/plugins\/([\w-]+)\.js/, // Development (no fingerprinting)+ /assets\/plugins\/test\/([\w-]+)_tests\.js/ // Test files+ );}- // Production (with fingerprints)- plugin ??= stack.match(- /assets\/plugins\/_?([\w-]+)-[0-9a-f]+(?:\.(?:br|gz))?\.js/- )?.[1];+ patterns.push(+ /assets\/plugins\/_?([\w-]+)-[0-9a-f]+_admin(?:\.(?:br|gz))?\.js/, // Admin UI Production (with fingerprints)+ /assets\/plugins\/_?([\w-]+)-[0-9a-f]+(?:\.(?:br|gz))?\.js/ // Production (with fingerprints)+ );++ for (const pattern of patterns) {+ plugin = stack.match(pattern)?.[1];+ if (plugin) {+ break;+ }+ }if (plugin) {return {diff --git a/frontend/discourse/app/resolver.js b/frontend/discourse/app/resolver.jsindex 612e78915d0..135166179e4 100644--- a/frontend/discourse/app/resolver.js+++ b/frontend/discourse/app/resolver.js@@ -314,30 +314,10 @@ export function buildResolver(baseName) {}findTemplate(parsedName, prefix) {- prefix = prefix || "";-- const withoutType = parsedName.fullNameWithoutType,- underscored = decamelize(withoutType).replace(/-/g, "_"),- segments = withoutType.split("/");-- // Default unmodified behavior of original resolveTemplate.- const original = prefix + withoutType;-- const candidates = [- // Convert dots and dashes to slashes- prefix + withoutType.replace(/[\.-]/g, "/"),- original,- // Underscored without namespace- prefix + underscored,- // Underscored with first segment as directory- prefix + underscored.replace("_", "/"),- // Underscore only the last segment- `${prefix}${segments.slice(0, -1).join("/")}/${segments[- segments.length - 1- ].replace(/-/g, "_")}`,- // All dasherized- prefix + withoutType.replace(/\//g, "-"),- ];+ const { original, candidates } = this.#buildTemplateCandidates(+ parsedName,+ prefix+ );for (const candidate of candidates) {const result = this.discourseTemplateModule(candidate);@@ -345,7 +325,10 @@ export function buildResolver(baseName) {if (candidate !== original) {deprecated(`Looking up 'template:${candidate}' is no longer permitted. Rename to 'template:${original}' instead`,- { id: "discourse.deprecated-resolver-normalization" }+ {+ id: "discourse.deprecated-resolver-normalization",+ source: DiscourseTemplateMap.identifySource(candidate),+ });}return result;@@ -394,7 +377,10 @@ export function buildResolver(baseName) {if (candidate !== parsedName) {deprecated(`Looking up '${candidate.fullName}' is no longer permitted. Rename to '${parsedName.fullName}' instead`,- { id: "discourse.deprecated-resolver-normalization" }+ {+ id: "discourse.deprecated-resolver-normalization",+ source: this.#findTemplateSource(candidate, prefix),+ });}return result;@@ -404,5 +390,55 @@ export function buildResolver(baseName) {return this.findTemplate(parsedName, "discourse/admin/templates/");}}++ /**+ * Builds a list of template path candidates based on various naming conventions.+ * Supports legacy naming patterns (underscored, dasherized, etc.) for backwards compatibility.+ *+ * @param {Object} parsedName - The parsed template name object+ * @param {string} [prefix=""] - Optional prefix to prepend to all candidate paths+ * @return {Object} Object with 'original' path and array of 'candidates' to try+ */+ #buildTemplateCandidates(parsedName, prefix = "") {+ const withoutType = parsedName.fullNameWithoutType;+ const underscored = decamelize(withoutType).replace(/-/g, "_");+ const segments = withoutType.split("/");+ const original = prefix + withoutType;++ return {+ original,+ candidates: [+ // Convert dots and dashes to slashes+ prefix + withoutType.replace(/[\.-]/g, "/"),+ original,+ // Underscored without namespace+ prefix + underscored,+ // Underscored with first segment as directory+ prefix + underscored.replace("_", "/"),+ // Underscore only the last segment+ `${prefix}${segments.slice(0, -1).join("/")}/${segments[segments.length - 1].replace(/-/g, "_")}`,+ // All dasherized+ prefix + withoutType.replace(/\//g, "-"),+ ],+ };+ }++ /**+ * Identifies the source (core, plugin, or theme) of a template by its parsed name.+ *+ * @param {Object} parsedName - The parsed template name object+ * @param {string} [prefix] - Optional prefix to prepend to the template path+ * @return {Object|undefined} Source information containing type and name, or undefined if not found+ */+ #findTemplateSource(parsedName, prefix) {+ const { candidates } = this.#buildTemplateCandidates(parsedName, prefix);++ for (const candidate of candidates) {+ const result = this.discourseTemplateModule(candidate);+ if (result) {+ return DiscourseTemplateMap.identifySource(candidate);+ }+ }+ }};}diff --git a/frontend/discourse/app/services/deprecation-warning-handler.js b/frontend/discourse/app/services/deprecation-warning-handler.jsindex 339b37e6d78..3ad5db40eac 100644--- a/frontend/discourse/app/services/deprecation-warning-handler.js+++ b/frontend/discourse/app/services/deprecation-warning-handler.js@@ -42,7 +42,7 @@ const REPLACEMENT_URLS = {};if (DEBUG) {// used in system specs- CRITICAL_DEPRECATIONS.push(/fake-deprecation.*/);+ CRITICAL_DEPRECATIONS.push(/fake.deprecation.*/);}// Deprecation handling APIs don't have any way to unregister handlers, so we set up permanentdiff --git a/frontend/discourse/testem.js b/frontend/discourse/testem.jsindex a5493b432a6..b0ea04a4bc6 100644--- a/frontend/discourse/testem.js+++ b/frontend/discourse/testem.js@@ -13,6 +13,7 @@ const sandboxDisabled =class Reporter extends TapReporter {failReports = [];deprecationCounts = new Map();+ deprecationCountsByOrigin = new Map();constructor() {super(...arguments);@@ -29,9 +30,18 @@ class Reporter extends TapReporter {reportMetadata(tag, metadata) {if (tag === "increment-deprecation") {- const id = metadata.id;+ const { id, origin } = metadata;+const currentCount = this.deprecationCounts.get(id) || 0;this.deprecationCounts.set(id, currentCount + 1);++ const originKey = origin || "unknown";+ if (!this.deprecationCountsByOrigin.has(originKey)) {+ this.deprecationCountsByOrigin.set(originKey, new Map());+ }+ const originMap = this.deprecationCountsByOrigin.get(originKey);+ const originCount = originMap.get(id) || 0;+ originMap.set(id, originCount + 1);} else if (tag === "summary-line") {this.out.write(`\n${metadata.message}\n`);} else {@@ -84,8 +94,7 @@ class Reporter extends TapReporter {...Array.from(this.deprecationCounts.keys()).map((k) => k.length));- let msg = `| ${"id".padEnd(maxIdLength)} | count |\n`;- msg += `| ${"".padEnd(maxIdLength, "-")} | ----- |\n`;+ let msg = this.buildTableHeader(["id", "count"], [maxIdLength, 5]);for (const [id, count] of this.deprecationCounts.entries()) {const countString = count.toString();@@ -95,25 +104,95 @@ class Reporter extends TapReporter {return msg;}- reportDeprecations() {- let deprecationMessage = "[Deprecation Counter] ";- if (this.deprecationCounts.size > 0) {- const table = this.generateDeprecationTable();- deprecationMessage += `Test run completed with deprecations:\n\n${table}`;+ generateDeprecationsByOriginTable() {+ const allDeprecationIds = this.collectAllDeprecationIds();+ const maxIdLength = Math.max(+ ...Array.from(allDeprecationIds).map((id) => id.length)+ );+ const origins = Array.from(this.deprecationCountsByOrigin.keys()).sort();+ const maxOriginLength = Math.max(...origins.map((o) => o.length), 6);++ let msg = this.buildTableHeader(+ ["origin", "id", "count"],+ [maxOriginLength, maxIdLength, 5]+ );- if (process.env.GITHUB_ACTIONS && process.env.GITHUB_STEP_SUMMARY) {- let jobSummary = `### ⚠️ JS Deprecations\n\nTest run completed with deprecations:\n\n`;- jobSummary += table;- jobSummary += `\n\n`;+ for (const origin of origins) {+ const originMap = this.deprecationCountsByOrigin.get(origin);+ const sortedIds = Array.from(originMap.keys()).sort();- fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, jobSummary);+ for (const id of sortedIds) {+ const count = originMap.get(id);+ const countString = count.toString();+ msg += `| ${origin.padEnd(maxOriginLength)} | ${id.padEnd(maxIdLength)} | ${countString.padStart(5)} |\n`;}- } else {- deprecationMessage += "No deprecations logged";}++ return msg;+ }++ collectAllDeprecationIds() {+ const allIds = new Set();+ for (const originMap of this.deprecationCountsByOrigin.values()) {+ for (const id of originMap.keys()) {+ allIds.add(id);+ }+ }+ return allIds;+ }++ buildTableHeader(columnNames, columnWidths) {+ let header = "| ";+ let separator = "| ";++ for (let i = 0; i < columnNames.length; i++) {+ const name = columnNames[i];+ const width = columnWidths[i];+ header += `${name.padEnd(width)} | `;+ separator += `${"".padEnd(width, "-")} | `;+ }++ return header + "\n" + separator + "\n";+ }++ reportDeprecations() {+ if (this.deprecationCounts.size === 0) {+ this.out.write("\n[Deprecation Counter] No deprecations logged\n\n");+ return;+ }++ const table = this.generateDeprecationTable();+ let deprecationMessage =+ "[Deprecation Counter] Test run completed with deprecations:\n\n" + table;++ let originTable = null;+ if (this.deprecationCountsByOrigin.size > 0) {+ originTable = this.generateDeprecationsByOriginTable();+ deprecationMessage += "\nDeprecations by test origin:\n\n" + originTable;+ }++ this.writeGitHubSummary(table, originTable);this.out.write(`\n${deprecationMessage}\n\n`);}+ writeGitHubSummary(table, originTable) {+ if (!process.env.GITHUB_ACTIONS || !process.env.GITHUB_STEP_SUMMARY) {+ return;+ }++ let jobSummary =+ "### ⚠️ JS Deprecations\n\nTest run completed with deprecations:\n\n";+ jobSummary += table;++ if (originTable) {+ jobSummary += "\n\nDeprecations by test origin:\n\n" + originTable;+ }++ jobSummary += "\n\n";++ fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, jobSummary);+ }+finish() {if (process.env.GITHUB_ACTIONS) {this.out.write("::endgroup::");diff --git a/frontend/discourse/tests/helpers/deprecation-counter.js b/frontend/discourse/tests/helpers/deprecation-counter.jsindex 537c700255c..05e7af1eafe 100644--- a/frontend/discourse/tests/helpers/deprecation-counter.js+++ b/frontend/discourse/tests/helpers/deprecation-counter.js@@ -5,17 +5,71 @@ import {isDeprecationSilenced,registerDeprecationHandler as registerDiscourseDeprecationHandler,} from "discourse/lib/deprecated";+import { isRailsTesting, isTesting } from "discourse/lib/environment";++/**+ * Set of deprecation IDs that should be skipped when counting deprecations.+ * @type {Set<string>}+ */+const skipCountIds = new Set();++/**+ * Marks a deprecation ID to be skipped when counting deprecations during tests.+ * This is useful when you want to temporarily ignore specific deprecations+ * without affecting the deprecation counter.+ *+ * USE ONLY FOR TESTING PURPOSES+ *+ * @param {string} id - The deprecation ID to skip counting+ * @throws {Error} If called outside of a QUnit test environment+ * @example+ * skipCountingDeprecation('my-deprecation-id');+ */+export function skipCountingDeprecation(id) {+ if (!isTesting()) {+ throw new Error("skipCountingDeprecation can only be used in QUnit tests.");+ }++ skipCountIds.add(id);+}++/**+ * Restores counting for a previously skipped deprecation ID.+ * Use this to re-enable deprecation counting for a specific ID that was+ * previously excluded via skipCountingDeprecation.+ *+ * USE ONLY FOR TESTING PURPOSES+ *+ * @param {string} id - The deprecation ID to restore counting for+ * @throws {Error} If called outside of a QUnit test environment+ * @example+ * restoreCountingDeprecation('my-deprecation-id');+ */+export function restoreCountingDeprecation(id) {+ if (!isTesting()) {+ throw new Error("resetSkipDeprecations can only be used in QUnit tests.");+ }++ skipCountIds.delete(id);+}export default class DeprecationCounter {counts = new Map();+ #origin = null;++ start(origin) {+ this.#origin = origin;- start() {registerDeprecationHandler(this.handleEmberDeprecation);registerDiscourseDeprecationHandler(this.handleDiscourseDeprecation);}shouldCount(id) {- return !isDeprecationSilenced(id) && DeprecationWorkflow.shouldCount(id);+ return (+ !skipCountIds.has(id) &&+ !isDeprecationSilenced(id) &&+ DeprecationWorkflow.shouldCount(id)+ );}@bind@@ -41,8 +95,13 @@ export default class DeprecationCounter {incrementCount(id) {const existingCount = this.counts.get(id) || 0;this.counts.set(id, existingCount + 1);+if (window.Testem) {- reportDeprecationToTestem(id);+ reportDeprecationToTestem(id, this.#origin);+ }+ if (isRailsTesting()) {+ // eslint-disable-next-line no-console+ console.count(`deprecation_id:${id}`); // origin will be identified using the spec metadata}}@@ -77,30 +136,40 @@ export default class DeprecationCounter {}}-function reportDeprecationToTestem(id) {+function reportDeprecationToTestem(id, origin) {window.Testem.useCustomAdapter(function (socket) {socket.emit("test-metadata", "increment-deprecation", {id,+ origin,});});}-export function setupDeprecationCounter(qunit) {+export function setupDeprecationCounter({ QUnit, origin } = {}) {const deprecationCounter = new DeprecationCounter();- qunit.begin(() => deprecationCounter.start());+ // for system specs+ if (isRailsTesting()) {+ deprecationCounter.start(origin);+ return;+ }- qunit.done(() => {- if (window.Testem) {- return;- } else if (deprecationCounter.hasDeprecations) {- // eslint-disable-next-line no-console- console.warn(- `[Discourse Deprecation Counter] Test run completed with deprecations:\n\n${deprecationCounter.generateTable()}`- );- } else {- // eslint-disable-next-line no-console- console.log("[Discourse Deprecation Counter] No deprecations found");- }- });+ if (QUnit) {+ // for QUnit tests+ QUnit.begin(() => deprecationCounter.start(origin));++ QUnit.done(() => {+ if (window.Testem) {+ return;+ } else if (deprecationCounter.hasDeprecations) {+ // eslint-disable-next-line no-console+ console.warn(+ `[Discourse Deprecation Counter] Test run completed with deprecations:\n\n${deprecationCounter.generateTable()}`+ );+ } else {+ // eslint-disable-next-line no-console+ console.log("[Discourse Deprecation Counter] No deprecations found");+ }+ });+ }}diff --git a/frontend/discourse/tests/helpers/raise-on-deprecation.js b/frontend/discourse/tests/helpers/raise-on-deprecation.jsindex 1ed0c5bb771..db58d3a258c 100644--- a/frontend/discourse/tests/helpers/raise-on-deprecation.js+++ b/frontend/discourse/tests/helpers/raise-on-deprecation.js@@ -1,11 +1,17 @@import { registerDeprecationHandler } from "@ember/debug";+import { isEmpty } from "@ember/utils";import QUnit from "qunit";import DeprecationWorkflow from "discourse/deprecation-workflow";import { registerDeprecationHandler as registerDiscourseDeprecationHandler } from "discourse/lib/deprecated";+import identifySource, { consolePrefix } from "discourse/lib/source-identifier";let disabled = false;let disabledQUnitResult = false;+/**+ * Configures deprecation handlers to raise errors when deprecations occur in tests.+ * This ensures core and preinstalled plugins remain deprecation-free.+ */export function configureRaiseOnDeprecation() {if (window.EmberENV.RAISE_ON_DEPRECATION !== undefined) {return;@@ -30,8 +36,22 @@ export function configureRaiseOnDeprecation() {});}+/**+ * Raises a deprecation error in QUnit tests, including source information.+ *+ * @param {string} message - The deprecation message+ * @param {Object} options - Deprecation options including id and source+ */function raiseDeprecationError(message, options) {- message = `DEPRECATION IN CORE TEST: ${message} (deprecation id: ${options.id})\n\nCore test runs must be deprecation-free. Use ember-deprecation-workflow to silence unresolved deprecations.`;+ const source = options?.source ?? identifySource();++ const prefix = consolePrefix(null, source);+ const from = isEmpty(prefix)+ ? ""+ : ` FROM ${prefix.substring(1, prefix.length - 1)}`;++ message = `DEPRECATION${from}: ${message} (deprecation id: ${options.id})\n\nCore and all the preinstalled plugins tests runs must be deprecation-free. Use ember-deprecation-workflow to silence unresolved deprecations.`;+if (QUnit.config.current && !disabledQUnitResult) {QUnit.assert.pushResult({result: false,diff --git a/frontend/discourse/tests/integration/components/float-kit/d-toast-test.gjs b/frontend/discourse/tests/integration/components/float-kit/d-toast-test.gjsindex 7d4152c6fc8..b91a2b91fef 100644--- a/frontend/discourse/tests/integration/components/float-kit/d-toast-test.gjs+++ b/frontend/discourse/tests/integration/components/float-kit/d-toast-test.gjs@@ -4,12 +4,9 @@ import { render, triggerEvent } from "@ember/test-helpers";import { module, test } from "qunit";import DToast from "discourse/float-kit/components/d-toast";import DToastInstance from "discourse/float-kit/lib/d-toast-instance";+import { withSilencedDeprecationsAsync } from "discourse/lib/deprecated";import { forceMobile } from "discourse/lib/mobile";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import {- disableRaiseOnDeprecation,- enableRaiseOnDeprecation,-} from "discourse/tests/helpers/raise-on-deprecation";function createCustomToastInstance(owner, options, newClose) {class CustomToastInstance extends DToastInstance {@@ -29,14 +26,6 @@ function createCustomToastInstance(owner, options, newClose) {module("Integration | Component | FloatKit | d-toast", function (hooks) {setupRenderingTest(hooks);- hooks.beforeEach(function () {- disableRaiseOnDeprecation();- });-- hooks.afterEach(function () {- enableRaiseOnDeprecation();- });-test("swipe up to close", async function (assert) {let closing = false;forceMobile();@@ -71,7 +60,10 @@ module("Integration | Component | FloatKit | d-toast", function (hooks) {duration: 9999,data: { message: "test" },});- await render(<template><DToast @toast={{toast}} /></template>);+ await withSilencedDeprecationsAsync(+ "float-kit.d-toast.duration",+ async () => await render(<template><DToast @toast={{toast}} /></template>)+ );assert.dom(".fk-d-toast")diff --git a/frontend/discourse/tests/integration/components/plugin-outlet-test.gjs b/frontend/discourse/tests/integration/components/plugin-outlet-test.gjsindex 7f7254c8930..f2a6c7ab8ac 100644--- a/frontend/discourse/tests/integration/components/plugin-outlet-test.gjs+++ b/frontend/discourse/tests/integration/components/plugin-outlet-test.gjs@@ -20,6 +20,10 @@ import {extraConnectorComponent,} from "discourse/lib/plugin-connectors";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import {+ restoreCountingDeprecation,+ skipCountingDeprecation,+} from "discourse/tests/helpers/deprecation-counter";import { registerTemporaryModule } from "discourse/tests/helpers/temporary-module-helper";import {disableRaiseOnDeprecation,@@ -479,11 +483,19 @@ module("Integration | Component | plugin-outlet", function (hooks) {innerHooks.beforeEach(function () {this.consoleWarnStub = sinon.stub(console, "warn");disableRaiseOnDeprecation();++ skipCountingDeprecation("discourse.plugin-connector.deprecated-arg");+ skipCountingDeprecation("discourse.plugin-connector.deprecated-arg.test");});innerHooks.afterEach(function () {this.consoleWarnStub.restore();enableRaiseOnDeprecation();++ restoreCountingDeprecation("discourse.plugin-connector.deprecated-arg");+ restoreCountingDeprecation(+ "discourse.plugin-connector.deprecated-arg.test"+ );});test("deprecated parameters with default message", async function (assert) {@@ -513,7 +525,7 @@ module("Integration | Component | plugin-outlet", function (hooks) {);assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `shouldDisplay` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `shouldDisplay` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the default message to the console");@@ -669,6 +681,9 @@ module(setupRenderingTest(hooks);hooks.beforeEach(function () {+ skipCountingDeprecation("discourse.plugin-connector.deprecated-arg");+ skipCountingDeprecation("discourse.plugin-connector.deprecated-arg.test");+registerTemporaryModule(`${TEMPLATE_PREFIX}/test-name/my-connector`,hbs`@@ -677,6 +692,13 @@ module();});+ hooks.afterEach(function () {+ restoreCountingDeprecation("discourse.plugin-connector.deprecated-arg");+ restoreCountingDeprecation(+ "discourse.plugin-connector.deprecated-arg.test"+ );+ });+test("uses classic PluginConnector by default", async function (assert) {await render(hbs`<PluginOutlet @name="test-name" @outletArgs={{lazyHash hello="world"}} />@@ -849,13 +871,13 @@ module();assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for @outletArgs.hello");assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/templates/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/templates/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for this.hello");@@ -881,13 +903,13 @@ module();assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for @outletArgs.hello");assert.false(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/templates/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/templates/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"),"does not log the message for this.hello");@@ -919,13 +941,13 @@ module();assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for @outletArgs.hello");assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for this.hello");@@ -956,13 +978,13 @@ module();assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for @outletArgs.hello");assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for this.hello");@@ -989,7 +1011,7 @@ module();assert.true(this.consoleWarnStub.calledWith(- "Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"+ "DEPRECATION NOTICE: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"),"logs the expected message for @outletArgs.hello");diff --git a/frontend/discourse/tests/setup-tests.js b/frontend/discourse/tests/setup-tests.jsindex f3e1fea3b32..8601ed6b400 100644--- a/frontend/discourse/tests/setup-tests.js+++ b/frontend/discourse/tests/setup-tests.js@@ -215,9 +215,11 @@ function writeSummaryLine(message) {}export default function setupTests(config) {+ const target = getUrlParameter("target") || "core";+disableCloaking();- setupDeprecationCounter(QUnit);+ setupDeprecationCounter({ QUnit, origin: target });QUnit.config.hidepassed = true;QUnit.config.testTimeout = 60_000;@@ -378,7 +380,6 @@ export default function setupTests(config) {handleLegacyParameters();- const target = getUrlParameter("target") || "core";if (target === "theme-qunit") {window.location.href = window.location.origin + "/theme-qunit";}@@ -403,7 +404,16 @@ export default function setupTests(config) {setLoadedFaker(FakerModule);- if (!hasPluginJs && !hasThemeJs) {+ // core tests run without loading plugins or themes+ const isCoreTest = !hasPluginJs && !hasThemeJs;+ const isPreinstalledPluginTest = !!document.querySelector(+ `script[data-discourse-plugin="${CSS.escape(target)}"][data-preinstalled="true"]`+ );++ if (+ window.EmberENV.RAISE_ON_DEPRECATION ??+ (isCoreTest || isPreinstalledPluginTest)+ ) {configureRaiseOnDeprecation();}}diff --git a/frontend/discourse/tests/unit/deprecation-workflow-test.js b/frontend/discourse/tests/unit/deprecation-workflow-test.jsindex e4f45afd3c9..fab5c5a41e3 100644--- a/frontend/discourse/tests/unit/deprecation-workflow-test.js+++ b/frontend/discourse/tests/unit/deprecation-workflow-test.js@@ -307,6 +307,30 @@ module("Unit | deprecation-workflow", function (hooks) {assert.true(wf.shouldCount("empty"), "empty handler -> count");});+ test("shouldCount respects dont-count handler", function (assert) {+ const wf = new DiscourseDeprecationWorkflow([+ { handler: "dont-count", matchId: "dc" },+ { handler: ["log", "dont-count"], matchId: "ldc" },+ { handler: ["counter", "dont-count"], matchId: "cdc" },+ { handler: "log", matchId: "l" },+ ]);++ assert.false(+ wf.shouldCount("dc"),+ "dont-count handler prevents counting"+ );+ assert.false(+ wf.shouldCount("ldc"),+ "dont-count with log still prevents counting"+ );+ assert.false(+ wf.shouldCount("cdc"),+ "dont-count overrides counter handler"+ );+ assert.true(wf.shouldCount("l"), "log only should count");+ assert.true(wf.shouldCount("unhandled"), "unhandled should count");+ });+test("shouldThrow handles throw and includeUnsilenced", function (assert) {const wf = new DiscourseDeprecationWorkflow([{ handler: "throw", matchId: "t" },@@ -348,23 +372,57 @@ module("Unit | deprecation-workflow", function (hooks) {"unhandled without includeUnsilenced -> false");});++ test("shouldThrow respects dont-throw handler", function (assert) {+ const wf = new DiscourseDeprecationWorkflow([+ { handler: "dont-throw", matchId: "dt" },+ { handler: ["throw", "dont-throw"], matchId: "tdt" },+ { handler: ["log", "dont-throw"], matchId: "ldt" },+ { handler: "throw", matchId: "t" },+ ]);++ assert.false(+ wf.shouldThrow("dt"),+ "dont-throw handler prevents throwing"+ );+ assert.false(wf.shouldThrow("tdt"), "dont-throw overrides throw handler");+ assert.false(+ wf.shouldThrow("ldt"),+ "dont-throw with log prevents throwing"+ );+ assert.true(wf.shouldThrow("t"), "throw handler should throw");++ assert.false(+ wf.shouldThrow("dt", true),+ "dont-throw prevents throwing even with includeUnsilenced"+ );+ assert.false(+ wf.shouldThrow("tdt", true),+ "dont-throw overrides throw even with includeUnsilenced"+ );+ assert.false(+ wf.shouldThrow("ldt", true),+ "dont-throw with log prevents throwing even with includeUnsilenced"+ );+ });});test("emberWorkflowList flattens handlers and filters to Ember CLI-compatible ones", function (assert) {const wf = new DiscourseDeprecationWorkflow([{ handler: ["silence", "counter"], matchId: "x" },{ handler: ["log", "throw"], matchId: "y" },+ { handler: ["silence", "dont-throw", "dont-count"], matchId: "z" },]);const flattened = wf.emberWorkflowList.map((w) => `${w.matchId}:${w.handler}`).sort();- // "counter" is not included in Ember CLI workflow output; others are+ // "counter", "dont-throw", "dont-count" are not included in Ember CLI workflow output; only Ember CLI handlers areassert.deepEqual(flattened,- ["x:silence", "y:log", "y:throw"].sort(),- "outputs one entry per allowed handler and excludes counter"+ ["x:silence", "y:log", "y:throw", "z:silence"].sort(),+ "outputs one entry per allowed handler and excludes counter, dont-throw, and dont-count");});});diff --git a/frontend/discourse/tests/unit/lib/deprecated-test.js b/frontend/discourse/tests/unit/lib/deprecated-test.jsindex 559f0edc3c6..52d10f8093c 100644--- a/frontend/discourse/tests/unit/lib/deprecated-test.js+++ b/frontend/discourse/tests/unit/lib/deprecated-test.js@@ -41,7 +41,7 @@ module("Unit | Utility | deprecated", function (hooks) {);assert.deepEqual(this.warnStub.args[0],- ["Deprecation notice: My message"],+ ["DEPRECATION NOTICE: My message"],"console.warn is called with the correct arguments");assert.strictEqual(@@ -66,7 +66,7 @@ module("Unit | Utility | deprecated", function (hooks) {assert.deepEqual(this.warnStub.args[0],[- "Deprecation notice: My message [deprecation id: discourse.my_deprecation_id]",+ "DEPRECATION NOTICE: My message [deprecation id: discourse.my_deprecation_id]",],"console.warn is called with the correct arguments");@@ -97,7 +97,7 @@ module("Unit | Utility | deprecated", function (hooks) {assert.deepEqual(this.warnStub.args[0],[- "Deprecation notice: My message [deprecated since Discourse v1] [removal in Discourse v100] [deprecation id: discourse.my_deprecation_id] [info: https://example.com]",+ "DEPRECATION NOTICE: My message [deprecated since Discourse v1] [removal in Discourse v100] [deprecation id: discourse.my_deprecation_id] [info: https://example.com]",],"console.warn is called with the correct arguments");@@ -120,7 +120,7 @@ module("Unit | Utility | deprecated", function (hooks) {id: "discourse.my_deprecation_id",raiseError: true,}),- "Deprecation notice: My message [deprecation id: discourse.my_deprecation_id]"+ "DEPRECATION NOTICE: My message [deprecation id: discourse.my_deprecation_id]");assert.strictEqual(this.counterStub.callCount,diff --git a/lib/discourse.rb b/lib/discourse.rbindex db174bec6d7..691a9ad4372 100644--- a/lib/discourse.rb+++ b/lib/discourse.rb@@ -1050,7 +1050,7 @@ module Discoursedef self.deprecate(warning, drop_from: nil, since: nil, raise_error: false, output_in_test: false)location = caller_locations[1].yield_self { |l| "#{l.path}:#{l.lineno}:in \`#{l.label}\`" }- warning = ["Deprecation notice:", warning]+ warning = ["DEPRECATION NOTICE:", warning]warning << "(deprecated since Discourse #{since})" if sincewarning << "(removal in Discourse #{drop_from})" if drop_fromwarning << "\nAt #{location}"diff --git a/lib/plugin/metadata.rb b/lib/plugin/metadata.rbindex 9bb5fec97cc..3e340ae3c83 100644--- a/lib/plugin/metadata.rb+++ b/lib/plugin/metadata.rb@@ -5,96 +5,9 @@ module Pluginendclass Plugin::Metadata+ # from config/official_plugins.jsonOFFICIAL_PLUGINS =- Set.new(- %w[- discourse-adplugin- discourse-affiliate- discourse-ai- discourse-akismet- discourse-algolia- discourse-apple-auth- discourse-assign- discourse-auto-deactivate- discourse-bbcode- discourse-bbcode-color- discourse-cakeday- discourse-calendar- discourse-categories-suppressed- discourse-category-experts- discourse-characters-required- discourse-chat-integration- discourse-code-review- discourse-data-explorer- discourse-details- discourse-doc-categories- discourse-docs- discourse-follow- discourse-fontawesome-pro- discourse-gamification- discourse-geoblocking- discourse-github- discourse-gradle-issue- discourse-graphviz- discourse-group-tracker- discourse-hcaptcha- discourse-invite-tokens- discourse-jira- discourse-lazy-videos- discourse-local-dates- discourse-login-with-amazon- discourse-logster-transporter- discourse-lti- discourse-math- discourse-microsoft-auth- discourse-narrative-bot- discourse-newsletter-integration- discourse-no-bump- discourse-oauth2-basic- discourse-openid-connect- discourse-patreon- discourse-perspective-api- discourse-policy- discourse-post-voting- discourse-presence- discourse-prometheus- discourse-prometheus-alert-receiver- discourse-push-notifications- discourse-reactions- discourse-restricted-replies- discourse-rss-polling- discourse-salesforce- discourse-saml- discourse-saved-searches- discourse-signatures- discourse-solved- discourse-staff-alias- discourse-steam-login- discourse-subscriptions- discourse-tag-by-group- discourse-teambuild- discourse-templates- discourse-tooltips- discourse-topic-voting- discourse-translator- discourse-user-card-badges- discourse-user-notes- discourse-vk-auth- discourse-whos-online- discourse-yearly-review- discourse-zendesk-plugin- discourse-zoom- discourse-rewind- automation- chat- checklist- docker_manager- footnote- poll- spoiler-alert- styleguide- ],- )+ Set.new(JSON.load_file(File.join(Rails.root, "config", "official_plugins.json")))FIELDS = %i[name about version authors contact_emails url required_version meta_topic_id label]attr_accessor(*FIELDS)diff --git a/lib/tasks/plugin.rake b/lib/tasks/plugin.rakeindex a18f87b12b3..3822290b819 100644--- a/lib/tasks/plugin.rake+++ b/lib/tasks/plugin.rake@@ -3,6 +3,11 @@directory "plugins"desc "install all official plugins (use GIT_WRITE=1 to pull with write access)"++task "plugin:list_official" do+ Plugin::Metadata::OFFICIAL_PLUGINS.each { |name| STDOUT.puts name }+end+task "plugin:install_all_official" doskip = Set.new(%w[customer-flair poll])@@ -191,6 +196,9 @@ def spec(plugin, files, parallel: false, argv: nil)params << "--seed #{ENV["RSPEC_SEED"]}" if Integer(ENV["RSPEC_SEED"], exception: false)params << argv if argv+ # if plugin contains a comma, it's a list. we need to surround it with brackets+ plugin = "{#{plugin}}" if plugin.include?(",")+# reject system specs as they are slow and need dedicated setupif files.empty?files =diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rakeindex 95030dffdaa..d1e22d8de08 100644--- a/lib/tasks/themes.rake+++ b/lib/tasks/themes.rake@@ -276,29 +276,34 @@ end# the themes QUnit tests requires the themes to be installed in the database.desc "Runs qunit tests for all official themes"task "themes:qunit_all_official" => :environment do |task, args|- theme_ids_with_qunit_tests = []+ official_theme_ids_with_qunit_tests = []ThemeMetadata::OFFICIAL_THEMES.each do |theme_name|path = File.join(Rails.root, "tmp/themes/#{theme_name}")if Dir.glob("#{File.join(path, "test")}/**/*.{js,gjs}").any?theme = RemoteTheme.import_theme_from_directory(path)- theme_ids_with_qunit_tests << theme.id+ official_theme_ids_with_qunit_tests << theme.idelseputs "Skipping #{theme_name} as no QUnit tests have been detected"endend+ core_theme_ids_with_qunit_tests = []+Theme::CORE_THEMES.each do |(theme_name, theme_id)|path = File.join(Rails.root, "themes/#{theme_name}")if Dir.glob("#{File.join(path, "test")}/**/*.{js,gjs}").any?- theme_ids_with_qunit_tests << theme_id+ core_theme_ids_with_qunit_tests << theme_idelseputs "Skipping #{theme_name} as no QUnit tests have been detected"endendRake::Task["themes:qunit"].reenable- Rake::Task["themes:qunit"].invoke("ids", theme_ids_with_qunit_tests.join("|"))+ Rake::Task["themes:qunit"].invoke("ids", official_theme_ids_with_qunit_tests.join("|"))++ ENV["EMBER_RAISE_ON_DEPRECATION"] = "1"+ Rake::Task["themes:qunit"].invoke("ids", core_theme_ids_with_qunit_tests.join("|"))enddiff --git a/lib/turbo_tests/base_formatter.rb b/lib/turbo_tests/base_formatter.rbindex e3139a9a00f..a1d728f61a4 100644--- a/lib/turbo_tests/base_formatter.rb+++ b/lib/turbo_tests/base_formatter.rb@@ -1,5 +1,4 @@# frozen_string_literal: true-RSpec::Support.require_rspec_core "formatters/base_text_formatter"RSpec::Support.require_rspec_core "formatters/console_codes"@@ -8,45 +7,119 @@ module TurboTestsRSpec::Core::Formatters.register(self, :dump_summary)def dump_summary(notification, timings)- if timings.present?- output.puts "\nTop #{timings.size} Slowest examples:"+ output_slowest_examples(timings) if timings.present?- timings.each do |(full_description, source_location, duration)|- output.puts " #{full_description}"- output.puts " #{RSpec::Core::Formatters::ConsoleCodes.wrap(duration.to_s + "ms", :bold)} #{source_location}"- end+ totals_by_id, totals_by_origin = aggregate_js_deprecations(notification.examples)+ output_js_deprecations(totals_by_id, totals_by_origin) if totals_by_id.present?++ super(notification)+ end++ private++ def output_slowest_examples(timings)+ output.puts "\nTop #{timings.size} Slowest examples:"+ timings.each do |(full_description, source_location, duration)|+ output.puts " #{full_description}"+ output.puts " #{RSpec::Core::Formatters::ConsoleCodes.wrap(duration.to_s + "ms", :bold)} #{source_location}"end+ end++ def aggregate_js_deprecations(examples)+ totals_by_id = Hash.new(0)+ totals_by_origin = Hash.new { |h, k| h[k] = Hash.new(0) }++ examples.each do |example|+ origin = extract_origin_from_example(example) || "unknown"- js_deprecation_totals = {}- notification.examples.each do |example|example.metadata[:js_deprecations]&.each do |id, count|- js_deprecation_totals[id] ||= 0- js_deprecation_totals[id] += count+ totals_by_id[id] += count+ totals_by_origin[origin][id] += countendend- if js_deprecation_totals.present?- max_id_length = js_deprecation_totals.keys.map(&:length).max- output.puts "\n[Deprecation Counter] Test run completed with deprecations:\n\n"+ [totals_by_id, totals_by_origin]+ end- table = ""- table += "| #{"id".ljust(max_id_length)} | count |\n"- table += "| #{"-" * max_id_length} | ----- |\n"- js_deprecation_totals.each do |id, count|- table += "| #{id.ljust(max_id_length)} | #{count.to_s.ljust(5)} |\n"- end+ def output_js_deprecations(totals_by_id, totals_by_origin)+ output.puts "\n[Deprecation Counter] Test run completed with deprecations:\n\n"++ deprecations_table = generate_deprecations_table(totals_by_id)+ output.puts deprecations_table++ origin_table = nil+ if totals_by_origin.any?+ origin_table = generate_deprecations_by_origin_table(totals_by_origin)+ output.puts "\nDeprecations by spec origin:\n\n"+ output.puts origin_table+ end++ write_github_summary(deprecations_table, origin_table)+ end++ def generate_deprecations_table(totals_by_id)+ max_id_length = totals_by_id.keys.map(&:length).max- output.puts table+ headers = ["id".ljust(max_id_length), "count".rjust(5)]+ rows = totals_by_id.map { |id, count| [id.ljust(max_id_length), count.to_s.rjust(5)] }- if ENV["GITHUB_ACTIONS"] && ENV["GITHUB_STEP_SUMMARY"]- job_summary = "### ⚠️ JS Deprecations\n\nTest run completed with deprecations:\n\n"- job_summary += table- job_summary += "\n\n"- File.write(ENV["GITHUB_STEP_SUMMARY"], job_summary)+ build_markdown_table(headers, rows)+ end++ def generate_deprecations_by_origin_table(totals_by_origin)+ all_ids = totals_by_origin.values.flat_map(&:keys).uniq+ max_id_length = all_ids.map(&:length).max+ origins = totals_by_origin.keys.sort+ max_origin_length = [origins.map(&:length).max, 6].max++ headers = ["origin".ljust(max_origin_length), "id".ljust(max_id_length), "count".rjust(5)]+ rows = []++ origins.each do |origin|+ origin_deprecations = totals_by_origin[origin]+ sorted_ids = origin_deprecations.keys.sort++ sorted_ids.each do |id|+ count = origin_deprecations[id]+ rows += [[origin.ljust(max_origin_length), id.ljust(max_id_length), count.to_s.rjust(5)]]endend- super(notification)+ build_markdown_table(headers, rows)+ end++ def build_markdown_table(headers, rows)+ table = "| #{headers.join(" | ")} |\n"+ table += "| #{headers.map { |h| "-" * h.length }.join(" | ")} |\n"+ rows.each { |row| table += "| #{row.join(" | ")} |\n" }+ table+ end++ def write_github_summary(deprecations_table, origin_table)+ return unless ENV["GITHUB_ACTIONS"] && ENV["GITHUB_STEP_SUMMARY"]++ summary = "### ⚠️ JS Deprecations\n\nTest run completed with deprecations:\n\n"+ summary += deprecations_table+ summary += "\n\nDeprecations by spec origin:\n\n#{origin_table}" if origin_table+ summary += "\n\n"++ File.write(ENV["GITHUB_STEP_SUMMARY"], summary)+ end++ def extract_origin_from_example(example)+ example_file_path = example.metadata[:rerun_file_path]+ return nil unless example_file_path++ expanded_example_file_path = Pathname.new(example_file_path).expand_path+ return nil unless expanded_example_file_path.to_s.start_with?(Rails.root.to_s)++ extension_match = example_file_path.match(%r{/(plugins|themes)/([^/]+)/})+ if extension_match+ _type_dir, extension_name = extension_match.captures+ extension_name+ else+ "core"+ endendendenddiff --git a/lib/turbo_tests/json_example.rb b/lib/turbo_tests/json_example.rbindex 9426d469ae4..a0ac86ce4ff 100644--- a/lib/turbo_tests/json_example.rb+++ b/lib/turbo_tests/json_example.rb@@ -20,6 +20,7 @@ module TurboTestsrun_duration_ms: @rspec_example.metadata[:run_duration_ms],process_pid: Process.pid,js_deprecations: @rspec_example.metadata[:js_deprecations],+ rerun_file_path: @rspec_example.metadata[:rerun_file_path],active_record_debug_logs: @rspec_example.metadata[:active_record_debug_logs],},location_rerun_argument: @rspec_example.location_rerun_argument,diff --git a/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjs b/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjsindex 0a7880e25a8..77e8b761092 100644--- a/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjs+++ b/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjs@@ -46,7 +46,7 @@ export default class ChatIncomingWebhookEditForm extends Component {});this.toasts.success({- duration: 3000,+ duration: "short",data: {message: i18n("chat.incoming_webhooks.saved"),},@@ -58,7 +58,7 @@ export default class ChatIncomingWebhookEditForm extends Component {});this.toasts.success({- duration: 3000,+ duration: "short",data: {message: i18n("chat.incoming_webhooks.created"),},diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.jsindex 00cc6c796f2..a42f298e020 100644--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.js+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.js@@ -3,6 +3,7 @@ import { withPluginApi } from "discourse/lib/plugin-api";import { formatUsername } from "discourse/lib/utilities";import { i18n } from "discourse-i18n";import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";+import UserMenuChatNotificationsList from "../components/user-menu/chat-notifications-list";export default {name: "chat-user-menu",@@ -150,7 +151,7 @@ export default {}get panelComponent() {- return "user-menu/chat-notifications-list";+ return UserMenuChatNotificationsList;}get icon() {diff --git a/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads.gjs b/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads.gjssimilarity index 100%rename from plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads.gjsrename to plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads.gjsdiff --git a/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads-index.gjs b/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads/index.gjssimilarity index 96%rename from plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads-index.gjsrename to plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads/index.gjsindex 3a416df3e1a..7247f8398c7 100644--- a/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads-index.gjs+++ b/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads/index.gjs@@ -2,7 +2,7 @@ import { LinkTo } from "@ember/routing";import DButton from "discourse/components/d-button";import routeAction from "discourse/helpers/route-action";import { i18n } from "discourse-i18n";-import HouseAdsListSetting from "../components/house-ads-list-setting";+import HouseAdsListSetting from "../../../components/house-ads-list-setting";export default <template><section class="house-ads-settings content-body">diff --git a/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads-show.gjs b/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads/show.gjssimilarity index 97%rename from plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads-show.gjsrename to plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads/show.gjsindex 21de779fe04..e967eee83e1 100644--- a/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/plugins-house-ads-show.gjs+++ b/plugins/discourse-adplugin/admin/assets/javascripts/admin/templates/admin-plugins/house-ads/show.gjs@@ -5,7 +5,7 @@ import DButton from "discourse/components/d-button";import TextField from "discourse/components/text-field";import GroupChooser from "discourse/select-kit/components/group-chooser";import { i18n } from "discourse-i18n";-import HouseAdsCategorySelector from "../components/house-ads-category-selector";+import HouseAdsCategorySelector from "../../../components/house-ads-category-selector";export default <template><section class="edit-house-ad content-body">diff --git a/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-translation-topic-admin.gjs b/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-translation-topic-admin.gjsindex 28df9f778b0..e66a999a763 100644--- a/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-translation-topic-admin.gjs+++ b/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-translation-topic-admin.gjs@@ -48,7 +48,7 @@ export default apiInitializer((api) => {);toasts.success({- duration: 5000,+ duration: "long",data: {message: i18n("discourse_ai.translation.schedule_topic_success", {count: result.scheduled_posts,@@ -61,7 +61,7 @@ export default apiInitializer((api) => {i18n("discourse_ai.translation.schedule_topic_error");toasts.error({- duration: 5000,+ duration: "long",data: {message: errorMessage,},diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin/plugins-explorer-index.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin-plugins/explorer/index.gjssimilarity index 95%rename from plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin/plugins-explorer-index.gjsrename to plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin-plugins/explorer/index.gjsindex 350e07b93f0..fbe15e3ad59 100644--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin/plugins-explorer-index.gjs+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin-plugins/explorer/index.gjs@@ -5,11 +5,11 @@ import DButton from "discourse/components/d-button";import PickFilesButton from "discourse/components/pick-files-button";import TableHeaderToggle from "discourse/components/table-header-toggle";import TextField from "discourse/components/text-field";-import boundDate from "discourse/helpers/bound-date";+import ageWithTooltip from "discourse/helpers/age-with-tooltip";import icon from "discourse/helpers/d-icon";import { not } from "discourse/truth-helpers";import { i18n } from "discourse-i18n";-import ShareReport from "../../components/share-report";+import ShareReport from "../../../components/share-report";export default <template>{{#if @controller.disallow}}@@ -156,11 +156,11 @@ export default <template></div>{{#if query.last_run_at}}<span>- {{boundDate query.last_run_at}}+ {{ageWithTooltip query.last_run_at format="medium"}}</span>{{else if query.created_at}}<span>- {{boundDate query.created_at}}+ {{ageWithTooltip query.created_at format="medium"}}</span>{{/if}}</td>diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin/plugins-explorer-queries-details.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin-plugins/explorer/queries/details.gjssimilarity index 96%rename from plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin/plugins-explorer-queries-details.gjsrename to plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin-plugins/explorer/queries/details.gjsindex f19595aa638..a79f7b161e7 100644--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin/plugins-explorer-queries-details.gjs+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/admin-plugins/explorer/queries/details.gjs@@ -11,10 +11,10 @@ import icon from "discourse/helpers/d-icon";import draggable from "discourse/modifiers/draggable";import MultiSelect from "discourse/select-kit/components/multi-select";import { i18n } from "discourse-i18n";-import CodeView from "../../components/code-view";-import ExplorerSchema from "../../components/explorer-schema";-import ParamInputForm from "../../components/param-input-form";-import QueryResultsWrapper from "../../components/query-results-wrapper";+import CodeView from "../../../../components/code-view";+import ExplorerSchema from "../../../../components/explorer-schema";+import ParamInputForm from "../../../../components/param-input-form";+import QueryResultsWrapper from "../../../../components/query-results-wrapper";export default <template>{{#if @controller.disallow}}diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/group/reports/index.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/group/reports/index.gjsindex 816e27ac234..361a64532e6 100644--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/group/reports/index.gjs+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/templates/group/reports/index.gjs@@ -1,6 +1,6 @@import { array } from "@ember/helper";import { LinkTo } from "@ember/routing";-import boundDate from "discourse/helpers/bound-date";+import ageWithTooltip from "discourse/helpers/age-with-tooltip";import { i18n } from "discourse-i18n";export default <template>@@ -31,7 +31,7 @@ export default <template><td>{{query.description}}</td><td>{{#if query.last_run_at}}- {{boundDate query.last_run_at}}+ {{ageWithTooltip query.last_run_at format="medium"}}{{/if}}</td></tr>diff --git a/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-create-leaderboard.gjs b/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-create-leaderboard.gjsindex ee04f978d37..8c7206a179c 100644--- a/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-create-leaderboard.gjs+++ b/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-create-leaderboard.gjs@@ -39,7 +39,7 @@ export default class AdminCreateLeaderboard extends Component {});this.toasts.success({- duration: 3000,+ duration: "short",data: {message: i18n("gamification.leaderboard.create_success"),},diff --git a/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-edit-leaderboard.gjs b/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-edit-leaderboard.gjsindex ed58cab60a3..9398a0ca6b8 100644--- a/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-edit-leaderboard.gjs+++ b/plugins/discourse-gamification/admin/assets/javascripts/admin/components/admin-edit-leaderboard.gjs@@ -45,7 +45,7 @@ export default class AdminEditLeaderboard extends Component {});this.toasts.success({- duration: 3000,+ duration: "short",data: {message: i18n("gamification.leaderboard.save_success"),},diff --git a/plugins/discourse-gamification/admin/assets/javascripts/discourse/controllers/admin-plugins/show/discourse-gamification-leaderboards/index.js b/plugins/discourse-gamification/admin/assets/javascripts/discourse/controllers/admin-plugins/show/discourse-gamification-leaderboards/index.jsindex 2df9ed1b1a7..cec589f238e 100644--- a/plugins/discourse-gamification/admin/assets/javascripts/discourse/controllers/admin-plugins/show/discourse-gamification-leaderboards/index.js+++ b/plugins/discourse-gamification/admin/assets/javascripts/discourse/controllers/admin-plugins/show/discourse-gamification-leaderboards/index.js@@ -41,7 +41,7 @@ export default class AdminPluginsShowDiscourseGamificationLeaderboardsIndexContr).then(() => {this.toasts.success({- duration: 3000,+ duration: "short",data: {message: i18n("gamification.leaderboard.delete_success"),},diff --git a/plugins/discourse-policy/spec/plugin_spec.rb b/plugins/discourse-policy/spec/plugin_spec.rbindex 32bbdb86fce..8b4508c8f3f 100644--- a/plugins/discourse-policy/spec/plugin_spec.rb+++ b/plugins/discourse-policy/spec/plugin_spec.rb@@ -117,7 +117,7 @@ describe DiscoursePolicy doSiteSetting.policy_restrict_to_staff_postsexpect(fake_logger.warnings[0]).to include(- "Deprecation notice: `SiteSetting.policy_restrict_to_staff_posts` has been deprecated. Please use `SiteSetting.create_policy_allowed_groups` instead. (removal in Discourse 3.7.0)",+ "DEPRECATION NOTICE: `SiteSetting.policy_restrict_to_staff_posts` has been deprecated. Please use `SiteSetting.create_policy_allowed_groups` instead. (removal in Discourse 3.7.0)",)endenddiff --git a/plugins/discourse-reactions/assets/javascripts/discourse/templates/user-activity/reactions.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/templates/user-activity/reactions.gjsindex fd4e410e2f0..a81be01382e 100644--- a/plugins/discourse-reactions/assets/javascripts/discourse/templates/user-activity/reactions.gjs+++ b/plugins/discourse-reactions/assets/javascripts/discourse/templates/user-activity/reactions.gjs@@ -1,8 +1,12 @@import PostList from "discourse/components/post-list";+import hideApplicationFooter from "discourse/helpers/hide-application-footer";import { i18n } from "discourse-i18n";import DiscourseReactionsReactionEmoji from "../../components/discourse-reactions-reaction-emoji";export default <template>+ {{#if @controller.canLoadMore}}+ {{hideApplicationFooter}}+ {{/if}}<PostList@posts={{@model}}@fetchMorePosts={{@controller.loadMore}}diff --git a/plugins/discourse-rss-polling/assets/javascripts/discourse/templates/admin/plugins-rss-polling.gjs b/plugins/discourse-rss-polling/assets/javascripts/discourse/templates/admin-plugins/rss-polling.gjssimilarity index 100%rename from plugins/discourse-rss-polling/assets/javascripts/discourse/templates/admin/plugins-rss-polling.gjsrename to plugins/discourse-rss-polling/assets/javascripts/discourse/templates/admin-plugins/rss-polling.gjsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-dashboard.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/dashboard.jssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-dashboard.jsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/dashboard.jsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-plans.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/plans.jssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-plans.jsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/plans.jsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-plans-index.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/plans/index.jssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-plans-index.jsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/plans/index.jsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-plans-show.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/plans/show.jssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-plans-show.jsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions/plans/show.jsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins-discourse-subscriptions-plans.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins/discourse-subscriptions/plans.jssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins-discourse-subscriptions-plans.jsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins/discourse-subscriptions/plans.jsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins-discourse-subscriptions-plans-index.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins/discourse-subscriptions/plans/index.jssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins-discourse-subscriptions-plans-index.jsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/routes/admin-plugins/discourse-subscriptions/plans/index.jsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions.gjssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions.gjsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-coupons.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/coupons.gjssimilarity index 97%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-coupons.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/coupons.gjsindex 76afa8e6c76..9ccf8ce8070 100644--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-coupons.gjs+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/coupons.gjs@@ -3,7 +3,7 @@ import { fn } from "@ember/helper";import { on } from "@ember/modifier";import DButton from "discourse/components/d-button";import { i18n } from "discourse-i18n";-import CreateCouponForm from "../../components/create-coupon-form";+import CreateCouponForm from "../../../components/create-coupon-form";export default <template>{{#if @controller.model.unconfigured}}diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-dashboard.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/dashboard.gjssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-dashboard.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/dashboard.gjsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-plans-index.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/plans/index.gjssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-plans-index.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/plans/index.gjsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products.gjssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products.gjsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-index.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/index.gjssimilarity index 97%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-index.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/index.gjsindex aa81edad605..b8e385fe96b 100644--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-index.gjs+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/index.gjs@@ -3,7 +3,7 @@ import DButton from "discourse/components/d-button";import icon from "discourse/helpers/d-icon";import routeAction from "discourse/helpers/route-action";import { i18n } from "discourse-i18n";-import formatUnixDate from "../../helpers/format-unix-date";+import formatUnixDate from "../../../../helpers/format-unix-date";export default <template>{{#if @controller.model.unconfigured}}diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-show.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/show.gjssimilarity index 97%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-show.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/show.gjsindex 0da8346653a..cd732bed9f5 100644--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-show.gjs+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/show.gjs@@ -4,8 +4,8 @@ import { LinkTo } from "@ember/routing";import DButton from "discourse/components/d-button";import icon from "discourse/helpers/d-icon";import { i18n } from "discourse-i18n";-import formatCurrency from "../../helpers/format-currency";-import formatUnixDate from "../../helpers/format-unix-date";+import formatCurrency from "../../../../helpers/format-currency";+import formatUnixDate from "../../../../helpers/format-unix-date";export default <template><h4>{{i18n "discourse_subscriptions.admin.products.title"}}</h4>diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-show-plans-show.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/show/plans/show.gjssimilarity index 100%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-products-show-plans-show.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/products/show/plans/show.gjsdiff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-subscriptions.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/subscriptions.gjssimilarity index 98%rename from plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-subscriptions.gjsrename to plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/subscriptions.gjsindex 498cb5c8fc3..50dacb1746d 100644--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin/plugins-discourse-subscriptions-subscriptions.gjs+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/subscriptions.gjs@@ -4,7 +4,7 @@ import DButton from "discourse/components/d-button";import LoadMore from "discourse/components/load-more";import loadingSpinner from "discourse/helpers/loading-spinner";import { i18n } from "discourse-i18n";-import formatUnixDate from "../../helpers/format-unix-date";+import formatUnixDate from "../../../helpers/format-unix-date";export default <template>{{#if @controller.model.unconfigured}}diff --git a/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/04-topic-list.gjs b/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/04-topic-list.gjsindex 48a36d47711..4f8904c5d57 100644--- a/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/04-topic-list.gjs+++ b/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/04-topic-list.gjs@@ -1,11 +1,11 @@import Component from "@glimmer/component";-import TopicList from "discourse/components/topic-list";+import TopicList from "discourse/components/topic-list/list";import StyleguideExample from "discourse/plugins/styleguide/discourse/components/styleguide-example";export default class TopicListOrganism extends Component {get topicListCode() {return `-import TopicList from "discourse/components/topic-list";+import TopicList from "discourse/components/topic-list/list";<template><TopicList @topics={{@dummy.topics}} @showPosters={{true}} />@@ -15,7 +15,7 @@ import TopicList from "discourse/components/topic-list";get topicListHidePostersCode() {return `-import TopicList from "discourse/components/topic-list";+import TopicList from "discourse/components/topic-list/list";<template><TopicList @topics={{@dummy.topics}} @showPosters={{false}} />diff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rbindex 092a02ee4ba..ae506f0b5d1 100644--- a/spec/lib/pretty_text_spec.rb+++ b/spec/lib/pretty_text_spec.rb@@ -2815,7 +2815,7 @@ HTML.logger.expects(:warn).once- .with("[PrettyText] Deprecation notice: Some deprecation message")+ .with("[PrettyText] DEPRECATION NOTICE: Some deprecation message")PrettyText.v8.eval <<~JSrequire("discourse/lib/deprecated").default("Some deprecation message");diff --git a/spec/rails_helper.rb b/spec/rails_helper.rbindex 6f255b2e3f3..f51283831e3 100644--- a/spec/rails_helper.rb+++ b/spec/rails_helper.rb@@ -483,6 +483,33 @@ RSpec.configure do |config|Capybara::Node::Base.prepend(CapybaraTimeoutExtension)config.before(:each, type: :system) do |example|+ # Only set ENV["EMBER_RAISE_ON_DEPRECATION"] if not already set+ if ENV["EMBER_RAISE_ON_DEPRECATION"].nil?+ example_file_path = example.metadata[:rerun_file_path]++ if example_file_path+ expanded_example_file_path = Pathname.new(example_file_path).expand_path+ is_within_rails_root = expanded_example_file_path.to_s.start_with?(Rails.root.to_s)++ if is_within_rails_root+ extension_match = example_file_path.match(%r{/(plugins|themes)/([^/]+)/})+ should_set_raise_on_deprecation =+ if extension_match+ type_dir, extension_name = extension_match.captures+ extension_root = Rails.root.join(type_dir, extension_name)++ # Preinstalled plugins/themes don't have a .git directory+ !extension_root.join(".git").exist?+ else+ # Not a plugin or theme spec+ true+ end++ ENV["EMBER_RAISE_ON_DEPRECATION"] = "1" if should_set_raise_on_deprecation+ end+ end+ end+if example.metadata[:time]freeze_time(example.metadata[:time])page.driver.with_playwright_page do |pw_page|@@ -959,13 +986,25 @@ RSpec.configure do |config|endend+ deprecation_error =+ $playwright_logger+ &.logs+ &.filter_map do |log|+ if log[:level] == "trace"+ error = JSON.parse(log[:message][/^fatal_deprecation:(.+)$/, 1])+ "~~~~~~~ JS ERROR ~~~~~~~\n#{error}\n~~~~~ END JS ERROR ~~~~~"+ end+ end+ &.first++ expect(deprecation_error).to be_nil, deprecation_error+$playwright_logger&.logs&.each do |log|- next if log[:level] != "WARNING"- deprecation_id = log[:message][/\[deprecation id: ([^\]]+)\]/, 1]+ next if log[:level] != "count"+ deprecation_id = log[:message][/^deprecation_id:(.+?):\s*\d+$/, 1]next if deprecation_id.nil?- deprecations = RSpec.current_example.metadata[:js_deprecations] ||= {}- deprecations[deprecation_id] ||= 0+ deprecations = RSpec.current_example.metadata[:js_deprecations] ||= Hash.new(0)deprecations[deprecation_id] += 1enddiff --git a/spec/system/ember_deprecation_spec.rb b/spec/system/ember_deprecation_spec.rbindex 7824f270c92..f6daac20420 100644--- a/spec/system/ember_deprecation_spec.rb+++ b/spec/system/ember_deprecation_spec.rb@@ -16,7 +16,7 @@ describe "JS Deprecation Handling", type: :system dowarn_calls = playwright_page.evaluate <<~JS() => {const { deprecate } = require('@ember/debug');- deprecate("Some message", false, { id: "some.id", for: "discourse", since: "3.4.0", until: "3.5.0" });+ deprecate("Some message", false, { id: "fake.deprecation", for: "discourse", since: "3.4.0", until: "3.5.0" });return window.intercepted_warnings;}JS@@ -25,7 +25,7 @@ describe "JS Deprecation Handling", type: :system doexpect(warn_calls.size).to eq(1)call, backtrace = warn_calls[0]- expect(call).to start_with("DEPRECATION: Some message [deprecation id: some.id]")+ expect(call).to start_with("DEPRECATION: Some message [deprecation id: fake.deprecation]")endit "shows warnings to admins for critical deprecations" do@@ -39,18 +39,18 @@ describe "JS Deprecation Handling", type: :system dopage.execute_script <<~JSconst deprecated = require("discourse/lib/deprecated").default;- deprecated("Fake deprecation message", { id: "fake-deprecation1" })- deprecated("Other fake deprecation message", { id: "fake-deprecation2" })+ deprecated("Fake deprecation message", { id: "fake.deprecation1" })+ deprecated("Other fake deprecation message", { id: "fake.deprecation2" })JSmessage = find("#global-notice-critical-deprecation--fake-deprecation1")expect(message).to have_text("One of your themes or plugins contains code which needs updating")- expect(message).to have_text("fake-deprecation1")+ expect(message).to have_text("fake.deprecation1")expect(message).to have_text(SiteSetting.warn_critical_js_deprecations_message)message = find("#global-notice-critical-deprecation--fake-deprecation2")expect(message).to have_text("One of your themes or plugins contains code which needs updating")- expect(message).to have_text("fake-deprecation2")+ expect(message).to have_text("fake.deprecation2")expect(message).to have_text(SiteSetting.warn_critical_js_deprecations_message)end@@ -65,7 +65,7 @@ describe "JS Deprecation Handling", type: :system dovalue: <<~JS,import deprecated from "discourse/lib/deprecated";function triggerDeprecation(){- deprecated("Fake deprecation message", { id: "fake-deprecation" })+ deprecated("Fake deprecation message", { id: "fake.deprecation" })}export default <template>{{triggerDeprecation}}diff --git a/spec/system/homepage_spec.rb b/spec/system/homepage_spec.rbindex 295cccfcfdc..dcb0c9fd6ca 100644--- a/spec/system/homepage_spec.rb+++ b/spec/system/homepage_spec.rb@@ -136,14 +136,21 @@ describe "Homepage", type: :system doFabricate(:theme_field,theme: theme,- type_id: ThemeField.types[:html],- target_id: Theme.targets[:common],- name: "head_tag",- value: <<~HTML,- <script type="text/x-handlebars" data-template-name="/connectors/custom-homepage/new-home">- <div class="new-home">Hi friends!</div>- </script>- HTML+ type_id: ThemeField.types[:js],+ target_id: Theme.targets[:extra_js],+ name: "discourse/api-initializers/theme-initializer.gjs",+ value: <<~GJS,+ import { apiInitializer } from "discourse/lib/api";++ export default apiInitializer((api) => {+ api.renderInOutlet(+ "custom-homepage",+ <template>+ <div class="new-home">Hi friends!</div>+ </template>+ );+ });+ GJS)end@@ -156,14 +163,21 @@ describe "Homepage", type: :system doFabricate(:theme_field,theme: component,- type_id: ThemeField.types[:html],- target_id: Theme.targets[:common],- name: "head_tag",- value: <<~HTML,- <script type="text/x-handlebars" data-template-name="/connectors/custom-homepage/new-home">- <div class="new-home">Hi friends!</div>- </script>- HTML+ type_id: ThemeField.types[:js],+ target_id: Theme.targets[:extra_js],+ name: "discourse/api-initializers/theme-initializer.gjs",+ value: <<~GJS,+ import { apiInitializer } from "discourse/lib/api";++ export default apiInitializer((api) => {+ api.renderInOutlet(+ "custom-homepage",+ <template>+ <div class="new-home">Hi friends!</div>+ </template>+ );+ });+ GJS)end@@ -179,14 +193,21 @@ describe "Homepage", type: :system doFabricate(:theme_field,theme: component,- type_id: ThemeField.types[:html],- target_id: Theme.targets[:common],- name: "head_tag",- value: <<~HTML,- <script type="text/x-handlebars" data-template-name="/connectors/custom-homepage/new-home">- <div class="new-home">Hi friends!</div>- </script>- HTML+ type_id: ThemeField.types[:js],+ target_id: Theme.targets[:extra_js],+ name: "discourse/api-initializers/theme-initializer.gjs",+ value: <<~GJS,+ import { apiInitializer } from "discourse/lib/api";++ export default apiInitializer((api) => {+ api.renderInOutlet(+ "custom-homepage",+ <template>+ <div class="new-home">Hi friends!</div>+ </template>+ );+ });+ GJS)end