46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from k1link.observatory.composition_runs import CompositionRunStore
|
|
from k1link.observatory.modular_composition import COMPOSITION_SCHEMA, ModuleRegistry
|
|
|
|
|
|
def test_operator_projection_can_be_renamed_and_hidden_without_changing_run(tmp_path: Path) -> None:
|
|
registry = ModuleRegistry.from_file(
|
|
Path(__file__).parents[1] / "config" / "observatory-ai-modules.json"
|
|
)
|
|
module = next(item for item in registry.modules if item.module_id == "tgs")
|
|
composition = registry.compose(
|
|
{
|
|
"schema_version": COMPOSITION_SCHEMA,
|
|
"selections": [
|
|
{
|
|
"group": module.group,
|
|
"module_id": module.module_id,
|
|
"module_sha256": module.sha256,
|
|
"parameters": {},
|
|
}
|
|
],
|
|
}
|
|
)
|
|
store = CompositionRunStore(tmp_path / "runs")
|
|
run = store.save(
|
|
source_session_id="source-1",
|
|
composition=composition,
|
|
setup_ids=("setup-1",),
|
|
job_ids=("job-1",),
|
|
idempotency_key="run-1",
|
|
created_at_utc="2026-09-04T12:00:00.000Z",
|
|
)
|
|
|
|
assert store.display_name(run.run_id) is None
|
|
assert store.list(source_session_id="source-1", include_hidden=False) == (run,)
|
|
assert store.rename_projection(run.run_id, " Маршрут у школы ") == "Маршрут у школы"
|
|
assert store.display_name(run.run_id) == "Маршрут у школы"
|
|
|
|
store.delete_projection(run.run_id)
|
|
assert store.list(source_session_id="source-1", include_hidden=False) == ()
|
|
assert store.list(source_session_id="source-1") == (run,)
|
|
assert store.get(run.run_id) == run
|