Skip to content

Finish repo configurations (Step 3)#152

Open
milindmore22 wants to merge 1 commit into
migrate/scaffoldfrom
ci/tooling-and-coverage-setup
Open

Finish repo configurations (Step 3)#152
milindmore22 wants to merge 1 commit into
migrate/scaffoldfrom
ci/tooling-and-coverage-setup

Conversation

@milindmore22

@milindmore22 milindmore22 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

What

This PR updates project documentation, improves developer tooling, and introduces a bug fix for origin and port comparison in REST API permission checks.

Why

The previous REST API permission checks did not adequately handle environments using different ports on the same host (e.g., localhost:8888 vs. localhost:8890), which caused issues in local development environments. Additionally, the developer workflow needed clearer instructions and automated pre-commit checks to improve code quality and onboarding.

Related Issue(s):

Covers Step 3 : https://github.com/rtCamp/OnePress/issues/78
Step 1 : #149

How

  • REST API Permission Validation:

  • Updated is_url_from_host in Abstract_REST_Controller.php to accept an optional port parameter, ensuring both host and port are compared.

  • Changed visibility of is_url_from_host from private to protected.

  • Updated check_api_permissions to pass the port when calling is_url_from_host to improve security and correctness.

  • Developer Documentation:

  • Updated AGENTS.md with instructions for local development using wp-env, including parallel environment setup, explicit CLI commands, and documentation for running pre-commit hooks with Lefthook and lint-staged.

  • Developer Tooling:

  • Enabled the pre-commit hook for lint-staged in .lefthook.yml.

  • Updated .lintstagedrc.mjs to wrap filenames in single quotes instead of double quotes for PHP file linting commands to improve compatibility.

Testing Instructions

  1. Set up the local development environment using the updated wp-env instructions in AGENTS.md.
  2. Perform a REST API request between environments running on the same host but different ports (e.g., localhost:8888 and localhost:8890) to verify that permission checks evaluate correctly.
  3. Modify a PHP file and attempt to commit the change to verify that the lint-staged pre-commit hook triggers automatically and lints the file.

Screenshots

N/A

Additional Info

N/A

Checklist

  • I have read the [Contribution Guidelines(https://github.com/rtCamp/OneUpdate/blob/main/docs/CONTRIBUTING.md).
  • I have read the [Development Guidelines(https://github.com/rtCamp/OneUpdate/blob/main/docs/DEVELOPMENT.md).
  • 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.
Open WordPress Playground Preview

…taged config, and document multi-environment setup
@milindmore22
milindmore22 marked this pull request as ready for review July 7, 2026 07:17
@milindmore22
milindmore22 requested a review from justlevine July 7, 2026 10:17
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.

1 participant