Record source-backed calendar contract and exact timezone-independent release
This commit is contained in:
1 parent
5d5fbf06e9
commit
339adb0765
38 files changed
+7718
-54
No files matched your search
@@ -0,0 +1,54 @@
|
||||
from pathlib import Path
|
||||
from html.parser import HTMLParser
|
||||
from urllib.parse import quote
|
||||
import json,re,urllib.request,hashlib
|
||||
out=Path('/tmp/progcode-date-content');ledger=json.loads((out/'ledger.json').read_text());candidate=json.loads(Path('/tmp/progcode-calendar-candidate.json').read_text());root=Path(candidate['staticRoot']);base=candidate['local']['url'];monthNames={'января':1,'февраля':2,'марта':3,'апреля':4,'мая':5,'июня':6,'июля':7,'августа':8,'сентября':9,'октября':10,'ноября':11,'декабря':12}
|
||||
monthNames.update({'янв':1,'февр':2,'мар':3,'март':3,'апр':4,'июн':6,'июл':7,'авг':8,'сент':9,'окт':10,'нояб':11,'дек':12})
|
||||
class Time(HTMLParser):
|
||||
def __init__(self):super().__init__();self.entries=[];self.entry=None
|
||||
def handle_starttag(self,t,a):
|
||||
if t=='time':self.entry=dict(datetime=dict(a).get('datetime'),text='')
|
||||
def handle_data(self,s):
|
||||
if self.entry is not None:self.entry['text']+=s
|
||||
def handle_endtag(self,t):
|
||||
if t=='time' and self.entry is not None:self.entries.append(self.entry);self.entry=None
|
||||
|
||||
def calendar(text):
|
||||
m=re.search(r'(\d{1,2})\s+([а-я]+)\.?\s+(\d{4})',text);assert m,text
|
||||
day,month,year=m.groups();return f'{int(year):04}-{monthNames[month]:02}-{int(day):02}'
|
||||
expected={r['preserveDateTimeMetadata']:r for r in ledger['records']};checks=[]
|
||||
for r in ledger['records']:
|
||||
for kind,path in [('canonical','/articles/'+r['slug']+'/'),('legacy',r['legacyPath'])]:
|
||||
url=base+quote(path,safe='/')
|
||||
with urllib.request.urlopen(url,timeout=10) as res:b=res.read();status=res.status
|
||||
assert status==200
|
||||
f=root/path.strip('/')/'index.html';assert b==f.read_bytes()
|
||||
parser=Time();parser.feed(b.decode());assert parser.entries
|
||||
header=parser.entries[0];assert header['datetime']==r['preserveDateTimeMetadata'],url
|
||||
display=calendar(header['text']);assert display==r['expectedPublicationCalendarDate'],(url,display)
|
||||
checks.append(dict(slug=r['slug'],kind=kind,url=url,status=status,expectedHistoricalDate=r['expectedPublicationCalendarDate'],visibleLabel=header['text'],displayCalendarDate=display,datetime=header['datetime'],matchesFrozenHTML=True,htmlSha256=hashlib.sha256(b).hexdigest(),verdict='PASS date/ISO evidence'))
|
||||
allTimes=[]
|
||||
for f in sorted(root.rglob('*.html')):
|
||||
p=Time();p.feed(f.read_text())
|
||||
for n,t in enumerate(p.entries):
|
||||
r=expected[t['datetime']];day=calendar(t['text']);assert day==r['expectedPublicationCalendarDate'],(str(f),t)
|
||||
allTimes.append(dict(file=str(f.relative_to(root)),timeIndex=n,datetime=t['datetime'],visibleLabel=t['text'],calendarDate=day,expectedHistoricalDate=r['expectedPublicationCalendarDate']))
|
||||
parity=json.loads(Path('/tmp/progcode-date-build-parity.json').read_text());assert parity['all81DateAndMetadataManifestsIdentical'] is True
|
||||
files=sorted(f for f in root.rglob('*') if f.is_file());h=hashlib.sha256()
|
||||
for f in files:h.update(str(f.relative_to(root)).encode());h.update(f.read_bytes())
|
||||
computed=h.hexdigest();assert computed==candidate['buildHash'],(computed,candidate['buildHash'])
|
||||
report=dict(reviewer='/root/content_manager',scope='Historical publication calendar and original ISO metadata only',candidateCommit='0cb1ce1',candidate=candidate,independentRawLedger='ledger.json',checkedCanonical=14,checkedLegacy=14,allHeaderChecksPassed=True,headerChecks=checks,allGeneratedHTMLCount=len(list(root.rglob('*.html'))),allTimeElementsChecked=len(allTimes),allGeneratedTimeChecksPassed=True,generatedTimes=allTimes,buildFileCount=len(files),computedBuildHash=computed,buildHashMatchesCandidate=True,twoBuildParityEvidence=dict(file='/tmp/progcode-date-build-parity.json',executedByThisReviewer=False,sourceHash=parity['builds']['UTC']['sourceHash'],UTC=parity['builds']['UTC'],Moscow=parity['builds']['Europe/Moscow'],all81DateAndMetadataManifestsIdentical=parity['all81DateAndMetadataManifestsIdentical']),verdict='ACCEPT exact local candidate calendar/ISO contract',unverified=['CI completion pending','Public production dates not checked in this followup','Expanded corpus Semrush webprogcode-v2.6 remains mandatory open'])
|
||||
(out/'candidate-followup-evidence.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n')
|
||||
(out/'candidate-followup-verdict.md').write_text(f'''# Exact calendar candidate follow-up — ACCEPT local date contract
|
||||
|
||||
Candidate commit `0cb1ce1`; source `{candidate['sourceHash']}`; build `{candidate['buildHash']}`. Immutable root `{root}`; local `{base}`, PID {candidate['local']['pid']}.
|
||||
|
||||
Independently fetched all14 canonical and all14 dated legacy URLs (28 requests). Every response is HTTP200, byte-identical to its frozen HTML, and displays the date from the independently inspected raw-source ledger. Every original full ISO datetime attribute remains exact. jQuery displays12January2019; Tilix25August2017; TLS12July2017. The UI's two-digit day padding is a formatting convention, not a different calendar date.
|
||||
|
||||
Also parsed all{len(list(root.rglob('*.html')))} generated HTML files and checked every one of{len(allTimes)} time elements against the static raw-backed expectations. All match. Recomputed the sorted-path/file-byte SHA256 over{len(files)} frozen files and matched the declared build hash.
|
||||
|
||||
Read `/tmp/progcode-date-build-parity.json`: it records separate UTC and Europe/Moscow full builds with81HTML/146time elements and identical date/metadata manifests. This reviewer did not execute those builds; the direct HTTP/frozen checks above are independent evidence for this exact frozen candidate.
|
||||
|
||||
Verdict: **ACCEPT the historical calendar/ISO metadata contract for this exact local candidate.** Product files and article bodies were not modified. This is not a CI or public-production date verification: CI was reported pending and final public dates must be checked after confirmed deployment. Mandatory expanded recovery `webprogcode-v2.6` and overall restoration acceptance remain open.
|
||||
''')
|
||||
print('PASS canonical14 legacy14;',len(allTimes),'times in',len(list(root.rglob('*.html'))),'HTML; buildhash',computed)
|
||||
Reference in new issue
Block a user