fed-sx-types Phase 1: DefineType + SubtypeOf genesis verbs
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Two new DefineActivity-form genesis activity-types for host-type federation (plans/fed-sx-host-types.md step 1): - next/genesis/activity-types/define_type.sx — DefineType verb; schema accepts an :object with a string :name and optional list :fields. - next/genesis/activity-types/subtype_of.sx — SubtypeOf verb; schema accepts an :object carrying string :child-type-cid + :parent-type-cid. Schema bodies use nested `get` (not keyword-threading) so they are directly evaluatable — keywords are not callable getters in the kernel. Both registered in manifest.sx (activity-types now 7); the four bootstrap suites' bundle counts bumped (5->7, total 36->38). Tests: next/tests/define_type.sh (7), subtype_of.sh (6) — parse shape, schema accept/reject, term_codec envelope round-trip. Also load follower_graph + delivery in bootstrap_start.sh: its check-26 publish path exercises outbox:compute_delivery_set/3 (follower_graph:new + delivery:delivery_set), which an m2 substrate change had left unloaded in that suite — a pre-existing red unrelated to the count bump. Conformance 771/771; all touched next/tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
34
next/genesis/activity-types/define_type.sx
Normal file
34
next/genesis/activity-types/define_type.sx
Normal file
@@ -0,0 +1,34 @@
|
||||
;; next/genesis/activity-types/define_type.sx
|
||||
;;
|
||||
;; Bootstrap definition of the DefineType verb per
|
||||
;; plans/fed-sx-host-types.md (host-type federation, Phase 1).
|
||||
;; Read as data by the bundler (bootstrap.erl) — never evaluated as
|
||||
;; code. The :schema and :semantics bodies are SX source.
|
||||
;;
|
||||
;; DefineType declares a refinement type. The activity's :object is
|
||||
;; the type record:
|
||||
;; {:name "Post" ;; the type's display name
|
||||
;; :fields (...) ;; optional field descriptors
|
||||
;; :refinement-schema (fn (obj) ...) ;; predicate over instances
|
||||
;; :instance-type "Note"} ;; base object-type it refines
|
||||
;;
|
||||
;; The schema below validates the *activity* shape: :object present,
|
||||
;; :name a string, :fields (when present) a list. The richer
|
||||
;; per-field shape check and the registry registration land with the
|
||||
;; peer_types cache (Phase 2) — at this phase the form is pure data.
|
||||
;;
|
||||
;; Schema bodies use nested `get` rather than keyword-threading so
|
||||
;; the predicate is directly evaluatable (keywords are not callable
|
||||
;; getters in the kernel; `(-> d :k)` is not a get).
|
||||
(DefineActivity
|
||||
:name "DefineType"
|
||||
:doc "Declare a refinement type. :object carries :name, optional :fields, :refinement-schema, and :instance-type."
|
||||
:schema (fn
|
||||
(act)
|
||||
(and
|
||||
(not (nil? (get act :object)))
|
||||
(string? (get (get act :object) :name))
|
||||
(or
|
||||
(nil? (get (get act :object) :fields))
|
||||
(list? (get (get act :object) :fields)))))
|
||||
:semantics (fn (state act) state))
|
||||
31
next/genesis/activity-types/subtype_of.sx
Normal file
31
next/genesis/activity-types/subtype_of.sx
Normal file
@@ -0,0 +1,31 @@
|
||||
;; next/genesis/activity-types/subtype_of.sx
|
||||
;;
|
||||
;; Bootstrap definition of the SubtypeOf verb per
|
||||
;; plans/fed-sx-host-types.md (host-type federation, Phase 1).
|
||||
;; Read as data by the bundler (bootstrap.erl) — never evaluated as
|
||||
;; code. The :schema and :semantics bodies are SX source.
|
||||
;;
|
||||
;; SubtypeOf records a hierarchy edge between two previously-defined
|
||||
;; types. The activity's :object is the relation record:
|
||||
;; {:child-type-cid "bafy...child"
|
||||
;; :parent-type-cid "bafy...parent"}
|
||||
;;
|
||||
;; The schema validates the *activity* shape: both CIDs present and
|
||||
;; string-typed. Verifying that each CID names a previously-defined
|
||||
;; type is a registry concern (it needs the type index that lands
|
||||
;; with peer_types in Phase 2), so it is deliberately out of the
|
||||
;; pure-predicate schema here — adding the edge to the hierarchy
|
||||
;; index is the :semantics' job once the registry surface exists.
|
||||
;;
|
||||
;; Schema bodies use nested `get` rather than keyword-threading so
|
||||
;; the predicate is directly evaluatable.
|
||||
(DefineActivity
|
||||
:name "SubtypeOf"
|
||||
:doc "Record a subtype edge. :object carries :child-type-cid and :parent-type-cid, both type CIDs."
|
||||
:schema (fn
|
||||
(act)
|
||||
(and
|
||||
(not (nil? (get act :object)))
|
||||
(string? (get (get act :object) :child-type-cid))
|
||||
(string? (get (get act :object) :parent-type-cid))))
|
||||
:semantics (fn (state act) state))
|
||||
Reference in New Issue
Block a user