perftools / xhgui

Web interface for XHProf profiling data can store data in MongoDB or PDO database
1.65k stars 341 forks source link

PDO: Move online schema creation behind feature flag #494

Closed Krinkle closed 6 months ago

Krinkle commented 1 year ago

The XHGui install at Wikimedia Foundation is deployed with database credentials that permit read-write operations (SELECT, INSERT) but as safety precaution do not permit admin actions like CREATE from individual web requests. In addition to not allowing admin actions, our install also disallows DELETE queries, given that the install is exposed to the public Internet (ref https://github.com/perftools/xhgui/issues/248) and further disables POST requests (so that those features serve HTTP 40x instead of a db query error with HTTP 50x).

Since XHGui version 0.16.0, with https://github.com/perftools/xhgui/pull/355, the lazy-creation for tables was moved from the Saver code (which is not used when browsing XHGui) to to Repo code, and thus resulted in the application serving HTTP 500 on all requests, unless the CREATE TABLE query is permitted on all web requests.

Fix this by making this method call feature flagged in a way that can be disabled.

Downstream task: https://phabricator.wikimedia.org/T341499

glensc commented 7 months ago

updated base branch to 0.22.x, but your pipelines have failed

PHP CS Fixer: src/ServiceProvider/PdoStorageProvider.php#L1Found violation(s) of type: blank_line_before_statement
--

[PHP CS Fixer: src/ServiceProvider/PdoStorageProvider.php#L1](https://github.com/perftools/xhgui/pull/494/files#annotation_12426236988)
Found violation(s) of type: blank_line_before_statement
Krinkle commented 6 months ago

@glensc That lint issue appears unrelated to this PR. If I understand correctly, between when I started and now, some dev package has implicitly upgraded due to unpinned versions, and this breaks builds of both 0.21.x and 0.22.x branches alike due to existing code not passing the new lint rules.

The warning in question presumably talks about the line break at the start of the file?

I don't mind creating a PR with lint fixes more generally. Most PHP projects I work on, install PHPCS and PHPUnit via Composer, including any config and presets present in the repo. I don't see an obvious way in this repo to run the linter/fixer locally and thus to verify whether it's completed. If you point me to how I do that, I'm happy to submit such a PR.

glensc commented 6 months ago

The release automation has failed:

In AssertException.php line 32:

  [Psl\Type\Exception\AssertException]  
  Expected "200", got "int".            

the release automation is probably too complicated for this project. no need for multiple release branches

glensc commented 6 months ago

seems the exact same error I already reported:

glensc commented 6 months ago

I don't understand your linter rant. the config is in repo and dependencies are managed by composer

glensc commented 6 months ago

Created ORGANIZATION_ADMIN_TOKEN token again:

With "repo" privileges as my PAT:

image

retried the action, job passed now: