lorebase-core 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- lorebase_core-0.4.0/LICENSE +201 -0
- lorebase_core-0.4.0/PKG-INFO +40 -0
- lorebase_core-0.4.0/README.md +13 -0
- lorebase_core-0.4.0/pyproject.toml +39 -0
- lorebase_core-0.4.0/src/lorebase_core/__init__.py +1 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/__init__.py +4 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/conflicts.py +33 -1
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/engine.py +11 -5
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/state.py +35 -1
- lorebase_core-0.4.0/tests/merge/test_fast_forward.py +35 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_policies.py +61 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_properties.py +1 -1
- lorebase_core-0.3.0/PKG-INFO +0 -9
- lorebase_core-0.3.0/pyproject.toml +0 -18
- lorebase_core-0.3.0/src/lorebase_core/__init__.py +0 -1
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/.gitignore +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/canonical/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/canonical/hashing.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/canonical/jcs.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/ast.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/checker.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/compiler.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/context.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/derivations.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/environment.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/errors.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/evaluator.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/functions.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/limits.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/operations.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/ops.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/resolver.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/rows.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/sensitivity.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/types.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/validation.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/values.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/expr/visibility.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/columns.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/engine.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/keys.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/names.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/options.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/phrases.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/profile.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/proposal.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/references.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/suggestions.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/infer/tables.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/consistency.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/data_merge.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/index.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/objects.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/policies.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/resolve.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/schema_merge.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/merge/text_merge.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/attribute.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/base.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/derivation.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/domain.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/embedding.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/ids.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/kind.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/lens.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/lineage.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/operation.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/paths.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/record.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/relation.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/schema.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/source.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/trait.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/vault.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/model/yaml_schema.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/query/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/query/dsl.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/query/resolve.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/reconcile/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/reconcile/candidates.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/reconcile/claims.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/reconcile/detect.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/reconcile/normalize.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/reconcile/options.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/reconcile/units.yaml +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/revision/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/revision/ancestry.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/revision/changeset.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/revision/revision.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/tree/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/tree/diff.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/tree/hamt.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/tree/node.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/tree/params.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/tree/root.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/tree/store.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/types/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/types/casts.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/types/constraints.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/types/encoding.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/types/errors.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/types/matching.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/types/types.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/validate/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/validate/changes.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/validate/changeset.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/validate/data_rules.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/validate/issues.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/src/lorebase_core/validate/schema_rules.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/test_hashing.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/test_jcs.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/object_hashes.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/rfc8785/nested.expected.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/rfc8785/nested.input.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/rfc8785/numbers.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/rfc8785/sorting.expected.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/rfc8785/sorting.input.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/rfc8785/values.expected.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/canonical/vectors/rfc8785/values.input.json +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/support.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_compile.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_evaluate.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_lens.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_operations.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_rows.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_tag_origins.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_validation.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/expr/test_visibility.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/support.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/test_columns.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/test_engine.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/test_keys.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/test_names.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/test_references.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/test_suggestions.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/infer/test_supply_gold.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/support.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_conflict_kinds.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_data_merge.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_end_to_end.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_index.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_preserved_base.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_resolutions.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_schema_merge.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_text_merge.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/merge/test_virtual_base.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/supply.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/test_embedding.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/test_model.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/test_paths.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/test_resolution_fields.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/test_supply_example.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/test_yaml_schema.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/model/yaml_support.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/query/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/query/test_resolve.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/reconcile/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/reconcile/test_detect.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/reconcile/test_model.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/reconcile/test_reconcile.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/revision/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/revision/test_ancestry.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/revision/test_revision.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/tree/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/tree/conftest.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/tree/support.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/tree/test_diff.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/tree/test_hamt.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/tree/test_node.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/types/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/types/strategies.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/types/test_casts.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/types/test_constraints.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/types/test_encoding.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/validate/__init__.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/validate/data.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/validate/test_changeset.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/validate/test_data_rules.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/validate/test_schema_rules.py +0 -0
- {lorebase_core-0.3.0 → lorebase_core-0.4.0}/tests/validate/test_vault_rules.py +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Antonio Antenore
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: lorebase-core
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Lorebase core: pure domain logic and versioning engine
|
|
5
|
+
Project-URL: Homepage, https://github.com/aantenore/lorebase
|
|
6
|
+
Project-URL: Documentation, https://aantenore.github.io/lorebase/
|
|
7
|
+
Project-URL: Repository, https://github.com/aantenore/lorebase
|
|
8
|
+
Project-URL: Changelog, https://github.com/aantenore/lorebase/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/aantenore/lorebase/issues
|
|
10
|
+
Author: Antonio Antenore
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: knowledge-graph,mcp,ontology,postgres,versioning
|
|
14
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Database
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Requires-Dist: cel-python>=0.5
|
|
23
|
+
Requires-Dist: google-re2>=1.1
|
|
24
|
+
Requires-Dist: pydantic>=2.7
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# lorebase-core
|
|
29
|
+
|
|
30
|
+
Part of [Lorebase](https://github.com/aantenore/lorebase), an open-source ontology platform: a versioned, governed knowledge graph on Postgres with git-like branching and three-way merge.
|
|
31
|
+
|
|
32
|
+
The domain logic of Lorebase: the ontology model, schema validation, the versioning engine (commits, branches and three-way merge) and the expression evaluation. It has no I/O; the other packages build on it.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pip install lorebase-core
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
It is a library of the other Lorebase packages and has no command of its own.
|
|
39
|
+
|
|
40
|
+
Documentation: [Design](https://aantenore.github.io/lorebase/design/) and the [documentation site](https://aantenore.github.io/lorebase/). License: Apache-2.0.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# lorebase-core
|
|
2
|
+
|
|
3
|
+
Part of [Lorebase](https://github.com/aantenore/lorebase), an open-source ontology platform: a versioned, governed knowledge graph on Postgres with git-like branching and three-way merge.
|
|
4
|
+
|
|
5
|
+
The domain logic of Lorebase: the ontology model, schema validation, the versioning engine (commits, branches and three-way merge) and the expression evaluation. It has no I/O; the other packages build on it.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pip install lorebase-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
It is a library of the other Lorebase packages and has no command of its own.
|
|
12
|
+
|
|
13
|
+
Documentation: [Design](https://aantenore.github.io/lorebase/design/) and the [documentation site](https://aantenore.github.io/lorebase/). License: Apache-2.0.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "lorebase-core"
|
|
3
|
+
version = "0.4.0"
|
|
4
|
+
description = "Lorebase core: pure domain logic and versioning engine"
|
|
5
|
+
requires-python = ">=3.12"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Antonio Antenore" }]
|
|
10
|
+
keywords = ["ontology", "knowledge-graph", "mcp", "postgres", "versioning"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Topic :: Database",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"cel-python>=0.5",
|
|
22
|
+
"google-re2>=1.1",
|
|
23
|
+
"pydantic>=2.7",
|
|
24
|
+
"pyyaml>=6.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/aantenore/lorebase"
|
|
29
|
+
Documentation = "https://aantenore.github.io/lorebase/"
|
|
30
|
+
Repository = "https://github.com/aantenore/lorebase"
|
|
31
|
+
Changelog = "https://github.com/aantenore/lorebase/blob/main/CHANGELOG.md"
|
|
32
|
+
Issues = "https://github.com/aantenore/lorebase/issues"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["hatchling>=1.27"]
|
|
36
|
+
build-backend = "hatchling.build"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.wheel]
|
|
39
|
+
packages = ["src/lorebase_core"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.0"
|
|
@@ -7,10 +7,12 @@ from lorebase_core.merge.conflicts import (
|
|
|
7
7
|
AutoResolution,
|
|
8
8
|
Conflict,
|
|
9
9
|
ConflictKind,
|
|
10
|
+
ConflictProvenance,
|
|
10
11
|
Resolution,
|
|
11
12
|
ResolutionChoice,
|
|
12
13
|
ResolutionError,
|
|
13
14
|
Side,
|
|
15
|
+
SideProvenance,
|
|
14
16
|
UnresolvedConflictsError,
|
|
15
17
|
conflict_fingerprint,
|
|
16
18
|
)
|
|
@@ -59,6 +61,7 @@ __all__ = [
|
|
|
59
61
|
"ChangeStamp",
|
|
60
62
|
"Conflict",
|
|
61
63
|
"ConflictKind",
|
|
64
|
+
"ConflictProvenance",
|
|
62
65
|
"InMemoryObjectStore",
|
|
63
66
|
"IndexViewFactory",
|
|
64
67
|
"LineageLoader",
|
|
@@ -77,6 +80,7 @@ __all__ = [
|
|
|
77
80
|
"ResolutionError",
|
|
78
81
|
"SchemaLoader",
|
|
79
82
|
"Side",
|
|
83
|
+
"SideProvenance",
|
|
80
84
|
"TextGranularity",
|
|
81
85
|
"TreeIndexView",
|
|
82
86
|
"UnresolvedConflictsError",
|
|
@@ -24,10 +24,12 @@ __all__ = [
|
|
|
24
24
|
"AutoResolution",
|
|
25
25
|
"Conflict",
|
|
26
26
|
"ConflictKind",
|
|
27
|
+
"ConflictProvenance",
|
|
27
28
|
"Resolution",
|
|
28
29
|
"ResolutionChoice",
|
|
29
30
|
"ResolutionError",
|
|
30
31
|
"Side",
|
|
32
|
+
"SideProvenance",
|
|
31
33
|
"UnresolvedConflictsError",
|
|
32
34
|
"conflict_fingerprint",
|
|
33
35
|
]
|
|
@@ -169,6 +171,32 @@ class _Frozen(BaseModel):
|
|
|
169
171
|
model_config = ConfigDict(frozen=True, extra="forbid")
|
|
170
172
|
|
|
171
173
|
|
|
174
|
+
class SideProvenance(_Frozen):
|
|
175
|
+
"""Who or what last changed the Attribute of a Conflict on one side, and when.
|
|
176
|
+
|
|
177
|
+
``provenance_id`` names the provenance entry of that change and ``at`` its time (ISO 8601,
|
|
178
|
+
timezone aware). ``actor`` wrote the entry; ``origin`` is its origin type (``source_sync``,
|
|
179
|
+
``operation``, ``extraction``, ...); ``source`` is the Source id of a Source sync and
|
|
180
|
+
``principal`` the principal of an Operation. ``labels`` are the origin labels an
|
|
181
|
+
``authority`` ranking matches, sorted.
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
provenance_id: str
|
|
185
|
+
at: str
|
|
186
|
+
actor: str | None = None
|
|
187
|
+
origin: str | None = None
|
|
188
|
+
source: str | None = None
|
|
189
|
+
principal: str | None = None
|
|
190
|
+
labels: tuple[str, ...] = ()
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class ConflictProvenance(_Frozen):
|
|
194
|
+
"""The provenance of the two competing sides; a side whose Lineage is unknown is ``None``."""
|
|
195
|
+
|
|
196
|
+
ours: SideProvenance | None = None
|
|
197
|
+
theirs: SideProvenance | None = None
|
|
198
|
+
|
|
199
|
+
|
|
172
200
|
class Conflict(_Frozen):
|
|
173
201
|
"""One Conflict of a merge attempt.
|
|
174
202
|
|
|
@@ -177,7 +205,10 @@ class Conflict(_Frozen):
|
|
|
177
205
|
Conflicts and a dotted property path for schema Conflicts. ``base``, ``ours`` and
|
|
178
206
|
``theirs`` hold the competing values (``None`` means absent) and the ``*_hash`` fields the
|
|
179
207
|
hashes of the elements they come from. Grouped Conflicts carry ``count`` members and a
|
|
180
|
-
``sample`` of their keys.
|
|
208
|
+
``sample`` of their keys. ``provenance`` says who or what changed each side and when: it is
|
|
209
|
+
set on open Attribute Conflicts (``DV1``, ``DV3``) when the merge has a Lineage loader and
|
|
210
|
+
knows the Lineage of at least one side, and ``None`` otherwise. It is not part of the
|
|
211
|
+
fingerprint.
|
|
181
212
|
"""
|
|
182
213
|
|
|
183
214
|
kind: ConflictKind
|
|
@@ -197,6 +228,7 @@ class Conflict(_Frozen):
|
|
|
197
228
|
details: dict[str, JsonValue] = Field(default_factory=dict)
|
|
198
229
|
choices: tuple[ResolutionChoice, ...] = ()
|
|
199
230
|
machine_resolvable: bool = False
|
|
231
|
+
provenance: ConflictProvenance | None = None
|
|
200
232
|
|
|
201
233
|
@property
|
|
202
234
|
def grouped(self) -> bool:
|
|
@@ -133,16 +133,22 @@ class MergeInput:
|
|
|
133
133
|
|
|
134
134
|
class MergeResult(StrEnum):
|
|
135
135
|
UP_TO_DATE = "up_to_date"
|
|
136
|
-
"""Theirs is already contained in ours: the target does not change.
|
|
136
|
+
"""Theirs is already contained in ours: the target does not change. ``root`` is ours and
|
|
137
|
+
``parents`` is ``(ours,)``."""
|
|
137
138
|
FAST_FORWARD = "fast_forward"
|
|
138
|
-
"""The target moves to theirs.
|
|
139
|
+
"""The target moves to theirs. ``root`` is theirs' tree. A caller that moves the ref to
|
|
140
|
+
``theirs`` writes nothing; one that commits ``root`` as returned gets a Revision whose only
|
|
141
|
+
parent is ours, so history stays connected."""
|
|
139
142
|
MERGED = "merged"
|
|
140
143
|
"""A merge Revision with parents ``(ours, theirs)`` is to be written."""
|
|
141
144
|
|
|
142
145
|
|
|
143
146
|
@dataclass(frozen=True)
|
|
144
147
|
class MergedTree:
|
|
145
|
-
"""A clean merge: the new tree and its changeset against ours (the first parent).
|
|
148
|
+
"""A clean merge: the new tree and its changeset against ours (the first parent).
|
|
149
|
+
|
|
150
|
+
``parents`` is never empty: ``(ours, theirs)`` for a merge, ``(ours,)`` for a fast-forward
|
|
151
|
+
or an up-to-date result, so committing ``root`` with ``parents`` never writes a root."""
|
|
146
152
|
|
|
147
153
|
result: MergeResult
|
|
148
154
|
root: bytes
|
|
@@ -286,7 +292,7 @@ class _Engine:
|
|
|
286
292
|
theirs=merge_input.theirs,
|
|
287
293
|
base=base,
|
|
288
294
|
virtual_base=False,
|
|
289
|
-
parents=(),
|
|
295
|
+
parents=(merge_input.ours,),
|
|
290
296
|
changes=(),
|
|
291
297
|
stats=changeset_stats(()),
|
|
292
298
|
)
|
|
@@ -304,7 +310,7 @@ class _Engine:
|
|
|
304
310
|
theirs=merge_input.theirs,
|
|
305
311
|
base=base,
|
|
306
312
|
virtual_base=False,
|
|
307
|
-
parents=(),
|
|
313
|
+
parents=(merge_input.ours,),
|
|
308
314
|
changes=changes,
|
|
309
315
|
stats=changeset_stats(changes),
|
|
310
316
|
)
|
|
@@ -17,10 +17,12 @@ from lorebase_core.merge.conflicts import (
|
|
|
17
17
|
AutoResolution,
|
|
18
18
|
Conflict,
|
|
19
19
|
ConflictKind,
|
|
20
|
+
ConflictProvenance,
|
|
20
21
|
Resolution,
|
|
21
22
|
ResolutionChoice,
|
|
22
23
|
ResolutionError,
|
|
23
24
|
Side,
|
|
25
|
+
SideProvenance,
|
|
24
26
|
conflict_fingerprint,
|
|
25
27
|
)
|
|
26
28
|
from lorebase_core.merge.objects import ObjectStore, SchemaLoader, load_object
|
|
@@ -370,7 +372,25 @@ class Context:
|
|
|
370
372
|
|
|
371
373
|
def report(self, conflict: Conflict) -> None:
|
|
372
374
|
if not self.virtual:
|
|
373
|
-
self.conflicts.append(conflict)
|
|
375
|
+
self.conflicts.append(self.with_provenance(conflict))
|
|
376
|
+
|
|
377
|
+
def with_provenance(self, conflict: Conflict) -> Conflict:
|
|
378
|
+
"""``conflict`` with who and when of each side, when a Lineage loader knows them.
|
|
379
|
+
|
|
380
|
+
Only Attribute Conflicts have a last change per side; without a loader, or when it
|
|
381
|
+
knows neither side, the Conflict is returned as it is.
|
|
382
|
+
"""
|
|
383
|
+
if self.lineage is None or conflict.kind not in _ATTRIBUTE_KINDS:
|
|
384
|
+
return conflict
|
|
385
|
+
ours = self.lineage_entry(Side.OURS, conflict)
|
|
386
|
+
theirs = self.lineage_entry(Side.THEIRS, conflict)
|
|
387
|
+
if ours is None and theirs is None:
|
|
388
|
+
return conflict
|
|
389
|
+
provenance = ConflictProvenance(
|
|
390
|
+
ours=None if ours is None else _side_provenance(ours),
|
|
391
|
+
theirs=None if theirs is None else _side_provenance(theirs),
|
|
392
|
+
)
|
|
393
|
+
return conflict.model_copy(update={"provenance": provenance})
|
|
374
394
|
|
|
375
395
|
def group(
|
|
376
396
|
self,
|
|
@@ -431,6 +451,20 @@ class Context:
|
|
|
431
451
|
return (values[0], values[1], values[2])
|
|
432
452
|
|
|
433
453
|
|
|
454
|
+
def _side_provenance(stamp: ChangeStamp) -> SideProvenance:
|
|
455
|
+
labels = sorted(stamp.labels)
|
|
456
|
+
named = dict(label.split(":", 1) for label in labels)
|
|
457
|
+
return SideProvenance(
|
|
458
|
+
provenance_id=stamp.id,
|
|
459
|
+
at=stamp.at.isoformat(),
|
|
460
|
+
actor=named.get("actor"),
|
|
461
|
+
origin=named.get("origin"),
|
|
462
|
+
source=named.get("source"),
|
|
463
|
+
principal=named.get("principal"),
|
|
464
|
+
labels=tuple(labels),
|
|
465
|
+
)
|
|
466
|
+
|
|
467
|
+
|
|
434
468
|
def other_side(side: Side) -> Side:
|
|
435
469
|
return Side.THEIRS if side is Side.OURS else Side.OURS
|
|
436
470
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""A fast-forward result committed as returned keeps the history connected."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from lorebase_core.merge import ConflictKind, MergeResult
|
|
6
|
+
|
|
7
|
+
from .support import Edit, Repo, attempt, base_records, base_schema, merged, supplier
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _fork() -> tuple[Repo, bytes, bytes, bytes]:
|
|
11
|
+
repo = Repo()
|
|
12
|
+
base = repo.commit("base", Edit(schema=base_schema(), put=list(base_records())))
|
|
13
|
+
source = repo.commit("source", Edit().upsert(supplier("S-1", vat="IT001", rating="4")), base)
|
|
14
|
+
model = repo.commit("model", Edit().upsert(supplier("S-1", vat="IT001", rating="5")), base)
|
|
15
|
+
return repo, base, source, model
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_fast_forward_commit_stays_connected_to_the_target() -> None:
|
|
19
|
+
repo, base, source, model = _fork()
|
|
20
|
+
forward = merged(repo.merge(base, source))
|
|
21
|
+
assert forward.result is MergeResult.FAST_FORWARD
|
|
22
|
+
assert forward.root == repo.roots[source]
|
|
23
|
+
assert forward.parents == (base,)
|
|
24
|
+
|
|
25
|
+
head = repo.add("main", forward.root, *forward.parents)
|
|
26
|
+
result = attempt(repo.merge(head, model))
|
|
27
|
+
assert result.base == base
|
|
28
|
+
assert [c.kind for c in result.conflicts] == [ConflictKind.ATTRIBUTE_VALUE]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_up_to_date_result_keeps_the_target_as_parent() -> None:
|
|
32
|
+
repo, base, source, _ = _fork()
|
|
33
|
+
same = merged(repo.merge(source, base))
|
|
34
|
+
assert same.result is MergeResult.UP_TO_DATE
|
|
35
|
+
assert same.parents == (source,)
|
|
@@ -197,6 +197,67 @@ def test_schema_authority_ranks_the_attribute_source_first() -> None:
|
|
|
197
197
|
assert result.auto_resolutions[0].choice is ResolutionChoice.THEIRS
|
|
198
198
|
|
|
199
199
|
|
|
200
|
+
# provenance of open Conflicts ---------------------------------------------------------------
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def test_open_conflicts_carry_who_and_when_of_each_side() -> None:
|
|
204
|
+
scenario = _conflicting()
|
|
205
|
+
loader = lineage(scenario, *_both(edit(1, "alice", T2), sync(2, ERP, T1)))
|
|
206
|
+
result = attempt(scenario.merge(lineage=loader))
|
|
207
|
+
assert {c.attribute for c in result.conflicts} == {NAME, COUNTRY}
|
|
208
|
+
for conflict in result.conflicts:
|
|
209
|
+
provenance = conflict.provenance
|
|
210
|
+
assert provenance is not None
|
|
211
|
+
ours, theirs = provenance.ours, provenance.theirs
|
|
212
|
+
assert ours is not None
|
|
213
|
+
assert theirs is not None
|
|
214
|
+
assert (ours.provenance_id, ours.at) == (ident("prv", 1), "2026-03-02T10:00:00+00:00")
|
|
215
|
+
assert (ours.actor, ours.origin, ours.principal, ours.source) == (
|
|
216
|
+
"alice",
|
|
217
|
+
"operation",
|
|
218
|
+
"alice",
|
|
219
|
+
None,
|
|
220
|
+
)
|
|
221
|
+
assert (theirs.provenance_id, theirs.at) == (ident("prv", 2), "2026-03-01T10:00:00+00:00")
|
|
222
|
+
assert (theirs.actor, theirs.origin, theirs.principal, theirs.source) == (
|
|
223
|
+
"scribe",
|
|
224
|
+
"source_sync",
|
|
225
|
+
None,
|
|
226
|
+
ERP,
|
|
227
|
+
)
|
|
228
|
+
assert theirs.labels == tuple(sorted(origin_labels(sync(2, ERP, T1))))
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def test_open_conflicts_without_a_lineage_loader_carry_no_provenance() -> None:
|
|
232
|
+
scenario = _conflicting()
|
|
233
|
+
result = attempt(scenario.merge())
|
|
234
|
+
assert [c.provenance for c in result.conflicts] == [None, None]
|
|
235
|
+
assert "provenance" not in {
|
|
236
|
+
name for c in result.conflicts for name in c.model_dump(exclude_none=True)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def test_a_side_of_unknown_lineage_is_left_out() -> None:
|
|
241
|
+
scenario = _conflicting()
|
|
242
|
+
one_sided = lineage(scenario, {}, {NAME: sync(2, ERP, T1)})
|
|
243
|
+
result = attempt(scenario.merge(lineage=one_sided))
|
|
244
|
+
by_attribute = {c.attribute: c.provenance for c in result.conflicts}
|
|
245
|
+
assert by_attribute[COUNTRY] is None
|
|
246
|
+
named = by_attribute[NAME]
|
|
247
|
+
assert named is not None
|
|
248
|
+
assert named.ours is None
|
|
249
|
+
assert named.theirs is not None
|
|
250
|
+
assert named.theirs.source == ERP
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def test_provenance_does_not_change_the_fingerprint() -> None:
|
|
254
|
+
scenario = _conflicting()
|
|
255
|
+
loader = lineage(scenario, *_both(edit(1, "alice", T2), sync(2, ERP, T1)))
|
|
256
|
+
plain = attempt(scenario.merge())
|
|
257
|
+
stamped = attempt(scenario.merge(lineage=loader))
|
|
258
|
+
assert [c.fingerprint for c in stamped.conflicts] == [c.fingerprint for c in plain.conflicts]
|
|
259
|
+
|
|
260
|
+
|
|
200
261
|
# newest_wins ------------------------------------------------------------------------------
|
|
201
262
|
|
|
202
263
|
|
|
@@ -140,7 +140,7 @@ def test_fast_forward_detection(world: World, allowed: bool) -> None:
|
|
|
140
140
|
assert forward.root == repo.roots[descendant]
|
|
141
141
|
if allowed:
|
|
142
142
|
assert forward.result is MergeResult.FAST_FORWARD
|
|
143
|
-
assert forward.parents == ()
|
|
143
|
+
assert forward.parents == (ours,)
|
|
144
144
|
else:
|
|
145
145
|
assert forward.result is MergeResult.MERGED
|
|
146
146
|
assert forward.parents == (ours, descendant)
|
lorebase_core-0.3.0/PKG-INFO
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: lorebase-core
|
|
3
|
-
Version: 0.3.0
|
|
4
|
-
Summary: Lorebase core: pure domain logic and versioning engine
|
|
5
|
-
Requires-Python: >=3.12
|
|
6
|
-
Requires-Dist: cel-python>=0.5
|
|
7
|
-
Requires-Dist: google-re2>=1.1
|
|
8
|
-
Requires-Dist: pydantic>=2.7
|
|
9
|
-
Requires-Dist: pyyaml>=6.0
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "lorebase-core"
|
|
3
|
-
version = "0.3.0"
|
|
4
|
-
description = "Lorebase core: pure domain logic and versioning engine"
|
|
5
|
-
requires-python = ">=3.12"
|
|
6
|
-
dependencies = [
|
|
7
|
-
"cel-python>=0.5",
|
|
8
|
-
"google-re2>=1.1",
|
|
9
|
-
"pydantic>=2.7",
|
|
10
|
-
"pyyaml>=6.0",
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
[build-system]
|
|
14
|
-
requires = ["hatchling"]
|
|
15
|
-
build-backend = "hatchling.build"
|
|
16
|
-
|
|
17
|
-
[tool.hatch.build.targets.wheel]
|
|
18
|
-
packages = ["src/lorebase_core"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|