@zhuoyuezs/ml-platform 0.1.3 → 0.1.5

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 (23) hide show
  1. package/CI-ARTIFACT.md +21 -0
  2. package/DEVELOPMENT.md +7 -5
  3. package/checksums.json +38 -33
  4. package/package.json +6 -3
  5. package/release.json +7 -7
  6. package/runtime/business-client/README.md +17 -0
  7. package/runtime/business-client/package-lock.json +2 -2
  8. package/runtime/business-client/package.json +4 -2
  9. package/runtime/business-client/src/catalog.js +3 -1
  10. package/runtime/business-client/src/cli.js +132 -24
  11. package/runtime/business-client/src/config.js +6 -2
  12. package/runtime/business-client/src/http.js +130 -13
  13. package/skills/feature-management/SKILL.md +178 -10
  14. package/skills/feature-management/assets/catalog-template/datasets/example_temperature_training.v1.json +16 -0
  15. package/skills/feature-management/assets/catalog-template/feature_sets/example_temperature_core.v1.json +1 -0
  16. package/skills/feature-management/assets/catalog-template/features/example_temperature_mean_5m.v1.json +9 -2
  17. package/skills/feature-management/assets/catalog-template/operator_package/tests/test_operator.py +51 -24
  18. package/skills/feature-management/assets/catalog-template/operators/example_temperature_features.v1.json +16 -1
  19. package/skills/feature-management/assets/catalog-template/parameters/example_temperature.v1.json +1 -0
  20. package/skills/feature-management/references/commands.md +29 -0
  21. package/skills/feature-management/references/contracts.md +43 -6
  22. package/skills/feature-management/references/operator-authoring.md +15 -7
  23. package/skills/feature-management/references/platform-capability-guide.md +73 -0
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "schema_version": "ml_data_platform.operator/v1",
3
+ "project": "replace_with_project",
3
4
  "name": "example_temperature_features",
4
5
  "version": "v1",
5
6
  "type": "feature",
@@ -10,7 +11,21 @@
10
11
  "code_artifact": null,
11
12
  "input_schema": {
12
13
  "parameters": [
13
- "example_temperature:v1"
14
+ "replace_with_project/example_temperature:v1"
15
+ ],
16
+ "prediction": {
17
+ "required": true,
18
+ "minimum_horizon": "0min",
19
+ "maximum_horizon": "0min"
20
+ },
21
+ "history_requirements": [
22
+ {
23
+ "anchor": "cutoff",
24
+ "lookback": "5min",
25
+ "output_columns": [
26
+ "example_temperature_mean_5m"
27
+ ]
28
+ }
14
29
  ]
15
30
  },
