Files
f20c82fb15 Fix Jinja2 false-positive when URL contains {% (#4208)
* Add tests for Jinja2 template detection in URL validation (RED)

* Fix Jinja2 false-positive when URL contains `{%` (GREEN)

* Consolidate Jinja2 template detection across URL/body/headers validation

* Propagate `FORCE_COLOR` to test containers

* Apply suggestion from @dgtlmoon

* Apply suggestion from @dgtlmoon

* Only render request headers/body at fetch time when they contain Jinja2, drop FORCE_COLOR changes

The edit form now skips Jinja2 validation for text like {%22 that is not a template,
but processors/base.py still rendered every header and the body unconditionally, so
a body such as q={%22key%22:1} was accepted on save and then failed every check with
a TemplateSyntaxError. Use JINJA2_MARKER_PATTERN there too, so it is sent as-is.

Also reset the CI workflow and run_*_tests.sh scripts to master, the FORCE_COLOR
changes are unrelated to this fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: dgtlmoon <dgtlmoon@gmail.com>
Co-authored-by: dgtlmoon <leigh@morresi.net>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:32:32 +02:00
..

Change detection post-processors

The concept here is to be able to switch between different domain specific problems to solve.

  • text_json_diff The traditional text and JSON comparison handler
  • restock_diff Only cares about detecting if a product looks like it has some text that suggests that it's out of stock, otherwise assumes that it's in stock.

Some suggestions for the future

  • graphical

API schema extension (api.yaml)

A processor can extend the Watch/Tag API schema by placing an api.yaml alongside its __init__.py. Define a components.schemas.processor_config_<name> entry and it will be merged into WatchBase at startup, making processor_config_<name> a valid field on all watch create/update API calls. The fully merged spec is served live at /api/v1/full-spec.

See restock_diff/api.yaml for a working example.

Todo

  • Make each processor return a extra list of sub-processed (so you could configure a single processor in different ways)
  • move restock_diff to its own pip/github repo