feat(telemetry): add isolated beta quality diagnostics and release identity

This commit is contained in:
dadachann
2026-09-15 09:35:01 +00:00
parent 91d6de8858
commit f8123ead0a
89 changed files with 4205 additions and 175 deletions
+23
View File
@@ -0,0 +1,23 @@
"""Stamp the exact source revision into distributable artifacts (build time only)."""
import argparse
from pathlib import Path
import re
import subprocess
def stamp(root: Path, revision: str | None = None) -> str:
if revision is None:
revision = subprocess.check_output(['git', 'rev-parse', '--verify', 'HEAD'], cwd=root, text=True).strip()
if not re.fullmatch(r'[0-9a-f]{40}', revision):
raise ValueError('Build revision must be a full lowercase Git SHA')
target = root / 'src/langbot/_build_info.py'
target.write_text(f'"""Exact source revision stamped at artifact build time."""\n\nCORE_REVISION = {revision!r}\n')
return revision
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--revision')
args = parser.parse_args()
print(stamp(Path(__file__).resolve().parents[1], args.revision))