Repository navigation
feat(provision): let the SCADA add recipe markers - #31
Merged
Merged
Conversation
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>
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.
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)andlocked boolean NOT NULL DEFAULT false; the viewer'sINSERT (t, label)stays valid.GRANT INSERT ON semiplot_markers TO scada_writer(writerMarkerGrant), justified inprovisioning.md#trust: the role already reaches the table throughsemiplot.scada_writerruns 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_privilegemust be false forSELECTandUPDATE,has_table_privilegefalse forDELETEandTRUNCATE.provisioning.md#recipe-markers: thekindtable,locked, and the statement a Simple-Scada 2 script sends throughRunSQL:INSERT INTO semiplot_markers (t, label, kind, locked) VALUES (clock_timestamp(), NULLIF(left('<file>', 80), ''), <kind>, true).kind = 4fails with 23514.Verified locally:
go test ./...,go vet ./...,golangci-lint run. The database checks run in thelinuxandinstallerCI jobs.Closes #21
🤖 Generated with Claude Code