16
31
  "output_schema": {
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "schema_version": "ml_data_platform.parameter/v1",
3
+ "project": "replace_with_project",
3
4
  "name": "example_temperature",
4
5
  "display_name": "Example temperature",
5
6
  "version": "v1",
@@ -49,6 +49,15 @@ ml-platform --profile server list-feature-sets -q <stable-name>
49
49
  ml-platform --profile server list-datasets -q <stable-dataset-id>
50
50
  ```
51
51
 
52
+ Run each command separately. Check `ml-platform --help` and the specific
53
+ subcommand help before adding flags. In the deployed 0.6.x CLI, `list-*`
54
+ commands print JSON by default and do not accept a `--json` flag.
55
+ If a deployed release rejects the global `--profile server` prefix, treat that
56
+ as CLI compatibility drift: record the syntax error, inspect `show-config` and
57
+ the subcommand help, then retry the same read-only command without the rejected
58
+ flag only if the installed help permits it. Do not report this as API/network
59
+ unavailability or switch to a direct HTTP client.
60
+
52
61
  By default each `list-*` command auto-pages through the whole result set and
53
62
  prints a **bare JSON array** of every matching item, so it never silently stops
54
63
  at the server's default page size. Use `-q` for a case-insensitive identifier
@@ -217,6 +226,17 @@ ml-platform --profile server wait-job <job_id>
217
226
  ml-platform --profile server get-job <job_id>
218
227
  ```
219
228
 
229
+ With explicit user authorization, stop a running build through the server CLI:
230
+
231
+ ```bash
232
+ ml-platform --profile server cancel-job <job_id>
233
+ ```
234
+
235
+ Cancellation is terminal for that Job; it does not change the immutable
236
+ DatasetManifest and it does not automatically resubmit with different
237
+ partition or parallelism settings. Check `get-job` after the request and
238
+ record the returned terminal status.
239
+
220
240
  ## Fetch Realtime Inference Data
221
241
 
222
242
  Fetch one causal-cutoff row in memory:
@@ -252,6 +272,15 @@ ml-platform --profile server \
252
272
  `--project` defaults to `default`; pass the owning project when the dataset lives
253
273
  elsewhere, or the lookup returns `artifact_not_found`.
254
274
 
275
+ The download command writes progress to stderr after response headers arrive.
276
+ Interpret a timeout with no progress line as a request/header or first-byte
277
+ failure. Interpret a timeout after one or more `artifact download: received ...`
278
+ lines as an incomplete response body. In either case, report the timeout and
279
+ keep downloaded-file validation incomplete; do not replace the supported CLI
280
+ with direct HTTP or object-store access. A successful metadata query remains
281
+ valid metadata-only evidence, but it does not prove Parquet schema, column
282
+ order, or file-content hashes.
283
+
255
284
  Inspect at least:
256
285
 
257
286
  ```text
@@ -35,6 +35,9 @@ Use this reference for the implemented V1 schemas. Prefer the running CLI and `s
35
35
  `project` field in its own JSON spec (it defaults to `default` when omitted).
36
36
  So to place an asset in a non-default project, set `"project": "<name>"` in the
37
37
  spec before `apply`.
38
+ - For a confirmed non-default target, include that field in every draft
39
+ Parameter, Operator, Feature, Feature input, FeatureSet, and DatasetManifest;
40
+ do not rely on Pydantic's `default` fallback during authoring.
38
41
  - Reads and filters, by contrast, take the project out-of-band: `list-* --project`
39
42
  and the leading project argument of the artifact commands. `apply --project`
40
43
  scopes the comparison snapshot that publication is validated against.
@@ -91,6 +94,11 @@ Required shape:
91
94
 
92
95
  Supported source modes are `direct_column`, `sql`, and `derived`. Prefer `direct_column` for ordinary business parameters.
93
96
 
97
+ For `sql`, `source.sql` must contain one statement without a trailing semicolon,
98
+ and named placeholders must be supplied through `source.params`; `start` and
99
+ `end` are reserved runtime window parameters. `source.parameters` is not a
100
+ supported field.
101
+
94
102
  `availability.strategy` 支持 `source_field`、`fixed_delay` 和 `unsupported`。只有一个
95
103
  事件时间列时,可以使用经过数据 owner 确认的固定延迟上界,例如
96
104
  `{"strategy":"fixed_delay","delay":"PT10M","accuracy":"upper_bound"}`。
@@ -282,6 +290,14 @@ The list must be nonempty, unique, and ordered exactly as consumers expect.
282
290
  "horizon": "10min"
283
291
  },
284
292
  "parameters": [],
293
+ "parameter_missing_policies": [
294
+ {
295
+ "parameter": "hot_blast_pressure",
296
+ "version": "v1",
297
+ "project": "default",
298
+ "policy": "report_only"
299
+ }
300
+ ],
285
301
  "feature_set": {"name": "pressure_core", "version": "v1"},
286
302
  "preprocess": [],
