diff --git a/tools/local_debug.py b/tools/local_debug.py new file mode 100644 index 0000000..15f5660 --- /dev/null +++ b/tools/local_debug.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Explicitly authorized temporary Debug install; preserve the notarized rollback.""" +import argparse, datetime, hashlib, json, os, plistlib, shutil, subprocess, sys, uuid +from pathlib import Path +import deliver as delivery +from template_payload import template_files + +ROOT=Path(__file__).resolve().parent.parent +CACHE=delivery.CACHE +DEST=delivery.DEST +PLUGIN=delivery.PLUGIN +APP=CACHE/'DerivedData/Build/Products/Debug/大鱼调色.app' +LOOSE=CACHE/'DerivedData/Build/Products/Debug/大鱼调色 XPC Service.pluginkit' + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--source',required=True,type=Path) + args=parser.parse_args();source=args.source.resolve() + commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=source,text=True).strip() + assert not subprocess.check_output(['git','status','--porcelain','--untracked-files=no'],cwd=source), '调试编译源须为干净的可恢复节点' + delivery.hosts_closed() + assert not any(line.endswith('/Contents/MacOS/大鱼调色') for line in delivery.run('ps','-axo','comm=').splitlines()),'请先正常退出大鱼调色主 APP' + lock=delivery.LOCK;lock.mkdir() + (lock/'owner.json').write_text(json.dumps(dict(PID=os.getpid(),cwd=str(ROOT),product='大鱼调色',mode='user-authorized-debug',started=datetime.datetime.now(datetime.timezone.utc).isoformat()))) + backup=None;stage=None + try: + print('Building explicitly authorized Debug configuration',flush=True) + with (CACHE/'debug-local-build.log').open('w') as log: + subprocess.run(['xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Debug','-enableAddressSanitizer','NO','-derivedDataPath',str(CACHE/'DerivedData'),'build'],cwd=source,stdout=log,stderr=subprocess.STDOUT,check=True) + for reference,bundled,_ in template_files(): + target=APP/delivery.BUNDLED_TEMPLATES/bundled;target.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(source/'template'/reference,target);target.chmod(0o644) + (APP/'Contents/Resources/Basis_balanceWheel.png').chmod(0o644) + info=plistlib.loads((APP/'Contents/Info.plist').read_bytes());info['DYLocalDebugBuild']=True;(APP/'Contents/Info.plist').write_bytes(plistlib.dumps(info)) + delivery.identity(APP,'com.dayu.color');delivery.identity(APP/PLUGIN,'com.dayu.color.XPC') + delivery.unregister(APP/PLUGIN);delivery.unregister(LOOSE) + for name in ['FxPlug','PluginManager']: + delivery.run('codesign','--force','--timestamp','--options','runtime','--sign',delivery.IDENTITY,str(APP/PLUGIN/'Contents/Frameworks'/(name+'.framework'))) + delivery.run('codesign','--force','--timestamp','--options','runtime','--sign',delivery.IDENTITY,str(APP/PLUGIN)) + delivery.run('codesign','--force','--timestamp','--options','runtime','--entitlements',str(source/'大鱼调色/Wrapper Application/SandboxEntitlements.entitlements'),'--sign',delivery.IDENTITY,str(APP)) + delivery.run('codesign','--verify','--deep','--strict',str(APP)) + stage=DEST.parent/('.dayu-color-debug-stage-'+uuid.uuid4().hex+'.app');delivery.run('ditto',str(APP),str(stage)) + delivery.identity(DEST,'com.dayu.color') + backup=DEST.parent/('.dayu-color-formal-before-debug-'+uuid.uuid4().hex+'.app');os.replace(DEST,backup);os.replace(stage,DEST);stage=None + try: + delivery.run('codesign','--verify','--deep','--strict',str(DEST));delivery.identity(DEST,'com.dayu.color') + delivery.unregister(backup/PLUGIN) + for path in [APP,LOOSE]: + if path.exists():delivery.unregister(path/PLUGIN if path==APP else path);shutil.rmtree(path) + delivery.run('pluginkit','-a',str(DEST/PLUGIN)) + registry=delivery.run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC') + entries=[line for line in registry.splitlines() if 'com.dayu.color.XPC(' in line] + assert len(entries)==1 and entries[0].rstrip().endswith('\t'+str(DEST/PLUGIN)),registry + delivery.run('open',str(DEST)) + assert str(DEST/'Contents/MacOS/大鱼调色') in delivery.run('ps','-axo','comm=').splitlines(),'调试 APP 未从固定位置启动' + except BaseException: + failed=DEST.parent/('.dayu-color-debug-failed-'+uuid.uuid4().hex+'.app');os.replace(DEST,failed);os.replace(backup,DEST);backup=None;delivery.run('pluginkit','-a',str(DEST/PLUGIN));raise + record=dict(status='temporary-debug-awaiting-host-verification',authorization='User explicitly requested local Debug testing while Apple notarization is pending.',configuration='Debug',notarized=False,bundleID='com.dayu.color',version=info['CFBundleShortVersionString'],build=info['CFBundleVersion'],sourceCommit=commit,path=str(DEST),formalRollback=str(backup),pendingReleaseNotary='0a1d2d49-1a03-4cd4-acbe-ba37f1fee42d',signatureVerified=True,pluginKitUniquePath=True,cleanup='Remove this temporary Debug APP when user testing ends or replace with the notarized Release; preserve the formal rollback until then.') + report=ROOT/'verification/DebugDelivery1.22.1.json';report.write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n') + print('DEBUG_INSTALLED. Verify FCP from the fixed path, then type keep to leave it for user testing.',flush=True) + for decision in sys.stdin: + if decision.strip()=='keep': + record['status']='temporary-debug-installed-for-user-testing';report.write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n');break + finally: + if stage and stage.exists():shutil.rmtree(stage) + (lock/'owner.json').unlink();lock.rmdir() + +if __name__=='__main__':main() diff --git a/开发交接.md b/开发交接.md index d8e4535..9d21eb2 100644 --- a/开发交接.md +++ b/开发交接.md @@ -2,7 +2,7 @@ 更新于 2026-11-11(Asia/Shanghai)。这是新对话的接手入口。历史设计和实现细节按需查阅专项交接,复现和交付证据以对应版本的报告为准。 -## 正在修改:1.22.1(133)统一 LUT 浏览器 +## 本地调试:1.22.1(133)统一 LUT 浏览器 用户要求:打开浏览器即上传当前缓存帧批量生成在线效果预览;在线与本地在同一分类树中显示,在线 LUT 有总分类及子分类;本地支持二级及更深目录;点击在线 LUT 安装到本地分类并应用。 @@ -10,7 +10,7 @@ 已实现:移除来源切换菜单、统一可展开分类树、自动捕获开窗缓存帧、后台预载当前在线页(并发 2)、独立在线预览缓存与取消状态、安装后立即刷新本地子分类。新帧不连续上传,保留“更新预览”操作。预览缩略图最长边 640、最多 230400 像素,服务器不保存帧。首次无缓存帧时在收到第一帧后自动补载。主 APP 和安装说明同步更新。 -已通过 68 项模拟网络/真实本地导入检查与 40 项本地浏览器回归,覆盖空缓存首次补载、竖屏 640 上限、关窗取消、二级分类折叠及离线可用。最终源码 `7f833757da243f2a4610c23c36ec278b44c80ad4` 已从独立 HTTPS 检出构建,921 个跟踪文件逐字节核对。Release 构建及 1,028 项发布前检查通过,APP 公证 `0a1d2d49-1a03-4cd4-acbe-ba37f1fee42d` 当前 In Progress;等待命令异常中断,旧版尚未替换。已添加只恢复原提交的交付入口,核对原 ZIP SHA-256 和完整 APP 文件/符号链接一致性后继续查询,不重编、不重签、不重传。恢复参数见 [恢复记录](verification/UnifiedLUTNotaryResume133.json)。132 在公证等待期间发现离线按钮边界问题,已停止安装;正式旧版仍为 131。133 补齐后台错误不影响本地按钮、缓存帧编码不等待本地 LUT 解析队列。尚未安装、公证或发行 133。下一步:完成回归,保存源码检查点后正式构建、公证、唯一安装和 FCP 合成色卡验收,再制包与 Release 下载核验。验收只用合成图,不改用户时间线。 +已通过 68 项模拟网络/真实本地导入检查与 40 项本地浏览器回归,覆盖空缓存首次补载、竖屏 640 上限、关窗取消、二级分类折叠及离线可用。最终源码 `7f833757da243f2a4610c23c36ec278b44c80ad4` 已从独立 HTTPS 检出构建,921 个跟踪文件逐字节核对。Release 构建及 1,028 项发布前检查通过,APP 公证 `0a1d2d49-1a03-4cd4-acbe-ba37f1fee42d` 当前 In Progress;等待命令异常中断,旧版尚未替换。已添加只恢复原提交的交付入口,核对原 ZIP SHA-256 和完整 APP 文件/符号链接一致性后继续查询,不重编、不重签、不重传。恢复参数见 [恢复记录](verification/UnifiedLUTNotaryResume133.json)。132 在公证等待期间发现离线按钮边界问题,已停止安装;正式旧版仍为 131。133 补齐后台错误不影响本地按钮、缓存帧编码不等待本地 LUT 解析队列。尚未安装、公证或发行 133。用户随后明确授权“公证卡住了就先 debug 模式本地测试”。已停止自动安装等待,保留原提交,改为从同一源码节点构建 Debug 配置并临时替换固定安装位置,原 131 公证版保留用于回滚。调试产物明确未公证,例外仅用于本地测试;测试结束后清理或由已公证 Release 替换。下一步用 `tools/local_debug.py --source <干净源码检出>` 完成本地调试安装和 FCP 合成色卡验收;正式公证、PKG 与 Release 暂缓。验收只用合成图,不改用户时间线。 131 的完整交付记录见 [此前交接](research/OnlineLUTRelease131Handoff.md)、[发行](verification/Release1.22.0.json)、[恢复](verification/Recovery1.22.0.json)。站点文章与主 APP 更新通道仍为 1.21.8(126),本轮不变。