Page MenuHomePhabricator

[SW] Update format constraint regex checks to stop errors from shellbox-constraints in the logs
Open, Needs TriagePublic

Description

As SRE
I don’t want to see errors from shellbox-constraints in the logs
and I don’t want retried requests to increase load.
So that we do not spend unnecessary resources

A/C

  • No "preg_match" errors are included in the logs

Notes

Planned changes:

  • When using shellbox, don’t directly call preg_match(), but instead send along a small snippet of PHP code that wraps the call and detects errors and returns them over the RPC interface (T362084#9700099, last part)
  • Instead of replacing / with \/ in the pattern, try using a different delimiter that makes additional escaping inside the pattern unnecessary (T362084#10113028)
  • Add a configuration setting for known-good patterns (default empty) and check these patterns directly using preg_match() without shellbox, and configure common patterns for that setting in production (T214378#9892636)

Investigation Task: T362084
Related Task: T214378

Event Timeline

Steps to get started with this task:

  • set up WikibaseQualityConstraints per its README, including ImportConstraintStatements
  • create or select a string-typed property
  • add a statement “property constraint: format constraint” with qualifier “format as a regular expression” set to, e.g., a\/b
  • add a statement with the property itself and a value like a/b or xy
  • see if a constraint check for the property itself (e.g. API sandbox, wbcheckconstraints) works as expected

Probably needs some more polishing though.