287
303
  "output": {
@@ -321,9 +337,13 @@ declared `realtime_fetch` policy contains meaningful defaults and changes the
321
337
  manifest hash. Declaring `endpoint_policy` also changes the manifest hash.
322
338
 
323
339
  Each explicit `parameters` request may set `missing_policy`. A
324
- `parameter_missing_policies` entry uses the same Parameter `name` and `version`
325
- but is reserved for Parameters used only through the selected FeatureSet's
326
- input closure; it must not also appear in `parameters`. The policies are:
340
+ `parameter_missing_policies` entry is reserved for a Parameter used only through
341
+ the selected FeatureSet's input closure; it must not also appear in
342
+ `parameters`. Its exact V1 shape is `{"parameter": "<name>", "version":
343
+ "<version>", "project": "<project>", "policy": "<policy>"}`. Do not use
344
+ the `ParameterRequest` field names `name` or `missing_policy` in this list. For
345
+ a confirmed non-default target, set `project` explicitly instead of relying on
346
+ its `default` fallback. The policies are:
327
347
 
328
348
  - `report_only`: retain all target rows and report source gaps.
329
349
  - `fail_on_requested_range_gap`: fail when a detected gap affects the requested
@@ -424,13 +444,30 @@ near the end of the target range can have its lookback clipped by the range end,
424
444
  and a window close to the end can remove most remaining rows.
425
445
 
426
446
  `target` states which instant the label is aligned to, so reviewing a manifest
427
- shows the target definition rather than only a Parameter version string.
428
- `si_time_source` is `weight_time` or `dispatch_time`.
447
+ shows the target definition rather than only a Parameter version string. When
448
+ the target is a Parameter, keep its complete versioned reference **inside**
449
+ `target.parameter`; do not flatten `version` or `project` onto `target`.
450
+ `si_time_source` is `weight_time` or `dispatch_time`. `interpolation` is an
451
+ object with a `method`, never a bare string.
429
452
 
430
453
  ```json
431
- "target": {"si_time_source": "weight_time", "offset_minutes": 0}
454
+ "target": {
455
+ "parameter": {
456
+ "parameter": "hot_metal_si",
457
+ "version": "v1",
458
+ "project": "replace_with_project"
459
+ },
460
+ "si_time_source": "weight_time",
461
+ "offset_minutes": 0,
462
+ "interpolation": {"method": "linear"}
463
+ }
432
464
  ```
433
465
 
466
+ Allowed interpolation methods are `none`, `linear`, and `forward_fill`. A
467
+ business phrase such as "allow and report target nulls" belongs in an existing
468
+ Parameter missing policy, Feature configuration, or the semantic review; it is
469
+ not a free-form `target` or DatasetManifest field.
470
+
434
471
  The declaration is checked against the selected Si Parameter, but only for
435
472
  `direct_column` reads, which name their time column in the contract. A `sql` or
436
473
  `derived` Parameter can apply an offset inside its query text, so those are
@@ -67,12 +67,17 @@ Use `context.cutoff_times` for causal feature windows. It is derived once from
67
67
  `context.target_times - context.prediction_horizon` using the DatasetManifest
68
68
  prediction contract; do not parse a duplicated Feature-level horizon.
69
69
 
70
- If an Operator requires a forecast contract, declare `input_schema.prediction`
71
- with `required`, `minimum_horizon`, and `maximum_horizon`. Declare source history
72
- as `input_schema.history_requirements`, using `anchor: cutoff` for causal windows
73
- and `anchor: target_time` only for intentional target-aligned formulas. Scope a
74
- requirement with `output_columns` when only some outputs need it. Include alignment
75
- slack such as hourly floor boundaries in the declared lookback.
70
+ An Operator requires an explicit forecast contract whenever its formula or code
71
+ uses `context.cutoff_times`, or any `input_schema.history_requirements` entry uses
72
+ `anchor: cutoff`. In that case always declare `input_schema.prediction` with
73
+ `required`, `minimum_horizon`, and `maximum_horizon`. This includes a strict
74
+ nowcast: declare `required=true` and both bounds as `0min`; do not omit the
75
+ section and silently accept the runtime's `default_nowcast` fallback. Declare
76
+ source history as `input_schema.history_requirements`, using `anchor: cutoff`
77
+ for causal windows and `anchor: target_time` only for intentional target-aligned
78
+ formulas. Scope a requirement with `output_columns` when only some outputs need
79
+ it. Include alignment slack such as hourly floor boundaries in the declared
80
+ lookback.
76
81
 
77
82
  For realtime reads, `history_requirements` is also the per-Parameter fetch
78
83
  contract. Do not rely on a package-local lookback map or a single fixed window
@@ -110,7 +115,10 @@ Never infer a rule from a Feature name alone. Require a business decision when a
110
115
 
111
116
  ## Required Tests
112
117
 
113
- Use deterministic fixtures and cover:
118
+ Use deterministic fixtures and cover each applicable item with a separately
119
+ named test. A broad formula or happy-path test does not substitute for the
120
+ cutoff-before, cutoff-at, cutoff-after, duplicate/missing, empty-history,
121
+ requested-output, event-time-order, or dtype/rounding cases below:
114
122
 
115
123
  1. expected formula values;
116
124
  2. the event immediately before cutoff;
@@ -0,0 +1,73 @@
1
+ # Platform Capability Guide
2
+
3
+ Use this guide to explain what the platform can execute. It is not business
4
+ evidence. A platform default never answers an unresolved business question.
5
+
6
+ ## Platform In One Paragraph
7
+
8
+ The platform is a versioned data-contract, registry, execution, and delivery
9
+ layer for algorithm projects. It turns confirmed source Parameters and approved
10
+ deterministic Operators into ordered Features and reproducible DatasetManifests,
11
+ then either materializes a batch DatasetArtifact or serves one causal realtime
12
+ read. It owns source adapters, quality/missingness/freshness evidence, lineage,
13
+ replay metadata, and Job execution; it does not own model training, model
14
+ evaluation, model serving, source-table creation, or Kubernetes administration.
15
+
16
+ The following distinctions are part of the platform contract:
17
+
18
+ - A `Parameter` is a public source-data contract, not an arbitrary raw table or
19
+ a model feature.
20
+ - An `Operator` is versioned executable code; a `Feature` is exactly one output
21
+ column; a `FeatureSet` is the consumer-visible column order.
22
+ - A `DatasetManifest` is a versioned request for time range, read policy,
23
+ rowsets, missing/endpoint rules, prediction, and one FeatureSet.
24
+ - A `DatasetArtifact` is an output of an authorized build, not evidence that the
25
+ source contract or business formula was semantically approved.
26
+ - Realtime inference is a causal cutoff read. It must not run a batch build,
27
+ write Parquet, or publish a DatasetArtifact.
28
+
29
+ Dry-run and registry resolution are structural evidence. They may not detect a
30
+ missing source relation; source-backed success must be established by the build
31
+ or realtime fetch response. Artifact metadata is separate from downloaded-file
32
+ evidence: schema, column order, file hashes, and numeric parity require the
33
+ complete files.
34
+
35
+ ## Public Assets
36
+
37
+ | Asset | Stores | Use when | Do not use for |
38
+ |---|---|---|---|
39
+ | Project | Namespace and isolation boundary | Every independent business release | A dataset version or a source table |
40
+ | Parameter | One readable source contract and its quality/time semantics | Raw or independently readable source values/events | Rolling means, ratios, trends, model columns |
41
+ | Operator | Versioned deterministic executable code | A formula needs computation over declared inputs | A business definition without confirmed formula |
42
+ | Feature | One immutable output-column contract | One model/input column produced by an Operator | A group of columns or an unnamed formula |
43
+ | FeatureSet | Ordered Feature references | Consumer column order is part of the contract | Copying formulas or creating multiple datasets |
44
+ | DatasetManifest | Dataset mode, time grid, rowsets, policy and FeatureSet reference | A reproducible dataset contract is ready | Filling unknown source or business semantics |
45
+ | DatasetArtifact | Output of an authorized build | Build was explicitly approved and completed | Proving a Catalog is semantically correct |
46
+
47
+ ## Decision Rules
48
+
49
+ - Parameter answers **what source value is exposed**; Operator/Feature answers
50
+ **how a confirmed business formula is computed**.
51
+ - FeatureSet order is consumer-facing and must be confirmed; it is not inferred
52
+ from filesystem order or JSON discovery order.
53
+ - Dataset `time_range`, `prediction`, `rowset_splits`, `abnormal_windows` and
54
+ `endpoint_policy` are separate contracts. A platform default does not choose
55
+ a business policy.
56
+ - `apply --dry-run` checks structure, references, package and immutability. It
57
+ does not prove source correctness, formula correctness or artifact parity.
58
+ - `publish` creates immutable Registry resources. `build` creates an execution
59
+ Job and must have a separate explicit approval.
60
+
61
+ ## Required Semantic Asset Review
62
+
63
+ Before writing Catalog JSON, produce a local review table with one row per
64
+ Parameter, Operator, Feature and Dataset field:
65
+
66
+ ```text
67
+ asset_key | business_meaning | source/evidence | confirmed_by | unresolved | proposed_value
68
+ ```
69
+
70
+ Stop before Catalog generation if any required `source/evidence`, formula,
71
+ time boundary, unit, null policy, output dtype, FeatureSet order, read policy,
72
+ or approval field is unresolved. The review table is a proposal for the user;
73
+ it is not a Registry asset and must not contain guessed values.