Skip to main content

relate_executor/
procedure_registry.rs

1//! Canonical built-in procedure signature registry: the single table of
2//! argument/return-column names and types for every procedure the engine
3//! executes or lists.
4//!
5//! Five consumers share this table so they cannot drift apart (e.g. the
6//! vector `query` argument typed `ANY` in one place and `LIST<FLOAT>` in
7//! another):
8//!
9//! - `exec::procedure_rows::builtin_procedure_rows` — the executor's `CALL`
10//!   dispatch (arg names/types, yield columns, arity, and the rows);
11//! - `relate::Database`'s compile-time `validate_calls` (same shapes);
12//! - `relate`'s namespace write classification (`writes`, ADR-0116 §4);
13//! - `show_catalog::procedure_catalog_rows` — the `SHOW PROCEDURES` catalog
14//!   (CIP-84/CIP-113/CIP-157 display, which additionally reads the
15//!   description/mode/deprecation fields);
16//! - `procedure_gate::procedure_preview_feature` — the preview-feature
17//!   mapping of the `db.ontology.*` family (ADR-0378).
18
19use crate::catalog_meta::{DeprecatedBy, ProcArgMeta};
20
21/// Which row producer a row-declaring executable signature carries: the
22/// registry owns the fact, so a signature that declares return columns but
23/// names no producer cannot be written without the table saying so, and the
24/// producer table cannot drift into a second name-keyed list.
25///
26/// Crate-internal: no reader outside this crate names a producer, matching
27/// `args`/`returns`.
28#[derive(Clone, Copy, Debug)]
29pub(crate) enum RowProducer {
30    TxGetMetaData,
31    DbmsComponents,
32    DbPing,
33    DbLabels,
34    DbRelationshipTypes,
35    DbPropertyKeys,
36    DbInfo,
37    DbmsInfo,
38    DbmsShowCurrentUser,
39    DbmsConfig,
40    FulltextAnalyzers,
41    DbmsLicenseAgreementDetails,
42    DbmsListCapabilities,
43    DbStatsRetrieve,
44    SchemaNodeTypeProperties,
45    SchemaRelTypeProperties,
46    SchemaVisualization,
47}
48
49/// Static signature and catalog metadata of a built-in procedure.
50pub struct ProcSignature {
51    pub name: &'static str,
52    pub description: &'static str,
53    pub mode: &'static str,
54    pub works_on_system: bool,
55    pub admin: bool,
56    /// Formal parameters. Required parameters come first; a parameter with
57    /// a `default` may be omitted by the caller (CIP-113's
58    /// `name = default :: type` rendering). Crate-internal (the parameter
59    /// type is); a cross-crate caller reads [`Self::parameters`].
60    pub(crate) args: &'static [ProcArgMeta],
61    /// Return columns (`YIELD` names/types). Crate-internal; a cross-crate
62    /// caller reads [`Self::return_columns`].
63    pub(crate) returns: &'static [ProcArgMeta],
64    /// The replacement when the procedure is deprecated (CIP-157's
65    /// `deprecatedBy`); `None` means not deprecated. One fact, so a bool and
66    /// its replacement cannot disagree.
67    pub deprecated_by: Option<DeprecatedBy>,
68    /// True when `CALL` can actually execute it (as opposed to a
69    /// catalog-only entry pinned by CIP-84/CIP-113/CIP-157 scenarios that no
70    /// scenario calls).
71    pub executable: bool,
72    /// True when `SHOW PROCEDURES` lists it.
73    pub listed: bool,
74    /// The row producer a row-declaring executable signature carries; `None`
75    /// for a void signature, a catalog-only entry and a diverted procedure
76    /// (whose `CALL` path is a dedicated executor — see `divert_call`). One
77    /// fact with the return columns, so a row-declaring signature cannot
78    /// answer without a producer.
79    pub(crate) rows: Option<RowProducer>,
80    /// True when a `CALL` mutates the graph or catalog (ADR-0116 §4) — the
81    /// write classification `relate`'s namespace rules read, so there is
82    /// one table (`mode` does not encode this: DBMS-mode entries such as
83    /// `dbms.components` and `tx.setMetaData` are not graph/catalog writes).
84    pub writes: bool,
85    /// True when the procedure's commit is a store-level commit of its own
86    /// (ADR-0120 §3) — the `db.ontology.set` / `db.ontology.drop` store ops,
87    /// which push a store-level redo and require the implicit-only /
88    /// no-mixed-writes gates; the in-overlay `db.ontology.apply` write is
89    /// not one. The store-op classification reads this table the same way
90    /// the write classification reads `writes`.
91    pub store_level: bool,
92}
93
94impl ProcSignature {
95    /// The common entry: a listed, executable read procedure with no
96    /// description, catalog flags or deprecation. The builders below name
97    /// only what a row changes from it, so the table states each entry's
98    /// deviations instead of restating ten fields per row.
99    pub(crate) const fn read(name: &'static str) -> Self {
100        Self {
101            name,
102            description: "",
103            mode: "READ",
104            works_on_system: false,
105            admin: false,
106            args: &[],
107            returns: &[],
108            deprecated_by: None,
109            executable: true,
110            listed: true,
111            writes: false,
112            store_level: false,
113            rows: None,
114        }
115    }
116
117    /// A listed procedure whose mode is `"DBMS"`. The system-database
118    /// capability is a separate fact — the corpus lists `tx.setMetaData` as
119    /// DBMS-mode but not system-database-capable (ADR-0497 §6) — so each
120    /// entry states [`Self::works_on_system`] itself.
121    pub(crate) const fn dbms(name: &'static str) -> Self {
122        let mut sig = Self::read(name);
123        sig.mode = "DBMS";
124        sig
125    }
126
127    /// A listed procedure whose mode is `"WRITE"`. The `writes` flag is a
128    /// separate fact: a catalog-only entry carries the mode without being
129    /// callable, so it can mutate nothing.
130    pub(crate) const fn write(name: &'static str) -> Self {
131        let mut sig = Self::read(name);
132        sig.mode = "WRITE";
133        sig
134    }
135
136    /// The row producer this signature's rows come from.
137    pub(crate) const fn rows(mut self, rows: RowProducer) -> Self {
138        self.rows = Some(rows);
139        self
140    }
141
142    /// The procedure works on the system database.
143    pub(crate) const fn works_on_system(mut self) -> Self {
144        self.works_on_system = true;
145        self
146    }
147
148    /// A description for the catalog row.
149    pub(crate) const fn described(mut self, description: &'static str) -> Self {
150        self.description = description;
151        self
152    }
153
154    /// The procedure requires admin privileges.
155    pub(crate) const fn admin(mut self) -> Self {
156        self.admin = true;
157        self
158    }
159
160    /// A `CALL` mutates the graph or catalog (ADR-0116 §4).
161    pub(crate) const fn writes(mut self) -> Self {
162        self.writes = true;
163        self
164    }
165
166    /// The procedure's commit is a store-level commit of its own (ADR-0120 §3).
167    pub(crate) const fn store_level(mut self) -> Self {
168        self.store_level = true;
169        self
170    }
171
172    /// The procedure's formal parameters.
173    pub(crate) const fn args(mut self, args: &'static [ProcArgMeta]) -> Self {
174        self.args = args;
175        self
176    }
177
178    /// The procedure's return columns.
179    pub(crate) const fn returns(mut self, returns: &'static [ProcArgMeta]) -> Self {
180        self.returns = returns;
181        self
182    }
183
184    /// The replacement when the procedure is deprecated (CIP-157).
185    pub(crate) const fn deprecated_by(mut self, by: DeprecatedBy) -> Self {
186        self.deprecated_by = Some(by);
187        self
188    }
189
190    /// Whether `CALL` can actually execute it.
191    pub(crate) const fn executable(mut self, executable: bool) -> Self {
192        self.executable = executable;
193        self
194    }
195
196    /// Whether `SHOW PROCEDURES` lists it.
197    pub(crate) const fn listed(mut self, listed: bool) -> Self {
198        self.listed = listed;
199        self
200    }
201}
202
203impl ProcSignature {
204    /// Number of leading parameters without a default — the minimum arity a
205    /// `CALL` may pass. (`args` lists required parameters first.)
206    pub fn required_args(&self) -> usize {
207        self.args.iter().take_while(|a| a.default.is_none()).count()
208    }
209
210    /// The formal parameters as `(name, declared type)` pairs, required
211    /// parameters first — a caller outside this crate's view of `args`
212    /// (`ProcArgMeta` is crate-internal). The compile-time `CALL`
213    /// validation reads this.
214    pub fn parameters(&self) -> impl Iterator<Item = (&'static str, &'static str)> + '_ {
215        self.args.iter().map(|arg| (arg.name, arg.type_str))
216    }
217
218    /// The `YIELD` column names, in signature order — a caller outside this
219    /// crate's view of `returns`.
220    pub fn return_columns(&self) -> impl Iterator<Item = &'static str> + '_ {
221        self.returns.iter().map(|ret| ret.name)
222    }
223
224    /// Whether the procedure produces no rows — a unit procedure such as
225    /// `tx.setMetaData`, `db.createLabel` or `db.awaitIndexes` declares no
226    /// return columns. The one void fact: the clause engine's terminal-call
227    /// check and the row-producer dispatch both read it instead of each
228    /// re-deriving it from `returns`.
229    pub(crate) fn is_void(&self) -> bool {
230        self.returns.is_empty()
231    }
232}
233
234mod signatures;
235
236pub use signatures::BUILTIN_PROCEDURE_SIGNATURES;
237
238/// Looks up a built-in procedure signature by name, case-sensitively.
239/// Casing sensitivity: built-in *function* names are
240/// case-insensitive, but built-in *procedure* names are case-sensitive --
241/// `CALL DB.LABELS()` is an UnknownProcedure error, only the exact declared
242/// casing (`CALL db.labels()`) resolves. The validator must agree.
243pub fn builtin_procedure_signature(name: &str) -> Option<&'static ProcSignature> {
244    BUILTIN_PROCEDURE_SIGNATURES
245        .iter()
246        .find(|sig| sig.name == name)
247}
248
249/// Whether the procedure behind `name` declares no return columns — the one
250/// void-procedure fact, so the `CALL` contract validator and the
251/// redundant-`OPTIONAL` notification detector cannot drift.
252///
253/// `registered` is the caller's own lookup of a user-registered procedure,
254/// which shadows the built-in: it answers from its `yield_names`, the
255/// built-in from the one signature table. A name that is neither is not a
256/// procedure, and is not void.
257pub fn is_void_procedure(registered: Option<&crate::graph::Procedure>, name: &str) -> bool {
258    if let Some(procedure) = registered {
259        return procedure.yield_names.is_empty();
260    }
261    builtin_procedure_signature(name).is_some_and(ProcSignature::is_void)
262}
263
264/// Whether `name` names one of the `db.ontology.*` procedures (ADR-0121 as
265/// amended by ADR-0227). Derived from the one table so the facade's
266/// compile-time gates (implicit-only, no-mixed-writes, target namespace)
267/// and the executor's `CALL` dispatch cannot drift apart.
268pub fn is_ontology_procedure(name: &str) -> bool {
269    builtin_procedure_signature(name)
270        .is_some_and(|signature| signature.name.starts_with("db.ontology."))
271}
272
273/// Whether `name` names a `db.ontology.*` write procedure (`set`, `drop`,
274/// `apply` — ADR-0121 as amended by ADR-0227): registered with the
275/// prefix AND flagged `writes`, both read from the one table.
276pub fn is_ontology_write_procedure(name: &str) -> bool {
277    builtin_procedure_signature(name)
278        .is_some_and(|signature| signature.writes && signature.name.starts_with("db.ontology."))
279}
280
281/// Whether `name` names a store-level ontology op (`db.ontology.set` /
282/// `db.ontology.drop`, ADR-0120 §3) as opposed to the in-overlay `apply`
283/// write or the `get` read. Derived from the one table the way
284/// [`is_ontology_write_procedure`] is: the procedure's signature is flagged
285/// [`ProcSignature::store_level`].
286pub fn is_ontology_store_op(name: &str) -> bool {
287    builtin_procedure_signature(name).is_some_and(|signature| signature.store_level)
288}
289
290/// Whether `CALL name` **could** write — the namespace gate's question: a
291/// store-registered procedure or a built-in flagged `writes` in the
292/// canonical signature registry (ADR-0116 §4). The gate must never admit a
293/// callable to a read view, so registration alone counts.
294///
295/// Its consumer is the facade's namespace write gate (`relate::gate`,
296/// which injects this as the `is_write_procedure` closure the planner's
297/// `is_write` and `plan` take — the planner cannot depend on this registry).
298/// The ADR-0402 effect asks the narrower question, `call_writes_store`.
299pub fn call_is_write(graph: &crate::graph::Graph, name: &str) -> bool {
300    graph.has_procedure(name)
301        || builtin_procedure_signature(name).is_some_and(|signature| signature.writes)
302}
303
304/// Whether `CALL name` writes the store — the ADR-0402 effect question. Only
305/// a writes-flagged built-in does; a store-registered procedure
306/// ([`crate::graph::Procedure`]) is a static row table and cannot mutate the
307/// store, so calling it is no write attempt.
308pub(crate) fn call_writes_store(name: &str) -> bool {
309    builtin_procedure_signature(name).is_some_and(|signature| signature.writes)
310}
311
312/// The replacement when `name` resolves to a deprecated built-in procedure,
313/// `None` otherwise; the procedure-side twin of
314/// [`crate::function_registry::builtin_function_deprecation`] and the one
315/// lookup the query-notification detector reads. The registry's
316/// `deprecated_by` field is the whole deprecation fact — `None` means not
317/// deprecated — so the lookup is a field read, never a bridge between two
318/// flags.
319pub fn builtin_procedure_deprecation(name: &str) -> Option<DeprecatedBy> {
320    builtin_procedure_signature(name)?.deprecated_by
321}
322
323#[cfg(test)]
324mod tests {
325    use super::*;
326
327    /// The lookup reads the one registry: a deprecated entry yields its
328    /// replacement (display text and syntactic form), a current entry and an
329    /// unknown name yield `None`.
330    #[test]
331    fn procedure_deprecation_lookup_reads_the_registry() {
332        assert_eq!(
333            builtin_procedure_deprecation("db.index.vector.queryNodes"),
334            Some(DeprecatedBy::clause("SEARCH"))
335        );
336        assert_eq!(builtin_procedure_deprecation("db.labels"), None);
337        assert_eq!(builtin_procedure_deprecation("no.such.procedure"), None);
338    }
339
340    #[test]
341    fn every_listed_procedure_has_a_signature() {
342        // The catalog placeholder path is gone: every `SHOW PROCEDURES`
343        // entry renders from this one table.
344        let listed = BUILTIN_PROCEDURE_SIGNATURES
345            .iter()
346            .filter(|s| s.listed)
347            .count();
348        assert!(listed >= 27, "expected the full listed set, got {listed}");
349    }
350
351    #[test]
352    fn vector_query_argument_is_list_of_float() {
353        for name in [
354            "db.index.vector.queryNodes",
355            "db.index.vector.queryRelationships",
356        ] {
357            let sig = builtin_procedure_signature(name).unwrap();
358            assert!(sig.executable);
359            assert_eq!(sig.args[2].name, "query");
360            assert_eq!(sig.args[2].type_str, "LIST<FLOAT>");
361        }
362    }
363
364    #[test]
365    fn lookup_is_case_sensitive() {
366        // CIP-230: built-in procedure names are case-sensitive (unlike
367        // function names) -- only the exact declared casing resolves, so
368        // `CALL DB.LABELS()`/`CALL Db.Labels()` are UnknownProcedure errors.
369        assert!(builtin_procedure_signature("db.labels").is_some());
370        assert!(builtin_procedure_signature("DB.LABELS").is_none());
371        assert!(builtin_procedure_signature("Db.Labels").is_none());
372        assert!(builtin_procedure_signature("no.such.procedure").is_none());
373    }
374
375    #[test]
376    fn required_args_stop_at_first_defaulted_parameter() {
377        let await_indexes = builtin_procedure_signature("db.awaitIndexes").unwrap();
378        assert_eq!(await_indexes.args.len(), 1);
379        assert_eq!(await_indexes.required_args(), 0);
380        let labels = builtin_procedure_signature("db.labels").unwrap();
381        assert_eq!(labels.required_args(), 0);
382        let create_label = builtin_procedure_signature("db.createLabel").unwrap();
383        assert_eq!(create_label.required_args(), 1);
384    }
385
386    /// ADR-0121/ADR-0227 (CIP-287): the four ontology procedures — no
387    /// database argument, `get` with the `"yaml"` default on `format`.
388    #[test]
389    fn is_ontology_procedure_matches_exactly_the_four() {
390        for name in [
391            "db.ontology.set",
392            "db.ontology.get",
393            "db.ontology.drop",
394            "db.ontology.apply",
395        ] {
396            assert!(is_ontology_procedure(name), "{name}");
397        }
398        for name in [
399            "db.labels",
400            "db.ontology",
401            "DB.ONTOLOGY.SET",
402            "db.ontology.getx",
403        ] {
404            assert!(!is_ontology_procedure(name), "{name}");
405        }
406    }
407
408    /// The write/store-op predicates derive from the one table: `get` is
409    /// not a write, `apply` is a write but not a store op.
410    #[test]
411    fn ontology_write_and_store_op_predicates_split_the_four() {
412        assert!(is_ontology_write_procedure("db.ontology.set"));
413        assert!(is_ontology_write_procedure("db.ontology.drop"));
414        assert!(is_ontology_write_procedure("db.ontology.apply"));
415        assert!(!is_ontology_write_procedure("db.ontology.get"));
416        assert!(!is_ontology_write_procedure("db.labels"));
417
418        assert!(is_ontology_store_op("db.ontology.set"));
419        assert!(is_ontology_store_op("db.ontology.drop"));
420        assert!(!is_ontology_store_op("db.ontology.apply"));
421        assert!(!is_ontology_store_op("db.ontology.get"));
422        assert!(!is_ontology_store_op("db.createLabel"));
423    }
424
425    #[test]
426    fn ontology_procedures_follow_cip287() {
427        let set = builtin_procedure_signature("db.ontology.set").unwrap();
428        assert!(set.executable && set.listed && set.writes);
429        assert_eq!(set.mode, "WRITE");
430        assert_eq!(
431            set.args
432                .iter()
433                .map(|a| (a.name, a.type_str))
434                .collect::<Vec<_>>(),
435            [("ontology", "STRING")]
436        );
437        assert!(set.returns.is_empty());
438
439        let get = builtin_procedure_signature("db.ontology.get").unwrap();
440        assert!(get.executable && get.listed && !get.writes);
441        assert_eq!(get.mode, "READ");
442        assert_eq!(get.args.len(), 1);
443        assert_eq!(get.args[0].name, "format");
444        assert_eq!(get.args[0].default, Some("\"yaml\""));
445        assert_eq!(get.required_args(), 0);
446        assert_eq!(
447            get.returns
448                .iter()
449                .map(|r| (r.name, r.type_str))
450                .collect::<Vec<_>>(),
451            [("ontology", "STRING")]
452        );
453
454        for (name, mode) in [
455            ("db.ontology.drop", "WRITE"),
456            ("db.ontology.apply", "WRITE"),
457        ] {
458            let sig = builtin_procedure_signature(name).unwrap();
459            assert!(sig.executable && sig.listed && sig.writes, "{name}");
460            assert_eq!(sig.mode, mode, "{name}");
461            assert!(sig.args.is_empty() && sig.returns.is_empty(), "{name}");
462        }
463    }
464
465    #[test]
466    fn writes_flag_marks_exactly_the_graph_or_catalog_mutating_builtins() {
467        // ADR-0116 §4: this set is the single source of truth for the
468        // write-procedure classification the `system_ontologies` read-only
469        // check reads — a name added to or dropped from the table must flip
470        // here, not in a second list.
471        let writes: Vec<&str> = BUILTIN_PROCEDURE_SIGNATURES
472            .iter()
473            .filter(|s| s.writes)
474            .map(|s| s.name)
475            .collect();
476        assert_eq!(
477            writes,
478            [
479                "db.createLabel",
480                "db.ontology.apply",
481                "db.ontology.drop",
482                "db.ontology.set"
483            ]
484        );
485    }
486
487    /// The corpus's `SHOW PROCEDURES` inventory, row by row (ADR-0497 §6):
488    /// every listed row carries the metadata the catalog renders, and the two
489    /// procedures the corpus has no row for are gone — `SHOW INDEXES` and
490    /// `SHOW CONSTRAINTS` are those surfaces.
491    #[test]
492    fn listed_rows_carry_catalog_metadata_and_the_removed_procedures_are_absent() {
493        for signature in BUILTIN_PROCEDURE_SIGNATURES
494            .iter()
495            .filter(|signature| signature.listed)
496        {
497            assert!(
498                !signature.description.is_empty(),
499                "{} is listed without a description",
500                signature.name
501            );
502            assert!(
503                !signature.mode.is_empty(),
504                "{} is listed without a mode",
505                signature.name
506            );
507        }
508        for removed in ["db.indexes", "db.constraints"] {
509            assert!(
510                builtin_procedure_signature(removed).is_none(),
511                "{removed} must leave the registry"
512            );
513        }
514    }
515
516    /// The policy's `add` rows are all registered with the mode the policy
517    /// states: `db.stats.retrieve` is the one executable addition, the other
518    /// five are listed-only inventory rows.
519    ///
520    /// The server-only families the policy originally added — cluster, routing,
521    /// fleet management, CDC, sessions/connections/locks/pools/JMX/security/
522    /// scheduler, usage statistics, server config, and the vector-property
523    /// setters — are gone: Relate is a single-process embedded engine, so those
524    /// rows advertised capabilities it cannot have (ADR-0557).
525    #[test]
526    fn added_procedures_are_registered_with_the_policys_mode() {
527        let adds = [
528            "db.clearQueryCaches",
529            "db.createProperty",
530            "db.createRelationshipType",
531            "db.listLocks",
532            "db.prepareForReplanning",
533        ];
534        for name in adds {
535            let signature =
536                builtin_procedure_signature(name).unwrap_or_else(|| panic!("{name} missing"));
537            assert!(signature.listed, "{name} must be listed");
538            assert!(!signature.executable, "{name} is catalog-only");
539            assert!(!signature.description.is_empty(), "{name}");
540        }
541        let retrieve = builtin_procedure_signature("db.stats.retrieve").expect("registered");
542        assert!(retrieve.listed && retrieve.executable);
543        assert_eq!(retrieve.mode, "READ");
544        assert_eq!(
545            retrieve
546                .returns
547                .iter()
548                .map(|ret| (ret.name, ret.type_str))
549                .collect::<Vec<_>>(),
550            [("section", "STRING"), ("data", "MAP")]
551        );
552    }
553
554    /// ADR-0143: the Browser/Desktop-compat `dbms.*` procedures stay callable
555    /// with the exact pinned return columns; ADR-0497 §6 makes every one of
556    /// them but `dbms.clientConfig` and `dbms.licenseAgreementDetails` a
557    /// listed `SHOW PROCEDURES` row, because the corpus inventories them.
558    #[test]
559    fn adr0143_procedures_keep_their_pinned_columns_and_corpus_listing() {
560        let show_current_user =
561            builtin_procedure_signature("dbms.showCurrentUser").expect("registered");
562        assert!(show_current_user.executable);
563        assert!(show_current_user.listed);
564        assert!(show_current_user.args.is_empty());
565        assert_eq!(
566            show_current_user
567                .returns
568                .iter()
569                .map(|r| (r.name, r.type_str))
570                .collect::<Vec<_>>(),
571            [
572                ("username", "STRING"),
573                ("roles", "LIST<STRING>"),
574                ("flags", "LIST<STRING>")
575            ]
576        );
577
578        // dbms.clientConfig and dbms.listConfig deliberately share one
579        // return-column list: same names, same types, same order, no args.
580        let client_config = builtin_procedure_signature("dbms.clientConfig").expect("registered");
581        let list_config = builtin_procedure_signature("dbms.listConfig").expect("registered");
582        assert!(client_config.executable && !client_config.listed);
583        assert!(list_config.executable && list_config.listed);
584        assert!(client_config.args.is_empty() && list_config.args.is_empty());
585        assert!(std::ptr::eq(client_config.returns, list_config.returns));
586        assert_eq!(
587            client_config
588                .returns
589                .iter()
590                .map(|r| (r.name, r.type_str))
591                .collect::<Vec<_>>(),
592            [
593                ("name", "STRING"),
594                ("description", "STRING"),
595                ("value", "STRING"),
596                ("dynamic", "BOOLEAN"),
597                ("defaultValue", "STRING"),
598                ("startupValue", "STRING"),
599                ("explicitlySet", "BOOLEAN"),
600                ("validValues", "STRING")
601            ]
602        );
603
604        let license =
605            builtin_procedure_signature("dbms.licenseAgreementDetails").expect("registered");
606        assert!(license.executable);
607        assert!(!license.listed);
608        assert!(license.args.is_empty());
609        assert_eq!(
610            license
611                .returns
612                .iter()
613                .map(|r| (r.name, r.type_str))
614                .collect::<Vec<_>>(),
615            [
616                ("status", "STRING"),
617                ("daysLeftOnTrial", "INTEGER"),
618                ("totalTrialDays", "INTEGER")
619            ]
620        );
621    }
622}