Skip to content

[+] reject parameter values that do not match the task kind - #870

Open
pashagolub wants to merge 5 commits into
masterfrom
parameter-shape-check
Open

pashagolub wants to merge 5 commits into
masterfrom
parameter-shape-check

Conversation

@pashagolub

Copy link
Copy Markdown
Collaborator

SQL parameters must be JSON arrays and PROGRAM parameters arrays of strings. Until now a scalar such as parameters: ["x"] was stored without complaint and only failed when the task ran.

Stacked on #867. The first two commits belong to #867 (sample fixes). Review only the last commit; this PR will be rebased onto master once #867 merges.

Changes

  • New migration adds the check_parameter trigger on timetable.parameter (insert/update) and on UPDATE OF kind, command of timetable.task. Violations raise 23514, naming the task and the expected shape.

    kind / command rule
    SQL array
    PROGRAM array of strings
    Sleep integer
    SendMail, Download, Copy* object
    Log, Shutdown, NoOp, unknown not checked
    SQL NULL, JSON null always allowed
  • YamlTask.ValidateTask rejects the same SQL/PROGRAM shapes at import, before touching the database.

  • Existing rows are not rewritten. Installs that already hold scalar SQL/PROGRAM parameters keep them (they fail at run time, as before); this belongs in the release notes.

Tests

  • ddl_test.sql: every example from reference-commands-tasks-chains.md is accepted, one wrong-type value per command is rejected, and so is a kind/command change that invalidates stored values.
  • TestYamlSamplesLoad loads every samples/yaml file into a real database.
  • TestMigrations checks the trigger after migrating.

Follow-ups

dajiaohuang and others added 5 commits October 16, 2026 04:17
Move yaml-format.md chain examples into samples/yaml and pull them in
with pymdownx.snippets, so the sample test covers them without regex
extraction from Markdown.
SQL parameters must be JSON arrays and PROGRAM parameters arrays of
strings; scalars were accepted on insert and failed only at run time.
BUILTIN values are checked against the documented top-level type for
Sleep, SendMail, Download and the Copy* commands.

Migration 00868 adds the check_parameter trigger on timetable.parameter
and on kind/command updates of timetable.task, raising 23514. Existing
rows are not rewritten. YAML import rejects the same SQL/PROGRAM shapes
before touching the database, and every samples/yaml file is now loaded
into a real database in TestYamlSamplesLoad.
@coveralls

coveralls commented Oct 16, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38942600065

Coverage increased (+0.2%) to 88.101%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (29 of 30 lines covered, 96.67%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
internal/pgengine/sql/ddl.sql 9 8 88.89%
Total (3 files) 30 29 96.67%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
internal/pgengine/log_hook.go 1 82.22%

Coverage Stats

Coverage Status
Relevant Lines: 2580
Covered Lines: 2273
Line Coverage: 88.1%
Coverage Strength: 0.99 hits per line

💛 - Coveralls

@pashagolub pashagolub self-assigned this Oct 16, 2026
@pashagolub pashagolub added the enhancement New feature or request label Oct 16, 2026
@pashagolub
pashagolub requested review from 0xgouda and df7cb October 16, 2026 18:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants