@voxgig/sdkgen 4.49.1 → 4.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/package.json +1 -1
  3. package/project/.sdk/model/feature/cache.aontu +6 -4
  4. package/project/.sdk/model/target/lua.aontu +6 -0
  5. package/project/.sdk/src/cmp/c/Config_c.ts +3 -134
  6. package/project/.sdk/src/cmp/c/TestClean_c.ts +14 -0
  7. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +10 -5
  8. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +13 -0
  9. package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +9 -0
  10. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +11 -3
  11. package/project/.sdk/src/cmp/go/TestClean_go.ts +39 -3
  12. package/project/.sdk/src/cmp/java/TestClean_java.ts +8 -0
  13. package/project/.sdk/src/cmp/js/TestClean_js.ts +13 -5
  14. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +22 -0
  15. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +12 -3
  16. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +18 -4
  17. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +12 -3
  18. package/project/.sdk/src/cmp/php/TestClean_php.ts +10 -3
  19. package/project/.sdk/src/cmp/py/TestClean_py.ts +10 -3
  20. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +10 -3
  21. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +10 -0
  22. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +34 -0
  23. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +20 -10
  24. package/project/.sdk/src/cmp/ts/TestClean_ts.ts +13 -5
  25. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +12 -0
  26. package/project/.sdk/tm/c/core/context.c +1 -0
  27. package/project/.sdk/tm/c/core/sdk.h +7 -4
  28. package/project/.sdk/tm/c/feature/cache.c +243 -13
  29. package/project/.sdk/tm/c/feature/debug.c +1 -0
  30. package/project/.sdk/tm/c/feature/secrets.c +27 -38
  31. package/project/.sdk/tm/c/feature/telemetry.c +1 -0
  32. package/project/.sdk/tm/c/tests/feature_test.c +142 -0
  33. package/project/.sdk/tm/c/utility/clean.c +26 -33
  34. package/project/.sdk/tm/c/utility/make_options.c +9 -8
  35. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +14 -11
  36. package/project/.sdk/tm/clojure/src/sdk/client.clj +3 -1
  37. package/project/.sdk/tm/clojure/src/sdk/core.clj +19 -11
  38. package/project/.sdk/tm/clojure/src/sdk/features.clj +83 -10
  39. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +47 -0
  40. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +1 -0
  41. package/project/.sdk/tm/cpp/Makefile +5 -0
  42. package/project/.sdk/tm/cpp/core/types.hpp +11 -4
  43. package/project/.sdk/tm/cpp/feature/audit.hpp +6 -7
  44. package/project/.sdk/tm/cpp/feature/cache.hpp +188 -9
  45. package/project/.sdk/tm/cpp/feature/debug.hpp +1 -0
  46. package/project/.sdk/tm/cpp/feature/secrets.hpp +12 -0
  47. package/project/.sdk/tm/cpp/feature/telemetry.hpp +1 -0
  48. package/project/.sdk/tm/cpp/test/feature_test.cpp +128 -0
  49. package/project/.sdk/tm/cpp/utility/pipeline.hpp +9 -7
  50. package/project/.sdk/tm/csharp/core/Context.cs +4 -0
  51. package/project/.sdk/tm/csharp/feature/CacheFeature.cs +126 -12
  52. package/project/.sdk/tm/csharp/feature/DebugFeature.cs +1 -0
  53. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +9 -27
  54. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +1 -0
  55. package/project/.sdk/tm/csharp/test/FeatureTest.cs +101 -0
  56. package/project/.sdk/tm/csharp/utility/Clean.cs +5 -10
  57. package/project/.sdk/tm/csharp/utility/Fetcher.cs +7 -1
  58. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +5 -12
  59. package/project/.sdk/tm/elixir/lib/projectname/context.ex +2 -0
  60. package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +146 -30
  61. package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +1 -0
  62. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +10 -56
  63. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +1 -0
  64. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +18 -12
  65. package/project/.sdk/tm/elixir/test/feature_test.exs +84 -0
  66. package/project/.sdk/tm/go/core/context.go +6 -0
  67. package/project/.sdk/tm/go/feature/cache_feature.go +131 -4
  68. package/project/.sdk/tm/go/feature/debug_feature.go +3 -2
  69. package/project/.sdk/tm/go/feature/secrets_feature.go +17 -71
  70. package/project/.sdk/tm/go/feature/telemetry_feature.go +5 -4
  71. package/project/.sdk/tm/go/test/feature_corpus_test.go +150 -2
  72. package/project/.sdk/tm/go/test/feature_test.go +101 -0
  73. package/project/.sdk/tm/go/utility/clean.go +5 -7
  74. package/project/.sdk/tm/go/utility/fetcher.go +11 -0
  75. package/project/.sdk/tm/go/utility/make_options.go +5 -7
  76. package/project/.sdk/tm/java/core/Context.java +9 -0
  77. package/project/.sdk/tm/java/feature/CacheFeature.java +123 -17
  78. package/project/.sdk/tm/java/feature/DebugFeature.java +1 -0
  79. package/project/.sdk/tm/java/feature/SecretsFeature.java +9 -92
  80. package/project/.sdk/tm/java/feature/TelemetryFeature.java +1 -0
  81. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +141 -2
  82. package/project/.sdk/tm/java/test/FeatureTest.java +88 -0
  83. package/project/.sdk/tm/java/utility/Clean.java +6 -10
  84. package/project/.sdk/tm/java/utility/Fetcher.java +5 -1
  85. package/project/.sdk/tm/java/utility/MakeOptions.java +3 -1
  86. package/project/.sdk/tm/js/src/Context.js +4 -0
  87. package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +118 -11
  88. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +3 -2
  89. package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +1 -0
  90. package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +1 -1
  91. package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +4 -4
  92. package/project/.sdk/tm/js/src/feature/rbac/RbacFeature.js +4 -4
  93. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +16 -6
  94. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +1 -0
  95. package/project/.sdk/tm/js/src/feature/validate/ValidateFeature.js +2 -1
  96. package/project/.sdk/tm/js/src/utility/CleanUtility.js +1 -1
  97. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +6 -6
  98. package/project/.sdk/tm/js/test/feature/Corpus.test.js +100 -2
  99. package/project/.sdk/tm/js/test/feature/harness.js +3 -3
  100. package/project/.sdk/tm/js/test/feature.test.js +17 -0
  101. package/project/.sdk/tm/js/test/pipeline.test.js +1 -1
  102. package/project/.sdk/tm/kotlin/core/Context.kt +3 -0
  103. package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +102 -7
  104. package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +1 -0
  105. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +10 -20
  106. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +1 -0
  107. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +79 -0
  108. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +5 -5
  109. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +4 -0
  110. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +3 -1
  111. package/project/.sdk/tm/lua/core/context.lua +6 -0
  112. package/project/.sdk/tm/lua/feature/cache_feature.lua +212 -15
  113. package/project/.sdk/tm/lua/feature/debug_feature.lua +1 -0
  114. package/project/.sdk/tm/lua/feature/secrets_feature.lua +15 -80
  115. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +1 -0
  116. package/project/.sdk/tm/lua/test/feature_test.lua +108 -0
  117. package/project/.sdk/tm/lua/utility/clean.lua +6 -9
  118. package/project/.sdk/tm/lua/utility/fetcher.lua +9 -0
  119. package/project/.sdk/tm/lua/utility/make_options.lua +5 -5
  120. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +21 -6
  121. package/project/.sdk/tm/ocaml/sdk_features.ml +108 -8
  122. package/project/.sdk/tm/ocaml/sdk_runtime.ml +13 -10
  123. package/project/.sdk/tm/ocaml/sdk_types.ml +2 -0
  124. package/project/.sdk/tm/ocaml/test/t_feature.ml +51 -1
  125. package/project/.sdk/tm/perl/core/context.pm +3 -0
  126. package/project/.sdk/tm/perl/feature/audit_feature.pm +4 -7
  127. package/project/.sdk/tm/perl/feature/cache_feature.pm +111 -15
  128. package/project/.sdk/tm/perl/feature/debug_feature.pm +1 -0
  129. package/project/.sdk/tm/perl/feature/secrets_feature.pm +13 -18
  130. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +1 -0
  131. package/project/.sdk/tm/perl/t/feature.t +86 -0
  132. package/project/.sdk/tm/perl/t/feature_corpus.t +80 -4
  133. package/project/.sdk/tm/perl/utility/clean.pm +6 -8
  134. package/project/.sdk/tm/perl/utility/fetcher.pm +4 -0
  135. package/project/.sdk/tm/perl/utility/make_options.pm +5 -5
  136. package/project/.sdk/tm/php/core/Context.php +4 -0
  137. package/project/.sdk/tm/php/feature/CacheFeature.php +98 -13
  138. package/project/.sdk/tm/php/feature/DebugFeature.php +1 -0
  139. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -15
  140. package/project/.sdk/tm/php/feature/TelemetryFeature.php +1 -0
  141. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +113 -3
  142. package/project/.sdk/tm/php/test/FeatureTest.php +90 -0
  143. package/project/.sdk/tm/php/utility/Clean.php +3 -10
  144. package/project/.sdk/tm/php/utility/Fetcher.php +8 -3
  145. package/project/.sdk/tm/php/utility/MakeOptions.php +5 -7
  146. package/project/.sdk/tm/py/pkg/core/context.py +4 -0
  147. package/project/.sdk/tm/py/pkg/feature/cache_feature.py +79 -13
  148. package/project/.sdk/tm/py/pkg/feature/debug_feature.py +1 -0
  149. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +15 -66
  150. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +1 -0
  151. package/project/.sdk/tm/py/pkg/utility/clean.py +4 -10
  152. package/project/.sdk/tm/py/pkg/utility/make_options.py +8 -9
  153. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +23 -9
  154. package/project/.sdk/tm/py/test/test_feature.py +73 -0
  155. package/project/.sdk/tm/py/test/test_feature_corpus.py +88 -3
  156. package/project/.sdk/tm/rb/core/context.rb +4 -1
  157. package/project/.sdk/tm/rb/feature/audit_feature.rb +6 -5
  158. package/project/.sdk/tm/rb/feature/cache_feature.rb +75 -11
  159. package/project/.sdk/tm/rb/feature/debug_feature.rb +1 -0
  160. package/project/.sdk/tm/rb/feature/secrets_feature.rb +9 -64
  161. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +1 -0
  162. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +85 -3
  163. package/project/.sdk/tm/rb/test/feature_test.rb +93 -0
  164. package/project/.sdk/tm/rb/utility/clean.rb +6 -7
  165. package/project/.sdk/tm/rb/utility/fetcher.rb +6 -0
  166. package/project/.sdk/tm/rb/utility/make_options.rb +5 -5
  167. package/project/.sdk/tm/rust/core/context.rs +8 -0
  168. package/project/.sdk/tm/rust/feature/cache.rs +120 -3
  169. package/project/.sdk/tm/rust/feature/debug.rs +1 -0
  170. package/project/.sdk/tm/rust/feature/secrets.rs +36 -98
  171. package/project/.sdk/tm/rust/feature/telemetry.rs +1 -0
  172. package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +3 -3
  173. package/project/.sdk/tm/rust/tests/feature_test.rs +141 -0
  174. package/project/.sdk/tm/rust/utility/clean.rs +35 -43
  175. package/project/.sdk/tm/rust/utility/fetcher.rs +6 -0
  176. package/project/.sdk/tm/rust/utility/make_options.rs +8 -11
  177. package/project/.sdk/tm/scala/core/Context.scala +4 -0
  178. package/project/.sdk/tm/scala/feature/CacheFeature.scala +117 -11
  179. package/project/.sdk/tm/scala/feature/DebugFeature.scala +1 -0
  180. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +11 -24
  181. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +1 -0
  182. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +52 -1
  183. package/project/.sdk/tm/scala/utility/Fetcher.scala +5 -0
  184. package/project/.sdk/tm/scala/utility/Make.scala +3 -1
  185. package/project/.sdk/tm/scala/utility/Misc.scala +5 -8
  186. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +3 -0
  187. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +122 -11
  188. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +1 -0
  189. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +9 -13
  190. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +1 -0
  191. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +4 -0
  192. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +5 -4
  193. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +4 -5
  194. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +79 -0
  195. package/project/.sdk/tm/ts/src/Context.ts +4 -0
  196. package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +115 -4
  197. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +3 -2
  198. package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +1 -0
  199. package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +1 -1
  200. package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +4 -4
  201. package/project/.sdk/tm/ts/src/feature/rbac/RbacFeature.ts +4 -4
  202. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +14 -2
  203. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +1 -0
  204. package/project/.sdk/tm/ts/src/feature/validate/ValidateFeature.ts +2 -1
  205. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +1 -1
  206. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +6 -6
  207. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +101 -2
  208. package/project/.sdk/tm/ts/test/feature/harness.ts +3 -3
  209. package/project/.sdk/tm/ts/test/feature.test.ts +17 -0
  210. package/project/.sdk/tm/ts/test/pipeline.test.ts +1 -1
  211. package/project/.sdk/tm/zig/core/context.zig +5 -0
  212. package/project/.sdk/tm/zig/core/utility.zig +11 -9
  213. package/project/.sdk/tm/zig/feature/cache.zig +144 -13
  214. package/project/.sdk/tm/zig/feature/debug.zig +1 -0
  215. package/project/.sdk/tm/zig/feature/secrets.zig +6 -1
  216. package/project/.sdk/tm/zig/feature/telemetry.zig +1 -0
  217. package/project/.sdk/tm/zig/test/feature_test.zig +100 -0
  218. package/project/sdkgen-package.json +1 -1
@@ -5,12 +5,12 @@ pub mod sekreto;
5
5
 
6
6
  use std::cell::RefCell;
7
7
  use std::collections::BTreeMap;
8
- use std::rc::Rc;
8
+ use std::rc::{Rc, Weak};
9
9
 
10
10
  use crate::core::context::Context;
11
11
  use crate::core::error::ProjectNameError;
12
12
  use crate::core::helpers::{
13
- call_json, call_vfn, get_str, getp, getpath, ja, jo, json_thunk, setp, to_int, vfn,
13
+ call_json, call_vfn, get_str, getp, getpath, jo, setp, to_int, vfn,
14
14
  };
15
15
  use crate::core::types::{Feature, FetcherFn};
16
16
  use crate::feature::support::{fopt_bool, fopt_int, fopt_list, fopt_map, fopt_str, fres_status};
@@ -65,7 +65,10 @@ pub struct SecretsState {
65
65
  /// The client's options, READ-ONLY. This feature never writes them -
66
66
  /// see the header note.
67
67
  options: Value,
68
+ /// The client's clean registry, which a resolved value joins.
69
+ cleancfg: Value,
68
70
  mode: String,
71
+ rootctx: Weak<Context>,
69
72
 
70
73
  /// What prepare_auth was generated from: the config declares auth only
71
74
  /// where it places a credential, and Basic only where it composes one.
@@ -75,10 +78,8 @@ pub struct SecretsState {
75
78
  cred: String,
76
79
  refresh: String,
77
80
 
78
- /// A settled SUCCESSFUL resolution. Kept only while caching is on
79
- /// (`cache: false` means every request asks the chain again), and
80
- /// never set by a FAILURE - a transient vault outage must not poison
81
- /// the client permanently.
81
+ /// A settled SUCCESSFUL resolution, kept only while caching is on and
82
+ /// never set by a FAILURE, so a vault outage cannot poison the client.
82
83
  resolved: bool,
83
84
 
84
85
  /// A chain that could not be built. The transport gate refuses to send
@@ -95,7 +96,9 @@ impl SecretsState {
95
96
  cache: true,
96
97
  exchange: None,
97
98
  options: Value::Noval,
99
+ cleancfg: Value::Noval,
98
100
  mode: "live".to_string(),
101
+ rootctx: Weak::new(),
99
102
  declared: false,
100
103
  basic: false,
101
104
  cred: String::new(),
@@ -217,6 +220,7 @@ impl Feature for SecretsFeature {
217
220
  }
218
221
 
219
222
  let mut state = SecretsState::empty();
223
+ state.rootctx = Rc::downgrade(ctx);
220
224
 
221
225
  state.mode = ctx
222
226
  .client
@@ -225,6 +229,7 @@ impl Feature for SecretsFeature {
225
229
  .map(|c| c.mode.borrow().clone())
226
230
  .unwrap_or_else(|| "live".to_string());
227
231
  state.options = ctx.options.borrow().clone();
232
+ state.cleancfg = ctx.cleancfg.borrow().clone();
228
233
 
229
234
  let config = ctx.config.borrow().clone();
230
235
  let declared = getpath(&["options", "auth"], &config);
@@ -272,7 +277,7 @@ impl Feature for SecretsFeature {
272
277
  let mut specs: Vec<ProviderSpec> = Vec::new();
273
278
 
274
279
  if !explicit.is_empty() {
275
- register(&state.options, &explicit);
280
+ register(&state.cleancfg, &explicit);
276
281
  match envkey(&state.secretname, "") {
277
282
  Ok(key) => {
278
283
  let mut values: BTreeMap<String, String> = BTreeMap::new();
@@ -465,7 +470,7 @@ fn resolve_once(state: &Rc<RefCell<SecretsState>>) -> Result<bool, ProjectNameEr
465
470
  let found = found.map_err(|err| fail(&format!("{}", err)))?;
466
471
 
467
472
  if let Some(value) = &found {
468
- register(&state.borrow().options, value);
473
+ register(&state.borrow().cleancfg, value);
469
474
  }
470
475
 
471
476
  {
@@ -565,10 +570,8 @@ fn with_refresh(
565
570
  }
566
571
 
567
572
  // Another request may have bought a token while this one was in
568
- // flight. Spend what is current before buying: a second exchange
569
- // for a token that is already fresh is wasted, and on a provider
570
- // that invalidates the previous credential on issuance it breaks
571
- // the first request's own retry.
573
+ // flight: spend what is current rather than buy a second, which a
574
+ // provider invalidating on issuance would break this retry with.
572
575
  let current = state.borrow().cred.clone();
573
576
 
574
577
  let token = if !current.is_empty() && current != used {
@@ -576,10 +579,8 @@ fn with_refresh(
576
579
  } else {
577
580
  match buy(state) {
578
581
  Ok(token) => token,
579
- // The purchase failed: answer with the API's own refusal
580
- // rather than this one. The caller asked for data, and the
581
- // refusal is the more useful of the two - the exchange
582
- // error is a symptom.
582
+ // The purchase failed: answer with the API's own refusal,
583
+ // the more useful of the two.
583
584
  Err(_) => return out,
584
585
  }
585
586
  };
@@ -693,25 +694,26 @@ fn buy(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameError> {
693
694
 
694
695
  let token = buy_once(state)?;
695
696
  state.borrow_mut().cred = token.clone();
696
- register(&state.borrow().options, &token);
697
+ register(&state.borrow().cleancfg, &token);
697
698
 
698
699
  Ok(token)
699
700
  }
700
701
 
701
702
  // A resolved or bought value arrives under no option key the intake
702
- // registration saw; the options map is the client's own, Rc-shared.
703
- fn register(options: &Value, value: &str) {
704
- crate::utility::clean::clean_add_opts(options, value);
703
+ // registration saw; the registry is the client's own, Rc-shared.
704
+ fn register(cleancfg: &Value, value: &str) {
705
+ crate::utility::clean::clean_add_cfg(cleancfg, value);
705
706
  }
706
707
 
707
708
  fn buy_once(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameError> {
708
- let (refresh, exchange, options, secretname) = {
709
+ let (refresh, exchange, options, secretname, rootctx) = {
709
710
  let s = state.borrow();
710
711
  (
711
712
  s.refresh.clone(),
712
713
  s.exchange.clone(),
713
714
  s.options.clone(),
714
715
  s.secretname.clone(),
716
+ s.rootctx.upgrade(),
715
717
  )
716
718
  };
717
719
 
@@ -754,21 +756,13 @@ fn buy_once(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameErro
754
756
  ),
755
757
  ("body", Value::str(body)),
756
758
  ("redirect", Value::str("manual")),
759
+ // Its own bound, in milliseconds: the timeout feature's wrapper is above it.
760
+ ("timeout", Value::Num(30000.0)),
757
761
  ]);
758
762
 
759
- let sys_fetch = getpath(&["system", "fetch"], &options);
760
-
761
- let fetch = |at: &str| -> Result<Value, ProjectNameError> {
762
- if let Value::Func(_) = sys_fetch {
763
- let out = call_vfn(&sys_fetch, &ja(vec![Value::str(at), fetchdef.clone()]));
764
- if let Some(msg) = get_str(&out, "__err__") {
765
- return Err(fail(&msg));
766
- }
767
- Ok(out)
768
- } else {
769
- raw_exchange_fetch(at, &fetchdef)
770
- }
771
- };
763
+ // The SDK's own transport beneath every wrapper: the test block and GET-only guard.
764
+ let rootctx = rootctx.ok_or_else(|| fail("secrets: the client is gone"))?;
765
+ let fetch = |at: &str| crate::utility::fetcher::fetcher_util(&rootctx, at, &fetchdef);
772
766
 
773
767
  let mut res = fetch(&url)?;
774
768
 
@@ -816,6 +810,14 @@ fn buy_once(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameErro
816
810
 
817
811
  const REDIRECT_MAX: usize = 5;
818
812
 
813
+ // An agent that follows nothing, for reading URLs the way ureq sends them.
814
+ fn exchange_agent() -> ureq::Agent {
815
+ static AGENT: std::sync::OnceLock<ureq::Agent> = std::sync::OnceLock::new();
816
+ AGENT
817
+ .get_or_init(|| ureq::AgentBuilder::new().redirects(0).build())
818
+ .clone()
819
+ }
820
+
819
821
  // The URL a body-keeping redirect names, while it stays on the exchange's own
820
822
  // origin. Any other redirect would drop the body or leave the origin.
821
823
  fn moved(url: &str, at: &str, res: &Value) -> Option<String> {
@@ -834,67 +836,3 @@ fn moved(url: &str, at: &str, res: &Value) -> Option<String> {
834
836
  None
835
837
  }
836
838
  }
837
-
838
- // One pooled agent for every exchange; a followed redirect would carry the token.
839
- fn exchange_agent() -> ureq::Agent {
840
- static AGENT: std::sync::OnceLock<ureq::Agent> = std::sync::OnceLock::new();
841
- AGENT
842
- .get_or_init(|| ureq::AgentBuilder::new().redirects(0).build())
843
- .clone()
844
- }
845
-
846
- fn raw_exchange_fetch(fullurl: &str, fetchdef: &Value) -> Result<Value, ProjectNameError> {
847
- let method = get_str(fetchdef, "method")
848
- .filter(|m| !m.is_empty())
849
- .unwrap_or_else(|| "POST".to_string());
850
-
851
- let agent = exchange_agent();
852
- let mut req = agent.request(&method, fullurl);
853
-
854
- if let Value::Map(m) = getp(fetchdef, "headers") {
855
- for (k, v) in m.borrow().iter() {
856
- if let Value::Str(sv) = v {
857
- req = req.set(k, sv);
858
- }
859
- }
860
- }
861
-
862
- let body = get_str(fetchdef, "body").unwrap_or_default();
863
-
864
- let sent = if body.is_empty() {
865
- req.call()
866
- } else {
867
- req.send_string(&body)
868
- };
869
-
870
- let resp = match sent {
871
- Ok(resp) => resp,
872
- Err(ureq::Error::Status(_code, resp)) => resp,
873
- Err(err) => return Err(fail(&format!("secrets: token exchange: {}", err))),
874
- };
875
-
876
- let status = resp.status() as i64;
877
-
878
- let headers = Value::empty_map();
879
- for name in resp.headers_names() {
880
- if let Some(val) = resp.header(&name) {
881
- setp(&headers, &name.to_lowercase(), Value::str(val));
882
- }
883
- }
884
-
885
- let text = resp
886
- .into_string()
887
- .map_err(|err| fail(&format!("secrets: token exchange body: {}", err)))?;
888
-
889
- let parsed = if text.is_empty() {
890
- Value::Noval
891
- } else {
892
- crate::utility::jsonparse::json_parse(&text).unwrap_or(Value::Noval)
893
- };
894
-
895
- Ok(jo(vec![
896
- ("status", Value::Num(status as f64)),
897
- ("headers", headers),
898
- ("json", json_thunk(parsed)),
899
- ]))
900
- }
@@ -108,6 +108,7 @@ impl Feature for TelemetryFeature {
108
108
  let span = Value::empty_map();
109
109
  setp(&span, "traceId", Value::str(self.id("trace")));
110
110
  setp(&span, "spanId", Value::str(self.id("span")));
111
+ setp(&span, "correlationId", Value::str(ctx.id.clone()));
111
112
  setp(&span, "name", Value::str(format!("{}.{}", entity, opname)));
112
113
  setp(
113
114
  &span,
@@ -1660,7 +1660,7 @@ fn exchange_auth_null_suppresses_and_is_never_retried() {
1660
1660
  }
1661
1661
 
1662
1662
  #[test]
1663
- fn the_exchange_has_a_raw_transport_when_no_system_fetch_is_given() {
1663
+ fn the_exchange_goes_through_the_sdk_transport_when_no_system_fetch_is_given() {
1664
1664
  if skipped_without_auth() {
1665
1665
  return;
1666
1666
  }
@@ -1690,8 +1690,8 @@ fn the_exchange_has_a_raw_transport_when_no_system_fetch_is_given() {
1690
1690
  assert_eq!(getp(&res, "ok"), Value::Bool(false));
1691
1691
  let err = get_str(&res, "err").unwrap_or_default();
1692
1692
  assert!(
1693
- err.contains("token exchange"),
1694
- "expected the exchange's own refusal from the raw transport, got: {}",
1693
+ err.contains("/api/auth/token"),
1694
+ "expected the SDK transport's failure for the token endpoint, got: {}",
1695
1695
  err
1696
1696
  );
1697
1697
  }
@@ -772,6 +772,106 @@ fn feature_cache_inactive_does_not_wrap() {
772
772
  assert_eq!(calls.borrow().len(), 2, "expected 2 calls");
773
773
  }
774
774
 
775
+ fn fh_cache_load(h: &FhHarness, path: &str, headers: Value) {
776
+ h.op(FhOpSpec {
777
+ op: "load".to_string(),
778
+ path: path.to_string(),
779
+ headers,
780
+ ..Default::default()
781
+ });
782
+ }
783
+
784
+ #[test]
785
+ fn feature_cache_keys_on_request_headers() {
786
+ if !fh_present(&["cache"]) {
787
+ return;
788
+ }
789
+ let (server, calls) = fh_recorder(None);
790
+ let f = Rc::new(RefCell::new(CacheFeature::new()));
791
+ let h = fh_make(Some(server), vec![(fr(&f), jo(vec![("ttl", Value::Num(10000.0))]))]);
792
+ fh_cache_load(&h, "/w/1", jo(vec![("x-tenant", Value::str("tenant-a"))]));
793
+ fh_cache_load(&h, "/w/1", jo(vec![("X-Tenant", Value::str("tenant-b"))]));
794
+ assert_eq!(calls.borrow().len(), 2, "a second tenant was served the first tenant's entry");
795
+ fh_cache_load(&h, "/w/1", jo(vec![("x-tenant", Value::str("tenant-b"))]));
796
+ assert_eq!(calls.borrow().len(), 2, "the same headers did not share an entry");
797
+ }
798
+
799
+ #[test]
800
+ fn feature_cache_a_write_drops_its_collection() {
801
+ if !fh_present(&["cache"]) {
802
+ return;
803
+ }
804
+ let (server, calls) = fh_recorder(None);
805
+ let f = Rc::new(RefCell::new(CacheFeature::new()));
806
+ let h = fh_make(Some(server), vec![(fr(&f), jo(vec![("ttl", Value::Num(10000.0))]))]);
807
+ let paths = ["/w/1", "/w", "/w/1/part", "/other/1", "/w/2"];
808
+ for p in paths {
809
+ fh_cache_load(&h, p, Value::Noval);
810
+ }
811
+ h.op(FhOpSpec {
812
+ op: "update".to_string(),
813
+ method: "PUT".to_string(),
814
+ path: "/w/1".to_string(),
815
+ ..Default::default()
816
+ });
817
+ for p in paths {
818
+ fh_cache_load(&h, p, Value::Noval);
819
+ }
820
+ assert_eq!(calls.borrow().len(), 9, "expected the collection refetched and /other cached");
821
+ assert_eq!(f.borrow().track.borrow().hit, 2, "expected /other served from cache");
822
+ }
823
+
824
+ #[test]
825
+ fn feature_cache_control_prevents_storing() {
826
+ if !fh_present(&["cache"]) {
827
+ return;
828
+ }
829
+ for control in ["no-store", "private", "No-Cache", "max-age=60, private"] {
830
+ let (server, calls) = fh_recorder(Some(Rc::new(move |_n, _fd| {
831
+ Ok(fh_response(
832
+ 200,
833
+ jo(vec![("ok", Value::Bool(true))]),
834
+ jo(vec![("Cache-Control", Value::str(control))]),
835
+ ))
836
+ })));
837
+ let f = Rc::new(RefCell::new(CacheFeature::new()));
838
+ let h = fh_make(Some(server), vec![(fr(&f), jo(vec![("ttl", Value::Num(10000.0))]))]);
839
+ fh_cache_load(&h, "/w", Value::Noval);
840
+ fh_cache_load(&h, "/w", Value::Noval);
841
+ assert_eq!(calls.borrow().len(), 2, "{} was stored", control);
842
+ }
843
+ }
844
+
845
+ #[test]
846
+ fn feature_cache_max_age_caps_the_ttl() {
847
+ if !fh_present(&["cache"]) {
848
+ return;
849
+ }
850
+ let clock = FhClock::new();
851
+ let (server, calls) = fh_recorder(Some(Rc::new(|_n, _fd| {
852
+ Ok(fh_response(
853
+ 200,
854
+ jo(vec![("ok", Value::Bool(true))]),
855
+ jo(vec![("cache-control", Value::str("max-age=1"))]),
856
+ ))
857
+ })));
858
+ let f = Rc::new(RefCell::new(CacheFeature::new()));
859
+ let h = fh_make(
860
+ Some(server),
861
+ vec![(
862
+ fr(&f),
863
+ jo(vec![("ttl", Value::Num(10000.0)), ("now", clock.now_fn())]),
864
+ )],
865
+ );
866
+ fh_cache_load(&h, "/w", Value::Noval);
867
+ clock.advance(500);
868
+ fh_cache_load(&h, "/w", Value::Noval);
869
+ assert_eq!(calls.borrow().len(), 1, "expected a hit inside max-age");
870
+ clock.advance(600);
871
+ fh_cache_load(&h, "/w", Value::Noval);
872
+ assert_eq!(calls.borrow().len(), 2, "expected max-age=1 to expire the entry before the ttl");
873
+ }
874
+
775
875
  // --- idempotency ----------------------------------------------------------------
776
876
 
777
877
  #[test]
@@ -1397,6 +1497,47 @@ fn feature_audit_inactive_records_nothing() {
1397
1497
  assert_eq!(f.borrow().records.len(), 0, "expected no records");
1398
1498
  }
1399
1499
 
1500
+ // --- one call, one id -----------------------------------------------------------
1501
+
1502
+ #[test]
1503
+ fn feature_telemetry_debug_audit_carry_one_calls_context_id() {
1504
+ if !fh_present(&["telemetry", "debug", "audit"]) {
1505
+ return;
1506
+ }
1507
+ let tf = Rc::new(RefCell::new(TelemetryFeature::new()));
1508
+ let df = Rc::new(RefCell::new(DebugFeature::new()));
1509
+ let af = Rc::new(RefCell::new(AuditFeature::new()));
1510
+ let h = fh_make(
1511
+ None,
1512
+ vec![
1513
+ (fr(&tf), Value::Noval),
1514
+ (fr(&df), Value::Noval),
1515
+ (fr(&af), Value::Noval),
1516
+ ],
1517
+ );
1518
+ h.op(opspec("load"));
1519
+ h.op(opspec("list"));
1520
+ let ids = |recs: &[Value]| -> Vec<Value> {
1521
+ recs.iter().map(|rec| getp(rec, "correlationId")).collect()
1522
+ };
1523
+ let calls = ids(&af.borrow().records);
1524
+ assert_eq!(calls.len(), 2, "expected 2 audit records");
1525
+ assert!(
1526
+ calls
1527
+ .iter()
1528
+ .all(|id| matches!(id, Value::Str(s) if !s.is_empty())),
1529
+ "expected non-empty string ids, got {:?}",
1530
+ calls
1531
+ );
1532
+ assert_ne!(calls[0], calls[1], "expected one id per call");
1533
+ assert_eq!(ids(&tf.borrow().spans), calls, "expected the spans' ids");
1534
+ assert_eq!(
1535
+ ids(&df.borrow().entries),
1536
+ calls,
1537
+ "expected the debug entries' ids"
1538
+ );
1539
+ }
1540
+
1400
1541
  // --- clienttrack ----------------------------------------------------------------
1401
1542
 
1402
1543
  #[test]
@@ -3,7 +3,7 @@ use std::rc::Rc;
3
3
 
4
4
  use crate::core::context::Context;
5
5
  use crate::core::error::ProjectNameError;
6
- use crate::core::helpers::{getp, getpath, jo, setp};
6
+ use crate::core::helpers::{getp, jo, setp};
7
7
  use crate::core::response::{header_value, is_binary_response, Response};
8
8
  use crate::core::spec::Spec;
9
9
  use crate::utility::media::{is_raw_request, RAW_BODY};
@@ -13,8 +13,8 @@ use crate::utility::voxgigstruct::Value;
13
13
  // Every registered secret VALUE (and its encoded forms) is replaced wherever
14
14
  // it appears in a string, and every value under a sensitive KEY name is
15
15
  // masked whatever it holds. The registry is the Rc-shared `values` list of
16
- // `options.__derived__.clean`, so a feature registering a value later
17
- // reaches the list every context reads.
16
+ // the context's `cleancfg`, held beside the options rather than in them, so a
17
+ // feature registering a value later reaches the list every context reads.
18
18
 
19
19
  const MAXDEPTH: usize = 32;
20
20
  const CIRCULAR: &str = "[circular]";
@@ -95,8 +95,8 @@ fn count(val: &Value, dflt: usize) -> usize {
95
95
  }
96
96
  }
97
97
 
98
- /// The derived clean block from a clean option block: what make_options
99
- /// stores under `__derived__.clean`.
98
+ /// The clean registry from a clean option block: what make_options stores
99
+ /// on the context as `cleancfg`.
100
100
  pub fn make_clean_config(cleanopts: &Value) -> Value {
101
101
  let active = !matches!(getp(cleanopts, "active"), Value::Bool(false));
102
102
  let mask = match getp(cleanopts, "mask") {
@@ -116,18 +116,13 @@ pub fn make_clean_config(cleanopts: &Value) -> Value {
116
116
  ])
117
117
  }
118
118
 
119
- fn derived_block(options: &Value) -> Value {
120
- getpath(&["__derived__", "clean"], options)
121
- }
122
-
123
- // A context without options (make_error is reached with a bare one) falls
119
+ // A context without a registry (make_error is reached with a bare one) falls
124
120
  // back to the schema defaults, so nothing leaves raw for want of a
125
121
  // constructor.
126
122
  fn config_block(ctx: &Context) -> Value {
127
- let options = ctx.options.borrow().clone();
128
- let derived = derived_block(&options);
129
- if let Value::Map(_) = derived {
130
- return derived;
123
+ let cfg = ctx.cleancfg.borrow().clone();
124
+ if let Value::Map(_) = cfg {
125
+ return cfg;
131
126
  }
132
127
  make_clean_config(&getp(&crate::core::schema::optspec(), "clean"))
133
128
  }
@@ -192,23 +187,22 @@ fn forms(value: &str) -> Vec<String> {
192
187
  out
193
188
  }
194
189
 
195
- /// Register a secret value against an options map. Idempotent; shorter
196
- /// than `min` is not a secret the SDK can mask without blanking ordinary
197
- /// text. A map with no derived block registers nothing.
198
- pub fn clean_add_opts(options: &Value, value: &str) {
199
- let block = derived_block(options);
190
+ /// Register a secret value in a clean registry. Idempotent; shorter than
191
+ /// `min` is not a secret the SDK can mask without blanking ordinary text.
192
+ /// Anything but a registry map registers nothing.
193
+ pub fn clean_add_cfg(block: &Value, value: &str) {
200
194
  if !matches!(block, Value::Map(_)) {
201
195
  return;
202
196
  }
203
- let min = count(&getp(&block, "min"), 4).max(1);
197
+ let min = count(&getp(block, "min"), 4).max(1);
204
198
  if value.chars().count() < min {
205
199
  return;
206
200
  }
207
- let list = match getp(&block, "values") {
201
+ let list = match getp(block, "values") {
208
202
  Value::List(l) => l,
209
203
  _ => {
210
204
  let l = Value::empty_list();
211
- setp(&block, "values", l.clone());
205
+ setp(block, "values", l.clone());
212
206
  match l {
213
207
  Value::List(l) => l,
214
208
  _ => return,
@@ -236,10 +230,10 @@ pub fn clean_add_opts(options: &Value, value: &str) {
236
230
  }
237
231
  }
238
232
 
239
- /// Register a secret value the context's options will mask from now on.
233
+ /// Register a secret value the context's registry will mask from now on.
240
234
  pub fn clean_add(ctx: &Rc<Context>, value: &str) {
241
- let options = ctx.options.borrow().clone();
242
- clean_add_opts(&options, value);
235
+ let cfg = ctx.cleancfg.borrow().clone();
236
+ clean_add_cfg(&cfg, value);
243
237
  }
244
238
 
245
239
  fn mask_value(cfg: &CleanConfig, value: &str) -> String {
@@ -478,14 +472,13 @@ pub fn clean_str(ctx: &Rc<Context>, val: &str) -> String {
478
472
  clean_string(&cfg, val)
479
473
  }
480
474
 
481
- /// Clean a value against an options map rather than a context, for a
482
- /// feature that holds the options but no context.
483
- pub fn clean_opts(options: &Value, val: &Value) -> Value {
484
- let block = derived_block(options);
475
+ /// Clean a value against a registry rather than a context, for a feature
476
+ /// that holds the registry but no context.
477
+ pub fn clean_cfg(block: &Value, val: &Value) -> Value {
485
478
  if !matches!(block, Value::Map(_)) {
486
479
  return val.clone();
487
480
  }
488
- clean_with(&read_config(&block), None, val)
481
+ clean_with(&read_config(block), None, val)
489
482
  }
490
483
 
491
484
  /// Is this key name sensitive under the context's clean configuration?
@@ -508,25 +501,24 @@ pub fn clean_error(ctx: &Rc<Context>, mut err: ProjectNameError) -> ProjectNameE
508
501
  }
509
502
 
510
503
  /// Every scalar under a sensitive name, at any depth and of any shape, is
511
- /// registered against `options`: a credential mistyped as a map or a number
512
- /// is still a credential.
513
- pub fn clean_add_sensitive_opts(options: &Value, val: &Value) {
514
- let block = derived_block(options);
504
+ /// registered in `block`: a credential mistyped as a map or a number is
505
+ /// still a credential.
506
+ pub fn clean_add_sensitive_cfg(block: &Value, val: &Value) {
515
507
  if !matches!(block, Value::Map(_)) {
516
508
  return;
517
509
  }
518
- let cfg = read_config(&block);
519
- add_sensitive(&cfg, options, val, false, 0, &mut Vec::new());
510
+ let cfg = read_config(block);
511
+ add_sensitive(&cfg, block, val, false, 0, &mut Vec::new());
520
512
  }
521
513
 
522
514
  pub fn clean_add_sensitive(ctx: &Rc<Context>, val: &Value) {
523
- let options = ctx.options.borrow().clone();
524
- clean_add_sensitive_opts(&options, val);
515
+ let cfg = ctx.cleancfg.borrow().clone();
516
+ clean_add_sensitive_cfg(&cfg, val);
525
517
  }
526
518
 
527
519
  fn add_sensitive(
528
520
  cfg: &CleanConfig,
529
- options: &Value,
521
+ block: &Value,
530
522
  val: &Value,
531
523
  under: bool,
532
524
  depth: usize,
@@ -536,8 +528,8 @@ fn add_sensitive(
536
528
  return;
537
529
  }
538
530
  match val {
539
- Value::Str(s) if under => clean_add_opts(options, s),
540
- Value::Num(n) if under => clean_add_opts(options, &vs::value::num_to_string(*n)),
531
+ Value::Str(s) if under => clean_add_cfg(block, s),
532
+ Value::Num(n) if under => clean_add_cfg(block, &vs::value::num_to_string(*n)),
541
533
  Value::List(_) | Value::Map(_) => {
542
534
  let ptr = node_ptr(val).unwrap_or(0);
543
535
  if seen.contains(&ptr) {
@@ -547,13 +539,13 @@ fn add_sensitive(
547
539
  match val {
548
540
  Value::List(l) => {
549
541
  for v in l.borrow().iter() {
550
- add_sensitive(cfg, options, v, under, depth + 1, seen);
542
+ add_sensitive(cfg, block, v, under, depth + 1, seen);
551
543
  }
552
544
  }
553
545
  Value::Map(m) => {
554
546
  for (k, v) in m.borrow().iter() {
555
547
  let sub = under || sensitive_key(cfg, Some(k));
556
- add_sensitive(cfg, options, v, sub, depth + 1, seen);
548
+ add_sensitive(cfg, block, v, sub, depth + 1, seen);
557
549
  }
558
550
  }
559
551
  _ => {}
@@ -133,6 +133,12 @@ fn default_http_fetch(
133
133
 
134
134
  let resp = loop {
135
135
  let mut req = agent.request(&method, &url);
136
+ // A bound in milliseconds, for a caller beneath the timeout feature.
137
+ if let Value::Num(ms) = getp(fetchdef, "timeout") {
138
+ if 0.0 < ms {
139
+ req = req.timeout(std::time::Duration::from_millis(ms as u64));
140
+ }
141
+ }
136
142
  for (name, value) in &headers {
137
143
  req = req.set(name, value);
138
144
  }
@@ -61,8 +61,8 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
61
61
  let optspec = crate::core::schema::optspec();
62
62
 
63
63
  // The secret registry exists BEFORE validation, fed from the raw input.
64
- // Its block is Rc-shared: what is registered into `cleanopts` here is
65
- // what `opts.__derived__.clean` carries out below.
64
+ // Its block is Rc-shared: what is registered here is what the context's
65
+ // `cleancfg` carries out below.
66
66
  let cleancfg = clean::make_clean_config(&vs::merge(
67
67
  &ja(vec![
68
68
  Value::empty_map(),
@@ -72,11 +72,10 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
72
72
  ]),
73
73
  None,
74
74
  ));
75
- let cleanopts = jo(vec![("__derived__", jo(vec![("clean", cleancfg.clone())]))]);
76
- clean::clean_add_sensitive_opts(&cleanopts, &without(&opts, &["clean"]));
75
+ clean::clean_add_sensitive_cfg(&cleancfg, &without(&opts, &["clean"]));
77
76
  for src in [&cfgopts, &opts] {
78
77
  for value in clean::splitvalues(&getpath(&["clean", "values"], src)) {
79
- clean::clean_add_opts(&cleanopts, &value);
78
+ clean::clean_add_cfg(&cleancfg, &value);
80
79
  }
81
80
  }
82
81
 
@@ -200,14 +199,12 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
200
199
  let order_list =
201
200
  Value::list(feature_order.into_iter().map(|n| Value::str(n)).collect());
202
201
 
203
- setp(
204
- &opts,
205
- "__derived__",
206
- jo(vec![("clean", cleancfg), ("featureorder", order_list)]),
207
- );
202
+ setp(&opts, "__derived__", jo(vec![("featureorder", order_list)]));
203
+
204
+ *ctx.cleancfg.borrow_mut() = cleancfg.clone();
208
205
 
209
206
  // Again over the merged result: the config's own defaults can carry one.
210
- clean::clean_add_sensitive_opts(&opts, &without(&opts, &["clean", "__derived__"]));
207
+ clean::clean_add_sensitive_cfg(&cleancfg, &without(&opts, &["clean", "__derived__"]));
211
208
 
212
209
  Ok(opts)
213
210
  }