Skip to content

feat(provision): let the SCADA add recipe markers - #31

Merged
mrcsin merged 1 commit into
masterfrom
feat/markers-kind-lock
Oct 28, 2026
Merged

mrcsin merged 1 commit into
masterfrom
feat/markers-kind-lock

Conversation

@mrcsin

@mrcsin mrcsin commented Oct 28, 2026

Copy link
Copy Markdown
Member

The SCADA marks each recipe's start and end on the chart so an operator exports one recipe by picking its markers.

  • sql/semiplot_markers.sql: kind smallint NOT NULL DEFAULT 0 CHECK (kind BETWEEN 0 AND 3) and locked boolean NOT NULL DEFAULT false; the viewer's INSERT (t, label) stays valid.
  • GRANT INSERT ON semiplot_markers TO scada_writer (writerMarkerGrant), justified in provisioning.md#trust: the role already reaches the table through semiplot.
  • Tail check 8: scada_writer runs the documented SCADA statement in a rolled-back transaction; a 42501 prints the grant, any other error is reported as it is. has_any_column_privilege must be false for SELECT and UPDATE, has_table_privilege false for DELETE and TRUNCATE.
  • provisioning.md#recipe-markers: the kind table, locked, and the statement a Simple-Scada 2 script sends through RunSQL:
    INSERT INTO semiplot_markers (t, label, kind, locked) VALUES (clock_timestamp(), NULLIF(left('<file>', 80), ''), <kind>, true).
  • CI: kind = 4 fails with 23514.

Verified locally: go test ./..., go vet ./..., golangci-lint run. The database checks run in the linux and installer CI jobs.

Closes #21

🤖 Generated with Claude Code

The SCADA is to mark each recipe's start and end on the chart, so an
operator exports one recipe by picking its markers instead of typing
times. semiplot_markers could not tell a SCADA marker from an
operator's, could not guard one against an accidental drag, and only
semiplot could insert into it.

kind (0 user, 1 recipe start, 2 recipe end, 3 recipe interrupted) and
locked go into the table with defaults, so the viewer's INSERT (t,
label) stays valid. scada_writer gets INSERT on the table and nothing
else: it already reaches the table through semiplot by owning trends,
so the grant adds no capability, and INSERT alone keeps a faulty SCADA
script from moving or deleting a marker. The tail check runs the
documented SCADA statement as scada_writer in a rolled-back
transaction, then asks has_any_column_privilege for SELECT and UPDATE,
so a column grant such as UPDATE (t) cannot slip through, and
has_table_privilege for DELETE and TRUNCATE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrcsin
mrcsin merged commit 5d882d7 into master Oct 28, 2026
3 checks passed
@mrcsin
mrcsin deleted the feat/markers-kind-lock branch October 28, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markers: add a kind and a lock, let the SCADA insert recipe markers

1 participant