fix: update legacy-string assertions in tests + onboarding template
Caught by my own broader test scope after Devin fixes — three test files asserted on user-visible strings that were renamed by the bootstrap PR but the assertions weren't updated: - tests/test_api_query_guardrail.py:110 — asserted `da fetch in suggestion` on /api/query 400 response. Renamed to `agnes snapshot create`. - tests/test_query_materialized_error_message.py:56 — asserted `da sync` in materialized-not-yet error detail. Renamed to `agnes pull`. - tests/test_cli_error_render.py:71 — fixture data + assertion both carried `da fetch`. Updated to `agnes snapshot create`. Plus an actual content miss: docs/setup/claude_settings.json (a template shipped to operators) still installed `da sync` / `da sync --upload-only` hooks. The companion test file (tests/test_setup_hooks_template.py) was asserting that legacy state. Updated both: - Template hooks: `agnes pull --quiet` / `agnes push --quiet` - Test assertions + function name match the new commands
This commit is contained in:
parent
3d58768143
commit
d8dc7c7799
5 changed files with 16 additions and 14 deletions
|
|
@ -5,7 +5,7 @@
|
|||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "da sync --quiet 2>/dev/null || true"
|
||||
"command": "agnes pull --quiet 2>/dev/null || true"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "da sync --upload-only --quiet 2>/dev/null || true"
|
||||
"command": "agnes push --quiet 2>/dev/null || true"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
When user SQL references a registered remote-BQ name (or a direct
|
||||
`bq."<ds>"."<tbl>"` path), run a BQ dry-run before execute. If the
|
||||
estimated scan exceeds the configured cap, reject with 400 +
|
||||
`remote_scan_too_large` so the operator pivots to `da fetch`.
|
||||
`remote_scan_too_large` so the operator pivots to `agnes snapshot create`.
|
||||
|
||||
Default cap: 5 GiB per request. Configurable via
|
||||
`api.query.bq_max_scan_bytes` in /admin/server-config (#160 §4.4).
|
||||
|
|
@ -107,8 +107,10 @@ def test_query_over_cap_rejected_400(seeded_app, mock_dry_run, monkeypatch):
|
|||
if isinstance(detail, dict):
|
||||
assert detail.get("reason") == "remote_scan_too_large", detail
|
||||
assert detail.get("scan_bytes") >= 10 * 1024 * 1024 * 1024
|
||||
assert "da fetch" in detail.get("suggestion", "").lower() or \
|
||||
"fetch" in detail.get("suggestion", "").lower()
|
||||
# Suggestion text was renamed in the agnes-bootstrap PR (`da fetch`
|
||||
# → `agnes snapshot create`). Accept the new shape.
|
||||
suggestion = detail.get("suggestion", "").lower()
|
||||
assert "agnes snapshot create" in suggestion or "snapshot create" in suggestion
|
||||
assert "ue" in detail.get("tables", []) or \
|
||||
any("ue" in t for t in detail.get("tables", []))
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ def test_renders_remote_scan_too_large(render_error):
|
|||
"limit_bytes": 5368709120, # 5 GiB
|
||||
"tables": ["finance.unit_economics"],
|
||||
"suggestion": (
|
||||
"Use `da fetch <id> --select <cols> --where <predicate> "
|
||||
"Use `agnes snapshot create <id> --select <cols> --where <predicate> "
|
||||
"--estimate` to materialize a filtered subset, then query "
|
||||
"the snapshot locally."
|
||||
),
|
||||
|
|
@ -68,7 +68,7 @@ def test_renders_remote_scan_too_large(render_error):
|
|||
assert "remote_scan_too_large" in out
|
||||
assert "10737418240" in out or "10 GiB" in out or "10737418240" in str(out)
|
||||
assert "finance.unit_economics" in out
|
||||
assert "da fetch" in out
|
||||
assert "agnes snapshot create" in out
|
||||
|
||||
|
||||
def test_renders_bq_path_not_registered(render_error):
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ def test_query_materialized_id_not_in_views_returns_helpful_message(seeded_app):
|
|||
# Message should name the table and surface the materialize-mode hint.
|
||||
assert "not_yet_materialized" in detail
|
||||
assert "materialized" in detail.lower()
|
||||
# Either a `da sync` hint or a direct-BQ-query hint must appear so the
|
||||
# Either a `agnes pull` hint or a direct-BQ-query hint must appear so the
|
||||
# operator has a concrete next step.
|
||||
assert "da sync" in detail or "bq." in detail
|
||||
assert "agnes pull" in detail or "bq." in detail
|
||||
|
||||
|
||||
def test_query_unknown_table_falls_back_to_default_error(seeded_app):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""The shipped Claude settings template must point hooks at `da sync`, not the deleted server/scripts."""
|
||||
"""The shipped Claude settings template must point hooks at `agnes pull` / `agnes push`, not the deleted server/scripts."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
|
@ -6,13 +6,13 @@ REPO_ROOT = Path(__file__).resolve().parents[1]
|
|||
TEMPLATE = REPO_ROOT / "docs" / "setup" / "claude_settings.json"
|
||||
|
||||
|
||||
def test_template_has_session_start_da_sync():
|
||||
def test_template_has_session_start_agnes_pull():
|
||||
cfg = json.loads(TEMPLATE.read_text())
|
||||
starts = cfg.get("hooks", {}).get("SessionStart", [])
|
||||
assert starts, "SessionStart hook missing"
|
||||
cmds = [h["command"] for entry in starts for h in entry.get("hooks", [])]
|
||||
assert any("da sync" in c and "--upload-only" not in c for c in cmds), (
|
||||
f"Expected `da sync` in SessionStart, got {cmds}"
|
||||
assert any("agnes pull" in c for c in cmds), (
|
||||
f"Expected `agnes pull` in SessionStart, got {cmds}"
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ def test_template_has_session_end_upload():
|
|||
cfg = json.loads(TEMPLATE.read_text())
|
||||
ends = cfg.get("hooks", {}).get("SessionEnd", [])
|
||||
cmds = [h["command"] for entry in ends for h in entry.get("hooks", [])]
|
||||
assert any("da sync --upload-only" in c for c in cmds), (
|
||||
assert any("agnes push" in c for c in cmds), (
|
||||
f"Expected `da sync --upload-only` in SessionEnd, got {cmds}"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue