Skip to content

Collapse semantics to one artifact per namespace#14

Merged
andredlng merged 2 commits into
mainfrom
semantics-single-artifact
Jul 21, 2026
Merged

Collapse semantics to one artifact per namespace#14
andredlng merged 2 commits into
mainfrom
semantics-single-artifact

Conversation

@andredlng

@andredlng andredlng commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Copying an organization's semantics graph produced two artifacts per namespace — a semantic-namespaces/<ns>.yaml row and a semantic-ontology/<ns>.yaml document — and applied them in that order. With the app now carrying the namespace's metadata (display_name, read_only, owner) in the ontology document's root custom_properties and provisioning the namespace when the ontology is applied, the row is redundant. This collapses semantics to one artifact per namespace.

Companion to datamesh-manager/entropy-data#1541, which must be deployed to the target instance first.

How it works

  • semantic-namespaces is marked artifact=False: it is still listed (so the ontology export can enumerate namespaces) and still pruned, but writes no directory of its own. export dir and the app's export zip now emit only semantic-ontology/<ns>.yaml.
  • On apply, the ontology PUT provisions the namespace, so no namespace PUT is issued.
  • Prune keep-set comes from the ontology filenames. Without a semantic-namespaces/ directory to read, the keep-set would otherwise be empty and apply --prune would delete every namespace on the target. It is now the set of semantic-ontology/<ns>.yaml stems — the same stems already used as the ontology PUT parent ids.
  • Back-compat: a tree exported by an older version still carries a semantic-namespaces/ directory. When present, it is applied as a flat resource exactly as before, so pre-existing artifact trees and zips keep full fidelity.

Testing

  • test_export_semantics_ontology_document — export writes semantic-ontology/<ns>.yaml and no semantic-namespaces/.
  • test_import_semantics_ontology_document — apply issues the ontology PUT and no namespace PUT.
  • test_apply_semantics_legacy_namespace_dir_still_applied — a legacy tree's namespace row is still PUT.
  • test_apply_semantics_prune_keeps_namespaces_from_ontology_filenames — with no semantic-namespaces/ dir, --prune deletes only the namespace absent from the ontology filenames, not all of them.

Full command suite green (239). Three unrelated test_cli.py truststore failures are pre-existing and environmental (outside this diff).

Notes / out of scope

  • semantic-namespaces stays a valid --include/--exclude name and prune unit; only its artifact materialization changed.

The ontology document now carries the namespace's uri, read-only flag and
owning team in its root custom_properties, and applying it provisions the
namespace. semantic-namespaces is marked artifact=False: still listed so the
ontology can be enumerated, still pruned, but written no directory of its own.

Its prune keep-set is derived from the ontology filenames — without that, an
apply --prune against a tree that has no semantic-namespaces/ directory would
read an empty keep-set and delete every namespace on the target. A legacy tree
that still carries the directory is applied unchanged.
@andredlng andredlng self-assigned this Jul 21, 2026
The app dropped the namespace uri and moved the remaining custom property keys
to snake_case, so describe what the document actually carries.
@andredlng
andredlng merged commit 82bd196 into main Jul 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant