actions/event: typed payload constructors per trigger (S41a-L4)
The shithub.event v1 schema was previously documentation-only —
docs/internal/actions-schema.md pinned the field layout but no
code enforced it. Audit S41a-L4 flagged this before S41b's trigger
pipeline writes the first event_payload row, since once data is in
the jsonb column the schema is sticky.
New package internal/actions/event with one constructor per trigger:
- event.Push(ref, before, after, hc HeadCommit)
- event.PullRequest(action, number, title, head, base, userLogin)
- event.Schedule()
- event.WorkflowDispatch(inputs map[string]string)
Each takes typed inputs (so adding a field is visible in the
function signature, reviewer-required by repo norms) and returns
map[string]any (what expr.evalEventPath consumes; also pgx-encodable
to jsonb without further transformation, so S41b passes the result
straight into InsertWorkflowRun).
The closed-door discipline matches the expression evaluator's
namespace + function allowlists: adding a field requires editing
the constructor, the doc, AND the corresponding *_FlowsThroughEvaluator
test in the same PR.
docs/internal/actions-schema.md pinned the field layout but no
code enforced it. Audit S41a-L4 flagged this before S41b's trigger
pipeline writes the first event_payload row, since once data is in
the jsonb column the schema is sticky.
New package internal/actions/event with one constructor per trigger:
- event.Push(ref, before, after, hc HeadCommit)
- event.PullRequest(action, number, title, head, base, userLogin)
- event.Schedule()
- event.WorkflowDispatch(inputs map[string]string)
Each takes typed inputs (so adding a field is visible in the
function signature, reviewer-required by repo norms) and returns
map[string]any (what expr.evalEventPath consumes; also pgx-encodable
to jsonb without further transformation, so S41b passes the result
straight into InsertWorkflowRun).
The closed-door discipline matches the expression evaluator's
namespace + function allowlists: adding a field requires editing
the constructor, the doc, AND the corresponding *_FlowsThroughEvaluator
test in the same PR.
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
25928549d91893a8f32483cc390d0336da694844- Parents
-
9c71d87 - Tree
b752b89