fed-sx-m1: Step 6a — pipeline:run_stages driver + validate_inbound/outbound + 10 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 37s

This commit is contained in:
2026-05-28 02:32:06 +00:00
parent aa6b01f430
commit 9cb002c856
3 changed files with 155 additions and 0 deletions

37
next/kernel/pipeline.erl Normal file
View File

@@ -0,0 +1,37 @@
-module(pipeline).
-export([run_stages/2,
validate_inbound/1, validate_outbound/1,
inbound_stages/0, outbound_stages/0]).
%% Validation pipeline per design §14.
%%
%% A stage is a 1-arity fun `(Activity) -> ok | {error, Reason}`.
%% The driver folds the activity through the stage list, halting
%% on the first error. The pure-functional driver itself takes a
%% stage list directly so tests can inject ad-hoc stage sequences
%% without depending on the bundled inbound/outbound lists.
%%
%% Inbound pipeline (full set per design §14): envelope, signature,
%% replay, audience, activity_schema, object_schema, content_validators,
%% capabilities, trust. Outbound is a subset (no replay, no trust;
%% auth handled at the HTTP layer).
%%
%% This sub-deliverable (6a) wires only the driver and the empty
%% stage lists. Concrete stages land in 6b-6c.
run_stages(_Activity, []) -> ok;
run_stages(Activity, [Stage | Rest]) ->
Result = Stage(Activity),
case Result of
ok -> run_stages(Activity, Rest);
{error, _} -> Result
end.
validate_inbound(Activity) ->
run_stages(Activity, inbound_stages()).
validate_outbound(Activity) ->
run_stages(Activity, outbound_stages()).
inbound_stages() -> [].
outbound_stages() -> [].