From ff4da651857ddecbb2ab7573e5a6f48347708724 Mon Sep 17 00:00:00 2001 From: Paulo Paracatu Date: Thu, 30 Apr 2026 15:13:37 -0300 Subject: [PATCH 1/3] Auto-set permalink structure during setup if plain/default detected --- rtc-test.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/rtc-test.sh b/rtc-test.sh index 65d291c..d0b1703 100755 --- a/rtc-test.sh +++ b/rtc-test.sh @@ -819,6 +819,18 @@ setup_wpcli() { printf ' cp "%s/rtc-test.php" "%s/"\n' "${SCRIPT_DIR}" "${mu_plugins_dir}" fi + # Ensure pretty permalinks are enabled — the REST API requires them. + local perm_struct + perm_struct="$(wp "${WP_FLAGS[@]}" option get permalink_structure 2>/dev/null)" || perm_struct="" + if [ -z "${perm_struct}" ]; then + printf 'Permalinks: default (query-string) -- setting to /%postname%/\n' + wp "${WP_FLAGS[@]}" rewrite structure '/%postname%/' --hard >/dev/null 2>&1 \ + || die "Could not set permalink structure. Set it manually: Settings > Permalinks." + printf 'Permalinks: set to /%postname%/\n' + else + printf 'Permalinks: %s\n' "${perm_struct}" + fi + # Always use the dedicated rtctest user so setup controls the password. # We generate the password here and either create or reset the account. local rtctest_wp_pass @@ -880,7 +892,7 @@ setup_wpcli() { fi # Check if SAVEQUERIES is already defined and enabled in wp-config.php. - savequeries_value=$(wp "${WP_FLAGS[@]}" config get SAVEQUERIES 2>/dev/null) + savequeries_value=$(wp "${WP_FLAGS[@]}" config get SAVEQUERIES 2>/dev/null || true) if [ "$savequeries_value" = "true" ] || [ "$savequeries_value" = "1" ]; then printf 'SAVEQUERIES: already enabled in wp-config.php\n' # Enable SAVEQUERIES so the plugin can record per-request DB time. @@ -943,10 +955,12 @@ setup_manual() { printf 'WP-CLI not available. Manual setup steps:\n\n' printf '1. Copy rtc-test.php to the site'"'"'s mu-plugins directory:\n' printf ' cp rtc-test.php /path/to/wp-content/mu-plugins/\n\n' - printf '2. Enable RTC: WP Admin > Settings > Writing > "Enable early access to\n' + printf '2. Enable pretty permalinks: WP Admin > Settings > Permalinks\n' + printf ' (any structure other than "Plain" works; e.g. Post name)\n\n' + printf '3. Enable RTC: WP Admin > Settings > Writing > "Enable early access to\n' printf ' real-time collaboration"\n\n' - printf '3. Note a post ID for an existing editor-role user you want to test with.\n\n' - printf '4. Copy .env.example to .env and fill in the required values:\n\n' + printf '4. Note a post ID for an existing editor-role user you want to test with.\n\n' + printf '5. Copy .env.example to .env and fill in the required values:\n\n' printf ' cp .env.example .env\n\n' printf ' Required values:\n' printf ' WP_URL="%s"\n' "${WP_URL}" @@ -954,7 +968,7 @@ setup_manual() { printf ' WP_PASS=""\n' printf ' WP_PATH=""\n' printf ' POST_ID=\n\n' - printf '5. Then run:\n' + printf '6. Then run:\n' printf ' bash rtc-test.sh refresh-auth # logs in and writes cookie jar + nonce\n\n' printf 'After that, all test commands are available.\n' } From 02ccd272e992facb1b224ffc89f3cf9a82f1cc51 Mon Sep 17 00:00:00 2001 From: Paulo Paracatu Date: Fri, 1 May 2026 12:16:58 -0300 Subject: [PATCH 2/3] Fix printf --- rtc-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtc-test.sh b/rtc-test.sh index d0b1703..ee56409 100755 --- a/rtc-test.sh +++ b/rtc-test.sh @@ -823,10 +823,10 @@ setup_wpcli() { local perm_struct perm_struct="$(wp "${WP_FLAGS[@]}" option get permalink_structure 2>/dev/null)" || perm_struct="" if [ -z "${perm_struct}" ]; then - printf 'Permalinks: default (query-string) -- setting to /%postname%/\n' + printf 'Permalinks: default (query-string) -- setting to /%%postname%%/\n' wp "${WP_FLAGS[@]}" rewrite structure '/%postname%/' --hard >/dev/null 2>&1 \ || die "Could not set permalink structure. Set it manually: Settings > Permalinks." - printf 'Permalinks: set to /%postname%/\n' + printf 'Permalinks: set to /%%postname%%/\n' else printf 'Permalinks: %s\n' "${perm_struct}" fi From e7785378fa5ca2f645bb3fea1d24588ab854bf26 Mon Sep 17 00:00:00 2001 From: Paulo Paracatu Date: Tue, 5 May 2026 12:00:26 -0300 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- rtc-test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtc-test.sh b/rtc-test.sh index ee56409..2ae6549 100755 --- a/rtc-test.sh +++ b/rtc-test.sh @@ -819,7 +819,8 @@ setup_wpcli() { printf ' cp "%s/rtc-test.php" "%s/"\n' "${SCRIPT_DIR}" "${mu_plugins_dir}" fi - # Ensure pretty permalinks are enabled — the REST API requires them. + # Ensure pretty permalinks are enabled because these tests use /wp-json/ endpoints + # and therefore require /wp-json/ routing to be available. local perm_struct perm_struct="$(wp "${WP_FLAGS[@]}" option get permalink_structure 2>/dev/null)" || perm_struct="" if [ -z "${perm_struct}" ]; then