现场证据 QA 与整改 Agent · 首个垂直:加州住宅热泵安装 Field-evidence QA & remediation agent · first vertical: CA residential heat pumps

一张不合格的现场照片,
不该在两周后才被发现。
A bad site photo shouldn't
surface two weeks after the van left.

ProofOps 把「安装证据要求」编译成可机器校验的清单:本地确定性测量每张照片,计算项目级覆盖率而非单图分数,为每个失败开出带重拍指令的整改任务,复检闭环,四道门禁全通过后生成可核验的证据包。 ProofOps compiles evidence requirements into a machine-checkable checklist: it measures every photo deterministically and locally, computes project-level coverage rather than per-image scores, turns each failure into a task with exact recapture instructions, rechecks the replacement, and only then generates a verifiable evidence package.

● 验证运行中validation run PROJECT / 加州住宅热泵(演示)CA RESIDENTIAL HEAT PUMP (DEMO) 确定性测量 · 本地 · 无网络deterministic · local · no network
HP-01 旧机铭牌OLD NAMEPLATE
FAIL
nameplate not legible
HP-02 室外机OUTDOOR UNIT
PASS
blur 412.7 ≥ 55.0
HP-05 室内铭牌INDOOR NAMEPLATE
FAIL
blur 34.6 < 80.0
HP-07 电气面板 ×2PANEL ×2
FAIL
near-duplicate phash
HP-11 调试记录COMMISSIONING
FAIL
dark px 0.41 > 0.30
HP-12 完工总览COMPLETED
PASS
coverage 1/1
阻断问题blocking issues 6 整改任务remediation tasks 6 必需要求required reqs 13 状态status REMEDIATION_REQUIRED
14项证据要求(演示清单)evidence requirements (demo)
18项逐图确定性测量deterministic measurements per photo
4道就绪门禁readiness gates
274个自动化测试automated tests
0默认外部网络调用external calls by default
§ 01

业界为什么需要这个东西Why the industry needs this

the problem

住宅电气化改造里,钱和照片是绑在一起的。补贴发放、质保生效、验收结案、争议追溯——最终都取决于一件事:现场是否留下了一组可用作文档的安装照片。而这组照片,是由一个正在赶下一单的技术员,用手机、在机房昏暗灯光下、单手拍的。 In residential electrification, the money is attached to the photos. Incentive payouts, warranty activation, sign-off, dispute trails — all of it turns on one question: did the crew leave behind a set of installation photos that is usable as documentation? That set gets shot one-handed, on a phone, in a badly lit mechanical room, by a technician already late for the next job.

01 / 回路太长LATENCY

反馈来得太晚,成本已经翻倍The feedback arrives after the truck is gone

技术员离场 → 上传 → 排队人工审核 → 数周后退回 → 二次上门。当场多拍一张的边际成本接近零;派人重返现场的成本是一整个工时窗口,外加客户再一次预约的耐心。 Crew leaves → upload → review queue → rejection weeks later → second truck roll. Taking one more photo on site costs essentially nothing. Sending someone back costs a labour slot, a scheduling window, and a customer's patience.

重返现场是最贵的返工truck rolls are the expensive defect
02 / 判断漂移DRIFT

人工审核在第三百张图上不再稳定Human review drifts by photo #300

"够清楚吗"是一个没有刻度的问题。同一张略糊的铭牌,不同审核员、同一审核员的上午和下午,结论可以不同。不稳定的门槛同时制造两种损失:不可用的证据被放行,可用的证据被误退。 "Is this legible enough?" has no unit. The same marginally soft nameplate gets different verdicts from different reviewers — or the same reviewer before and after lunch. An unstable threshold loses in both directions: unusable evidence passes, usable evidence gets bounced.

阈值应该是数字,不是心情a threshold should be a number
03 / 缺件不可见GAPS

最贵的问题不在某张照片里The costliest defect isn't in any photo

真正卡住结案的往往是"这项根本没拍"、"要两张只有一张"、"两张其实是同一个角度"。逐张打分的工具永远看不见这类问题——它们只存在于项目层面。 What actually stalls a file is usually "that requirement was never shot", "it needs two and there's one", "those two are the same angle". Per-image scoring can never see these. They exist only at the project level.

缺失 / 数量不足 / 近重复missing · short count · near-duplicate

※ 以上是对行业运作方式的定性描述。本页不引用任何未经核实的统计数字;页面上出现的一切数值,都来自本仓库中可运行的代码、阈值与测试。 ※ The above describes how the work runs, qualitatively. This page cites no unverified industry statistics — every number shown here comes from runnable code, thresholds and tests in this repository.

模型永远不能制造一次通过。
它只能让结论更谨慎。
A model can never
manufacture a pass.

语义分析只能下调结论。降级响应、低置信度、不符合约定格式的模型输出,一律变成 UNCERTAIN——永远不会变成 PASS,也永远无法覆盖一次确定性的 FAIL。这是整个产品的安全叙事,写在验证引擎的不变量里,并由测试守着。 Semantic analysis can only downgrade an outcome. A degraded, low-confidence or off-contract model response becomes UNCERTAIN — never PASS, and never an override of a deterministic FAIL. That is the product's safety story, encoded as an invariant in the validation engine and guarded by tests.

§ 02

核心卖点The core value

what makes it different
01

判的是「这组证据够不够」,不是「这张图好不好」It judges the evidence set, not the individual photo

覆盖率从持久化的资产状态推导——哪些照片被接受、归属哪项要求——而不是从某一次运行的流水账。因此:被替换的旧照片立刻停止计数,被豁免的要求立刻算作满足,复检结果立刻反映在数字上。缺失、数量不足、近重复(感知哈希)都是项目级发现,而不是某张图的扣分项。 Coverage is derived from durable asset state — which photos were accepted against which requirement — not from the transcript of a single run. So a superseded photo stops counting immediately, a waived requirement counts as satisfied immediately, and a recheck moves the numbers immediately. Missing evidence, short counts and near-duplicates (perceptual hash) are project-level findings, not per-image deductions.

services/coverage.py · CoverageRow.satisfied
02

测量在本地,且可复现Measurement is local and reproducible

分辨率、拉普拉斯方差(清晰度)、平均亮度、过曝/欠曝像素比、边缘密度、文字区域占比、感知哈希、EXIF 拍摄时间——全部用 OpenCV/Pillow 在本地算出。默认零网络依赖,同样的图永远得到同样的数。 Resolution, variance of the Laplacian (sharpness), mean brightness, clipped-highlight and crushed-shadow ratios, edge density, text-region ratio, perceptual hash, EXIF capture time — all computed locally with OpenCV/Pillow. No network by default; the same image always yields the same numbers.

analyzers/deterministic.py
03

每个失败都自带可执行的整改Every failure explains itself — and ships a fix

没有"质量不佳"这种输出。每一条发现都携带:消息、实测值、期望值、以及给技术员的具体重拍指令。它随即变成一个 QA issue 和一个整改任务。 There is no "quality issue" output. Every finding carries a message, the observed value, the expected value, and concrete recapture instructions — then becomes a QA issue and a remediation task.

services/rules.py · RuleFinding
04

根因抑制:一次重拍,关掉一个任务Root-cause suppression: one reshoot, one task

一张模糊的铭牌只产生 max_blur 一条发现,而不是同时报"铭牌不可读""检测不到文字区域""识别不出型号"。当拍摄缺陷已经解释了衍生症状时,衍生发现被抑制。技术员收到的是一个任务,不是三个。 A blurred nameplate produces one finding — max_blur — not three. Derived symptoms (unreadable nameplate, missing text regions) are suppressed when a capture defect already explains them. The technician gets one task, not a pile.

不变量 #3invariant #3
05

「就绪」是门禁,不是一个按钮Readiness is a gate, not a button

项目要进入待审状态,必须同时通过四道门。没人可以手动把它推过去——包括模型。 A project reaches "ready for review" only when four gates hold at once. Nobody pushes it through by hand — the model least of all.

services/coverage.py · compute_readiness
06

交付物是可核验的证据包The deliverable is a verifiable package

一个 ZIP:带哈希的清单(manifest)、HTML 摘要、CSV 导出、原始验证结果、按要求归类的已接受照片,以及一份明确的免责声明。可以直接交给审核方,也可以在争议时逐项回溯。 One ZIP: a hashed manifest, an HTML summary, CSV exports, the raw validation results, the accepted photos organised by requirement, and an explicit disclaimer. Hand it to a reviewer, or walk it back item by item in a dispute.

services/package_service.py
FAIL BLOCKING HP-05 · 室内机铭牌indoor unit nameplate code: max_blur · issue_type: BLURRY_IMAGE
MESSAGESharpness score 34.6 is below the required 80.0; the image reads as out of focus or motion blurred.
OBSERVED34.6 (variance of Laplacian)
EXPECTED>= 80.0
REMEDIATIONBrace against a solid surface, tap the subject to lock focus, and take the shot again.
被抑制SUPPRESSEDrequire_nameplate_readable、expect_text_regions —— 已由拍摄缺陷解释,不重复开任务。require_nameplate_readable, expect_text_regions — already explained by the capture defect; no duplicate tasks.

↑ 这是引擎的真实输出结构,不是示意图。↑ actual output shape of the engine, not a mockup.

§ 03

它能跑通什么业务What business it actually runs

upload → package, closed loop

承包商装完一台热泵,上传一堆手机照片。从这一刻到一个可以交出去的证据包之间的每一步,都在系统里。 A contractor finishes a heat-pump install and uploads a folder of phone photos. Every step between that moment and a package you can hand over lives in the system.

01

把要求物化成清单Materialise the checklist

证据模板展开为逐项要求:最少张数、严重级别、拍摄指引,以及一组可机器校验的验证规则。 An evidence template becomes per-project requirements: minimum photo count, severity, capture guidance, and a set of machine-checkable validation rules.

POST /projects/{id}/requirements
/load-template
min_blur_score · brightness_range
min_text_region_ratio · minimum_count
02

确定性测量每一张照片Measure every photo deterministically

18 项本地测量字段,OpenCV/Pillow,无网络。上传即校验:魔术字节判 MIME、流式尺寸限制、解压炸弹防护、文件名与存储键消毒。 Eighteen local measurement fields via OpenCV/Pillow, no network. Validated on the way in: MIME by magic bytes, streaming size limits, decompression-bomb guard, filename and storage-key sanitisation.

POST /projects/{id}/assets
blur_score · brightness · contrast
over/underexposed_ratio · edge_density
text_region_ratio · perceptual_hash · EXIF
03

分类与匹配Classify and match

每张照片关联到它最可能满足的那项要求:文件名信号、随图元数据,以及可选的 Claude 视觉调用。判不准就是 UNCERTAIN,交给人,而不是猜。 Each photo is associated with the requirement it most plausibly satisfies — filename signals, sidecar metadata, and optionally a Claude vision call. When it can't tell, the answer is UNCERTAIN and a human decides. It does not guess.

VISION_ANALYZER_MODE=mock | anthropic
ANTHROPIC_MODEL=claude-sonnet-5
默认离线 mock,确定性输出offline mock by default
04

算覆盖率,不只是打分Compute coverage, not scores

缺失证据、张数不足、近重复照片,在项目层面被算出来。 Missing evidence, insufficient counts and near-duplicate photos surface as project-level findings.

GET /projects/{id}/coverage
readiness_percent · blockers[]
05

开 QA 问题与整改任务Open issues and remediation tasks

每条阻断性发现变成一个带具体理由的 issue,以及一个带精确重拍指令的任务,可指派到人。 Each blocking finding becomes an issue with a concrete reason and a task with precise recapture instructions, assignable to a person.

GET /projects/{id}/issues
GET /projects/{id}/tasks
POST …/tasks/{id}/assign
06

闭环:替换上传 → 定向复检Close the loop: replace, then recheck

直接在任务里上传替换照片,跑一次定向复检。通过则任务完成、issue 解决、旧照片置为已替换;不通过则 issue 保持打开,并记下新的理由。 Upload the replacement straight into the task and run a focused recheck. Pass: the task completes, the issue resolves, the old photo is superseded. Fail: the issue stays open with the new reason recorded.

POST …/tasks/{id}/replacement
POST …/tasks/{id}/recheck
asset.status → SUPERSEDED
07

就绪门禁Gate readiness

四道门全部成立,项目才能变成待审。未通过时,409 里直接带着 blockers 列表,说明还差什么。 Four gates must all hold before the project can move to ready-for-review. When they don't, the 409 carries a blockers list saying exactly what's missing.

PATCH /projects/{id}
409 · details.blockers[]
08

生成证据包Generate the evidence package

带哈希清单的 ZIP、HTML 摘要、CSV 导出、原始验证结果、按要求归档的照片、免责声明。只有 package_service 能把状态置为已生成——任何模型输出都不能推动项目状态。 A ZIP with a hashed manifest, HTML summary, CSV exports, raw validation results, accepted photos filed by requirement, and the disclaimer. Only package_service may set the generated status — no model output moves project state.

POST /projects/{id}/package
GET …/package/download
sha256 manifest
落地场景WHERE IT LANDS A

补贴与激励材料归档Incentive & rebate filing

在提交给项目方之前,先让机器过一遍:缺件、糊图、重复角度当场暴露,退件率下降的成本来自现场十分钟,而不是两周后的一次上门。 Run the machine pass before submission. Gaps, soft frames and repeated angles surface on site, so the cost of a clean file is ten minutes with the crew still there — not a truck roll two weeks later.

落地场景WHERE IT LANDS B

分包商质量管理Subcontractor quality control

同一套阈值适用于所有班组,判定不再取决于谁审。任务、指派、复检、活动时间线全部留痕,可以拿来做班组质量对比。 The same thresholds apply to every crew, so the verdict no longer depends on who reviewed it. Tasks, assignment, rechecks and an append-only activity timeline give you a per-crew quality record.

落地场景WHERE IT LANDS C

争议与追溯Disputes and traceability

每一次判定都有实测值、期望值和时间戳;每一次豁免都必须写理由;活动流只追加不修改。争议发生时,可以回答"当时看到的是什么"。 Every verdict carries an observed value, an expected value and a timestamp; every waiver requires a written reason; the activity stream is append-only. When something is contested, you can answer what was actually seen, and when.

§ 04

作为 Agent,优势在哪里Where the agent earns its keep

not a checklist, not a chatbot

这里的"agent"不是"接了个大模型"。区别在三件事:它会动手(开问题、建任务、收替换、跑复检、改状态),它的自治是被约束的(状态机 + 四道门禁),并且它的失败方向是被设计好的——出错时永远偏向更谨慎。 "Agent" here does not mean "we called an LLM". Three things make the difference: it acts (opens issues, creates tasks, ingests replacements, runs rechecks, moves state), its autonomy is bounded (a state machine plus four gates), and its failure direction is designed — when it is wrong, it is wrong towards caution.

纸质/表单清单Paper checklist 人工 QA 审核Human QA review 纯 CV 打分工具Pure CV scoring ProofOps
判定依据Basis of verdict 拍了没Was it shot 审核员的眼睛A reviewer's eye 单图分数A per-image score 实测值 + 阈值 + 项目覆盖率Measured value + threshold + coverage
反馈时机When feedback lands 从不Never 数天到数周后Days to weeks later 上传后After upload 上传即时,任务可当场重拍On upload, while a reshoot is still cheap
输出物Output 勾选框Ticked boxes 一句话备注A comment 一个分数A number 发现 → 问题 → 带指令的任务 → 复检 → 证据包Finding → issue → task with instructions → recheck → package
出错方向Failure direction 漏检Silent miss 双向漂移Drifts both ways 可能给出错误的通过Can hand out a false pass 只会更谨慎:疑则 UNCERTAINOnly more cautious: doubt → UNCERTAIN
可审计Auditability 无None 看邮件Email threads 日志Logs 只追加的活动流 + 哈希清单Append-only activity + hashed manifest
可回归Regression-testable — 不可No 部分Partly 默认离线确定性,274 个测试全绿Deterministic offline default, 274 tests
A · 分工DIVISION OF LABOUR

测量不外包给模型,语义不硬编码成阈值Measurement isn't outsourced to the model; semantics aren't hard-coded as thresholds

"这张糊不糊"是可以算的——就用拉普拉斯方差算,别问模型。"这是不是室外机的铭牌、上面的型号对不对得上"不是阈值问题——那才交给视觉模型。两边各做自己擅长的事,边界写在代码里。 "Is this soft?" is computable — compute it with the variance of the Laplacian, don't ask a model. "Is this the outdoor unit's nameplate, and does the model number match the record?" is not a threshold question — that's where the vision model goes. Each side does what it is good at, and the boundary is in the code.

B · 工具闭环IT ACTS

它交付的是状态变化,不是一段文字It delivers state changes, not paragraphs

一次运行之后,系统里多出的是:若干条 issue、若干个可指派任务、一份更新过的覆盖率、一个新的项目状态。人接手时面对的是待办,不是一份需要自己翻译成行动的报告。 After a run, what exists in the system is: issues, assignable tasks, an updated coverage matrix, a new project status. A person picks up work items, not a report they must translate into action.

C · 被约束的自治BOUNDED AUTONOMY

它能推进流程,但推不动结论It can move the work forward; it cannot move the verdict

状态转移走状态机;就绪必须过四道门;只有 package_service 能置"已生成证据包"。高严重级别的 UNCERTAIN 结果必须有人复核过——系统会一直卡在那里,直到有人做出决定并留下记录。 Transitions go through a state machine; readiness needs all four gates; only package_service may set the package-generated status. A high-severity UNCERTAIN result must be reviewed by a person — the system simply stays blocked until someone decides, on the record.

D · 可预测的失效PREDICTABLE FAILURE

模型出问题时,产品的行为是已知的When the model misbehaves, the product's behaviour is already known

超时、传输失败、畸形 JSON、幻觉出的证据类型、越界的置信度、拒答——统一降级为 confidence 0 + 显式的不确定性说明 + UNCERTAIN。重试只针对 429/5xx/超时,400 永不重试。没有 API key 时回退到本地 mock,服务照常启动。 Timeout, transport failure, malformed JSON, a hallucinated evidence type, an out-of-range confidence, a refusal — all collapse to confidence 0, an explicit uncertainty explanation, and UNCERTAIN. Retries fire only on 429/5xx/timeouts; a 400 is never retried. With no API key it falls back to the local mock and still starts.

§ 05

失效护栏:出错时会发生什么Guardrails: what happens when things go wrong

the honest part
发生了什么What happens 系统的反应What the system does
模型超时 / 传输失败Model timeout or transport failureUNCERTAIN · confidence 0 · 附解释explanation attached
畸形 JSON / 越界置信度 / 不符合约定的字段Malformed JSON, out-of-range confidence, off-contract fieldsUNCERTAIN · Pydantic 校验拦下rejected by Pydantic validation
模型幻觉出一个不存在的证据类型Model hallucinates a non-existent evidence typeUNCERTAIN · 不采信not accepted
模型拒答Model refusesUNCERTAIN
模型说"看起来没问题",但本地测出模糊Model says it looks fine, but the local metrics say blurredFAIL · 确定性结论不可被覆盖deterministic verdict is not overridable
未配置 API keyNo API key configured回退本地 mock,记一条 warning,服务正常启动falls back to the local mock, logs a warning, starts normally
分类置信度低于 0.45Classification confidence below 0.45UNCERTAIN · 拒绝断言 PASS,等人refuses to assert PASS; waits for a human
高严重级别的 UNCERTAIN 未被复核A high-severity UNCERTAIN is unreviewed就绪门禁不通过,项目卡住readiness gate fails; the project stays blocked

四道就绪门禁The four readiness gates

GATE 01

覆盖率Coverage

每项必需要求都已被足够数量的已接受照片覆盖,或被明确豁免。Every required requirement is covered by enough accepted photos, or explicitly waived.

GATE 02

无未决阻断问题No open blocking issue

没有 blocking / major 级别的 QA 问题仍处于打开状态。No blocking- or major-severity QA issue is still open.

GATE 03

无未解决的必需失败No unresolved required FAIL

必需要求上没有仍然失败的最新验证结果(被替换的照片不算)。No current FAIL on a required requirement (superseded photos don't count).

GATE 04

高严重不确定项已复核High-severity UNCERTAIN reviewed

每个高严重级别的 UNCERTAIN 结果都已由人接受或驳回。Every high-severity UNCERTAIN result has been accepted or rejected by a person.

上传面UPLOAD SURFACE

按字节判类型,不信客户端Type by magic bytes, never by the client

MIME 由魔术字节判定;单文件与单请求大小在流式过程中就被限制;解压炸弹有防护;文件名与存储键拒绝路径穿越、绝对路径、空字节与空段,解析后再做一次包含性检查。 MIME is decided by magic bytes; per-file and per-request limits are enforced while streaming; decoding is guarded against decompression bombs; filenames and storage keys reject traversal, absolute paths, null bytes and empty segments, with a second containment check after resolution.

一致性CONSISTENCY

响应返回时,事务已经提交The transaction is committed before the response ships

请求日志用纯 ASGI 中间件实现。BaseHTTPMiddleware 会把 FastAPI 依赖的 teardown 推迟到响应之后——客户端拿到 200 后立刻重读,可能读到提交前的状态。这正是复检后 UI 的行为,所以它被专门测试守着。 Request logging is pure ASGI. BaseHTTPMiddleware defers FastAPI's dependency teardown past the response, so a client that re-reads right after a 200 can see pre-commit state — exactly what the UI does after a recheck. A dedicated test guards the regression.

输出面OUTPUT SURFACE

用户输入进 HTML 前一律转义Everything user-controlled is escaped

生成的 HTML 报告里,每一个用户可控字符串都经过转义;500 响应体是通用的,内部细节不外泄;结构化 JSON 日志每行都带 request id;CORS 来源由环境变量配置,未知来源被拒绝。 Every user-controlled string is escaped before it reaches the generated HTML report; 500 bodies are generic so internals never leak; structured JSON logs carry a request id on every line; CORS origins come from the environment and unknown origins are rejected.

§ 06

一次可复现的走查A reproducible walkthrough

make demo-reset

种子演示项目故意是不合格的:一个不可读的铭牌、一张糊的、一张过暗的、一张近重复、两项完全没拍。因此验证总是产出恰好六个阻断问题——这套数字被单元测试和浏览器端到端测试同时锁住。 The seeded demo project is deliberately imperfect: one illegible nameplate, one blurred frame, one underexposed frame, one near-duplicate and two requirements never shot. Validation therefore always produces exactly six blocking issues — a count locked down by both unit tests and the browser end-to-end spec.

要求Requirement 种子照片Seeded photo 结果Outcome 理由Reason
HP-01 旧设备铭牌Old equipment nameplate风化、字迹不清weathered, illegibleFAIL铭牌不可读nameplate not legible
HP-02 室外机总览Outdoor unit overview正常cleanPASS—
HP-03 室外机铭牌Outdoor unit nameplate正常cleanPASS—
HP-04 室内机总览Indoor unit overview正常cleanPASS—
HP-05 室内机铭牌Indoor unit nameplate失焦out of focusFAIL清晰度低于阈值sharpness below threshold
HP-06 电气断路开关Electrical disconnect正常cleanPASS—
HP-07 配电面板(需 2 张)Panel (needs 2)一张好,一张近重复one good, one near-duplicateFAIL重复,有效张数不足duplicate, short count
HP-08 冷媒管路Refrigerant line set未上传none uploadedFAIL证据缺失missing evidence
HP-09 冷凝排水Condensate drain正常cleanPASS—
HP-10 温控器Thermostat正常cleanPASS—
HP-11 调试记录Commissioning record曝光不足underexposedFAIL暗部像素比超限crushed-shadow ratio over limit
HP-12 完工总览Completed overview正常cleanPASS—
HP-13 客户确认单Customer acknowledgement未上传none uploadedFAIL证据缺失missing evidence
HP-14 现场环境Site conditions可选optionalN/A非必需not required
# 起环境、重置演示、跑通全套质量门bring it up, reset the demo, run the full quality gate
make setup        # venv + deps + fixtures
make up           # postgres · minio · api · web
make demo-reset   # 确定性种子 → 验证 → 打印就绪度deterministic seed → validate → print readiness
make verify-all   # format · lint · typecheck · tests · build · playwright

在浏览器里:运行验证 → 六个任务 → 逐个附上替换照片 → 定向复检 → 就绪度到 100% → 生成并下载证据包。同一条路径也作为 Playwright 用例无头运行。 In the browser: run validation → six tasks → attach each replacement → focused recheck → readiness hits 100% → generate and download the package. The same path runs headlessly as a Playwright spec.

§ 07

工程实现How it's built

boring on purpose
后端BACKEND

FastAPI · Python 3.12

分层由约定强制:路由 → 服务 → 仓储。所有 SQL 集中在仓储层,服务层不构造查询。枚举以字符串存储,跨方言列类型让同一套 schema 在 Postgres 与 SQLite 上都能跑。mypy 严格模式覆盖应用代码与测试,应用代码无豁免。 Layering is enforced by convention: routes → services → repositories. All SQL lives in the repository layer; services never build queries. Enums are stored as strings and cross-dialect column types let the same schema run on Postgres and SQLite. mypy runs strict over application code and tests, with no escape hatches in application code.

SQLAlchemyAlembicPydanticOpenCVPillowmypy --strict
前端FRONTEND

Next.js 16 · TypeScript strict

App Router,页面是很薄的服务端组件,交互全在客户端特性组件里。服务端状态只走 TanStack Query,没有临时的 useEffect 取数;查询键集中管理,变更后按项目维度整体失效。每个面板都显式处理加载与错误态。 App Router: pages are thin server components, all interactivity lives in client feature components. Server state is TanStack Query only — no ad-hoc useEffect fetching. Query keys are centralised and invalidated per project after a mutation. Every panel handles pending and error states explicitly.

TanStack QueryTailwind v4VitestPlaywright
数据与存储DATA & STORAGE

Postgres · MinIO

图片字节进对象存储(S3/MinIO 或文件系统),元数据与状态进 Postgres。后端测试默认跑 SQLite 内存库,无需任何外部服务;同一套用例可以通过环境变量指向 Postgres 跑生产方言。 Image bytes go to object storage (S3/MinIO or the filesystem); metadata and state go to Postgres. Backend tests default to in-memory SQLite so no services are needed, and the same suite can be pointed at Postgres to exercise the production dialect.

Docker ComposeasyncpgS3 API
34个 REST 端点REST endpoints
199后端测试 (pytest)backend tests (pytest)
72前端测试 (vitest)frontend tests (vitest)
3浏览器端到端用例browser E2E specs
1条命令跑完全部质量门command for the full gate
已知边界KNOWN LIMITS

这个 MVP 还没有做的事What this MVP does not do yet

没有认证、授权与多租户;文字区域指标是 OCR 的代理指标,不是真正的 OCR(它检测"像文字的结构",不识别字符);验证在请求内同步执行,几十张图没问题,几百张需要队列;分类是启发式的,未标注的照片会变成 UNCERTAIN 等人,而不是猜;演示清单与示例图片都是虚构生成的。 No authentication, authorisation or tenancy isolation. The text-region metric is an OCR proxy, not OCR — it detects text-like structure and does not read characters. Validation runs synchronously inside the request: fine for a dozen photos, a queue is needed for hundreds. Classification is heuristic; an unlabelled photo becomes UNCERTAIN and waits for a human rather than guessing. The demo checklist and sample images are fictional and generated.

下一步NEXT

最先要动的是验证队列The first real change is a durable job queue

同步验证是负载下第一个会断的东西:200 张图 + 模型分析必然超出任何合理的请求超时。把验证搬到工作队列上,用已有的 ValidationRun 作为持久记录,向 UI 推进度,按资产做幂等重试。之后依次是:认证与租户、真正的 OCR、可版本化的模板管理、现场移动端预检、审核工作流、带标注集的模型评测、可观测性、存储生命周期。 Synchronous validation is the first thing that breaks under load — 200 photos with a model-backed analyzer will exceed any sensible request timeout. Move validation onto a worker with the existing ValidationRun as the durable record, stream progress to the UI, and make retries idempotent per asset. Then, in order: auth and tenancy, real OCR, versioned template management, in-field mobile pre-checks, a reviewer workflow, a labelled evaluation harness, observability, storage lifecycle.

决策支持工具,不构成任何认证Decision support only — not a certification of anything

ProofOps 评估的是安装照片能否作为文档使用。它不认证建筑规范合规、电气安全、许可状态、补贴或激励资格、厂商质保有效性,也不构成任何形式的法律合规判定。 ProofOps assesses whether installation photos are usable as documentation. It does not certify building-code compliance, electrical safety, permit status, rebate or incentive eligibility, manufacturer warranty validity, or legal compliance of any kind.

自动图像分析双向都可能出错——它可能标记合格的证据,也可能漏掉不合格的证据。任何结果在被依赖之前,必须由有资质的人复核。 Automated image analysis can be wrong in both directions — it can flag acceptable evidence and it can miss unacceptable evidence. A qualified person must review every result before it is relied upon.

  • 随附的证据清单是虚构的演示内容,不是任何真实项目的要求。所有示例图片、姓名、型号与序列号均为编造。 The bundled evidence checklist is fictional demonstration content, not an authoritative programme requirement. All sample images, names, model numbers and serials are invented.
  • 本 MVP 没有认证机制,也没有多租户隔离。不要把它暴露在不受信任的网络上,也不要向其中导入真实客户数据。 This MVP has no authentication and no multi-tenancy. Do not expose it to an untrusted network and do not load real customer data into it.
  • 本页所有数值均引自本仓库的代码、阈值与测试;页面不引用任何外部行业统计。 Every number on this page is quoted from code, thresholds and tests in this repository; no external industry statistics are cited.