| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- """Record the fifth relayed response; keep source bytes and unexecuted work separate."""
- from pathlib import Path
- import hashlib
- import json
- WORK = Path(__file__).resolve().parent
- def digest(relative):
- return hashlib.sha256((WORK / relative).read_bytes()).hexdigest()
- def main():
- case = json.loads((WORK / 'case.json').read_bytes())
- edits = json.loads((WORK / 'presentation-edits.json').read_bytes())
- for name, expected in edits['originalFileSha256'].items():
- assert digest(name) == expected, name
- changes = [
- ('rounds/R05/reply-verbatim.md', 'rounds/R05/reply-display.md',
- '线上回读校验通过:HTTP 200、284,212 B、本地与线上的 sha256 一致,关键内容全部命中。\n\n', '',
- 'omit operational file-readback preface; retain it in the original'),
- ('rounds/R05/reply-verbatim.md', 'rounds/R05/reply-display.md',
- '对照图:https://s3.fmode.cn/user/DpPsnlBm0K/report/ksf-four-products-r1-20261109.html',
- '对照图见“研究成果”中的四款产品对照。', 'point to the embedded received artifact'),
- ('rounds/R05/reply-verbatim.md', 'rounds/R05/reply-display.md',
- '本轮全程免费公开资料,未购样、未付费测试、未新增采集、未改 Skill、未改研究库。\n', '',
- 'omit operational environment/payment tail, without changing research judgments'),
- ('rounds/R05/artifacts/four-products-received.html', 'rounds/R05/artifacts/four-products-display.html',
- '(本轮不付费,未做)', '(本轮未做)',
- 'remove model/tool payment framing; retain the product willingness-to-pay hypothesis'),
- ]
- css = '''<style id="presentation-layout">
- body{font-size:16px}.sub,.g,.g th,.g td,.bd,.val,.src,.nt,.hno,.hrow,.hrow b,.hrow p,.hrow li,figcaption,.warn,.legend{font-size:15px!important}
- .wrap,.sc,.hyp{min-width:0}.sc{max-width:100%;overflow-x:auto}.g{min-width:1000px}.g th,.g td{min-width:165px;overflow-wrap:anywhere}.g .itemh{min-width:110px}.hyp,.warn{overflow-wrap:anywhere}
- figure{max-width:100%;overflow-x:auto}figure:first-of-type img{min-width:960px}figure:not(:first-of-type) img{max-width:300px;margin:auto}
- @media(max-width:640px){.wrap{padding:22px 14px 40px}.hyp{padding:18px 15px}.g th,.g td{padding:11px 10px}.htitle{font-size:18px}}
- </style></head>'''
- changes.append(('rounds/R05/artifacts/four-products-received.html',
- 'rounds/R05/artifacts/four-products-display.html', '</head>', css,
- 'presentation-only readable type, internal table/image scrolling'))
- displays = {}
- for source, display, before, after, reason in changes:
- text = displays.get(display, (WORK / source).read_text(encoding='utf-8'))
- assert text.count(before) == 1, (display, before[:80])
- displays[display] = text.replace(before, after)
- edit = {'source': source, 'display': display, 'before': before, 'after': after, 'reason': reason}
- if edit not in edits['edits']:
- edits['edits'].append(edit)
- edits['originalFileSha256'][source] = digest(source)
- for name, text in displays.items():
- (WORK / name).write_text(text, encoding='utf-8', newline='\n')
- # The older prompt is immutable; the existing presentation variant removes only environment wording.
- for name in ('rounds/R05/prompt-verbatim.txt', 'rounds/R05/prompt-current.txt'):
- edits['originalFileSha256'][name] = digest(name)
- url = 'https://s3.fmode.cn/user/DpPsnlBm0K/report/ksf-four-products-r1-20261109.html'
- fifth = next(r for r in case['rounds'] if r['roundId'] == 'R05')
- fifth.update({
- 'status': 'complete-reply-received-reviewed-hypotheses-need-reframing',
- 'forwardedConfirmed': None, 'executionConfirmed': True, 'replyReceived': True,
- 'replyPath': 'rounds/R05/reply-verbatim.md',
- 'replySha256': digest('rounds/R05/reply-verbatim.md'),
- 'replyComplete': True, 'reviewPath': 'rounds/R05/review.md',
- 'promptExecutionMatch': 'inferred-from-conversation-sequence-exact-variant-unverified',
- 'executionEvidence': 'user-relayed-complete-reply; original prompt execution logs unavailable',
- 'claimsIndependentlyVerified': False,
- 'specificClaimVerifiedHere': {'claim': 'CN official page for original 140g lists fried noodles',
- 'url': 'https://www.samyangfoods.com/chn/brand/view.do?seq=152',
- 'path': 'rounds/R05/local-review-sources/samyang-cn-seq152.html',
- 'scope': 'official statement for that page version; not physical test or all-market packaging'},
- 'receivedArtifact': {
- 'path': 'rounds/R05/artifacts/four-products-received.html',
- 'presentationPath': 'rounds/R05/artifacts/four-products-display.html',
- 'url': url, 'httpStatus': 200, 'bytes': 284212,
- 'sha256': digest('rounds/R05/artifacts/four-products-received.html'),
- 'fileIndependentlyDownloaded': True, 'sourceAnchorLinks': 0, 'embeddedImages': 2,
- 'scope': 'received file; not verification of every product cell or board operations'},
- })
- if not any(r['roundId'] == 'R06' for r in case['rounds']):
- case['rounds'].append({
- 'roundId': 'R06', 'moduleId': 'D1-04',
- 'purpose': '界定研究问题并探索使用条件、具体麻烦和消费者取舍',
- 'promptPath': 'rounds/R06/prompt-verbatim.txt',
- 'promptOrigin': 'authored-locally-for-user-forwarding',
- 'status': 'prepared-for-user-forwarding', 'forwardedConfirmed': False,
- 'executionConfirmed': False, 'replyReceived': False,
- 'reportIds': [], 'actualUserDecision': None,
- 'scopeNote': 'research question/task formation before limited VOC supplementation; not opportunity selection',
- })
- case['status'] = 'R05-four-products-received-limited-verification-R06-prepared'
- case['courseModules'][2]['status'] = 'four-product-reference-received-source-and-mechanism-limits-remain'
- case['demonstration'].update({
- 'status': 'five-actual-replies-four-received-artifacts-layout-pending',
- 'actualReplies': 5, 'latestReplyComplete': True,
- 'earlierIncompleteReplies': ['R03', 'R04'],
- })
- (WORK / 'case.json').write_text(json.dumps(case, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
- (WORK / 'presentation-edits.json').write_text(json.dumps(edits, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
- print(json.dumps({'receivedRound': 'R05', 'receivedReplies': 5, 'receivedArtifacts': 4,
- 'nextPromptExecuted': False, 'originalHashesPreserved': True}, ensure_ascii=False))
- if __name__ == '__main__':
- main()
|