A sync that changed nothing says so again
Comparing the per-node digest against an engine that does not record one is comparing against nothing, and reporting every node as changed on every sync for ever — which is what a client newer than its engine did, since `NodeDef` drops fields it has never heard of. A node is named now only when both sides carry a digest, so a no-op sync is `unchanged` again and the signal one syncs for is back. That silence had also been the only sign of the mismatch, so sync now names it: one line saying the engine stored no record of what a node's code reaches, with both versions in it and what to run. Bumped to 0.1.6 — the digest changed the stored document's shape, and a version that does not move makes two different engines indistinguishable, which is the thing it was made load-bearing for a day ago. `— draft` was printed whenever there was simply nothing to publish, which reads as work left unfinished. It is said only when a draft is genuinely there, and `— published` when one was.
This commit is contained in:
@@ -301,8 +301,18 @@ def cmd_sync(args: argparse.Namespace) -> int:
|
||||
continue
|
||||
what = "created" if report.created else "updated"
|
||||
detail = ", ".join(report.changed)
|
||||
state = "published" if report.published else "draft"
|
||||
_say(f" {report.flow}: {what} ({detail}) — {state}")
|
||||
# Nothing to publish is not the same as left as a draft, and saying
|
||||
# the second when it was the first reads as work not finished.
|
||||
state = "published" if report.published else "draft" if report.drafted else ""
|
||||
_say(f" {report.flow}: {what} ({detail})" + (f" — {state}" if state else ""))
|
||||
if any(report.forgot_code for report in reports):
|
||||
engine = _engine_version(client)
|
||||
_say(
|
||||
" note: this engine did not store what each node's code reaches, "
|
||||
"so its cache is still keyed on the whole repository. It is "
|
||||
f"{engine or 'older'} and this client is {__version__} — "
|
||||
"`pip install -U fluksio` there."
|
||||
)
|
||||
stamp = origin["commit"][:7] + ("-dirty" if origin["dirty"] else "")
|
||||
_say(f"Stamped with {stamp or 'no commit'} from {repo}.")
|
||||
return 0
|
||||
@@ -984,12 +994,17 @@ def _list_names(client: Client, args: argparse.Namespace) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def _engine_version(client: Client) -> str:
|
||||
"""What the engine says it is, or empty if it is older than saying so."""
|
||||
try:
|
||||
return str((client.summary() or {}).get("version") or "")
|
||||
except (SyncError, ApiError, httpx.HTTPError):
|
||||
return ""
|
||||
|
||||
|
||||
def _too_old(client: Client) -> str:
|
||||
"""A route this client knows and the engine does not."""
|
||||
try:
|
||||
version = (client.summary() or {}).get("version") or ""
|
||||
except (ApiError, httpx.HTTPError):
|
||||
version = ""
|
||||
version = _engine_version(client)
|
||||
engine = f"the engine is {version}" if version else "the engine is older"
|
||||
return (
|
||||
f"this engine has no export endpoints — {engine} and this client is "
|
||||
|
||||
Reference in New Issue
Block a user