Milestone 288 — pattern library + forge integration #111
@@ -1049,13 +1049,18 @@ async def attach_live_body(note, data: dict) -> None:
|
|||||||
data["body_source"] = "forge"
|
data["body_source"] = "forge"
|
||||||
data["body_freshness"] = "current"
|
data["body_freshness"] = "current"
|
||||||
if fetched.commit_sha:
|
if fetched.commit_sha:
|
||||||
|
# Read the stored stamp BEFORE writing the fresh one into the
|
||||||
|
# response: `fields` aliases data["snippet"], so the other order
|
||||||
|
# makes the staleness check compare the new stamp to itself and
|
||||||
|
# the persist never fires (caught by the unit test, run 3811).
|
||||||
|
stored_prov = fields.get("provenance") or {}
|
||||||
|
stale = stored_prov.get("commit_sha") != fetched.commit_sha
|
||||||
prov = compose_provenance(commit_sha=fetched.commit_sha)
|
prov = compose_provenance(commit_sha=fetched.commit_sha)
|
||||||
# Reflected in THIS response as well as persisted — the reader
|
# Reflected in THIS response as well as persisted — the reader
|
||||||
# shouldn't need a second pull to see the stamp they caused.
|
# shouldn't need a second pull to see the stamp they caused.
|
||||||
if isinstance(data.get("snippet"), dict):
|
if isinstance(data.get("snippet"), dict):
|
||||||
data["snippet"]["provenance"] = prov
|
data["snippet"]["provenance"] = prov
|
||||||
stored_prov = fields.get("provenance") or {}
|
if stale:
|
||||||
if stored_prov.get("commit_sha") != fetched.commit_sha:
|
|
||||||
spawn(
|
spawn(
|
||||||
_refresh_provenance(note, fetched.commit_sha),
|
_refresh_provenance(note, fetched.commit_sha),
|
||||||
site="pull provenance-refresh",
|
site="pull provenance-refresh",
|
||||||
|
|||||||
Reference in New Issue
Block a user