@altopelago/sansa 0.12.0 → 0.13.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.
package/CHANGELOG.md CHANGED
@@ -7,8 +7,31 @@ versions may still include breaking changes when the SANSA specifications move.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.13.0 - 2026-10-06
11
+
12
+ ### Added
13
+
14
+ - Added bounded Rust SANSA Query clause and expression parsing, covering all 57
15
+ stable parser cases from the pinned Query CTS. The syntax surface includes
16
+ canonical AST rendering, AEON scalar literal families, projections, dynamic
17
+ `path(...)` sources, and explicit input, token, AST-node, nesting, and literal
18
+ ceilings.
19
+ - Added host-neutral Rust SANSA Query evaluation over opaque namespace handles,
20
+ covering all 169 stable evaluator cases from the pinned Query CTS. The
21
+ evaluator implements From, Where, Order, Offset, Limit, Select, stable
22
+ functions and value families, short-circuiting, deterministic ordering,
23
+ phase-specific budgets, and constrained dynamic-address activation. Together
24
+ with parsing, the Rust runtime now claims the complete 226-case stable core
25
+ `SANSA.Query` lane; experimental Transform cases remain excluded.
26
+
10
27
  ## 0.12.0 - 2026-10-01
11
28
 
29
+ ### Added
30
+
31
+ - Added the publishable `altopelago-sansa-runtime` Rust crate. The initial
32
+ Rust surface implements the pinned stable Address, Resolve, and shared AEON
33
+ minimum value-semantics CTS lanes while reporting Query as unimplemented.
34
+
12
35
  ### Changed
13
36
 
14
37
  - Added AEON symbolic literals to Query, Instruction, mutation target
package/CONTRIBUTING.md CHANGED
@@ -32,6 +32,7 @@ version is:
32
32
  ## Development expectations
33
33
 
34
34
  - run `npm test` for normal package changes
35
+ - run `npm run test:rust` for Rust runtime or conformance-harness changes
35
36
  - run `npm run cts` for conformance-affecting changes
36
37
  - run `npm run cts:query:experimental` when touching experimental Query or
37
38
  Transform behavior
@@ -2,7 +2,7 @@
2
2
  "claim_format": "aeonite.cts-claims.v1",
3
3
  "repository": "AltoPelago/sansa",
4
4
  "implementation": "@altopelago/sansa",
5
- "implementation_version": "0.12.0",
5
+ "implementation_version": "0.13.0",
6
6
  "cts_repository": "aeonite-org/aeonite-cts",
7
7
  "cts_protocol": "cts.protocol.v1",
8
8
  "claims": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "implementation": "@altopelago/sansa",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "profiles": [
5
5
  "value-semantics-minimum-consumer",
6
6
  "aeon.value.default.v1",
package/docs/releasing.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Releasing
2
2
 
3
- SANSA publishes to npm from GitHub Actions using npm trusted publishing.
3
+ SANSA publishes its JavaScript package to npm and its host-neutral Rust runtime
4
+ to crates.io from GitHub Actions using trusted publishing.
4
5
 
5
6
  ## npm setup
6
7
 
@@ -19,16 +20,57 @@ packages published from public repositories.
19
20
 
20
21
  ## GitHub setup
21
22
 
22
- Create a GitHub environment named `npm`. Add required reviewers to that
23
- environment if release approval should be explicit before publishing.
23
+ Create GitHub environments named `npm` and `crates-io`. Add required reviewers
24
+ to either environment if release approval should be explicit before publishing.
24
25
 
25
26
  The publish workflow runs when a GitHub Release is published. It verifies that
26
27
  the release tag matches the package version, so `package.json` version `X.Y.Z`
27
28
  must be released from tag `vX.Y.Z`.
28
29
 
30
+ ## crates.io setup
31
+
32
+ crates.io does not allow a trusted publisher to create a crate. Bootstrap the
33
+ initial release with a conventional crates.io API token, then configure a
34
+ trusted publisher for `altopelago-sansa-runtime`:
35
+
36
+ - GitHub organization or user: `AltoPelago`
37
+ - Repository: `sansa`
38
+ - Workflow filename: `rust-publish.yml`
39
+ - Environment name: `crates-io`
40
+
41
+ The Rust workflow uses a separate signed annotated `rust/vX.Y.Z` tag. It checks
42
+ that the tag resolves to `main`, matches the shared project version, passes all
43
+ implemented stable Rust CTS lanes, and produces a package that builds before
44
+ requesting a short-lived crates.io token through GitHub OIDC. A clean consumer
45
+ then installs and exercises the exact published version.
46
+
47
+ ### Initial crates.io bootstrap
48
+
49
+ For the initial `0.12.0` publication only:
50
+
51
+ 1. Merge the reviewed Rust-publication PR and confirm CI passes on `main`.
52
+ 2. Create the narrowest short-lived crates.io API token that permits publishing
53
+ a new crate.
54
+ 3. From a clean checkout of that `main` commit, run `cargo login`, enter the
55
+ token when prompted, and then run:
56
+
57
+ ```sh
58
+ cargo publish --locked --manifest-path implementations/rust/crates/sansa-runtime/Cargo.toml
59
+ ```
60
+
61
+ 4. Run `cargo logout` and revoke the bootstrap token on crates.io.
62
+ 5. Configure the trusted publisher above now that the crate exists.
63
+ 6. Create and push the signed annotated `rust/v0.12.0` tag from the same
64
+ reviewed commit. The workflow verifies the existing exact release, skips a
65
+ duplicate upload, and runs the clean-registry smoke test.
66
+
67
+ Do not retain the bootstrap token as a GitHub secret. Subsequent Rust releases
68
+ are published by the workflow using short-lived OIDC credentials.
69
+
29
70
  ## Release steps
30
71
 
31
- 1. Run `npm run version:set -- X.Y.Z` to update machine-owned release metadata.
72
+ 1. Run `npm run version:set -- X.Y.Z` to update machine-owned npm,
73
+ capability, and Rust release metadata atomically.
32
74
  2. Update `conformance/cts-claims.json` so `implementation_version` matches the
33
75
  package release, and confirm every claimed immutable CTS snapshot id remains
34
76
  authoritative for the release.
@@ -39,11 +81,18 @@ must be released from tag `vX.Y.Z`.
39
81
  5. Merge the release-prep PR into `main`.
40
82
  6. Confirm CI passes on `main`.
41
83
  7. Create tag `vX.Y.Z` from the checked `main` commit.
42
- 8. Publish a GitHub Release for `vX.Y.Z`.
43
- 9. Let `Publish npm` run from GitHub Actions.
44
- 10. Confirm the npm package page shows the expected version and provenance.
84
+ 8. Publish a GitHub Release for `vX.Y.Z` and let `Publish npm` complete.
85
+ 9. Create a signed annotated `rust/vX.Y.Z` tag from the same checked `main`
86
+ commit and push it.
87
+ 10. Let `Rust Publish` complete, including its clean-registry smoke test.
88
+ 11. Confirm both registry pages show the expected version and provenance.
89
+
90
+ For the initial Rust-only 0.12.0 publication, follow the bootstrap procedure
91
+ above; the existing npm `v0.12.0` tag and artifact remain unchanged. From the
92
+ next coordinated version onward, create both tags from the same checked commit.
45
93
 
46
- `version:set` updates `package.json` and `docs/capabilities.json` together.
94
+ `version:set` updates `package.json`, `docs/capabilities.json`, and
95
+ `implementations/rust/Cargo.toml` together.
47
96
  `version:check` is enforced by CI and the publish workflow; it also requires a
48
97
  matching dated changelog heading. The setter accepts valid SemVer without a
49
98
  leading `v`, permits an exact idempotent rerun, and otherwise requires the new
@@ -51,6 +100,6 @@ version to have higher SemVer precedence. Neither command commits, tags, or
51
100
  publishes.
52
101
  Updates use staged files, backups, and atomic renames. If a process is
53
102
  interrupted, both `version:set` and `version:check` fail closed until
54
- `npm run version:recover` either restores the original pair or finishes cleanup
55
- for a committed pair. Run recovery only after confirming no other version
56
- command is active.
103
+ `npm run version:recover` either restores the original release set or finishes
104
+ cleanup for a committed set. Run recovery only after confirming no other
105
+ version command is active.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altopelago/sansa",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Semantic Address NameSpace Abstraction parser, resolver, and query toolkit.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -65,7 +65,8 @@
65
65
  "version:check": "node scripts/version.mjs check",
66
66
  "version:recover": "node scripts/version.mjs recover",
67
67
  "validate:cts-claims": "node scripts/validate-cts-claims.mjs",
68
- "test": "node --test test/*.test.js"
68
+ "test": "node --test test/*.test.js",
69
+ "test:rust": "cargo fmt --all --check --manifest-path implementations/rust/Cargo.toml && cargo clippy --locked --workspace --all-features --all-targets --manifest-path implementations/rust/Cargo.toml -- -D warnings && cargo test --locked --workspace --all-features --all-targets --manifest-path implementations/rust/Cargo.toml"
69
70
  },
70
71
  "keywords": [
71
72
  "sansa",
@@ -23,6 +23,7 @@ const repositoryRoot = path.resolve(
23
23
  const expectedPackageName = '@altopelago/sansa';
24
24
  const packagePath = path.join(repositoryRoot, 'package.json');
25
25
  const capabilitiesPath = path.join(repositoryRoot, 'docs', 'capabilities.json');
26
+ const cargoManifestPath = path.join(repositoryRoot, 'implementations', 'rust', 'Cargo.toml');
26
27
  const changelogPath = path.join(repositoryRoot, 'CHANGELOG.md');
27
28
  const transactionPath = path.join(repositoryRoot, '.sansa-version-transaction');
28
29
  const journalPath = path.join(transactionPath, 'journal.json');
@@ -45,6 +46,13 @@ const transactionTargets = [
45
46
  backup: path.join(transactionPath, 'capabilities.backup'),
46
47
  restore: path.join(transactionPath, 'capabilities.restore'),
47
48
  },
49
+ {
50
+ label: 'implementations/rust/Cargo.toml',
51
+ path: cargoManifestPath,
52
+ next: path.join(transactionPath, 'cargo.next'),
53
+ backup: path.join(transactionPath, 'cargo.backup'),
54
+ restore: path.join(transactionPath, 'cargo.restore'),
55
+ },
48
56
  ];
49
57
 
50
58
  function fail(message) {
@@ -294,6 +302,30 @@ async function jsonWithReplacedVersion(file, label, currentVersion, nextVersion)
294
302
  );
295
303
  }
296
304
 
305
+ function cargoVersionFromSource(source) {
306
+ const matches = [...source.matchAll(/^version\s*=\s*"([^"]+)"\s*$/gm)];
307
+ if (matches.length !== 1) {
308
+ throw new Error(
309
+ 'implementations/rust/Cargo.toml must contain exactly one workspace package version',
310
+ );
311
+ }
312
+ return matches[0][1];
313
+ }
314
+
315
+ async function cargoWithReplacedVersion(currentVersion, nextVersion) {
316
+ const source = await readFile(cargoManifestPath, 'utf8');
317
+ const actualVersion = cargoVersionFromSource(source);
318
+ if (actualVersion !== currentVersion) {
319
+ throw new Error(
320
+ `implementations/rust/Cargo.toml version ${JSON.stringify(actualVersion)} does not match package version ${JSON.stringify(currentVersion)}`,
321
+ );
322
+ }
323
+ return source.replace(
324
+ new RegExp(`^(version\\s*=\\s*)"${escapeRegExp(currentVersion)}"[ \\t]*$`, 'm'),
325
+ `$1${JSON.stringify(nextVersion)}`,
326
+ );
327
+ }
328
+
297
329
  function releaseHeadingProblem(changelog, version) {
298
330
  const releaseHeading = new RegExp(
299
331
  `^## ${escapeRegExp(version)} - \\d{4}-\\d{2}-\\d{2}$`,
@@ -305,7 +337,7 @@ function releaseHeadingProblem(changelog, version) {
305
337
  : `CHANGELOG.md must have exactly one dated release heading for ${version}`;
306
338
  }
307
339
 
308
- function metadataProblems(packageManifest, capabilities, changelog = null) {
340
+ function metadataProblems(packageManifest, capabilities, cargoVersion, changelog = null) {
309
341
  const problems = [];
310
342
  const version = packageManifest.version;
311
343
  if (packageManifest.name !== expectedPackageName) {
@@ -324,6 +356,11 @@ function metadataProblems(packageManifest, capabilities, changelog = null) {
324
356
  `docs/capabilities.json version ${JSON.stringify(capabilities.version)} does not match package version ${JSON.stringify(version)}`,
325
357
  );
326
358
  }
359
+ if (cargoVersion !== version) {
360
+ problems.push(
361
+ `implementations/rust/Cargo.toml version ${JSON.stringify(cargoVersion)} does not match package version ${JSON.stringify(version)}`,
362
+ );
363
+ }
327
364
  if (changelog !== null && typeof version === 'string') {
328
365
  const problem = releaseHeadingProblem(changelog, version);
329
366
  if (problem !== null) problems.push(problem);
@@ -332,14 +369,21 @@ function metadataProblems(packageManifest, capabilities, changelog = null) {
332
369
  }
333
370
 
334
371
  async function loadMetadata({ includeChangelog }) {
335
- const [packageManifest, capabilities, changelog] = await Promise.all([
372
+ const [packageManifest, capabilities, cargoManifest, changelog] = await Promise.all([
336
373
  readJson(packagePath, 'package.json'),
337
374
  readJson(capabilitiesPath, 'docs/capabilities.json'),
375
+ assertRegularFile(cargoManifestPath, 'implementations/rust/Cargo.toml')
376
+ .then(() => readFile(cargoManifestPath, 'utf8')),
338
377
  includeChangelog
339
378
  ? assertRegularFile(changelogPath, 'CHANGELOG.md').then(() => readFile(changelogPath, 'utf8'))
340
379
  : Promise.resolve(null),
341
380
  ]);
342
- return { packageManifest, capabilities, changelog };
381
+ return {
382
+ packageManifest,
383
+ capabilities,
384
+ cargoVersion: cargoVersionFromSource(cargoManifest),
385
+ changelog,
386
+ };
343
387
  }
344
388
 
345
389
  async function checkVersion() {
@@ -348,6 +392,7 @@ async function checkVersion() {
348
392
  const problems = metadataProblems(
349
393
  metadata.packageManifest,
350
394
  metadata.capabilities,
395
+ metadata.cargoVersion,
351
396
  metadata.changelog,
352
397
  );
353
398
  await Promise.all([
@@ -363,6 +408,10 @@ async function checkVersion() {
363
408
  metadata.capabilities.version,
364
409
  metadata.capabilities.version,
365
410
  ),
411
+ cargoWithReplacedVersion(
412
+ metadata.packageManifest.version,
413
+ metadata.packageManifest.version,
414
+ ),
366
415
  ]).catch((error) => problems.push(errorMessage(error)));
367
416
  if (problems.length > 0) throw new Error(problems.join('; '));
368
417
  console.log(
@@ -421,6 +470,7 @@ async function setVersion(version) {
421
470
  const problems = metadataProblems(
422
471
  metadata.packageManifest,
423
472
  metadata.capabilities,
473
+ metadata.cargoVersion,
424
474
  metadata.changelog,
425
475
  );
426
476
  if (problems.length > 0) {
@@ -449,6 +499,7 @@ async function setVersion(version) {
449
499
  metadata.capabilities.version,
450
500
  version,
451
501
  ),
502
+ cargoWithReplacedVersion(metadata.packageManifest.version, version),
452
503
  ]);
453
504
  await writeVersionTransaction(updates);
454
505
  console.log(`Set ${expectedPackageName} release metadata to ${version}.`);
package/src/index.js CHANGED
@@ -4355,6 +4355,9 @@ function consumeFallbackOperand(value, namespace) {
4355
4355
  };
4356
4356
  }
4357
4357
  const scalar = getBindingScalarValue(namespace, value.bindings[0]);
4358
+ if (!scalar.ok && scalar.error.code === 'SANSA_QUERY_EVALUATE_MISSING_SCALAR') {
4359
+ return { ok: false, missing: true };
4360
+ }
4358
4361
  if (!scalar.ok) return scalar;
4359
4362
  return scalarQueryValue(scalar.value, scalar.metadata);
4360
4363
  }
@@ -6428,10 +6431,17 @@ function getBindingScalarInfo(namespace, binding) {
6428
6431
  const radixBase = getBindingRadixBase(namespace, binding);
6429
6432
  const radixScale = getBindingRadixScale(namespace, binding);
6430
6433
  if (typeof namespace.value === 'function') {
6431
- return { ok: true, value: namespace.value(binding), kind, semanticType, nullReason, numericLexeme, radixBase, radixScale };
6434
+ const value = namespace.value(binding);
6435
+ if (value !== undefined) {
6436
+ return { ok: true, value, kind, semanticType, nullReason, numericLexeme, radixBase, radixScale };
6437
+ }
6438
+ }
6439
+ if (Object.hasOwn(binding, 'value') && binding.value !== undefined) {
6440
+ return { ok: true, value: binding.value, kind, semanticType, nullReason, numericLexeme, radixBase, radixScale };
6441
+ }
6442
+ if (Object.hasOwn(binding, 'scalar') && binding.scalar !== undefined) {
6443
+ return { ok: true, value: binding.scalar, kind, semanticType, nullReason, numericLexeme, radixBase, radixScale };
6432
6444
  }
6433
- if (Object.hasOwn(binding, 'value')) return { ok: true, value: binding.value, kind, semanticType, nullReason, numericLexeme, radixBase, radixScale };
6434
- if (Object.hasOwn(binding, 'scalar')) return { ok: true, value: binding.scalar, kind, semanticType, nullReason, numericLexeme, radixBase, radixScale };
6435
6445
  return {
6436
6446
  ok: false,
6437
6447
  error: queryEvaluateError('SANSA_QUERY_EVALUATE_MISSING_SCALAR', 'Binding does not expose a scalar value'),