test(dashboard-testing): author current structural editor prerequisites
This commit is contained in:
@@ -23,6 +23,7 @@ from src.core.database import get_db
|
||||
from src.dependencies import get_current_user
|
||||
from src.models.auth import Permission, Role, User
|
||||
from src.models.scenario_registry import ScenarioRegistryEntry, ScenarioRevision
|
||||
from tests.admitted_metric_fixture import literal_graph
|
||||
from tests.services.dashboard_testing.registry.editor_canonical_base import canonicalize_base_graph
|
||||
|
||||
_FIXTURE_PATH = (
|
||||
@@ -31,6 +32,8 @@ _FIXTURE_PATH = (
|
||||
|
||||
_SCENARIO_ID = "11111111-1111-4111-8111-111111111111"
|
||||
_BASE_REVISION_ID = "22222222-2222-4222-8222-222222222222"
|
||||
# Structural graph for editor/RBAC tests only, not a publication or execution grant.
|
||||
_CURRENT_GRAPH = literal_graph()
|
||||
|
||||
|
||||
def _parse_ts(value: str | None) -> datetime | None:
|
||||
@@ -82,7 +85,7 @@ def _seed_registry(session) -> None:
|
||||
activated_at=_parse_ts(row.get("activated_at")),
|
||||
activation_agent_action_id=row.get("activation_agent_action_id"),
|
||||
))
|
||||
canonicalize_base_graph(session)
|
||||
canonicalize_base_graph(session, current_graph=_CURRENT_GRAPH.scenario)
|
||||
session.commit()
|
||||
|
||||
|
||||
@@ -152,9 +155,9 @@ def _propose_payload():
|
||||
"request_text": "add XLSX comparison",
|
||||
"ops": [{
|
||||
"op": "set_assertion",
|
||||
"logical_step_id": "phase-1-B01-apply_filters",
|
||||
"comparison": "exact",
|
||||
"baseline_ref": "baseline:phase-1-B01-apply_filters",
|
||||
"logical_step_id": _CURRENT_GRAPH.binding.comparison_step_id,
|
||||
"comparison": "chart_response",
|
||||
"baseline_ref": f"baseline:{_CURRENT_GRAPH.selection.baseline_id}",
|
||||
}],
|
||||
"agent_action_id": "agent-action-1",
|
||||
}
|
||||
@@ -198,7 +201,7 @@ class TestAgentProposeRoutes:
|
||||
payload["ops"] = [{
|
||||
"op": "set_assertion",
|
||||
"logical_step_id": "step-1",
|
||||
"comparison": "exact",
|
||||
"comparison": "chart_response",
|
||||
"baseline_ref": "baseline:SELECT * FROM users",
|
||||
}]
|
||||
resp = editor_route_env.client(permissions=[("scenario", "EDIT")]).post(
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# schema_version/compiler_version/scenario_id/revision_hash/objective/phases shape, so
|
||||
# the strict editor path refuses it with "canonical graph does not satisfy its declared
|
||||
# schema" instead of exercising the edit it is asked to perform.
|
||||
# @INVARIANT Only the fields the canonical schema requires are supplied; the fixture's own identity
|
||||
# @INVARIANT The default supplies only the fields the canonical schema requires; the fixture's own identity
|
||||
# (scenario_id, revision_hash, compiler_version) and every field a test sets before the
|
||||
# edit are preserved, so a test that pre-seeds context_authority still sees it.
|
||||
# @REJECTED Rewriting the shared tests/fixtures/scenario_registry/registry.json in place was
|
||||
@@ -22,7 +22,10 @@
|
||||
# coverage honest until then without touching either of them.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from src.services.dashboard_testing.scenario.models import DashboardTestScenario
|
||||
|
||||
CANONICAL_BASE_REVISION_ID = "22222222-2222-4222-8222-222222222222"
|
||||
CANONICAL_BASE_SCENARIO_ID = "11111111-1111-4111-8111-111111111111"
|
||||
@@ -65,11 +68,17 @@ CANONICAL_BASE_FIELDS: dict[str, Any] = {
|
||||
|
||||
|
||||
# #region Test.ScenarioEditor.CanonicalBaseGraph.Canonicalize [C:2] [TYPE Function]
|
||||
# @POST The base revision snapshot satisfies the canonical schema; every pre-existing field survives.
|
||||
def canonicalize_base_graph(db, revision_id: str = CANONICAL_BASE_REVISION_ID) -> None:
|
||||
# @POST Default fixture behavior is unchanged; an explicit graph replaces structural fields while registered identity/envelope survives.
|
||||
# @RATIONALE Current assertion editor lifecycle guards need an already-bound current graph, without granting runtime admission.
|
||||
# @REJECTED Invented predicates or erased descriptions cannot manufacture evidence of a meaningful comparison-policy edit.
|
||||
def canonicalize_base_graph(db, revision_id: str = CANONICAL_BASE_REVISION_ID, *,
|
||||
current_graph: DashboardTestScenario | None = None) -> None:
|
||||
from src.models.scenario_registry import ScenarioRevision
|
||||
|
||||
revision = db.query(ScenarioRevision).filter_by(revision_id=revision_id).one()
|
||||
revision.graph_snapshot = {**(revision.graph_snapshot or {}), **CANONICAL_BASE_FIELDS}
|
||||
fields = CANONICAL_BASE_FIELDS if current_graph is None else current_graph.model_dump(
|
||||
mode="json", exclude={"scenario_id", "revision_hash", "parent_revision_hash"}
|
||||
)
|
||||
revision.graph_snapshot = {**(revision.graph_snapshot or {}), **fields}
|
||||
# #endregion Test.ScenarioEditor.CanonicalBaseGraph.Canonicalize
|
||||
# #endregion Test.ScenarioEditor.CanonicalBaseGraph
|
||||
|
||||
@@ -11,23 +11,26 @@ import pytest
|
||||
|
||||
from src.models.scenario_registry import ScenarioEditProposal, ScenarioRegistryEntry, ScenarioRevision
|
||||
from src.services.dashboard_testing.editor.agent import agent_propose, save_proposal
|
||||
from tests.admitted_metric_fixture import literal_graph
|
||||
from tests.services.dashboard_testing.registry.editor_canonical_base import canonicalize_base_graph
|
||||
|
||||
_SCENARIO_ID = "11111111-1111-4111-8111-111111111111"
|
||||
_BASE_REVISION_ID = "22222222-2222-4222-8222-222222222222"
|
||||
# Structural editor input only; no persisted publication or runtime admission is claimed.
|
||||
_CURRENT_GRAPH = literal_graph()
|
||||
|
||||
|
||||
def _ops():
|
||||
return [{
|
||||
"op": "set_assertion",
|
||||
"logical_step_id": "phase-1-B01-apply_filters",
|
||||
"comparison": "exact",
|
||||
"baseline_ref": "baseline:phase-1-B01-apply_filters",
|
||||
"logical_step_id": _CURRENT_GRAPH.binding.comparison_step_id,
|
||||
"comparison": "chart_response",
|
||||
"baseline_ref": f"baseline:{_CURRENT_GRAPH.selection.baseline_id}",
|
||||
}]
|
||||
|
||||
|
||||
def _propose(db, **overrides):
|
||||
canonicalize_base_graph(db)
|
||||
canonicalize_base_graph(db, current_graph=_CURRENT_GRAPH.scenario)
|
||||
kwargs = {
|
||||
"scenario_id": _SCENARIO_ID,
|
||||
"base_revision_id": _BASE_REVISION_ID,
|
||||
@@ -61,7 +64,7 @@ def test_agent_propose_rejects_unsafe_ops(seeded_registry):
|
||||
_propose(seeded_registry, operations=[{
|
||||
"op": "set_assertion",
|
||||
"logical_step_id": "step-1",
|
||||
"comparison": "exact",
|
||||
"comparison": "chart_response",
|
||||
"baseline_ref": "baseline:SELECT * FROM users",
|
||||
}])
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@ from src.services.dashboard_testing.editor.ops import SetAssertionOp, SetDepende
|
||||
def test_assertion_requires_approved_baseline():
|
||||
with pytest.raises(ValueError, match="approved baseline"):
|
||||
validate_assertion(SetAssertionOp(
|
||||
op="set_assertion", logical_step_id="step-1", comparison="exact", baseline_ref="raw:123",
|
||||
op="set_assertion", logical_step_id="step-1", comparison="chart_response", baseline_ref="raw:123",
|
||||
))
|
||||
|
||||
|
||||
def test_sql_assertion_is_rejected():
|
||||
with pytest.raises(ValueError, match="unsafe"):
|
||||
validate_assertion(SetAssertionOp(
|
||||
op="set_assertion", logical_step_id="step-1", comparison="exact",
|
||||
baseline_ref="baseline:step-1", threshold=None,
|
||||
op="set_assertion", logical_step_id="step-1", comparison="chart_response",
|
||||
baseline_ref="baseline:step-1",
|
||||
).model_copy(update={"baseline_ref": "baseline:SELECT * FROM users"}))
|
||||
|
||||
|
||||
|
||||
@@ -10,25 +10,28 @@ import pytest
|
||||
|
||||
from src.models.scenario_registry import ScenarioRegistryEntry
|
||||
from src.services.dashboard_testing.editor.save import create_working_draft, save_revision
|
||||
from tests.admitted_metric_fixture import literal_graph
|
||||
from tests.services.dashboard_testing.registry.editor_canonical_base import (
|
||||
BASE_STEP_ID,
|
||||
CANONICAL_BASE_REVISION_ID,
|
||||
CANONICAL_BASE_SCENARIO_ID,
|
||||
canonicalize_base_graph,
|
||||
)
|
||||
|
||||
# Structural editor input only; the operation reasserts its existing exact baseline pin.
|
||||
_CURRENT_GRAPH = literal_graph()
|
||||
|
||||
|
||||
def _ops():
|
||||
return [{
|
||||
"op": "set_assertion",
|
||||
"logical_step_id": BASE_STEP_ID,
|
||||
"comparison": "exact",
|
||||
"baseline_ref": f"baseline:{BASE_STEP_ID}",
|
||||
"logical_step_id": _CURRENT_GRAPH.binding.comparison_step_id,
|
||||
"comparison": "chart_response",
|
||||
"baseline_ref": f"baseline:{_CURRENT_GRAPH.selection.baseline_id}",
|
||||
}]
|
||||
|
||||
|
||||
def _draft(db):
|
||||
canonicalize_base_graph(db)
|
||||
canonicalize_base_graph(db, current_graph=_CURRENT_GRAPH.scenario)
|
||||
return create_working_draft(
|
||||
db,
|
||||
CANONICAL_BASE_SCENARIO_ID,
|
||||
|
||||
@@ -1007,4 +1007,10 @@ Separate three-path test cut authors current dispatched top-level logical_step_i
|
||||
|
||||
Actual dedicated PostgreSQL clone catalog_fixture_classes_20261011 came from pristine catalog_final_linear0038_20261010 only after read-only donor head0039,144 application tables0rows, quota/claimed-pair consistency (0pairs) and no donor sessions. No migration/counter repair/stand action. Clone receipt33a9f4a807e9142eb724cfc086f3b508eee13a146e53843787cea3cc2b5c9fa9, private0600 configfixture-classes-connection.json. Scoped provider run157:three committed modules142 PASS all stages; fourth superset module first3PASS/12 DTO fixture failures. Its explicit absent-native-config prerequisite then12 recheck3PASS/9 actual CHART_RESPONSE_OWNED_OBSERVATION_REQUIRED failures, retained privately; that fourth path is NOT in this green commit. Provider summary0dcfc445a46dcd32d3fccba33ac146c38f7974436db760ef2f2d8615757526b3; affected summary6cae225ee009be984acab61b14b0ea14c00f607c6dfec76e2f97c565b6121e5c/wiref92dd87b408dbccf301c03b0187ca6e0fc59b70578f9a2887ed75727ec569954. Every setup/teardown PASS, post quotas0/leases0. These are fixture prerequisites, not closure of SDK authority. N120/ONE347 unchanged; D17 stop ASIS remains.
|
||||
|
||||
### 2026-10-11 — current structural editor prerequisites, idempotent coverage
|
||||
|
||||
Five-path fixture cut keeps canonicalize_base_graph default unchanged; optional typed current_graph copies only explicit structural fields and retains registered scenario/revision/parent identity and envelope. Existing literal_graph is structural input, not actual_metric_fixture, a persisted publication or runtime grant. Four editor owners author current chart_response and exact declared comparison/baseline identity; obsolete threshold=None is removed. All old ast.Assert, pytest.raises and Mock.assert_* sequences independently match HEAD. No invented predicate or description edit manufactures a meaningful diff.
|
||||
|
||||
First22-node attempt10PASS/12 CHART_RESPONSE_ASSERTION_PIN_REQUIRED failures retained; after explicit current v2 structural prerequisite22 setup/call/teardown PASS. Evidence editor-fixture-classes-current summarycf77d93b35059d36e400cdc706fba9b90783b74c4a9d81f02a254342a5ba98eb, Molecular8569683bf9c4ff2dea2876a8eda95d9dc1296e8b25e30e02c7a538edc017db4a, JUnit85ffcb2c06dfb8e0140e9d5953119ae067b3a1bca2ea5fa1136ede3dcbb4c5e9. Actual nine proposal REFLECT events correlate; no fabricated negative event. Dedicated PG post quota0/leases0, default Ruff/compile/diff PASS. This preserves idempotent proposal/save, ACL, digest and provenance guards; meaningful operator/threshold editing and nonempty graph diff remain an explicit live SCEDIT feature gap. Existing diff assertions check keys, not nonempty values. N120/ONE347 unchanged; no accounting expansion, runtime reload or D17 image action.
|
||||
|
||||
## @} Stage2.ChartTypeStabilizationJournal20261010
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
[Единый список347](2026-10-10-deleted-test-accounting.md#one-combined-pending-withdrawal-list) условно утверждён владельцем: автоматическая проверка275 ссылок на сохраняющие проверки должна подтвердить их существование и успешность на итоговом коммите без ошибок учёта. До выполнения условия счётчик не закрываем. Проверяющий инструмент готов; условие ещё не выполнено на итоговом полном прогоне. Общие недоработки остаются открытыми; мерж запрещён.
|
||||
|
||||
- **Готово:** каталог PostgreSQL, разрешённый сброс лаборатории и миграции выполнены с сохранением защищённых данных и файлов. Доказательства привязаны к своим коммитам; миграции повторять не нужно. Обязательная запись операций провайдера и защита от конкурентного изменения проверены на PostgreSQL.
|
||||
- **Блокирует:** полный прогон на1e557782:4434 теста,4201 прошёл,166 упали при выполнении,66 при подготовке,1 пропущен; завершение без ошибок.232 ошибки разделены на52 наблюдаемые точки отказа, не52 доказанные первопричины. Заняты обе браузерные квоты, записей аренды нет; происхождение расхождения пока неизвестно. Счётчики вручную не исправлялись. Три группы fixture-предпосылок исправлены:142 целевые PostgreSQL-проверки прошли. Незавершены запросы через SDK и SQL, преобразование результатов, публикация и запуски по расписанию.
|
||||
- **Блокирует:** полный прогон на1e557782:4434 теста,4201 прошёл,166 упали при выполнении,66 при подготовке,1 пропущен; завершение без ошибок.232 ошибки разделены на52 наблюдаемые точки отказа, не52 доказанные первопричины. Заняты обе браузерные квоты, записей аренды нет; происхождение расхождения пока неизвестно. Счётчики вручную не исправлялись. Три группы fixture-предпосылок исправлены:142 целевые PostgreSQL-проверки прошли. Ещё22 проверки редактора прошли на текущем структурном графе: сохранение, права и digest; изменение оператора/порога этим не доказано. Незавершены запросы через SDK и SQL, преобразование результатов, публикация и запуски по расписанию.
|
||||
- **Решение владельца:** D17 больше не блокирует мерж. PNGd8c01a0d отклонён; прежний вопрос о пересъёмке снят. Не переснимать, не принимать, не подтверждать и не публиковать этот PNG. Готовая capture-механика сохранена:16 целевых локальных проверок, включая Chromium, прошли; это не приёмка visual baseline.
|
||||
- **Далее:** запретить visual comparison в обычном compile/run до внешних действий с точным кодом `VISUAL_COMPARISON_UPGRADE_MODE_ONLY`; исправить общие классы ошибок и получить свежий полный зелёный прогон. Выполнить через API график8: PASS→разрешённая когерентная мутация→FAIL с названной ячейкой→обязательное восстановление→PASS с тем же pin. Приложить снимок текущего запуска и VLM по объявленным критериям как рекомендацию, без эталона и самостоятельного PASS. Stage2(a/b/c) — после мержа в новой короткой ветке.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user