Skip to content

Commit 7a33c0d

Browse files
fix(impl-generate): preserve created across regens + correct model string
Two metadata bugs fixed at the source: 1. `created` was overwritten with the current timestamp on every regen, silently erasing the first-generation date. Now the generator reads the existing metadata file (if present) and preserves its `created` value; only `updated` advances. The impl-review step already uses `created != updated` to decide whether to print "Created: ..." or "Updated: ..." in the implementation header — that logic only works when `created` is immutable. 2. `generated_by: claude-opus-4-5-20251101` was frozen from the era when the workflow was written. The Claude action actually runs `--model opus`, which resolves to whatever the current opus alias is (today Opus 4.7). Switching to the family name `claude-opus` is honest + future-proof, and stops the metadata from lying every model release. The scatter-basic pilot already landed 9 files with today's date as `created`. Those will stabilise on the next regen (this fix) or can be patched in place if needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d7a8b90 commit 7a33c0d

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/impl-generate.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ jobs:
391391
# Write metadata file using Python for proper YAML formatting
392392
# Pass all variables inline to avoid export/env issues
393393
.venv/bin/python3 -c "
394-
import yaml
394+
import os, yaml
395395
lib = '$LIBRARY'
396396
spec = '$SPEC_ID'
397397
language = '$LANGUAGE'
@@ -403,13 +403,31 @@ jobs:
403403
has_html = '$HAS_HTML' == 'true'
404404
metadata_file = '$METADATA_FILE'
405405
base_url = f'https://storage.googleapis.com/anyplot-images/plots/{spec}/{language}/{lib}'
406+
407+
# Preserve the original 'created' timestamp on regenerations.
408+
# 'created' is the first-generation date — it must never be overwritten.
409+
# Only 'updated' moves forward on every regen.
410+
created_ts = ts
411+
if os.path.exists(metadata_file):
412+
try:
413+
with open(metadata_file) as f:
414+
existing = yaml.safe_load(f) or {}
415+
if existing.get('created'):
416+
created_ts = existing['created']
417+
except Exception:
418+
pass
419+
406420
data = {
407421
'library': lib,
408422
'language': language,
409423
'specification_id': spec,
410-
'created': ts,
424+
'created': created_ts,
411425
'updated': ts,
412-
'generated_by': 'claude-opus-4-5-20251101',
426+
# Reflects what claude_args=`--model opus` actually runs: whatever
427+
# Claude Code's current "opus" alias resolves to (today Opus 4.7).
428+
# Use the family name instead of a frozen version string so the
429+
# metadata doesn't go stale every model release.
430+
'generated_by': 'claude-opus',
413431
'workflow_run': run_id,
414432
'issue': issue,
415433
'python_version': py_ver,

0 commit comments

Comments
 (0)