Skip to content

Fix: QA issues#15

Merged
up1512001 merged 9 commits intodevelopfrom
fix/table-issue
Dec 15, 2025
Merged

Fix: QA issues#15
up1512001 merged 9 commits intodevelopfrom
fix/table-issue

Conversation

@up1512001
Copy link
Copy Markdown
Member

What

Related Issue(s):

Part of https://github.com/rtCamp/OnePress/issues/58

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • My code is tested to the best of my abilities.
  • My code passes all lints (ESLint etc.).
  • My code has detailed inline documentation.
  • I have updated the project documentation as needed.

@up1512001 up1512001 self-assigned this Dec 15, 2025
Copilot AI review requested due to automatic review settings December 15, 2025 06:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses multiple QA issues identified in the OneAccess plugin. The changes include fixing the hook used for user deduplication to ensure user metadata is available, updating the uninstall script to use the correct placeholder for table names in prepared statements, and refactoring role/table creation from deferred execution to immediate execution during plugin initialization.

Key changes:

  • Changed user deduplication hook from user_register to profile_update with priority 99 to ensure user metadata is set
  • Updated uninstall.php to use %i identifier placeholder instead of %s string placeholder for table names in DROP TABLE queries
  • Modified error messages in REST API responses to differentiate between success and partial failure scenarios

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
uninstall.php Fixed indentation and corrected the wpdb::prepare() placeholder from %s to %i for table identifiers in DROP TABLE queries
inc/Modules/Rest/Governing_Site_Controller.php Updated error messages for user operations, removed URL normalization in some places, fixed array casting, and removed debug response data from error logs
inc/Modules/Core/User_Roles.php Changed role creation from deferred plugins_loaded hooks to immediate execution during register_hooks()
inc/Modules/Core/Hooks.php Changed user deduplication hook from user_register to profile_update with priority 99 and added documentation explaining the rationale
inc/Modules/Core/DB.php Changed table creation from deferred plugins_loaded hook to immediate execution during register_hooks()

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

Comment thread inc/Modules/Core/DB.php
Comment thread inc/Modules/Rest/Governing_Site_Controller.php Outdated
Comment thread inc/Modules/Rest/Governing_Site_Controller.php Outdated
Comment thread inc/Modules/Rest/Governing_Site_Controller.php Outdated
Comment thread inc/Modules/Rest/Governing_Site_Controller.php Outdated
Comment thread inc/Modules/Rest/Governing_Site_Controller.php Outdated
Comment thread inc/Modules/Core/User_Roles.php
Copilot AI review requested due to automatic review settings December 15, 2025 06:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


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

Comment thread inc/Modules/Rest/Governing_Site_Controller.php Outdated
Comment thread inc/Modules/Rest/Governing_Site_Controller.php Outdated
Comment thread uninstall.php
foreach ( $sites as $site_url ) {
$url = untrailingslashit( $site_url['url'] ?? '' );
if ( ! isset( $oneaccess_sites_info[ $url ] ) ) {
if ( ! isset( $oneaccess_sites_info[ $site_url['url'] ] ) ) {
Copy link
Copy Markdown
Collaborator

@justlevine justlevine Dec 15, 2025

Choose a reason for hiding this comment

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

What was the reason for this change?

Not sure why this isn't being picked out by either linters, but isset( $x[ $y['z'] ] ) doesn't check internals, so at minimum you want to ! isset( $site_url['url'], $oneaccess_sites_info[ $site_url['url'] ] ) (depending on the internals ofc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

image

$site = $oneaccess_sites_info[ $site_key ] ?? [];
$site_url = $site['url'] ?? '';
$site = (array) ( $oneaccess_sites_info[ $site_key ] ?? [] );
$site_url = trailingslashit( $site['url'] ?? '' );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You want to trailing-slash the empty space or should it ! empty( $site['url'] ) ? trailingslashit(...) : ''?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

copilot sometimes overkills #15 (comment)


foreach ( $sites as $site ) {
$site_url = $site['url'] ?? '';
$site_url = untrailingslashit( $site['url'] ?? '' );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

Other than the isset() this LGTM.

( Beyond the scope of this PR/QA, but if this comes up elsewhere, i'd much rather us enforce a single and uniform {un}trailingslashit at a single point of truth (our db setters/getters, a REST args schema for the sites array) + right before a check where it matters. Right now it's hard for someone who isn't the codeowner to tell when a url is indented to be trailingslashed at any specific point in the codebase. )

Copilot AI review requested due to automatic review settings December 15, 2025 15:50
@up1512001
Copy link
Copy Markdown
Member Author

Other than the isset() this LGTM.

( Beyond the scope of this PR/QA, but if this comes up elsewhere, i'd much rather us enforce a single and uniform {un}trailingslashit at a single point of truth (our db setters/getters, a REST args schema for the sites array) + right before a check where it matters. Right now it's hard for someone who isn't the codeowner to tell when a url is indented to be trailingslashed at any specific point in the codebase. )

In general I would like to add trailingslashit at getter of shared sites but will see it I find more place when slash is needed will revisit current implementation.

@up1512001 up1512001 requested a review from justlevine December 15, 2025 15:57
Copy link
Copy Markdown
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@up1512001 up1512001 merged commit b1a11db into develop Dec 15, 2025
9 checks passed
@up1512001 up1512001 deleted the fix/table-issue branch December 15, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants