Repository navigation
Fix mail trigger dates shifted by the server time zone, and node docs and DSL fields that do not exist - #1088
Merged
Merged
Conversation
RFC 5322 gives "-0000" for a time in UTC whose sender's zone is unknown, and Python's email.utils.formatdate() writes it by default. parsedate_to_datetime returns such a date naive, and converting it to UTC read it as the server's local time: the image and docker-compose set TZ=Europe/Berlin, so 10:00 -0000 became 09:00Z in winter and 08:00Z in summer. The IMAP, Gmail and Outlook triggers all build their payload with email_payload; a naive date is now taken as UTC.
The node page and the AI builder's DSL said dataTableLimit defaulted to 100. The editor says "Leave empty for no limit" and the node limits only when the value is above 0, so a workflow built without the field expecting 100 rows got the whole table (150 of 150 on a live instance). The docs and the DSL now describe what the node does.
The node page and the AI builder's DSL described $errorHandler.error as
the message and listed .errorNode, .errorNodeType and .timestamp, which
are the body of the separate error workflow. The node outputs
{"error": {"node_id", "node_label", "node_type", "message"}}, as its
editor hint says, so a notification written from the DSL rendered as
'Error in $catchErrors.errorNode: {"node_id": ...}'. The docs, the Slack
page's example and the DSL examples now use .error.message and
.error.node_label.
…works The node page listed $nodeLabel.body, which the node never returns: it returns html, url, status and, in extract mode, extracted. Its selector example had no name and no crawlerMode "extract", and the node skips a selector without a name and extracts only in extract mode, so the example extracted nothing. The page now matches the handler and the DSL prompt. A test runs the page's example through the node with a fake FlareSolverr.
…turn The Slack, Discord and Telegram trigger pages listed triggered_by and trigger_node_id: they are run inputs, and the trigger nodes copy only their own fields into the output, so both were always null. The Condition and Switch pages said the input passes through to the branch; they output only the branch (and Switch its value), so $cond.text and $input.text after them are null. The Telegram page said status is "sent"; it is the HTTP status code. The test now checks every field these pages' Overview rows name against the node's output.
Collaborator
|
Thanks for this batch, the date fix and the handler checks are spot on 🙏 A few changes before we can merge:
|
A Data Table node added from the canvas starts with dataTableLimit 100, so the page now says both: new canvas nodes start at 100, and an empty or 0 limit returns every row. The DSL check moves to its own test class, so it runs without a database.
The canvas pre-fills message with $error.message, so the node page keeps that default on the message row. The features reference listed a timestamp in the node's output; it now names the error fields the node returns.
The features reference said both nodes pass the input to the chosen branch; they output only their branch (and Switch its value), as their node pages now say.
Contributor
Author
|
Thanks! All four are in, as three follow-up commits:
Each has a test. Full suite: 9820 passed. |
Collaborator
|
Thanks, all four are in 🙏 Two small things in the new
|
Switch's value is what the expression evaluated to, so on default it matched no case; the entry no longer says "the value it matched". The Error Handler entry also names message, which a canvas node always has since it pre-fills message with $error.message.
Contributor
Author
|
Both fixed in |
Collaborator
|
Thank you 💯 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five fixes, one commit each. The first changes code: the mail triggers'
date. The other four correct node pages and the AI builder's DSL prompt where they name fields or defaults the nodes do not have, with tests that check the pages and the prompt against the handlers.I ran step 1 against
main(e23686b) and against this branch, on two local instances. Steps 2 to 4 only change docs and the DSL prompt, so they print the same on both; they show that the documented form does not work and the corrected one does.The steps share this setup:
1. A mail's
dateis shifted by the server's time zone when the Date header says-0000RFC 5322 (3.3) writes
-0000for a time in UTC whose sender's zone is unknown, and Python's ownemail.utils.formatdate()writes it by default.parsedate_to_datetimereturns such a date without a zone, andemail_payloadthen called.astimezone(timezone.utc), which reads a zone-less datetime as the server's local time.backend/DockerfilesetsTZ=Europe/Berlinand docker-compose defaults to it, so10:00:00 -0000came out as09:00Zin winter and08:00Zin summer. The IMAP, Gmail and Outlook triggers all build their payload withemail_payload. A zone-less date is now taken as UTC.With an IMAP server on
127.0.0.1(I used GreenMail:docker run -p 3025:3025 -p 3143:3143 -e GREENMAIL_OPTS='-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled' greenmail/standalone:2.1.0) and a backend whoseTZis not UTC:My backends ran in
Europe/Tallinn(UTC+2 in November):main:{'received': {'date': '2025-11-03T08:00:00+00:00'}}{'received': {'date': '2025-11-03T10:00:00+00:00'}}With the image's
Europe/Berlin,maingives09:00for this date. Test:tests/test_email_payload_date.py, which pinsTZ=Europe/Berlin.2. The Error Handler fields in the docs and the DSL prompt do not exist
The node page and the DSL prompt described
$errorHandler.erroras the message and listed.errorNode,.errorNodeTypeand.timestamp. Those are the input body of the separate error workflow (error_workflow_runner.build_error_context). The node outputs{"error": {"node_id", "node_label", "node_type", "message"}}, which is also what its editor hint says ($error.message,$error.node_id,$error.node_label). A notification written from the DSL, as the AI builder writes it, renders the whole object. The page, the Slack page's example and the DSL's examples now use.error.messageand.error.node_label. The node is unchanged.Both versions print:
Test:
tests/test_error_handler_dsl_fields.py. It checks that every$errorHandler.error.<field>the prompt names is in the node's output, that no old name or bare$errorHandler.erroris left, and that the prompt's notification example renders the failure.3. The Data Table limit has no default of 100
The node page and the DSL prompt said
dataTableLimitdefaults to 100. The editor says "Leave empty for no limit", and the node limits only when the value is above 0, so a workflow built without the field got the whole table. The page and the prompt now say that.Both versions print
150. Test:tests/test_data_table_limit_default_postgres.py.4. Node pages that name outputs their nodes never return
I found these by comparing each node page and DSL section with the handler's return value; the DSL prompt was already right for all of them.
$nodeLabel.body; the node returnshtml,url,statusand, inextractmode,extracted. Its selector example had nonameand nocrawlerMode: "extract", and the node skips a selector without a name and extracts only in extract mode, so the example extracted nothing. The page now matches the handler, and the example extracts.$nodeLabel.triggered_byand$nodeLabel.trigger_node_id. They are run inputs (andreference/triggers.md, which describes run inputs, keeps them), but the trigger nodes copy only their own fields into their output, so both were always null.branch(and Switch itsvalue), so$isLong.body.textor$input.body.textafter a Condition is null; the earlier node's label still works.$nodeLabel.statusis"sent"; it is the HTTP status code of Telegram's response.The Condition case on either version:
prints
{"probe":{"viaCondition":null,"viaLabel":"hello"}}.The Crawler needs FlareSolverr and the triggers need a Slack, Discord or Telegram webhook, which I do not have here.
tests/test_node_doc_outputs.pyruns the Crawler page's own JSON example through the node with a fake FlareSolverr, and checks every field named in these pages' Overview rows against what the handlers return. Onmain's pages both Crawler tests fail, and so do 5 subtests for the triggers, Condition and Switch.Review changes
datatable-node.mdsays both: a node added from the canvas starts at100, and empty or0returns every matching row.error-handler-node.mdkeeps$error.messageas themessagedefault the canvas pre-fills.reference/features.md: the Error Handler entry names theerrorfields instead of a timestamp, and the Condition and Switch entries say they output only their branch (Switch also its value).test_the_dsl_does_not_promise_a_default_limitmoved to its own class,DataTableLimitDocsTests, so it runs without a database.Tests check each:
test_the_page_names_the_canvas_start_and_no_limit,ErrorHandlerPageTests, andFeaturesPageTestsintests/test_node_doc_outputs.py.Checks
./run_tests.shagainst PostgreSQL: 9821 tests, 9821 passed.ruff check,ruff format --check,git diff --checkandscripts/check-file-line-limits.shpass.