feat(news): index news packages and research persistent events

Extract reusable literal keywords once per source revision, assign complete news packages to long-lived events, and research all event members with immutable evidence and references.

Add additive research storage, vocabulary snapshots, the two-stage workspace, isolated acceptance coverage, and a paused rollout with an initial fixed 50-news production trial.
This commit is contained in:
eezd committed 2026-11-04 12:09:58 +08:00
1 parent 07252fea0f
commit 4929a32a0a
69 files changed
+8215 -2092

No files matched your search

+27 -1
View File
@@ -292,17 +292,43 @@ asyncio.run(main())
"""
print(run(*command, input='CONFIRMED = '+repr(confirmed)+'\n'+program), flush=True)
def reset_news_derived(build, execute=False, acceptance=None, baseline=None):
"""Run the scoped reset with both deployment and model-admission locks."""
report = json.loads(acceptance.read_text()) if acceptance else None
raw = baseline.read_bytes() if baseline else None
if execute:
require(bool(report and raw and report.get('real_models') is True and report.get('quality_accepted') is True
and report.get('baseline_sha256') == hashlib.sha256(raw).hexdigest()
and report.get('baseline_packages') == 20 and report.get('originals') == 27
and report.get('failed') == 0 and report.get('unassigned') == 0), '固定样本真实模型质量验收尚未通过')
validate_images(build)
with locked(INSTANCE / '.deploy.lock'):
require(not (INSTANCE / 'deployment.pending.json').exists(), 'Recover the pending deployment first')
command = ['docker','run','--rm','-i','--network','dev_default','--env-file',str(INSTANCE / '.env'),
IMAGES['backend']+':'+build['version'],'python','-']
run(*command,input=SCHEMA)
source = (ROOT / 'scripts/reset_news_ai.py').read_text()
program = "import asyncio,json\nnamespace={'__name__':'news_reset'}\nexec("+repr(source)+",namespace)\n"
program += 'print(json.dumps(asyncio.run(namespace["reset"]('+repr(execute)+','+repr(report)+','+repr(raw)+')),ensure_ascii=False))'
print(run(*command,input=program),flush=True)
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('command', choices=('update', 'recover', 'rollback', 'reset-news-ai', 'install-entrypoints'))
parser.add_argument('command', choices=('update', 'recover', 'rollback', 'reset-news-ai', 'reset-news-derived', 'install-entrypoints'))
parser.add_argument('--build', type=Path, default=ROOT / 'build.json')
parser.add_argument('--confirm-delete-old-news-ai', action='store_true')
parser.add_argument('--confirm-reset-news-derived', action='store_true')
parser.add_argument('--acceptance', type=Path)
parser.add_argument('--baseline', type=Path)
args = parser.parse_args()
if args.command == 'install-entrypoints':
with locked(INSTANCE / '.deploy.lock'):
require(not (INSTANCE / 'deployment.pending.json').exists(), 'Recover the pending deployment first')
install_entrypoints(INSTANCE)
print('实例启停入口已安装;未启动或停止任何服务')
elif args.command == 'reset-news-derived':
reset_news_derived(json.loads(args.build.read_text()),args.confirm_reset_news_derived,args.acceptance,args.baseline)
elif args.command == 'reset-news-ai':
reset_news_ai(json.loads(args.build.read_text()), args.confirm_delete_old_news_ai)
elif args.command == 'update':