Reality Search Taiwan · Search-first MVP · Level 2 MVP 完成版
搜尋此刻真實狀態
輸入自然語言問題,直接取得結論、信心、依據與建議。現階段最穩定的 demo 是中央氣象署即時天氣 / 雨量 / 地震資料。
頁面本身公開,但不嵌入 server-side API key。瀏覽器會用你貼上的 key 呼叫 POST /v1/reality/check。
結論
等待查詢。建議先試:「阿里山現在有下雨嗎?」
信心:— 狀態:waiting_for_query 地點:— 意圖:—
判斷依據
- 送出查詢後顯示。
建議
目前沒有查詢結果。
原始 API 回應
Level 2 MVP 已完成:首頁提供 15 個固定 demo 問題、首頁一鍵分享、GET /result?query=... 可分享結果頁、非 allowlist 友善提示與 GET /verify 驗證頁;公開頁面不嵌入 server-side API key。
Level 3 Beta:進行中;Sprint 1:Beta Verification Foundation 已建立 GET /beta 狀態頁、source health / freshness / confidence factors contract、Persistence / Audit Contract 與 scripts/verify_level3_beta.py live verification script。
開啟純搜尋頁 /search · Level 2 驗證頁 · Level 3 Beta 狀態頁 · Swagger UI · ReDoc
Reality Intelligence API
台灣現實世界搜尋引擎 Taiwan World Model 的機器介面。這個 staging API 讓 TrueSight / Codex / internal tools 查詢目前可介接的現實資料能力,並測試 Reality Check 合約。
https://taiwanworldmodel.thesense.biz
所有受保護 API 需使用 header:X-API-Key。請不要把 API key 寫死在程式碼或公開 repo。
Reality Search:用自己的 API key 試查「台灣剛剛有地震嗎?」與「阿里山現在有下雨嗎?」。Answer card 會把 current_state=no_rain_detected 等 raw state 轉成人類決策語言,例如「目前未偵測到明顯降雨」、「近10分鐘無雨」與高/中/低信心標籤,避免使用者直接解讀 raw JSON。
Admin Import safety:source catalog metadata collection-limit depth exact-int guard 已讓 Durable Source Catalog _raise_for_metadata_collection_limits() 在 recursive max-depth 與 collection item-count checks 前拒絕 bool/float/string depth helper drift;source catalog source-from-dict key exact-string guard 已讓 Durable Source Catalog _source_from_dict() 在 source_id / .get() lookup 前拒絕 source item str subclass key drift;source catalog source-item payload key exact-string guard 已讓 Durable Source Catalog _has_valid_source_item_allowed_keys() / _has_valid_source_item_value_types() 在 set equality 與 .get() lookup 前拒絕 loaded sources[] item str subclass key drift;source catalog source text-list length exact-source-object guard 已讓 Durable Source Catalog _raise_for_source_text_list_lengths() 在 supports_intents/safety_notes count validation 前拒絕 source item dict subclass helper drift;source catalog metadata value-type finite-float guard 已讓 Durable Source Catalog _is_valid_metadata_value_type() 在 JSON number type acceptance 前拒絕 NaN/Infinity;source catalog duplicate-object-key pair-list exact-list guard 已讓 _reject_duplicate_catalog_keys() 在 object_pairs_hook pair traversal 前拒絕 list subclass helper drift;source catalog exact value-type helper exact-mapping guard 已讓 _has_exact_value_types() 在 wrapper value-type contract iteration/value lookup 前拒絕 mapping subclass helper drift;source catalog optional int field exact-input guard 已讓 Durable Source Catalog _optional_int_field() 在 priority lookup/fallback 與 exact-int validation 前拒絕 source item/key/default subclass helper drift;source catalog durable payload atomic-write value exact-value guard 已讓 _durable_payload_atomic_write() 在 save-time atomic_write proof 建構前拒絕 same-type safe-value drift;source catalog atomic-write value key exact-string guard 已讓 _atomic_write_required_optional_values_contract() 在 atomic-write proof safe-value acceptance 前拒絕 required/optional value key-table / mapping str subclass helper drift;source catalog load-validation key contract exact-tuple guard 已讓 _load_validation_key_contract() 在 wrapper key equality/traversal 前拒絕 required/optional/emitted tuple subclass key-table drift;source catalog load-validation value key exact-string guard 已讓 _load_validation_required_optional_values_contract() 與 _load_validation_emitted_values_contract() 在 load-validation proof safe-value acceptance 前拒絕 required/optional/emitted value key-table / mapping str subclass helper drift;source catalog contains required-value key exact-string guard 已讓 _contains_required_values_contract() 在 contains wrapper source-count proof 前拒絕 required-value key-table / mapping str subclass helper drift;source catalog durable payload contains key exact-string guard 已讓 _durable_payload_contains() 在 admin_source_catalog_v1.contains metadata 建構前拒絕 contains source-count key-table / mapping str subclass helper drift;source catalog redaction required value key exact-string guard 已讓 _redaction_required_values_contract() 在 redaction wrapper fixed-value acceptance 前拒絕 required/list-value key-table / mapping str subclass helper drift;source catalog load-validation key contract exact-string guard 仍讓 _load_validation_key_contract() 在 required/allowed/optional/emitted key-table validation 前拒絕 str subclass helper drift;仍為 metadata-only source catalog,不公開 durable path、source payload、credential、token 或 raw feed locator。
目前狀態
status=catalog_only:資料源能力目錄已可查詢。status=insufficient_data:Reality Check endpoint 可呼叫,但尚未接入正式即時資料源。- 目前不是 production API;API clients、rate limit、audit log 仍是 in-memory。
- Admin Import safety:source catalog checksum helper exact-boundary guard 已讓
_has_valid_catalog_checksum在 load-time digest comparison 前拒絕 dict/list subclass、tuple-like source container 與非 exact source item helper drift;source catalog restart verify output field order drift guard 已讓 restart helper success JSON 在輸出前驗證固定 metadata-only field order,拒絕 duplicate、unknown 或 path/locator/credential/payload/hash 類敏感欄位名 drift;source catalog restart verify output exact-type guard 已讓 restart helper success JSON 在輸出前要求 exact schema/status strings、exact true booleans 與 exact non-negative integer counts,避免字串化 safety metadata 或 float count 被誤判為成功;source catalog post-deploy restart output exact-schema guard 已讓 post-deploy wrapper 解析 nested restart verify stdout 時拒絕 unknown field drift,避免 richer restart metadata 被摘要成安全結果;source catalog restart verify healthz interval bounds guard 已讓 restart helper 在 healthz readiness loop 建構 request 前驗證 retry interval finite/positive/bounded,避免 interval drift 進入 urlopen/sleep 或回顯 URL、credential、path、hash、locator;source catalog health check output field order immutable guard 已讓 staging helper 在 operator JSON 排序前要求 order table 仍為 tuple,避免 helper caller 換成 mutable list 後再 append path/locator/credential/payload 欄位;source catalog health check output field order known-field guard 已讓 staging helper 在 operator JSON 排序前要求所有 known safe sanitized/required/hash/failure 欄位仍被 order table 覆蓋,避免 known safe 欄位被靜默 append 到表尾;source catalog health check output field order drift guard 已讓 staging helper 在 operator JSON 排序前拒絕 duplicate 或 unsafe path/locator/credential/payload 欄位名 drift;source catalog atomic-write merged values helper immutable guard 已讓_atomic_write_required_optional_values_contract()回傳 read-only mapping,鎖定 required/optional atomic-write safe values 合併後的 helper contract;source catalog load-validation key helper immutable guard 已讓_load_validation_key_contract()回傳 read-only mapping,鎖定 required/allowed/optional/emitted load-validation key groups;public sources endpoint-camera metadata redaction guard 已讓/v1/reality/sourcesresponse boundary 移除 endpoint/camera/locator hint metadata keys;data source catalog list_sources defensive list guard 已讓DataSourceCatalog.list_sources()的 all-source listing 回傳 fresh list,避免 caller mutation 改寫 in-memory catalog ordering 或 membership;data source catalog constructor defensive source copy guard 已讓DataSourceCatalog建構時複製 capability intent/note lists 與 nested metadata,避免 caller-held source reference mutation 改寫 catalog source state;data source catalog list_sources defensive source copy guard 已讓DataSourceCatalog.list_sources()對 all-source 與 intent-filter listing 都回傳 capability copies,避免 caller mutation 改寫 in-memory catalog source lists 或 nested metadata;admin import SSRF guard table immutable guard 已將UNSAFE_SCHEMES與PRIVATE_HOSTS改為 immutable frozenset,鎖定 unsafe scheme / localhost blocklist;admin role rank table immutable guard 已將ADMIN_ROLE_RANKS改為 read-only mapping;rollback snapshot defensive data copy guard 會在建立 rollback snapshot 與full_dict()匯出時 deep-copy snapshot data,避免 caller/response mutation 改寫 rollback snapshot 與 checksum 對應內容;不開啟 apply gate、不觸碰 production apply,也不暴露 API key、admin key、credential、token、raw feed URL 或 password hash。 - Admin Import safety helper envfile parsing:source catalog health systemd envfile suffix parsing guard 已讓
scripts/source_catalog_health_check.py可剝除 systemdEnvironmentFilesreadback 的(ignore_errors=...)後綴,再供 staging operator env probes 開檔;source catalog health envfile parser guard 讓 health check helper 可用--env-file直接解析 explicit runtime env file、不需 shell source,且只載入 requested env names;失敗訊息維持 generic,不回 durable path、source payload、credential、hash、env value 或 raw feed locator。
Reality Search MVP Location fixes
Earthquake scope parser:地震查詢先使用災害範圍解析,不用一般 POI geocoder 猜地點。「台灣剛剛有地震嗎?」會被視為 national_scope,不會解析成台灣中油;「花蓮剛剛地震多大?」會被視為 county_scope / 花蓮縣,再交給 CWA 地震報告查詢。
Demo 地點擴充:「合歡山現在天氣好嗎?」現在會解析成 weather_suitability + hehuanshan,使用合歡山座標選最近中央氣象署觀測/雨量資料,不再回 intent=unknown。
Level 2 MVP 完成版:首頁免 API key demo mode 已擴充為 15 個固定 demo 問題,首頁提供一鍵分享連結;GET /result?query=... 提供可分享結果頁,公開頁面只呼叫 allowlisted POST /v1/reality/demo-check,不嵌入 server-side API key;非 allowlist query 顯示 demo_query_not_allowed;GET /verify 提供固定驗證頁,列出 Level 2 完成 checklist。
Level 3 Sprint 2:完成 — Sprint 2:Runtime Trust Foundation:Weather / Rain Reality answer 已加入 source_health_status、freshness_seconds、staleness、reliability_score 與 confidence_factors;stale / degraded source 會降低 confidence,且 stability 影響 confidence / stability affects confidence。Persistence contract 目前為 audit log JSONL persistence、usage event JSONL persistence、source health history JSONL persistence 的 Beta contract marker。
Level 3 Beta:完成:TrueSight E2E dry-run integration:完成;Weather / Rain beta-ready、Earthquake / Disaster beta-ready、Forecast Reality beta-ready;audit log JSONL persistence:完成、usage event JSONL persistence:完成、source health history JSONL persistence:完成;final Level 3 live verification:PASSED。外部 TrueSight repo merge 與 production HA 屬下一階段,不阻擋本 Beta gate。
WRA restricted API policy:水利署已回覆其影像系統有 API 介接機制,但僅供具業務需求且經申請核准之機關/單位使用;一般公開產品路徑只能使用 data.gov.tw 資料集作 best_effort_from_data_gov_dataset,不繞過 access control。相關 camera metadata 會以 access_model=public_dataset_only、restricted_api_available=true、restricted_api_eligibility=approved_agency_or_unit_only 標示。
Endpoints
| Endpoint | 用途 | 目前狀態 |
|---|---|---|
GET /healthz | 服務健康檢查 | Public |
GET /verify | Level 2 MVP verification page:列出 15 個 demo queries、首頁一鍵分享、可分享結果頁、非 allowlist 友善提示與 secret leak check checklist;不嵌入 server-side API key | Public |
GET /camera-test | Camera L3 Remote Test page:公開瀏覽器測試頁,讓 operator 貼上自己的 X-API-Key 後呼叫 /v1/reality/cameras/status-table?format=json&limit=500 與 /v1/reality/cameras/{camera_id}/live-query;頁面不嵌入 server-side key、不顯示影像 locator 或原圖 | Public page;API calls 仍需 API key |
GET /beta | Level 3 Beta:進行中 status page;Sprint 1:Beta Verification Foundation,列出 Level 3 Done checklist、source health / freshness / confidence factors contract、Persistence / Audit Contract 與 scripts/verify_level3_beta.py live verification script | Public |
GET /v1/reality/sources | 查詢可介接資料源能力目錄,可用 ?intent=... 過濾;回 metadata-only source_catalog_health public source catalog health summary,含 configured_durable、loaded_from_durable、redacted catalog_sha256、paths_hidden=true 與 restart_reload_check=source_catalog_restart_reload_check_v0(列出 restart 後只比較 checksum 的 public/admin health endpoints,requires_path_exposure=false),方便 restart 後驗證 durable catalog | API key required,回 status=catalog_only |
GET /v1/reality/auth/whoami | 驗證目前 API key 對應的 client identity、tier、endpoint permissions;不回傳 key value | API key required |
GET /v1/reality/billing/current | 回傳目前 client 本月 usage metering / shadow billing summary;用於未來評估合理費用,不是正式 invoice | API key required,回 shadow_only / internal_usage_only |
GET /v1/reality/production-readiness | Production Readiness Matrix V0:以 L0–L8 分級列出 Reality/API 能力目前成熟度、已完成項、缺口與下一個 milestone | API key required,回 production_readiness_matrix_v0 |
GET /v1/reality/source-health | Source Runtime Health V0:read-only 檢查 CWA / camera runtime 是否已設定與可進入下一階段;不執行 upstream fetch、不顯示 credential | API key required,回 source_runtime_health_v0 |
POST /v1/reality/source-health/probe | Source Health Recorder / Probe V0:寫入 metadata-only source health observations;不呼叫上游、不顯示 credential | API key required,回 source_health_probe_v0,write_scope=source_health_observations_only |
POST /v1/reality/source-health/probe/live-cwa | CWA Live Fetch Health Probe V0:受控 live upstream probe,呼叫 CWA weather/rainfall datasets 並記錄 latency / staleness / success 或 failure | API key required,回 cwa_live_fetch_health_probe_v0 |
GET /v1/reality/source-health/alerts | CWA Monitoring / Alerting V0:read-only metadata-only alert evaluator,不呼叫 CWA、不寄送外部通知、不顯示 secrets | API key required,回 cwa_monitoring_alerts_v0 |
GET /v1/reality/source-health/notification-channel-status | External Notification Channel Staging Config Contract V0:read-only metadata contract,只回 channel configured booleans;不顯示 channel address、provider token 或 credential value | API key required,回 cwa_notification_channel_status_v0 / notification_channel_status_ready |
GET /v1/reality/source-health/escalation-policy | Escalation Ownership Contract V0:read-only metadata contract,定義 owner approval、severity escalation 與 quiet-hours policy 缺口;不顯示個人聯絡值、不啟用 real send | API key required,回 cwa_escalation_policy_contract_v0 / escalation_policy_contract_ready |
GET /v1/reality/source-health/real-send-approval | Staging Real-send Approval Contract V0:read-only metadata contract,定義 dry-run 進到 one-time staging real-send 的必要 gates;real_send_enabled=false、不寄送通知、不允許 production enablement | API key required,回 cwa_real_send_approval_contract_v0 / real_send_approval_contract_ready |
GET /v1/reality/source-health/notification-delivery | Production Monitoring Notification Delivery Contract V0:read-only metadata contract,定義 channel readiness、severity mapping、retry/dedupe policy;不寄送通知、不顯示 channel address/provider secret | API key required,回 cwa_notification_delivery_contract_v0 |
POST /v1/reality/source-health/notification-drill | Staging Notification Drill V0:dry-run only,驗證 alert payload / severity / dedupe key / escalation placeholder;不寄送 Telegram/email/webhook | API key required,必須 dry_run=true,回 cwa_notification_drill_v0 / dry_run_available |
GET /v1/reality/weather/cross-validation | Forecast / Radar / Satellite Cross-validation V0:read-only metadata contract,定義 forecast/radar/satellite/observation 證據角色;不下載雷達/衛星圖 | API key required,回 cwa_forecast_radar_satellite_cross_validation_v0 |
GET /v1/reality/weather/radar-metadata | Radar Runtime Metadata V0:read-only metadata contract,定義 CWA radar evidence role、freshness bands、ground-truth limitation;不下載雷達圖、不做 image analysis | API key required,回 cwa_radar_runtime_metadata_v0 |
GET /v1/reality/weather/satellite-metadata | Satellite Runtime Metadata V0:read-only metadata contract,定義 CWA satellite evidence role、freshness bands、regional-context limitation;不下載衛星圖、不做 image analysis | API key required,回 cwa_satellite_runtime_metadata_v0 |
GET /v1/reality/weather/disagreement-scoring | Disagreement Scoring Contract V0:read-only metadata contract,定義 observation/forecast/radar/satellite 分歧評分維度、confidence modifiers 與官方觀測優先規則;不計算 live score | API key required,回 cwa_disagreement_scoring_contract_v0 |
GET /v1/reality/weather/production-thresholds | CWA Weather Production Thresholds V0:freshness/staleness/confidence/SLO metadata contract | API key required,回 cwa_weather_production_thresholds_v0 |
GET /v1/reality/cwa-runbook | CWA Operator Runbook Contract V0:read-only metadata contract,定義 key rotation、upstream outage、stale data degraded mode、rollback、probe pause 與 emergency wording;不執行危險操作;production gap runtime_status=cwa_runbook_contract_ready | API key required,回 cwa_operator_runbook_contract_v0 |
GET /v1/reality/cwa-production-gap | CWA Weather Reality Production Gap Checklist V0:明確列出 CWA Weather Reality 從 L6 → L7 production ready 的 pass / partial / blocker | API key required,回 cwa_production_gap_v0 |
GET /v1/reality/cameras | 查詢攝影機白名單/候選 registry,可用 ?location_id=... 過濾;不公開原始 CCTV URL | API key required,回 status=camera_registry_only |
GET /v1/reality/cameras/search | National Camera Coverage MVP:依 query、county、intent 搜尋全台縣市 coverage camera source candidates;schema=national_camera_coverage_v0,全台縣市 coverage 先回 registry/公開來源頁候選,不表示每筆已可 runtime fetch | API key required,回 camera_sources_found / no_camera_source_found |
GET /v1/reality/cameras/nearby | National Camera Coverage MVP:依 lat/lng/radius_km 查附近攝影機候選;回 distance_km,仍不公開技術取流網址 | API key required,回 nearby_camera_sources_found / no_nearby_camera_source_found |
GET /v1/reality/cameras/runtime-fetch-expansion | Camera Runtime Fetch Expansion:依 query/county/intent 批次回報全台 camera candidates 的 runtime fetch readiness;未帶 filter 時以 upgrade_mode=all_registry_sources_when_no_filter 處理整個 registry;schema=camera_runtime_fetch_expansion_v0,含 L1_public_source_page_only、L2_snapshot_metadata_available、L3_visual_evidence_available、blockers 與 completion_summary;completion 不等於全部升 L3,而是每支都有最高安全等級與下一步;預設 probe=false/visual_probe=false,明確 probe=true 才對白名單/已設定來源做 metadata probe,並以 bounded parallel metadata probes(目前 service default max 16 workers)加速大量 registry 檢查且維持輸出順序;明確 visual_probe=true 才做 AI visual evidence probe;metadata-only snapshot 仍算 L2,不算 L3 AI visual evidence;blocked_or_not_ready 只計仍低於 L2/L3 的 camera,已成功 snapshot probe 的 metadata-only L2 不會因尚未配置 AI vision runtime 被重新計為 blocked;discovery-only public page 仍列為 source_discovery_required_before_internal_use / blocked_pending_source_discovery;latest snapshot configuration_required / fetch_failed / invalid_snapshot 會分別落到 runtime_configuration_required_blocked、runtime_fetch_failed_blocked、runtime_invalid_snapshot_blocked,讓 Phase A completion 明確停在 L2 或可處理 blocker,而非 generic runtime_probe_failed | API key required,回 runtime_fetch_expansion_reported;不公開 raw URL / raw image bytes |
GET /v1/reality/cameras/status-table | Camera Status Table:API-key protected 狀態表,支援 format=json 或 format=markdown,預設以 limit=500 回 435 支 camera 的安全欄位:camera_id、county、location、L0/L1/L2/L3、completion_status、highest_safe_target_level、internal_callability_status、internal_use_allowed、public_access_tier、snapshot_status、locator-free snapshot_failure_reason、blockers、next_action、owner_track、public_source_url;JSON/markdown 都顯示內部可調用性與最後安全 snapshot probe 結果,並在 top-level 回 returned-row internal_callability_summary / public_access_tier_summary / snapshot_probe_status_summary / l2_remediation_summary / l2_remediation_source_groups,以及不受小 limit 分頁影響的 all_registry_summary / all_registry_completion_summary / all_registry_internal_callability_summary / all_registry_snapshot_probe_status_summary / all_registry_camera_rollout_readiness / all_registry_l2_remediation_summary / all_registry_l2_remediation_queue / all_registry_l2_remediation_source_groups / all_registry_l2_remediation_batch_plan,用來盤點全 435 支「內部是否可調用」以及 blocked work 是 configuration_required、fetch_failed 或其他 probe 狀態,而非直接公開影像權限;locator-free snapshot_failure_reason 可包含 missing_configured_locator_value、fetch_failed、unsupported_content_type、official_resource_html_response、official_resource_access_challenge 或 official_resource_record_not_found,其中 access challenge 代表官方端點回 HTML gateway/challenge;record not found 代表官方 JSON resource 可讀但沒有匹配 camera record / 安全 image locator,兩者都需改用授權/一手 image locator 或重新 source discovery 後再 probe;camera_rollout_readiness_v0 明確回全 registry callability conclusion completeness、L2/remediation/L3 counts 與 L3 必要 live gates,且 true_l3_rollout_allowed_from_status_table_only=false;camera_l2_failure_reason_repair_contract_v0 / camera_l2_source_specific_repair_playbook_v0 會在 summary/source groups/batch plan 內針對 locator-free failure reason 回 required artifacts/operator action/no-locator safety flags,避免把 HTML gateway/index 或 fixture/dry-run 誤算 L2/L3;camera_l2_remediation_summary_v0 只回 aggregate counts、public access tier split、safe public_auxiliary first buckets 與 operator order(fetch_failed → invalid_snapshot → configuration_required;先修已配置 server-side locator 的 runtime_probe_failed,再處理 source_discovery_required),camera_l2_source_group_discovery_contract_v0 會嵌在 source groups / batch plan,列出 official source page review、per-camera locator review、server-side secret configuration、re-probe before L2 與 must_not_expose policy;camera_l2_official_source_page_review_v0 只回 data.gov.tw public dataset id/title 與 HTTP 200/title-match review 結論,並嵌入 metadata-only camera_l2_official_resource_metadata_review_v0(public resource format summary、providing agency、update frequency、license、per-camera matching field names、locator field names only),不回 resource endpoint、raw locator/env、credential 或 raw image;camera_l2_remediation_queue_v0 只回最多 10 筆下一批可操作 metadata(camera_id/county/display/location/snapshot_status/access tier/next_action/public source),camera_l2_remediation_source_groups_v0 依 source_lineage/public_source_url 彙總需同批補 server-side locator 或修 probe 的候選數、snapshot/access-tier split 與最多 3 個 sample camera_id;camera_l2_remediation_batch_plan_v0 以預設 90 支為一批,產生 out-of-band server-side locator 設定/修復與 re-probe 的安全 bulk plan,並回 metadata-only missing_locator_configuration_candidates、configured_locator_repair_candidates、expected_live_l2_delta_if_all_candidates_probe_successfully 與 workstreams 以區分補缺 locator 與修已配置但 fetch/invalid 的 locator;四者都不回 locator/env/secret/raw image;unfiltered 小 limit request 只跑單次 all-registry probe,再由同一 probe result 切出 returned rows,避免 transient camera source 造成 returned-row summary 與全表 summary 不一致;若 blockers 或 source policy 為 discovery_only,即使有 public page,也回 source_discovery_required_before_internal_use / blocked_pending_source_discovery,因該頁仍是 discovery/index reference 而非已審查的逐 camera callable locator;batch21/batch28/batch29/batch30/batch31/batch32/batch33/batch34/batch35/batch36/batch37/batch38 延伸 data.gov.tw 36687 水利署水利防災用影像 117 支低隱私水情與防災影像 candidate;batch20 仍保留 data.gov.tw 41567 水利署河川分署遠端監控影像 10 支低隱私臺東卑南溪/高雄二仁溪河川疏濬工區觀測站 L2-candidate,實際 snapshot locator 必須留在 server-side config,未設定前不假稱 L3;data.gov.tw 142980 IoW淹水深度最新資料已列為 official_wra_iow_realtime_flood_depth_review_required 低隱私防災感測 context;data.gov.tw 5982 防災資訊淹水警戒已列為 official_wra_flood_warning_context_review_required 低隱私水利署防災警戒 context;data.gov.tw 22227 河川水位測站站況已列為 official_wra_river_water_level_station_status_metadata_review_required 低隱私水位站 metadata context;data.gov.tw 156083 水位計已列為 official_yunlin_water_level_gauge_metadata_review_required 雲林低隱私水情測站 context;data.gov.tw 145465 水位站已列為 official_yunlin_water_level_station_metadata_review_required 雲林低隱私水情測站 context;data.gov.tw 138749 臺北捷運萬大中和樹林線第一期工程交通即時影像位置資料集已列為 official_taipei_metro_construction_camera_metadata_high_privacy_review_required 交通/施工影像 metadata,高隱私與車牌風險未審查前不升 L2/L3;data.gov.tw 131753 申請介接臺北市閉路電視攝影機(CCTV)作業說明已列為 official_taipei_cctv_authorization_process_reference_only 授權流程參考;data.gov.tw 156053 CCTV設備座標已列為 official_taichung_cctv_device_coordinates_high_privacy_blocked;data.gov.tw 146054 土石流潛勢溪流參考雨量站雨量資料已列為 official_moa_debris_reference_rainfall_context_review_required 低隱私防災雨量 context;data.gov.tw 177644 桃園國際機場即時航班第二版已列為 official_taoyuan_airport_realtime_flight_context_non_camera;data.gov.tw 132888 臺北市室內空氣品質相關資訊已列為 official_taipei_indoor_air_quality_context_review_required;data.gov.tw 174854 觀光政策已列為 official_tourism_policy_reference_only;data.gov.tw 36687 水利署水利防災用影像已列為 official_wra_water_disaster_camera_l2_snapshot_metadata_candidate_review_required;95806 鯉魚潭水庫每日水情資訊、41568 水庫每日營運狀況與 32729 水利署所屬雨量站基本資料只作低隱私水情/雨量 cross-check context;data.gov.tw 37665 CCTV 靜態資訊(v2.0) 與 122133 嘉義縣即時路況攝影機CCTV 僅作交通/CCTV source discovery,高隱私與車牌風險未審查前 blocked;130237 克利金法逐時雷達估計降雨資料只作雨量/淹水 cross-check context;146055 土石流潛勢溪流縣市鄉鎮警戒值清單與 174270 大規模崩塌潛勢區警戒值只作低隱私防災 threshold context;163147 淹水感測器(白金)只作雲林縣政府低隱私防災感測 cross-check context;上述 discovery 需逐筆授權/freshness/probe,不當成 camera visual truth;不回 raw URL / 原圖 / secret | API key required,回 camera_status_table_ready |
scripts/run_camera_upgrade_batch.py | Camera Upgrade Batch Runner:operator-only report runner,schema=camera_upgrade_batch_runner_v0;以 --offset/--batch-size/--max-batches 分批處理全 registry,輸出 L0/L1/L2/L3、blockers 與 Recommended next batch;report-only,不寫 registry,不啟用新 feed | CLI / staging operator,支援 --format json / --format markdown;不公開 raw URL / raw image bytes |
GET /v1/reality/cameras/{camera_id}/live-query | Camera Live Visual Query:schema=camera_live_visual_query_v0;任一已登錄 camera_id 都可查安全狀態。5 支優先官方/觀光 YouTube proxy(九份、貓空、象山、旗津海水浴場、阿里山二延平)支援 query_mode=on_demand_safe_proxy_snapshot_summary:server-side on-demand 抓取 thumbnail metadata 時回 source_lineage=official_public_channel_via_youtube、freshness=questionable、youtube_thumbnail_current_frame_claim=false、confidence_cap<=0.70、effective_confidence_cap=min(source_lineage_cap, freshness_cap),不公開 raw thumbnail/stream/embed locator、env var 或 raw image bytes;九份另回 camera_traffic_parking_fusion_v0,官方停車訊號優先,停車/交通來源未設定或阻擋時回 unavailable/blocker。已達 L3 回即時 visual evidence 摘要;未達 L3 回 9-step onboarding checklist、blockers 與 next steps;不回原圖、不回技術取流網址。Camera L3 Rollout / L2 snapshot metadata:目前 local/fixture-verified L2 snapshot metadata target 為 435 支,含 batch13 data.gov.tw 174655 官方觀測站、batch14 data.gov.tw 100218 臺南市管區域排水即時影像、batch15/batch16/batch17/batch18/batch19/batch20 data.gov.tw 41567 水利署河川分署遠端監控影像、batch21/batch28/batch29/batch30/batch31/batch32/batch33/batch34/batch35/batch36/batch37/batch38 data.gov.tw 36687 水利署水利防災用影像與 batch22/batch23/batch24/batch25/batch26/batch27 data.gov.tw 28196 環境部空氣品質監測即時影像資料 candidate;staging live 仍需 server-side snapshot config/probe 才確認實際 L2,第一手來源優先但不阻塞,proxy evidence 必須標註 lineage/tier/privacy、套 confidence cap 與 limitations,L3 仍需真實可信 vision runtime;已配置 server-side locator 若指向官方 JSON resource/index(含 CKAN-style nested wrappers / CCDList parent-child records),snapshot fetcher 只在 process 內以 split camera terms 匹配單一 camera image 並回 metadata;camera snapshot process-local fetch cache 會在同一個 fetcher instance 內以預設 300 秒 TTL 重用相同官方 dataset/page/JSON/YouTube proxy locator 的 metadata fetch 結果,避免 on-demand burst 或全 registry probe 重複打同一個上游端點,但不做 continuous monitoring、不落盤、不進 response、不回 raw image bytes 或 raw URL;不公開 resource endpoint、per-camera locator、JSON payload、env var 或 raw image | API key required,回 live_visual_evidence_available / on_demand_visual_reference_available / on_demand_visual_reference_unavailable / onboarding_required / camera_not_found |
GET /v1/reality/cameras/select | Multi-source Camera Selection v0:依 location / intent 排序候選鏡頭;不把 discovery_only 視為可抓取影像 | API key required,目前回 multi_source_camera_selection_v0 |
GET /v1/reality/cameras/{camera_id}/snapshot | server-side 抓取白名單攝影機 snapshot metadata;不回傳影像內容或 raw URL | API key required,目前可能回 configuration_required |
GET /v1/reality/cameras/{camera_id}/visual-evidence | 攝影機 visual observation usable V0;有 server-side snapshot 時回 metadata-only visual_evidence_available,不回 raw image bytes、不回 raw URL、不做人臉/車牌/個體追蹤 | API key required,目前可能回 metadata_only_snapshot_available / snapshot_not_available / analysis_not_enabled |
GET /v1/reality/cameras/vision-provider/status | Camera Vision Provider Status V0:只回 provider/model/credential 是否 configured 的 metadata;不呼叫外部 vision API、不回 key/env/raw prompt/raw image;內含 camera_vision_call_budget_guard_v0、max_calls_per_camera_per_hour、cache_ttl_seconds、max_image_bytes | API key required,回 camera_vision_provider_status_v0,可能是 not_configured / configured_disabled |
GET /v1/reality/cameras/{camera_id}/stability | Camera Stability Monitor v0:回報 fetch 成功率、延遲與內容一致性;不公開 raw URL | API key required,目前多為 limited_history |
GET /v1/reality/cameras/{camera_id}/cross-check | Camera × Official Data Cross-check v0:標準化攝影機 visual evidence 與 CWA / radar / satellite / traffic / water/disaster 官方來源的關係 | API key required,目前回 insufficient_data / visual_analysis_not_enabled |
POST /v1/reality/check | 送出自然語言 Reality Check 查詢 | API key required,目前氣象查詢可回 live_data;CWA Forecast Query V0 支援 rain_forecast / cwa_rain_forecast_answer_v0,用 CWA 短時預報回答「阿里山下午會下雨嗎?」並標示 forecast 不是 current observation;CWA Earthquake Reality V0 支援 earthquake_recent,使用 E-A0015-001 / E-A0016-001 回最近地震、震央、規模、深度、最大震度與受影響縣市 |
POST /v1/reality/demo-check | Public Demo Check:首頁免 API key demo mode;不需要 X-API-Key,且只允許首頁固定 demo queries(Level 2 為 15 個固定 demo 問題);非 allowlist 問題回 demo_query_not_allowed | Public but allowlisted;不回傳、不嵌入、不暴露 server-side API key;任意查詢仍需使用 POST /v1/reality/check + 自己的 API key |
Production Readiness Matrix V0
GET /v1/reality/production-readiness 回 production_readiness_matrix_v0 / readiness_matrix_returned,用 L0–L8 明確區分 planned、contract、staging verified、production candidate 與 production ready,避免把 foundation 誤稱為 production。
- L0 idea / planned:概念或待接入。
- L4 staging live data:staging 已有 live data,但尚未達 production。
- L7 production ready:需 live data、provenance、freshness、confidence、cross-validation、safety、persistence、monitoring、docs/tests/staging verification 與 production operations 皆完成。
- CWA Weather Reality = L6 production candidate:已有 live CWA observation/rainfall runtime 與 staging verification,但仍缺 durable observation storage、source health persistence、production monitoring 與 radar/satellite/forecast cross-validation。
- Camera Visual Validation = L3 client ready foundation:已有 registry/snapshot metadata/source lineage/stability/cross-check contracts,但仍缺 first-party/licensed camera source、live snapshot fetch 與 AI visual evidence production pipeline。
production_ready_count=0:目前沒有任何能力標記為 L7 production ready。
Source Runtime Health V0
GET /v1/reality/source-health 回 source_runtime_health_v0 / source_health_returned,用 read-only metadata 檢查 CWA official API client 與 camera visual validation foundation 的 runtime readiness。
fetch_performed=false:此 endpoint 不呼叫上游資料源,只檢查 runtime 設定與缺口。- CWA credential configured without printing key:只回
credential_configured=true/false,不顯示CWA_API_KEY或任何 key value。 - camera_visual_validation foundation_only:攝影機仍是 foundation/contract;缺 first-party 或 licensed source、live snapshot fetch 與 AI visual evidence production pipeline。
- source_catalog_runtime_status_v0:同一個 API-key guarded response 也回 metadata-only
source_catalogpersistence status;source catalog runtime-status required value tableSOURCE_CATALOG_RUNTIME_STATUS_REQUIRED_VALUES維護schema_version=source_catalog_runtime_status_v0、metadata_only=true與 redaction booleans;source catalog runtime restart-consistency required value tableSOURCE_CATALOG_RUNTIME_RESTART_CONSISTENCY_REQUIRED_VALUES維護source_catalog_runtime_restart_consistency_v0/compare_field=catalog_sha256/metadata_only=true/paths_hidden=true;source catalog runtime durable-load-proof required value tableSOURCE_CATALOG_RUNTIME_DURABLE_LOAD_PROOF_REQUIRED_VALUES維護source_catalog_runtime_durable_load_proof_v0/compare_field=catalog_sha256/public_sources_endpoint=/v1/reality/sources/metadata_only=true/paths_hidden=true/requires_path_exposure=false;source catalog runtime durable-load-proof value type contract tableSOURCE_CATALOG_RUNTIME_DURABLE_LOAD_PROOF_VALUE_TYPE_CONTRACT鎖定 runtime durable load proof 的 fixed strings、metadata booleans、loaded_flagbool 與 nested proof wrappers types;source catalog runtime restart-reload-check value type contract tableSOURCE_CATALOG_RUNTIME_RESTART_RELOAD_CHECK_VALUE_TYPE_CONTRACT鎖定 nested restart reload proof 的 fixed strings、metadata booleans 與 path-exposure guard booleans;source catalog health check required contract value tableSOURCE_CATALOG_HEALTH_CHECK_REQUIRED_CONTRACT_VALUES維護scripts/source_catalog_health_check.py的 require checks safe fixed values(storage_mode=durable_json_v1、loaded_from_durable=true、restart_consistency_schema_version=source_catalog_restart_consistency_v0、restart_consistency_compare_field=catalog_sha256、metadata_only=true、paths_hidden=true),source catalog health check schema/status allowlist sanitization 只輸出 allowlisted top-level schema_version / status,drift 值改成 unknown,避免 schema/status 欄位回顯 path/payload text;source catalog health check source count strict int sanitization 只輸出 exact int source_count,drift 值改成 0,避免 count 欄位回顯 path/payload text;source catalog health check storage durable strict bool sanitization 只把 exact bool true 視為 durable,避免 truthy string drift;source catalog health check storage mode allowlist sanitization 只輸出 allowlisted storage mode,未知值改成 unknown,避免 mode drift 回顯 path/locator/credential;operator output 仍不顯示 durable path、source payload、credential 或 raw feed locator;source catalog runtime restart-reload-check required value tableSOURCE_CATALOG_RUNTIME_RESTART_RELOAD_CHECK_REQUIRED_VALUES維護source_catalog_restart_reload_check_v0/helper_schema_version=source_catalog_restart_reload_v0/compare_field=catalog_sha256/public_sources_endpoint_after_restart=/v1/reality/sources/admin_health_endpoint_after_restart=/admin/sources/health/metadata_only=true/paths_hidden=true/requires_path_exposure=false;source catalog health restart-reload-check required value tableSOURCE_CATALOG_HEALTH_RESTART_RELOAD_CHECK_REQUIRED_VALUES讓/admin/sources/health使用同一組 metadata-only restart reload proof values;source catalog health restart-consistency required value tableSOURCE_CATALOG_HEALTH_RESTART_CONSISTENCY_REQUIRED_VALUES維護/admin/sources/health的source_catalog_restart_consistency_v0/compare_field=catalog_sha256/metadata_only=true/paths_hidden=truecompare guide;source catalog health redaction required value tableSOURCE_CATALOG_HEALTH_REDACTION_REQUIRED_VALUES;source catalog health metadata-safety required value tableSOURCE_CATALOG_HEALTH_METADATA_SAFETY_REQUIRED_VALUES維護/admin/sources/health的metadata_only=true/paths_hidden=true;source catalog health write-scope required value tableSOURCE_CATALOG_HEALTH_WRITE_SCOPE_REQUIRED_VALUES維護/admin/sources/health固定 write-scope safety values(write_scope=sources_only/cameras_written=0/clients_written=0/production_apply_locked=true);source catalog health check write-scope safe value tableSOURCE_CATALOG_HEALTH_CHECK_WRITE_SCOPE_SAFE_VALUES維護scripts/source_catalog_health_check.pysanitized operator output 的相同 write-scope values,且不輸出 camera/client payload、durable path、credential 或 raw feed locator;source catalog health redaction required values 維護/admin/sources/healthredaction booleanssecrets_removed=true/raw-feed_locators_removed=true/paths_hidden=true;source catalog runtime file-safety-proof required value tableSOURCE_CATALOG_RUNTIME_FILE_SAFETY_PROOF_REQUIRED_VALUES維護source_catalog_runtime_file_safety_proof_v0/owner_only_file_mode_required=true/metadata_only=true/paths_hidden=true/requires_path_exposure=false;並包含source_catalog_storage、loaded_from_durable、source_count、redactedcatalog_sha256、source_catalog_runtime_restart_consistency_v0compare guide(compare_field=catalog_sha256/paths_hidden=true)、source_catalog_runtime_durable_load_proof_v0(只回 durable load flag、/v1/reality/sourcesendpoint、source_catalog_restart_reload_check_v0、requires_path_exposure=false與source_catalog_runtime_file_safety_proof_v0/owner_only_file_mode_required=true,標示 load 已驗證 owner-only file mode 但不曝光 path)與 redaction flags;可用於 client-side restart checksum visibility;fresh startup durable catalog source-health metadata-only 已鎖定 fresh app import/startup 載入ADMIN_SOURCE_CATALOG_PATH後只回 storage/checksum/count,不顯示 durable path、source payload、credential、raw feed locator 或 secret;source_catalog_load_validation_v0也寫入storage_wrapper_keys_rechecked_after_read=true、storage_wrapper_values_rechecked_after_read=true、metadata_collection_types_rechecked_after_read=true、metadata_scalar_types_rechecked_after_read=true與redaction_wrapper_values_rechecked_after_read=true、redaction_removed_categories_order_rechecked_after_read=true,宣告 startup/load 在 JSON read 後會重新確認 storage wrapper 仍只含 metadata-only durable_json_v1/mode booleans,且mode=durable_json_v1/durable=true值也重新驗證;metadata collection 仍只由 object/list 組成、scalar value 仍維持 JSON-safe string/bool/null/int/finite-float 型別,且 redaction removed_categories 仍是 deterministic ordered allowlist。 - source catalog health check source count nonnegative sanitization guard:
scripts/source_catalog_health_check.py的 operator JSONsource_count只接受非負 exact int,負數或 drift 值降為0;仍 metadata-only,不回 durable path、credential、hash、source payload 或 raw feed locator。 - source catalog runtime file-safety-proof value type contract table:
SOURCE_CATALOG_RUNTIME_FILE_SAFETY_PROOF_VALUE_TYPE_CONTRACT鎖定 nestedfile_safety_proof的 fixed string、owner-only mode/load booleans、metadata booleans 與 path-exposure guard boolean;source catalog runtime durable-load-proof emitted key tableSOURCE_CATALOG_RUNTIME_DURABLE_LOAD_PROOF_EMITTED_KEYS鎖定 outer durable proof public/admin runtime key order;source catalog runtime restart-reload-check emitted key tableSOURCE_CATALOG_RUNTIME_RESTART_RELOAD_CHECK_EMITTED_KEYS鎖定 nested restart reload proof key order;source catalog health restart-reload-check emitted key tableSOURCE_CATALOG_HEALTH_RESTART_RELOAD_CHECK_EMITTED_KEYS鎖定 admin source health nested restart reload proof key order;source catalog runtime file-safety-proof emitted key tableSOURCE_CATALOG_RUNTIME_FILE_SAFETY_PROOF_EMITTED_KEYS鎖定 nested proof public/admin runtime key order;仍 metadata-only、paths_hidden=true,不回 durable path、credential、source payload 或 raw feed locator。 - source catalog runtime durable-load-proof value immutable guard:
SOURCE_CATALOG_RUNTIME_DURABLE_LOAD_PROOF_REQUIRED_VALUES、SOURCE_CATALOG_RUNTIME_DURABLE_LOAD_PROOF_VALUE_TYPE_CONTRACT與SOURCE_CATALOG_RUNTIME_RESTART_RELOAD_CHECK_VALUE_TYPE_CONTRACT現在使用 read-only mapping 鎖定/v1/reality/source-healthdurable load proof fixed safe values、nested restart reload type contract 與 metadata/path-exposure guards,避免 test/runtime helper 直接 mutation 改寫 restart persistence proof;仍不回 durable path、credential、source payload 或 raw feed locator。 - source catalog runtime file-safety-proof required/type immutable guard:
SOURCE_CATALOG_RUNTIME_FILE_SAFETY_PROOF_REQUIRED_VALUES與SOURCE_CATALOG_RUNTIME_FILE_SAFETY_PROOF_VALUE_TYPE_CONTRACT現在使用 read-only mapping 鎖定 nestedfile_safety_prooffixed safe values、owner-only mode/load booleans、metadata/path-hidden/path-exposure guards 與 strict type contract,避免 test/runtime helper 直接 mutation 改寫 file safety proof;仍不回 durable path、credential、source payload 或 raw feed locator。 - source catalog health admin required values immutable guard:
SOURCE_CATALOG_HEALTH_RESTART_RELOAD_CHECK_REQUIRED_VALUES、SOURCE_CATALOG_HEALTH_RESTART_CONSISTENCY_REQUIRED_VALUES、SOURCE_CATALOG_HEALTH_REDACTION_REQUIRED_VALUES、SOURCE_CATALOG_HEALTH_METADATA_SAFETY_REQUIRED_VALUES與SOURCE_CATALOG_HEALTH_WRITE_SCOPE_REQUIRED_VALUES現在使用 read-only mapping 鎖定/admin/sources/healthmetadata-only restart/reload、restart consistency、redaction、metadata-safety 與 write-scope safe values,避免 test/runtime helper 直接 mutation 改寫 admin health proof;仍不回 durable path、credential、source payload、camera/client payload 或 raw feed locator。 - source catalog restart-reload helper required values immutable guard:
SOURCE_CATALOG_RESTART_RELOAD_HELPER_REQUIRED_VALUES現在使用 read-only mapping 鎖定 fresh startup reload helper 的source_catalog_restart_reload_v0schema、compare_field=catalog_sha256、metadata_only=true與paths_hidden=truesafe values,避免 test/runtime helper 直接 mutation 改寫 restart reload proof;仍不回 durable path、credential、source payload 或 raw feed locator。 - source catalog health key contract immutable guard:
SOURCE_CATALOG_HEALTH_KEY_CONTRACT現在使用 read-only mapping 鎖定/admin/sources/healthemitted/allowed key table references,public summary projection 會先驗證 exact emitted order 與 allowed key set,避免 test/runtime helper 直接 mutation 改寫 admin health key contract;仍 metadata-only,不回 durable path、credential、source payload 或 raw feed locator。 - source catalog runtime restart-reload-check required values immutable guard:
SOURCE_CATALOG_RUNTIME_RESTART_RELOAD_CHECK_REQUIRED_VALUES現在使用 read-only mapping 鎖定/v1/reality/source-healthnested restart reload proof fixed safe values、restart verify endpoint names、metadata/path/exposure guards,避免 test/runtime helper 直接 mutation 改寫 restart reload proof;仍不回 durable path、credential、source payload 或 raw feed locator。 - source catalog runtime status/restart-consistency required values immutable guard:
SOURCE_CATALOG_RUNTIME_STATUS_REQUIRED_VALUES與SOURCE_CATALOG_RUNTIME_RESTART_CONSISTENCY_REQUIRED_VALUES現在使用 read-only mapping 鎖定/v1/reality/source-healthsource catalog runtime status 與 restart consistency nested proof fixed safe values,避免 test/runtime helper 直接 mutation 改寫 schema、checksum compare field、metadata-only 或 path-hidden guards;仍不回 durable path、credential、source payload 或 raw feed locator。 - source catalog source-item value type contract drift guard:
_source_item_value_type_contract會先驗證 source-item value-type contract key table、allowed-key table 與 exact-check table 同步;若 table drift 則 load-time source item validation fail-closed,仍 metadata-only 且不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog source-item value-type empty-contract helper guard:
_has_valid_source_item_value_types()先拒絕 empty invalid value-type contract 與 empty exact-check key table,避免 helper-only empty table drift 接受空 source item;仍 metadata-only 且不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog source-item value-type contract exact-proxy guard:
_source_item_value_type_contract()現在要求ADMIN_SOURCE_CATALOG_SOURCE_ITEM_VALUE_TYPE_CONTRACT維持 exact read-only mapping,拒絕 mutable/dict-subclass helper drift 後才做 durablesources[]item strict type validation;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog source-item value-type value exact-tuple guard:
_source_item_value_type_contract()現在會在 mapping equality 前要求 nullable metadata type contract 維持 exacttuple且成員為 exact type objects,拒絕 tuple subclass helper-only drift 後才做sources[]item strict type validation;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog active error message exact-string guard:
_has_valid_source_catalog_error_message_table()現在會在 comparing fixed generic error-message mappings 前,先要求 runtime error-message mapping 的 keys/values 維持 exactstr,拒絕 str subclass helper-only drift 後才供 duplicate/invalid/too-many source catalog save/load error classification 使用;錯誤仍固定 generic、metadata-only,不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog expected error message key table exact-string guard:
_has_valid_source_catalog_error_message_table()現在會在 comparing fixed generic error key tuples 前,先要求 baseline expected error-message key table 的 keys 維持 exactstr,拒絕 str subclass helper-only drift 後才供 duplicate/invalid/too-many source catalog save/load error classification 使用;錯誤仍固定 generic、metadata-only,不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog expected error message exact-string guard:
_has_valid_source_catalog_error_message_table()現在會在 comparing fixed generic error-message mappings 前,先要求 baseline expected error-message mapping 的 keys/values 維持 exactstr,拒絕 str subclass helper-only drift 後才供 duplicate/invalid/too-many source catalog save/load error classification 使用;錯誤仍固定 generic、metadata-only,不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog source-item value type contract immutable runtime guard:
ADMIN_SOURCE_CATALOG_SOURCE_ITEM_VALUE_TYPE_CONTRACT現在使用 read-only mapping 鎖定 durablesources[]item runtime value-type table,避免 test/runtime helper 直接 mutation 改寫 source item load-time type contract;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog metadata type contract exact-proxy guard:
_metadata_value_type_contract()/_metadata_scalar_type_contract()現在要求 metadata value/scalar type table 維持 exact read-onlyMappingProxyType,拒絕 mutable dict 或 dict subclass helper-only drift 後才做 tuple()/mapping equality 與 scalar/container dispatch;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog metadata runtime type contract immutable guard:
ADMIN_SOURCE_CATALOG_METADATA_VALUE_TYPE_CONTRACT與ADMIN_SOURCE_CATALOG_METADATA_SCALAR_TYPE_CONTRACT現在使用 read-only mapping 鎖定 metadata runtime value/scalar type table,避免 test/runtime helper 直接 mutation 改寫 durable metadata load-time JSON-safe type contract;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog env storage mode runtime contract immutable guard:
ADMIN_SOURCE_CATALOG_STORAGE_MODE_CONTRACT、ADMIN_SOURCE_CATALOG_ENV_CONTRACT與 required env safe-value table 現在使用 read-only mapping 鎖定 durable/in-memory storage mode 與 metadata-only/path-hidden env contract,避免 test/runtime helper 直接 mutation 改寫 startup/load persistence contract;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level key contract drift guard / exact-string guard / exact-proxy guard:
_top_level_key_contract會拒絕 required/allowed/load-required top-level durable wrapper key table 的 duplicate/unknown-key fail-closed drift、str subclass key-table drift,也會要求ADMIN_SOURCE_CATALOG_TOP_LEVEL_KEY_CONTRACT維持 exact read-only mapping,且_has_valid_top_level_key_set在 invalid empty contract 時會做 empty-payload invalid-contract fail-closed,避免未知 wrapper、duplicate marker、subclass key、mapping subclass 或空 payload helper-only path 被 load-time key-set validation silently 接受;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level type contract exact-string guard:
_top_level_scalar_type_contract()與_top_level_wrapper_type_contract()會拒絕 scalar/wrapper type contract key 的 str subclass helper-only drift,再做 tuple/mapping equality、duplicate/unknown-key fail-closed 與 exact type validation;仍 metadata-only 且不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog wrapper value-type contract exact-string guard / source catalog wrapper value-type contract exact-container guard:
_value_type_contract_for_allowed_keys()現在會先拒絕 Mapping/tuple subclass helper-only drift,再檢查 storage/contains/redaction/restart/atomic/load value-type helper table 的 str subclass key drift、tuple/mapping equality、duplicate/unknown-key fail-closed 與 exact type validation;仍 metadata-only 且不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog storage path fspath exact-string guard / source-item key contract exact-string guard:
AdminSourceCatalogStore.path與_has_unpadded_control_free_storage_path()只接受os.fspath()回傳 exactstr;source catalog source-item allowed key-table exact-tuple guard / source catalog source-item key contract exact-string guard / source catalog source-item value-type contract exact-string guard / source catalog source-item value-type key-table exact-tuple guard 也要求 source item allowed-key、value-type key 與 exact-check key tables 維持 exacttuple,且 allowed-key 與 value-type helper table field names 維持 exactstr,拒絕 tuple/str subclass helper-only drift 後才做 durable source item allowed-key 與 exact type validation。仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog storage/contains/redaction value-type value drift guard:
_storage_value_type_contract/_contains_value_type_contract/_redaction_value_type_contract會拒絕 fixed expected type-value drift(storage、contains、redaction wrapper metadata types),避免 key-only type contract helper silently 接受 drift;仍 metadata-only 且不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog storage/contains/redaction runtime value-type contract immutable guard:
ADMIN_SOURCE_CATALOG_STORAGE_VALUE_TYPE_CONTRACT、ADMIN_SOURCE_CATALOG_CONTAINS_VALUE_TYPE_CONTRACT與ADMIN_SOURCE_CATALOG_REDACTION_VALUE_TYPE_CONTRACT現在使用 read-only mapping 鎖定 durable wrapper runtime type tables,避免 test/runtime helper 直接 mutation 改寫 storage/contains/redaction load-time type contract;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog restart-consistency key contract drift guard:
_restart_consistency_key_contract鎖定 restart-consistency required/allowed key tables exact order,拒絕 duplicate/unknown-key fail-closed drift,避免 wrapper key-set validation 因 set comparison silently 接受 table drift;仍 metadata-only 且不公開 durable path、source payload、credential、token 或 raw feed locator。 - Source Health Persistence V0:若設定
SOURCE_HEALTH_LOG_PATH,/v1/reality/source-health會回source_health_persistence_v0metadata summary,包含 per-sourcelast_success_at、last_failure_at、success_rate、failure_count、avg_latency_ms與 latest status;也會回source_health_rolling_windows_v024h rolling windows,包含每個 source 的 sample_count、success_rate、failure_count、avg_latency_ms、last_success_at / last_failure_at;不顯示檔案路徑、API key、credential、raw feed URL 或 source payload。 - Source Health Recorder / Probe V0:
POST /v1/reality/source-health/probe回source_health_probe_v0,以write_scope=source_health_observations_only寫入 CWA official source configuration-only health observations;fetch_performed=false,不呼叫 CWA upstream、不顯示 credential。 - CWA Live Fetch Health Probe V0:
POST /v1/reality/source-health/probe/live-cwa回cwa_live_fetch_health_probe_v0,作為 live upstream probe 實際呼叫 CWA weather/rainfall datasets 一次,記錄latency_ms、staleness_seconds、success/failure 與error_code;只寫入source_health_observations_only,不顯示 credential、raw URL、JSONL path 或 source payload。 - CWA Source Health Scheduled Probe V0:
scripts/probe_cwa_source_health.py可由 operator、cron 或 systemd timer 呼叫既有/v1/reality/source-health/probe/live-cwa;script 從REALITY_API_BASE_URL/TRUESIGHT_REALITY_API_BASE_URL與REALITY_API_KEY/TRUESIGHT_REALITY_API_KEY讀設定,輸出cwa_scheduled_source_health_probe_v0metadata-only summary;notification_sent=false,不輸出 key、raw payload、raw URL 或 source payload。自動排程尚未啟用。 - CWA Source Health systemd Timer V0:
deploy/systemd/taiwan-world-model-cwa-probe.service與deploy/systemd/taiwan-world-model-cwa-probe.timer提供每 10 分鐘執行 probe helper 的 staging templates;unit 只用EnvironmentFile=/etc/taiwan-world-model.env讀取 server-side env,不寫 plaintext key;OnUnitActiveSec=10min、Persistent=true、StandardOutput=journal。template 不會因 rsync/deploy 自動 enable,需 operator 先手動systemctl start驗證,再systemctl enable --now。 - CWA Source Health Thresholds / Degraded Mode V0:
/v1/reality/source-health回cwa_degraded_mode_v0,將 source health history 轉成healthy / degraded / stale / upstream_error / configuration_required;包含production_usable、confidence_modifier、reasons 與 thresholds。/v1/reality/check也會回reality_health_status並套用cwa_degraded_response_policy_v0:degraded 時降 confidence/status,stale/upstream_error 時不再包裝成完整即時資料。 - CWA Monitoring / Alerting V0:
/v1/reality/source-health/alerts回cwa_monitoring_alerts_v0,把 source health history 轉成 metadata-only alerts;read_only=true、fetch_performed=false、notification_sent=false,不呼叫 CWA、不寄送外部通知、不顯示 credential、raw URL、JSONL path 或 source payload。 - Forecast / Radar / Satellite Cross-validation V0:
/v1/reality/weather/cross-validation回cwa_forecast_radar_satellite_cross_validation_v0,提供 forecast/radar/satellite/observation 的證據角色、交叉驗證政策與限制;目前是 metadata contract,read_only=true、fetch_performed=false、runtime_connected=false,不下載雷達/衛星圖、不把衛星雲圖當單點地面雨勢;目前runtime_status=radar_satellite_metadata_and_disagreement_contract_ready。Radar Runtime Metadata V0 另由/v1/reality/weather/radar-metadata回cwa_radar_runtime_metadata_v0,先定義 CWA radar evidence role、10/20/30 分鐘 freshness bands 與 station rainfall ground-truth limitation;仍不下載雷達圖、不做 image analysis。Satellite Runtime Metadata V0 另由/v1/reality/weather/satellite-metadata回cwa_satellite_runtime_metadata_v0,定義 CWA satellite broad cloud / typhoon context role、30/60/120 分鐘 freshness bands 與 regional-context limitation;仍不下載衛星圖、不做 image analysis。Disagreement Scoring Contract V0 另由/v1/reality/weather/disagreement-scoring回cwa_disagreement_scoring_contract_v0,先定義 observation/forecast/radar/satellite 分歧評分維度、confidence modifiers 與 official observation / official alerts first 的 authority policy;仍不計算 live score。
CWA Weather Reality Production Gap Checklist V0
GET /v1/reality/cwa-production-gap 回 cwa_production_gap_v0 / gap_checklist_returned,明確列出 CWA Weather Reality 從 L6 → L7 production ready 的 pass / partial / blocker。
read_only=true且fetch_performed=false:此 endpoint 不呼叫 CWA、不寫入資料,只回 checklist metadata。- pass:官方 CWA credential、live observation/rainfall runtime 等已完成項。
- partial:freshness/confidence contract、forecast/radar/satellite metadata contract、source-health monitoring alert evaluator、External Notification Channel Staging Config Contract V0(
notification_channel_status_ready)、Escalation Ownership Contract V0(escalation_policy_contract_ready)、Staging Real-send Approval Contract V0(real_send_approval_contract_ready)、Production Monitoring Notification Delivery Contract V0、Staging Notification Drill V0(dry_run_available)、CWA Operator Runbook Contract V0(cwa_runbook_contract_ready)與 staging runbook 已有基礎但仍缺 runtime fetch / external notification delivery / approved one-time real-send drill / rollback drill。 - blocker:目前 CWA Weather Reality L7 checklist 已無 metadata-layer blocker;production_ready 仍為 false,因多項必要 gate 仍是 partial。
- 不顯示
CWA_API_KEY、REALITY_API_KEY或任何 credential value。
Admin Console Security Foundation V0
Reality API 也提供給人類營運者看的後台入口:/admin/login。V0 使用 server-side admin username + password hash、session cookie、HttpOnly、Secure、SameSite=Lax,並有登入失敗 rate-limit 與 audit log foundation。
- Dashboard:顯示 API clients、usage summary 與人類可讀管理入口。
- Sources / Cameras:顯示資料源與攝影機 registry metadata,不顯示 plaintext API key、不顯示 raw CCTV URL、不顯示 key hash 或 server secrets。
- Export:
GET /admin/export/catalog.json回schema_version=admin_export_v0,採 metadata-only redacted export。 - Import Dry-run:
GET /admin/import與POST /admin/import/dry-run提供 Admin Import Dry-run V0;回schema_version=admin_import_dry_run_v0、apply_enabled=false,只做 schema validation、SSRF/security scan、dry-run diff,不會寫入 production registry。 - Visual Diff:表單預設
response_format=html,顯示 Admin Import Visual Diff V0,包含 summary table、diff table、Security findings、Validation errors、Apply disabled、No data has been written。 - Field Diff:Admin Import Field-level Diff V0 會在 JSON 回應加入
field_diffs,並在 HTML 顯示 Field-level before/after diff 與Field changes;不顯示 secrets、API key、tokens、cookies、password 或 raw feed 欄位。 - Confirmation:Admin Import Confirmation Token V0 會在 dry-run 回應加入
confirmation、payload_sha256、confirmation_token流程與/admin/import/applyendpoint;V0 永遠回apply_disabled_v0,並明確顯示 No data has been written。 - Rollback Snapshot:Admin Import Rollback Snapshot V0 提供
POST /admin/import/rollback-snapshot與GET /admin/import/rollback-snapshot/{snapshot_id};回admin_import_rollback_snapshot_v0、snapshot_id、snapshot_sha256、restore_enabled=false,V0 採in_memory_v0且只保存 redacted metadata snapshot。 - Audit:Durable Admin Audit Log V0 支援
ADMIN_AUDIT_LOG_PATH,例如/var/log/taiwan-world-model/admin-audit.jsonl;每筆 JSONL 使用admin_audit_log_v0,可記錄payload_sha256、snapshot_id、token_valid等安全 metadata;不寫入 secrets、API key/hash、tokens、cookies、passwords 或 raw CCTV URL。 - Audit Viewer:Admin Audit Log Viewer V0 提供
/admin/audit;回admin_audit_log_viewer_v0/audit_events_returned,read_only=true、delete_enabled=false,支援endpoint/decision/reasonfilters,只顯示 audit metadata,不顯示 request body、tokens、keys、cookies、passwords 或 raw feed locators。 - Role Permissions:Admin Role Permissions V0 使用
viewer/operator/admin三層角色;viewer可讀取 admin 頁面與 audit metadata(viewer 可讀取 admin 頁面),operator可執行 dry-run / restore dry-run / cleanup dry-run(operator 可執行 dry-run),admin才可進入 apply / cleanup apply / client status update 等安全流程(admin 才可進入 apply / cleanup apply);權限不足回admin_role_forbidden,並明確顯示 No data has been written。 - CSRF:Admin CSRF Protection V0 會在 session form 加入
csrf_token,並保護/admin/import/dry-run、/admin/import/apply、/admin/import/rollback-snapshot;缺 token 或錯 token 回admin_csrf_v0/csrf_validation_failed,並明確顯示 No data has been written。 - Apply Guard:Staging-only Apply Guard V0 使用
REALITY_DEPLOYMENT_ENV;deployment_env=production時即使 confirmation token 與 payload hash 都正確,也回production_apply_locked/ Production apply is locked;deployment_env=staging目前仍回apply_disabled_v0,兩者都明確顯示 No data has been written。 - Preview Lock:Apply Preview Lock V0 要求
/admin/import/apply在進入 apply preview 前必須提供rollback_snapshot_id與rollback_snapshot_sha256;缺少回rollback_snapshot_required,id/hash 不匹配回rollback_snapshot_mismatch,成功驗證才回rollback_snapshot_valid=true;V0 仍不寫入並顯示 No data has been written。 - Durable Snapshot:Durable Rollback Snapshot V1 支援
ADMIN_ROLLBACK_SNAPSHOT_DIR;設定後 rollback snapshot 會以admin_import_rollback_snapshot_v1JSON 檔落盤,responsestorage.mode=durable_json_v1、storage.durable=true,即使 server restart 後仍可透過 snapshot id 取回。 - Snapshot List:Rollback Snapshot List V0 提供
/admin/import/rollback-snapshots;回admin_rollback_snapshot_list_v0/snapshot_list_returned的 metadata list,只列 snapshot id、sha256、generated_at、contains、storage,不回 snapshot data,且apply_enabled=false、restore_enabled=false、No data has been written。 - Restore UI:Human Admin Restore UI V0 會在
/admin/import顯示 Rollback Snapshot List,每筆提供 Restore dry-run 與 Restore apply 表單;apply 仍由ADMIN_IMPORT_APPLY_ENABLED控制,且 V0 仍是 sources-only。 - Snapshot Cleanup:Snapshot Cleanup Dry-run V0 提供
/admin/import/rollback-snapshots/cleanup-dry-run;回admin_rollback_snapshot_cleanup_dry_run_v0/cleanup_dry_run_completed,支援max_files與max_age_daysretention preview,且cleanup_enabled=false、delete_enabled=false、No snapshot files have been deleted。 - Snapshot Cleanup Apply:Snapshot Cleanup Apply V0 提供
/admin/import/rollback-snapshots/cleanup-apply;需先有 dry-run 產生的cleanup_plan_id/cleanup_plan_sha256,缺少回cleanup_plan_required,drift/hash 錯誤回cleanup_plan_mismatch,production 回production_cleanup_locked,staging + flag true 才回admin_rollback_snapshot_cleanup_apply_v0/staging_snapshot_cleanup_applied_v0,且delete_scope=rollback_snapshots_only。 - Snapshot Cleanup UI:Snapshot Cleanup UI V0 會在
/admin/import顯示 Preview cleanup candidates 表單,支援max_files/max_age_days;HTML dry-run 結果顯示cleanup_plan_id/cleanup_plan_sha256與 Apply cleanup 表單,但仍受 staging-only 與 apply flag 保護。 - Durable Confirmation:Durable Confirmation Token Store V0 支援
ADMIN_CONFIRMATION_TOKEN_DIR;設定後 confirmation token metadata 會以admin_import_confirmation_v1JSON 檔落盤,只保存token_sha256,不保存 plaintext token;apply response 會回confirmation_storage,仍顯示 No data has been written。 - Restore Preview:Restore / Rollback Dry-run V0 提供
/admin/import/rollback-snapshot/{snapshot_id}/restore-dry-run;回admin_restore_dry_run_v0/restore_dry_run_completed,找不到 snapshot 回snapshot_not_found,且永遠restore_enabled=false、顯示 Restore dry-run only 與 No data has been written。 - Source Restore:Source Restore Apply V0 提供
/admin/import/rollback-snapshot/{snapshot_id}/restore-apply;僅在 staging 且ADMIN_IMPORT_APPLY_ENABLED=true時以admin_restore_apply_v0/staging_source_restore_applied_v0恢復restore_scope=sources_only,先建立pre_restore_backup_snapshot_id,寫入 durable source catalog,且cameras_restored=0、clients_restored=0。production 回production_restore_locked,flag false 回restore_disabled_v0。 - Apply Flag:Staging Real Apply Enable Flag V0 使用
ADMIN_IMPORT_APPLY_ENABLED;response 會回apply_enabled_flag。production 仍回production_apply_locked;staging 且 flag false 回apply_disabled_v0;staging 且 flag true 必須先通過 apply plan lock,且 V0 只允許sources_onlywrite scope。 - Apply Plan:Staging Registry Write Plan / Transaction V0 提供
/admin/import/apply-plan;回admin_import_apply_plan_v0/apply_plan_created、transaction_plan_id、pre_write_hash、post_write_expected_hash,但仍write_plan_enabled=false、Apply plan only、No data has been written。若設定ADMIN_APPLY_PLAN_DIR,apply plan 會以storage.mode=durable_json_v1落盤,server restart 後仍可驗證。 - Apply Plan Lock:Apply Plan Lock / Plan Confirmation V0 要求
/admin/import/apply在 staging real apply flag 開啟時綁定transaction_plan_id、pre_write_hash、post_write_expected_hash;缺 plan 回apply_plan_required,hash 或 payload/snapshot 不一致回apply_plan_mismatch,有效 plan 回transaction_plan_valid=true。 - Source Write:Source-only Staging Registry Write V0 / Durable Source Catalog Store V0 僅在
REALITY_DEPLOYMENT_ENV=staging且ADMIN_IMPORT_APPLY_ENABLED=true、confirmation/rollback/apply-plan 全部有效時寫入 sources;成功回staging_source_write_applied_v0、write_scope=sources_only、source_catalog_storage、source_catalog_health(metadata-onlysource_catalog_health_v0checksum/restart compare guide,含 top-levelsource_catalog_health.paths_hidden=true、planner_source_count與runtime_catalog_in_sync)、cameras_written=0、clients_written=0。若設定ADMIN_SOURCE_CATALOG_PATH,成功後會以admin_source_catalog_v1/durable_json_v1透過 same-directory temp file、existing catalog lstat-only metadata validation guard、temp catalog lstat-only metadata validation guard、post-replace catalog lstat-only metadata validation guard、write parent preflight lstat-only metadata validation guard、pre-write temp catalog chmod guard、temp file creation failure fail-closed guard / temp file creation TypeError fail-closed guard(temporary source catalog file must be creatable)、temp file open failure fail-closed guard / temp file context enter TypeError fail-closed guard(temporary source catalog file must be openable)、temp file lstat-before-chmod failure fail-closed guard / temp file lstat-before-chmod TypeError fail-closed guard(temporary source catalog file must be inspectable before chmod)、temp cleanup unlink TypeError primary-error preservation guard、temp file chmod failure fail-closed guard / temp file chmod TypeError fail-closed guard(temporary source catalog file must be chmodable)、post-chmod temp file fd mode recheck、temp file fd fileno failure fail-closed guard / temp file fd fileno before write TypeError fail-closed guard、temp file lstat before write TypeError fail-closed guard(temporary source catalog file fd must be inspectable before write)、temp file fd fstat failure fail-closed guard / temp file fd fstat before write TypeError fail-closed guard(temporary source catalog file fd must be inspectable before write)、temp file path lstat failure fail-closed guard(temporary source catalog file must be inspectable before write)、temp file fd/path identity recheck(temporary source catalog path changed before write)、pre-tempfile parent-dir no-follow guard(source catalog parent directory must not be group/world-writable before write)、write parent-dir open fail-closed guard / write parent-dir open TypeError fail-closed guard(source catalog parent directory must be openable before write)、write parent-dir fstat failure fail-closed guard / write parent-dir fstat TypeError fail-closed guard(source catalog parent directory must be inspectable before write)、write parent-dir lstat failure fail-closed guard(source catalog parent directory must be inspectable before write)、write parent-dir primary failure precedence guard、write parent-dir close failure fail-closed guard、write parent-dir close TypeError fail-closed guard(source catalog parent directory fd must be closable before write)、write parent-dir fd/path identity recheck(source catalog parent directory changed before write)、pre-replace parent-dir fd metadata recheck(source catalog parent directory must not be group/world-writable before replace)、pre-replace parent-dir open fail-closed guard / pre-replace parent-dir open TypeError fail-closed guard(source catalog parent directory must be openable before replace)、pre-replace parent-dir fstat failure fail-closed guard / pre-replace parent-dir fstat TypeError fail-closed guard(source catalog parent directory must be inspectable before replace)、pre-replace parent-dir lstat failure fail-closed guard / replace identity lstat TypeError fail-closed guard、pre-replace parent-dir primary failure precedence guard(source catalog parent directory must be inspectable before replace)、pre-replace parent-dir close failure fail-closed guard、pre-replace parent-dir close TypeError fail-closed guard(source catalog parent directory fd must be closable before replace)、parent mkdir failure fail-closed guard / parent mkdir TypeError fail-closed guard(source catalog parent directory must be creatable)、atomic replace failure fail-closed guard / atomic replace TypeError fail-closed guard(source catalog path must be replaceable atomically)、restart consistency paths_hidden=true、temporary source catalog parent symlink guard(temporary source catalog parent directory must not be a symlink)、flush/fsync、private file mode 0600、atomic replace、post-replace catalog path recheck、post-replace catalog fd no-follow recheck、post-replace catalog fd/path identity recheck、post-replace catalog open fail-closed guard(source catalog path must be openable after replace)、post-replace catalog fstat failure fail-closed guard / post-replace catalog fstat TypeError fail-closed guard、post-replace catalog lstat TypeError fail-closed guard(source catalog fd must be inspectable after replace)、post-replace catalog fd primary failure precedence guard、post-replace catalog lstat failure fail-closed guard(source catalog path must be inspectable after replace)、post-replace catalog close failure fail-closed guard(source catalog fd must be closable after replace)、post-replace parent-dir fd metadata recheck / post-replace parent-dir open TypeError fail-closed guard(source catalog parent directory must be openable after replace/source catalog parent directory must not be group/world-writable after replace)、post-replace parent-dir fstat failure fail-closed guard / post-replace parent-dir fstat TypeError fail-closed guard(source catalog parent directory must be inspectable after replace)、post-replace parent-dir lstat failure fail-closed guard(source catalog parent directory must be inspectable after replace)、post-replace parent-dir primary failure precedence guard、post-replace parent-dir close failure fail-closed guard、post-replace parent-dir close TypeError fail-closed guard / after-replace parent-dir close failure fail-closed guard(source catalog parent directory fd must be closable after replace)、parent-dir fsync no-follow guard、parent-dir fsync fstat failure fail-closed guard(source catalog parent directory must be inspectable during fsync)、parent-dir fsync lstat failure fail-closed guard(source catalog parent directory must be inspectable during fsync)、parent-dir fsync fstat owner/mode recheck、parent-dir fsync fd/path identity recheck(source catalog parent directory changed during fsync)、parent-dir fsync open fail-closed guard、parent-dir fsync open TypeError fail-closed guard、parent-dir fsync fstat TypeError fail-closed guard(source catalog parent directory must be openable during fsync)與 parent-dir fsync failure fail-closed guard(source catalog parent directory must be fsyncable)、parent-dir fsync primary failure precedence guard、parent-dir fsync close failure fail-closed guard、parent-dir fsync close TypeError fail-closed guard(source catalog parent directory fd must be closable during fsync)、temp file write failure fail-closed guard / temp file write TypeError fail-closed guard(temporary source catalog file must be writable)、temp file fsync failure fail-closed guard(temporary source catalog file must be fsyncable)、temp file fd fileno during fsync failure fail-closed guard / temp file fd fileno during fsync TypeError fail-closed guard(temporary source catalog file fd must be inspectable during fsync)、temp file fd fstat during fsync failure fail-closed guard / temp file fd fstat during fsync TypeError fail-closed guard(temporary source catalog file fd must be inspectable during fsync)、temp file close-after-write failure fail-closed guard / temp file close-after-write TypeError fail-closed guard(temporary source catalog file fd must be closable after write)、temp file write primary failure precedence guard(保留temporary source catalog file must be writable)落盤;若 replace 後 catalog path 變成 symlink 會 fail closed(source catalog path must not be a symlink),不回報成功、不寫入 operator-visible symlink target;startup/load 另有 load parent-dir open fail-closed guard(source catalog parent directory must be openable before read)與 load parent-dir close failure fail-closed guard(source catalog parent directory fd must be closable before read),並會拒絕 world-readable catalog file;save/write 也有 owner-only existing catalog write guard(source catalog path must be owner-only readable/writable);startup/load 也會拒絕 hardlinked catalog file(source catalog path must not have multiple hard links)、unowned catalog file(source catalog path must be owned by the service user)、unowned parent directory(source catalog parent directory must be owned by the service user)與 world-writable parent directory(source catalog parent directory must not be group/world-writable);load-time parent-dir no-follow guard 會以O_NOFOLLOW/O_DIRECTORY開啟 parent directory 並重新確認不是 group/world-writable(source catalog parent directory must not be group/world-writable before read),且執行 load-time parent-dir fd/path identity recheck(source catalog parent directory changed before read);relative storage path(source catalog path must be absolute)、symlink storage path(source catalog path must not be a symlink)、directory storage path / non-regular storage path(source catalog path must be a regular file)、parent path file(source catalog parent path must be a directory)或 symlink parent/ancestor directory;建立缺少 parent directory 後會做 post-mkdir parent symlink recheck(source catalog parent directory must not be a symlink)、too many sources(source catalog cannot contain more than 1000 sources)、duplicatesource_id、out-of-range priority(priority must be between 0 and 10000)、overlong source_id、overlong text fields(source identity / license_note / supports_intents / safety_notes 必須 256 characters or fewer)、source locator 欄位 redaction(hostname-only locator keys 也會移除)、source text list overflow(supports_intents cannot contain more than 100 items/safety_notes cannot contain more than 100 items)、overlong metadata string values(metadata key/value string 必須 256 characters or fewer)、non-finite metadata numbers(metadata numbers must be finite)、non-standard JSON constants(non-standard JSON constants are not allowed)、oversized source catalog file / write-before-temp-file size guard(source catalog file cannot exceed 1000000 bytes)、metadata total node count overflow(metadata total node count cannot exceed 1000)、metadata serialized size overflow(metadata serialized size cannot exceed 16384 bytes)、metadata depth overflow(metadata depth cannot exceed 8 levels)、metadata collection overflow(metadata collections cannot contain more than 100 items)、blank/paddedsupports_intents/ blank/padded safety_notes / blank/padded license_note / blank/padded identity fields(name/provider/source_type/integration_status,必須是 non-empty unpadded strings)/ blank/padded metadata keys 或含 unsupported characters(例如 slash/path-like)的 invalidsource_id會在開啟 temp file 前被拒絕並保留既有 catalog;replace 失敗時保留舊 catalog 並清理 temp file;apply 流程會先完成 durable save,再切換 runtime catalog / Evidence Planner,因此 durable save 失敗不會把 imported source 洩入 memory-only runtime。service startup 會載入 durable catalog,restart 後/v1/reality/sources仍可看到 imported source,且 sources endpoint 會回報source_catalog_storage(memory/durable mode,不含路徑或 secrets);同一個 runtime 也會在 sources-only apply 成功後重建 Evidence Planner,讓後續/v1/reality/check的 evidence planning 使用更新後 source catalog。durable catalog 與 apply 後同 process runtime catalog 都會移除 raw feed URL、一般http(s)URL value、streaming scheme URL-like value(rtsp:///rtmp:///ws:///wss:///ftp:///sftp://)、embedded URL-like string value、scheme-relative URL value、bare host/path URL-like value、bare IP host/path URL-like value、credentials、passwords、tokens、JWT-like compact token value、PEM private key value redaction、PGP private key block value redaction、PuTTY private key value redaction、bare cloud access key ID value redaction(bare cloud access key ID direct regex coverage)、AWS secret access key value redaction(AWS secret access key direct regex coverage)、AWS session token value redaction(AWS session token direct regex coverage)、AWS presigned URL query value redaction(AWS presigned URL query direct regex coverage)、Cloudinary URL value redaction(Cloudinary URL direct regex coverage)、1Password service account token value redaction(1Password service account token direct regex coverage)、Terraform Cloud token value redaction(Terraform Cloud token direct regex coverage)、Cloudflare API token value redaction、Fastly API token value redaction、Langfuse secret key value redaction、Helicone API key value redaction、Doppler service token value redaction(Doppler service token direct regex coverage)、PlanetScale service token value redaction(PlanetScale service token direct regex coverage)、PlanetScale password value redaction(PlanetScale password direct regex coverage)、MQTT broker locator value redaction、Kafka broker locator value redaction、AMQP broker locator value redaction、Redis cache locator value redaction、NATS broker locator value redaction、GitHub PAT value redaction、GitHub PAT direct regex coverage、Slack token value redaction、session/cookie credential value redaction、credentialed URI userinfo value redaction(including IPv4 URI userinfo value redaction, IPv6 URI userinfo value redaction, and localhost URI userinfo value redaction)、non-JSON-safe opaque metadata values、non-string metadata keys、authorization/bearer header hints,以及 metadata list / nested metadata list / metadata tuple 裡的Authorization: ...、Authorization = ...、Bearer ...、api_key=...、api key: ...、access_token-redacted=...、access token: ...、refresh-token: ...、refresh token-redacted=...、client_secret=...、private-key: ...、password_hash=...、token-redacted=...、token: ...、password=...、password: ...、secret=...、secret: ...類 secret-like string values;redaction 同時是 key-based 與 value-based URL-like redaction / secret-like redaction,即使敏感 locator 或 secret-like string 被放在非敏感命名欄位也會移除,避免/v1/reality/sources或 Evidence Planner 在 restart 前短暫暴露敏感 metadata;若 catalog 檔案 corrupt / unreadable / top-level non-object JSON / schema 不符、sources不是 list、含 non-object source entries,或單筆 source 欄位 malformed(malformed source item fail-closed,包含supports_intents/safety_notes不是 list,list 內含 non-string item 而非 list of strings,或metadata非 object/null),或偵測到 unredacted loaded catalog files(durable JSON 仍含會被 redaction 移除的 raw URL/credential/token metadata),load 會 fail closed / 忽略整份 unsafe durable file 並 fallback seed/valid catalog data,不會邊載入邊清理、不會 crash 或載入 unsafe data。Source Catalog Health V0 會在/admin/sources顯示 Metadata-only health panel,且/v1/reality/sources會回source_catalog_healthpublic source catalog health summary,包含source_catalog_health_v0、loaded_from_durable、redactedcatalog_sha256、metadata_only=true與paths_hidden=true;admin panel 另外包含source_count、storage_mode、loaded_from_durable與 redactedcatalog_sha256;不顯示 durable file path、source record payload、API key/hash、tokens、passwords 或 raw feed locators。payload 若包含 cameras/clients 回unsupported_write_scope_v0;production 仍回production_apply_locked。 - source catalog restart verify helper durable hash guard:新增
scripts/source_catalog_restart_verify.py,可在 staging restart 前後讀取 metadata-only/admin/sources/health並比對 catalog checksum;輸出只保留 count/boolean,不輸出 checksum 值、durable path、source payload、admin key、credential 或 raw feed locator,production apply 仍 hard locked。 - Source catalog restart verify checklist:staging deploy/restart smoke 應使用
scripts/source_catalog_restart_verify.py --admin-key-env REALITY_ADMIN_KEY --restart-unit taiwan-world-model.service --execute-restart,以 metadata-only count/boolean 驗證 Durable Source Catalog restart persistence;預期成功 markersource_catalog_restart_verified,最後仍確認ADMIN_IMPORT_APPLY_ENABLED=false。 - Durable redaction hardening:source catalog value-based URL-like redaction 也涵蓋 cloud storage URI locator values(例如
s3:///gs:///file://)、GitLab token value redaction(例如 GitLab PAT / OAuth token-shaped values;GitLab token direct regex coverage)、GitLab CI job token value redaction(例如 GitLab CI job / runner token-shaped values;GitLab CI job token direct regex coverage)、Linear API key value redaction(例如 Linear API key-shaped values;Linear API key direct regex coverage)、Mapbox access token value redaction(例如 Mapbox access token-shaped values;Mapbox access token direct regex coverage)、Opsgenie API key value redaction(例如 GenieKey-prefixed values)、IPv4 host:port locator value redaction(例如 metadata-only IPv4 host:port locator-shaped values)、bare host:port locator value redaction、percent-encoded bare host:port locator value redaction(例如 metadata-only domain host:port locator-shaped values)、percent-encoded IPv4 host:port locator value redaction(例如 metadata-only URL/query encoded IPv4 host:port locator-shaped values)、IPv6 host:port locator value redaction、percent-encoded IPv6 host:port locator value redaction(例如 metadata-only bracketed IPv6 host:port locator-shaped values)、localhost host:port locator value redaction、percent-encoded localhost host:port locator value redaction(例如 metadata-only localhost host:port locator-shaped values)、Oracle connection locator value redaction(例如 Oracle connection locator-shaped values;Oracle connection locator direct regex coverage)、Elasticsearch connection locator value redaction(例如 Elasticsearch connection locator-shaped values)、OpenSearch connection locator value redaction(例如 OpenSearch connection locator-shaped values)、ClickHouse connection locator value redaction(例如 ClickHouse connection locator-shaped values)、Memcached cache locator value redaction(例如 Memcached cache locator-shaped values)、Cassandra connection locator value redaction(例如 Cassandra connection locator-shaped values;Cassandra connection locator direct regex coverage)、MQTT broker locator value redaction(例如 MQTT broker locator-shaped values;MQTT broker locator direct regex coverage)、Kafka broker locator value redaction(例如 Kafka broker locator-shaped values;Kafka broker locator direct regex coverage)、Snowflake connection locator value redaction(例如 Snowflake connection locator-shaped values)、CockroachDB connection locator value redaction(例如 CockroachDB connection locator-shaped values)、SQL Server connection locator value redaction(例如 SQL Server / JDBC SQL Server connection locator-shaped values)、MariaDB connection locator value redaction(例如 MariaDB connection locator-shaped values)、SQLite connection locator value redaction(例如 SQLite connection locator-shaped values)、Redshift connection locator value redaction(例如 Redshift connection locator-shaped values)、DynamoDB connection locator value redaction(例如 DynamoDB connection locator-shaped values)、local filesystem path value redaction(例如 local runtime/symlink path-shaped values)、Windows filesystem path value redaction、parenthesized Windows filesystem path value redaction、Windows Program Files path value redaction(例如 Windows runtime/cache path-shaped values)、Windows UNC filesystem path value redaction、parenthesized Windows UNC filesystem path value redaction(例如 Windows UNC runtime/cache path-shaped values)、relative filesystem path value redaction、tilde filesystem path value redaction(例如 relative runtime/cache path-shaped values)、parenthesized tilde filesystem path value redaction(例如 metadata notes 中括號包住的 ~/runtime path-shaped values)、IPv6 bare locator value redaction(例如 bracketed / bare IPv6 host-path locator-shaped values)、localhost host/path locator value redaction(例如 localhost host/path locator-shaped values)、Docker Hub access token value redaction(例如 Docker Hub access token-shaped values;Docker Hub access token direct regex coverage)、Slack token value redaction(例如xoxb-.../xoxp-...;Slack token direct regex coverage)、Slack app-level token value redaction(例如 Slack app-level token-shaped values;Slack app-level token direct regex coverage)、Slack webhook URL value redaction(例如 Slack incoming webhook URL-shaped values)、Discord webhook URL value redaction(例如 Discord webhook URL-shaped values)、Microsoft Teams webhook URL value redaction(例如 Microsoft Teams incoming webhook URL-shaped values)、Deepgram API key value redaction(例如 Deepgram API-key-shaped values;Deepgram API key direct regex coverage)、DeepL API key value redaction(例如 DeepL API-key-shaped values;DeepL API key direct regex coverage)、Segment write key value redaction(例如 Segment write-key-shaped values;Segment write key direct regex coverage)、Discord bot token value redaction(例如 bot token / MFA token-shaped values;Discord bot token direct regex coverage)、Google API key value redaction / Gemini API key value redaction(例如AIza...)、Google OAuth access token value redaction、Google OAuth refresh token value redaction、Clerk secret key value redaction(例如 Google OAuth access token-shaped values)、Honeycomb API key value redaction(例如 Honeycomb API key-shaped values)、Brevo API key value redaction(例如 Brevo API key-shaped values)、Buildkite API token value redaction(例如 Buildkite user access token-shaped values)、CircleCI API token value redaction(例如 CircleCI API token-shaped values)、Figma PAT value redaction(例如 Figma personal access token-shaped values)、Expo access token value redaction(例如 Expo access token-shaped values)、Asana PAT value redaction(例如 Asana PAT-shaped values)、Doppler service token value redaction(例如 Doppler service token-shaped values)、PlanetScale service token value redaction(例如 PlanetScale service token-shaped values)、PlanetScale password value redaction(例如 PlanetScale password-shaped values)、Upstash QStash token value redaction(例如 Upstash QStash token-shaped values)、Prefect API key value redaction(例如 Prefect API key-shaped values)、Contentful PAT value redaction(例如 Contentful personal access token-shaped values)、Sourcegraph access token value redaction(例如 Sourcegraph access token-shaped values)、Databricks PAT value redaction(例如 Databricks personal access token-shaped values)、Airtable PAT value redaction(例如 Airtable personal access token-shaped values)、New Relic API key value redaction(例如 New Relic API / insert key-shaped values)、Replicate API token value redaction(例如 Replicate API token-shaped values)、Dropbox access token value redaction(例如 Dropbox short-lived access token-shaped values)、LangSmith API key value redaction(例如 LangSmith API key-shaped values)、Groq API key value redaction(例如 Groq API key-shaped values;Groq API key direct regex coverage)、Perplexity API key value redaction(例如 Perplexity API key-shaped values;Perplexity API key direct regex coverage)、Okta API token value redaction(例如 Okta API token-shaped values;Okta API token direct regex coverage)、Stripe secret key value redaction(例如sk_live_.../rk_test_...)、Stripe webhook secret value redaction(Stripe webhook secret direct regex coverage;例如 Stripe webhook secret-shaped values)、SendGrid API key value redaction(例如SG....)、OpenAI API key value redaction(例如sk-proj-.../sk-svcacct-...)與 OpenAI admin key value redaction(OpenAI admin key direct regex coverage;例如sk-admin-...)、Firecrawl API key value redaction(例如fc-...)、Jina AI API key value redaction(例如 Jina API key-shaped values)、OpenRouter API key value redaction(例如sk-or-v1-...)、Pinecone API key value redaction(例如pcsk_...)、Grafana service account token value redaction(例如glsa_...)、Grafana Cloud API token value redaction、Grafana Cloud API token direct regex coverage(例如glc_...)、xAI API key value redaction(例如 xAI API key-shaped values)、SonarQube token value redaction(例如 SonarQube token-shaped values)、Anthropic API key value redaction(例如 Anthropic API key-shaped values)、npm token value redaction、npm token direct regex coverage(例如npm_...)、Netlify personal access token value redaction、Netlify personal access token direct regex coverage(例如 Netlify personal access token-shaped values)、PyPI API token value redaction、PyPI API token direct regex coverage(例如 PyPI API token-shaped values)、DigitalOcean PAT value redaction、DigitalOcean PAT direct regex coverage(例如 DigitalOcean PAT-shaped values)、Postman API key value redaction、Postman API key direct regex coverage(例如 Postman API key-shaped values)、Sentry auth token value redaction(例如 Sentry auth token-shaped values)、Neon API key value redaction(例如 Neon API key-shaped values)、MongoDB URI value redaction、PostgreSQL connection locator value redaction、MySQL connection locator value redaction(例如 MySQL / MySQL X locator-shaped values)、ClickHouse connection locator value redaction(例如 ClickHouse locator-shaped values)、Vercel token value redaction(例如 Vercel token-shaped values;Vercel token direct regex coverage)、Vercel Blob read-write token value redaction / Vercel Blob read/write token value redaction(例如 Vercel Blob read/write token-shaped values;Vercel Blob read-write token direct regex coverage;Snyk token direct regex coverage;Pulumi access token direct regex coverage;Resend API key direct regex coverage)、Fly.io access token value redaction(例如 Fly.io access token-shaped values)、Railway API token value redaction(例如 Railway API token-shaped values;Railway API token direct regex coverage)、Heroku API key value redaction(例如 Heroku API key-shaped values;Heroku API key direct regex coverage)、Snyk token value redaction、Pulumi access token value redaction(例如 Pulumi access token-shaped values)、Resend API key value redaction(例如 Resend API key-shaped values)、NVIDIA NGC API key value redaction(例如 NVIDIA NGC API key-shaped values)、Datadog API key value redaction(例如 DD_API_KEY / DATADOG_API_KEY-shaped values)、Codecov upload token value redaction(例如 Codecov upload token-shaped values)、Postmark server token value redaction、Algolia API key value redaction(例如 Algolia API-key-shaped values)、Ably API key value redaction(例如 Ably API-key-shaped values)、Braze REST API key value redaction(例如 Braze REST API-key-shaped values)、Klaviyo API key value redaction(例如 Klaviyo API-key-shaped values)、Amplitude API key value redaction(例如 Amplitude API-key-shaped values)、Render API key value redaction(例如 Render API key-shaped values)、RubyGems API key value redaction(例如 RubyGems API key-shaped values)、LaunchDarkly SDK key value redaction(例如 LaunchDarkly SDK key-shaped values)、Cerebras API key value redaction(例如 Cerebras API key-shaped values)、WandB API key value redaction;WandB API key direct regex coverage / Weights & Biases API key value redaction(例如 WandB API key-shaped values)、Hugging Face token value redaction / HuggingFace token value redaction(例如hf_...)、Firebase Cloud Messaging server key value redaction(例如 FCM legacy server key-shaped values)、Shopify access token value redaction(例如 Shopify access token-shaped values)、Supabase access token value redaction(例如 Supabase access token-shaped values)、Mailchimp API key value redaction(例如 Mailchimp API key-shaped values)、Mailgun API key value redaction(例如 Mailgun API key-shaped values)、Atlassian API token value redaction(例如 Atlassian API token-shaped values)、Azure DevOps PAT value redaction;Azure DevOps PAT direct regex coverage(例如 Azure DevOps PAT-shaped values)、Tailscale auth key value redaction(例如 Tailscale auth/client key-shaped values)、Square access token value redaction;Square access token direct regex coverage(例如 Square access token-shaped values)、Plaid access token value redaction;Plaid access token direct regex coverage(例如 Plaid access token-shaped values)、PayPal access token value redaction;PayPal access token direct regex coverage(例如 PayPal access token-shaped values)、PagerDuty API token value redaction(PagerDuty API token direct regex coverage)(例如 PagerDuty API token-shaped values)、OpenWeather appid value redaction(OpenWeather appid direct regex coverage)(例如 OpenWeather appid-shaped query values)、Notion integration token value redaction(Notion integration token direct regex coverage)(例如 Notion integration token-shaped values)、Twilio API key value redaction(Twilio API key direct regex coverage)、Twilio auth token pair value redaction(Twilio auth token pair direct regex coverage)、Modal token pair value redaction(Modal token pair direct regex coverage)、Basic auth credential value redaction、Bitbucket app password value redaction(例如 Twilio API key-shaped values / Twilio AccountSid+AuthToken pair-shaped values / Modal token_id+token_secret pair-shaped values / HTTP Basic authorization credential-shaped values)、Telegram bot token value redaction(例如 Telegram bot token-shaped values)、HashiCorp Vault token value redaction, Tavily API key value redaction, Cohere API key value redaction, AssemblyAI API key value redaction, PostHog personal API key value redaction, Loops API key value redaction, Voyage API key value redaction, Mistral API key value redaction, Together AI API key value redaction(例如 HashiCorp Vault service/batch token-shaped values)、Azure Storage connection string value redaction(Azure Storage connection string direct regex coverage)、Azure SAS token value redaction(Azure SAS token direct regex coverage)、Azure Service Bus connection string value redaction(Azure Service Bus connection string direct regex coverage)、Azure Shared Access Signature value redaction(Azure Shared Access Signature direct regex coverage)(例如DefaultEndpointsProtocol=...;AccountKey=...)、database connection string value redaction(例如 database connection string-shaped values)、credential hash value redaction, Django PBKDF2 password hash value redaction, Werkzeug scrypt password hash value redaction, Unix SHA-512 crypt password hash value redaction, Unix MD5 crypt password hash value redaction, Apache apr1 MD5 crypt password hash value redaction(例如 credential hash-shaped values)、session/cookie credential value redaction、credentialed URI userinfo value redaction、IPv4 URI userinfo value redaction、IPv6 URI userinfo value redaction 與 localhost URI userinfo value redaction。 - Source Catalog Redaction Pattern Coverage:Durable Source Catalog Store V0 的 Oracle、Elasticsearch、OpenSearch、ClickHouse、Memcached、AMQP、Redis、NATS、MQTT、Kafka、Snowflake、CockroachDB、SQL Server、MySQL、MariaDB、SQLite、Redshift、DynamoDB、PostgreSQL、local filesystem path、usr/local filesystem path、parenthesized filesystem path、key-value filesystem path、semicolon-delimited filesystem path、pipe-delimited filesystem path、backtick-delimited filesystem path、at-delimited filesystem path、hash-delimited filesystem path、ampersand-delimited filesystem path、plus-delimited filesystem path、dollar-delimited filesystem path、percent-encoded filesystem path、percent-encoded URL locator value、percent-encoded scheme-relative locator value、percent-encoded scheme-relative query locator value、percent-encoded localhost scheme-relative locator value、percent-encoded localhost scheme-relative query locator value、percent-encoded IP scheme-relative locator value、percent-encoded IP scheme-relative query locator value、percent-encoded bracketed IPv6 scheme-relative locator value、percent-encoded bracketed IPv6 encoded-port scheme-relative locator value、percent-encoded bare host/path locator value、bare host:port locator value、percent-encoded bare host:port locator value、percent-encoded localhost path locator value、percent-encoded IPv4 path locator value、percent-encoded IPv4 host:port locator value、percent-encoded IPv6 path locator value、percent-encoded IPv6 host:port locator value、localhost host:port locator value、percent-encoded localhost host:port locator value、percent-encoded IPv6 zone-id path locator value、bare IPv6 zone-id path locator value、IPv4 host:port locator value、IPv6 host:port locator value、plus/dollar-delimited percent-encoded filesystem path、percent-encoded relative filesystem path、percent-encoded tilde filesystem path、double percent-encoded filesystem path、triple percent-encoded filesystem path、Windows filesystem path、parenthesized Windows filesystem path、pipe-delimited Windows filesystem path、at-delimited Windows filesystem path、hash-delimited Windows filesystem path、ampersand-delimited Windows filesystem path、plus-delimited Windows filesystem path、dollar-delimited Windows filesystem path、percent-encoded Windows filesystem path、plus/dollar-delimited percent-encoded Windows filesystem path、percent-encoded Windows Program Files path、percent-encoded Windows UNC filesystem path、double percent-encoded Windows filesystem path、triple percent-encoded Windows filesystem path、Windows UNC filesystem path、parenthesized Windows UNC filesystem path、pipe-delimited Windows UNC filesystem path、at-delimited Windows UNC filesystem path、hash-delimited Windows UNC filesystem path、ampersand-delimited Windows UNC filesystem path、plus-delimited Windows UNC filesystem path、dollar-delimited Windows UNC filesystem path、relative filesystem path、parenthesized relative filesystem path、pipe-delimited relative filesystem path、at-delimited relative filesystem path、hash-delimited relative filesystem path、ampersand-delimited relative filesystem path、plus-delimited relative filesystem path、dollar-delimited relative filesystem path、tilde filesystem path、parenthesized tilde filesystem path、pipe-delimited tilde filesystem path、at-delimited tilde filesystem path、hash-delimited tilde filesystem path、ampersand-delimited tilde filesystem path、plus-delimited tilde filesystem path、dollar-delimited tilde filesystem path、IPv6 bare locator、localhost host/path locator、Hugging Face、Firebase Cloud Messaging、Shopify、Supabase、Mailchimp、Mailgun、Atlassian、Tailscale、Vercel、Vercel Blob、Snyk、Pulumi、Resend、NVIDIA NGC、Datadog、Codecov、Postmark、Algolia、Braze、Klaviyo、Amplitude、Railway、Heroku、Linear、Mapbox、Docker Hub、Slack token、Slack app-level token、Opsgenie、Deepgram、DeepL、Segment、Discord bot、Fastly、Langfuse、Helicone、Cloudflare、Upstash QStash、Prefect、Contentful、Sourcegraph、Databricks、Airtable、New Relic、Replicate、Dropbox、LangSmith、Groq、Perplexity、Okta、GitHub、GitLab、Azure Storage、Azure SAS、Azure Service Bus 與 Azure Shared Access Signature connection/cache/broker/path/token value redaction 已有 direct regex coverage,包含 Opsgenie API key direct regex coverage、Deepgram API key direct regex coverage、DeepL API key direct regex coverage、Segment write key direct regex coverage、Discord bot token direct regex coverage、Oracle connection locator direct regex coverage、Elasticsearch connection locator direct regex coverage、OpenSearch connection locator direct regex coverage、ClickHouse connection locator direct regex coverage、Memcached cache locator direct regex coverage、AMQP broker locator direct regex coverage、Redis cache locator direct regex coverage、NATS broker locator direct regex coverage、Snowflake connection locator direct regex coverage、CockroachDB connection locator direct regex coverage、SQL Server connection locator direct regex coverage、MySQL connection locator direct regex coverage、MariaDB connection locator direct regex coverage、SQLite connection locator direct regex coverage、Redshift connection locator direct regex coverage、DynamoDB connection locator direct regex coverage、PostgreSQL connection locator direct regex coverage、local filesystem path direct regex coverage、Windows filesystem path direct regex coverage、Windows UNC filesystem path direct regex coverage、relative filesystem path direct regex coverage、tilde filesystem path direct regex coverage、IPv6 bare locator direct regex coverage、localhost host/path locator direct regex coverage、Hugging Face token direct regex coverage、Firebase Cloud Messaging server key direct regex coverage、Shopify access token direct regex coverage、Supabase access token direct regex coverage、Mailchimp API key direct regex coverage、Mailgun API key direct regex coverage、Atlassian API token direct regex coverage、Tailscale auth key direct regex coverage、Vercel token direct regex coverage、Vercel Blob read-write token direct regex coverage、Snyk token direct regex coverage、Pulumi access token direct regex coverage、Resend API key direct regex coverage、NVIDIA NGC API key direct regex coverage、Datadog API key direct regex coverage、Codecov upload token direct regex coverage、Postmark server token direct regex coverage、Algolia API key direct regex coverage、Ably API key direct regex coverage、Braze REST API key direct regex coverage、Klaviyo API key direct regex coverage、Amplitude API key direct regex coverage、Render API key direct regex coverage、RubyGems API key direct regex coverage、LaunchDarkly SDK key direct regex coverage、Cerebras API key direct regex coverage、Railway API token direct regex coverage、Heroku API key direct regex coverage、Fastly API token direct regex coverage、Langfuse secret key direct regex coverage、Helicone API key direct regex coverage、Cloudflare API token direct regex coverage、Upstash QStash token direct regex coverage、Prefect API key direct regex coverage、Contentful PAT direct regex coverage 與 Sourcegraph access token direct regex coverage、Databricks PAT direct regex coverage、Airtable PAT direct regex coverage、New Relic API key direct regex coverage、Replicate API token direct regex coverage、Dropbox access token direct regex coverage、LangSmith API key direct regex coverage、Groq API key direct regex coverage、Perplexity API key direct regex coverage、Okta API token direct regex coverage、GitHub PAT direct regex coverage、GitLab token direct regex coverage、GitLab CI job token direct regex coverage,避免 patterns 與 store redaction integration 脫鉤;coverage 使用 synthetic metadata-only fixtures,不擴大 write scope。
- Source Catalog Webhook Redaction Pattern Coverage:Durable Source Catalog Store V0 的 Slack webhook URL、Discord webhook URL 與 Microsoft Teams webhook URL value redaction 已有 direct regex coverage,包含 Slack webhook URL direct regex coverage、Discord webhook URL direct regex coverage 與 Microsoft Teams webhook URL direct regex coverage;coverage 使用 synthetic metadata-only fixtures,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Identity/CI Token Direct Coverage:Google API key direct regex coverage、Gemini API key direct regex coverage、Google OAuth access token direct regex coverage、Google OAuth refresh token direct regex coverage、Clerk secret key direct regex coverage、Honeycomb API key direct regex coverage、Brevo API key direct regex coverage、Buildkite API token direct regex coverage、CircleCI API token direct regex coverage、Figma PAT direct regex coverage、Expo access token direct regex coverage 與 Asana PAT direct regex coverage 已補齊;coverage 使用 synthetic metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Search/LLM Token Direct Coverage:Firecrawl API key direct regex coverage、Jina AI API key direct regex coverage、OpenRouter API key direct regex coverage、Pinecone API key direct regex coverage、Grafana service account token direct regex coverage、xAI API key direct regex coverage、SonarQube token direct regex coverage 與 Anthropic API key direct regex coverage 已補齊;coverage 使用 synthetic token-shaped metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog AI/Ops/Data Token Direct Coverage:Cohere API key direct regex coverage、AssemblyAI API key direct regex coverage、Voyage API key direct regex coverage、Mistral API key direct regex coverage、Together AI API key direct regex coverage、Sentry auth token direct regex coverage、Neon API key direct regex coverage 與 MongoDB URI direct regex coverage 已補齊;coverage 使用 synthetic metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Platform Token Coverage Lock:Hugging Face token direct regex coverage、Firebase Cloud Messaging server key direct regex coverage 與 Shopify access token direct regex coverage 已由 public guide / README regression tests 鎖定;coverage 仍只使用 synthetic metadata-only fixtures,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Messaging/Growth Token Direct Coverage:Bitbucket app password direct regex coverage、Telegram bot token direct regex coverage、LINE channel access token direct regex coverage、HashiCorp Vault token direct regex coverage、Tavily API key direct regex coverage、PostHog personal API key direct regex coverage 與 Loops API key direct regex coverage 已補齊;coverage 使用 synthetic token-shaped metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Core API Token Direct Coverage:Stripe secret key direct regex coverage、SendGrid API key direct regex coverage 與 OpenAI API key direct regex coverage 已補齊;coverage 使用 synthetic token-shaped metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Generic Secret Direct Coverage:JWT-like compact token direct regex coverage、URI userinfo credential direct regex coverage、percent-encoded bare URI userinfo locator value redaction、percent-encoded host-only URI userinfo locator value redaction、raw host-only URI userinfo locator value redaction、raw bracketed IPv6 URI userinfo locator value redaction、raw username-only bracketed IPv6 zone URI userinfo locator value redaction、percent-encoded bracketed IPv6 zone URI userinfo locator value redaction、percent-encoded username-only bracketed IPv6 zone URI userinfo locator value redaction、triple percent-encoded URI userinfo locator value redaction、quadruple percent-encoded URI userinfo locator value redaction、quintuple percent-encoded URI userinfo locator value redaction、sextuple percent-encoded URI userinfo locator value redaction、septuple percent-encoded URI userinfo locator value redaction、octuple percent-encoded URI userinfo locator value redaction、nonuple percent-encoded URI userinfo locator value redaction、decuple percent-encoded URI userinfo locator value redaction、undecuple percent-encoded URI userinfo locator value redaction、duodecuple percent-encoded URI userinfo locator value redaction、tredecuple percent-encoded URI userinfo locator value redaction、tetradecuple percent-encoded URI userinfo locator value redaction、quindecuple percent-encoded URI userinfo locator value redaction、sexdecuple percent-encoded URI userinfo locator value redaction、septendecuple percent-encoded URI userinfo locator value redaction、octodecuple percent-encoded URI userinfo locator value redaction、nonodecuple percent-encoded URI userinfo locator value redaction、vigintuple percent-encoded URI userinfo locator value redaction、unvigintuple percent-encoded URI userinfo locator value redaction、duovigintuple percent-encoded URI userinfo locator value redaction、trivigintuple percent-encoded URI userinfo locator value redaction、quattuorvigintuple percent-encoded URI userinfo locator value redaction、quinvigintuple percent-encoded URI userinfo locator value、sexvigintuple percent-encoded URI userinfo locator value redaction、septemvigintuple percent-encoded URI userinfo locator value redaction、octovigintuple percent-encoded URI userinfo locator value redaction、novemvigintuple percent-encoded URI userinfo locator value redaction、trigintuple percent-encoded URI userinfo locator value redaction、untrigintuple percent-encoded URI userinfo locator value redaction、duotrigintuple percent-encoded URI userinfo locator value redaction、tritrigintuple percent-encoded URI userinfo locator value redaction、quattuortrigintuple percent-encoded URI userinfo locator value redaction、quintrigintuple percent-encoded URI userinfo locator value redaction、sextrigintuple percent-encoded URI userinfo locator value redaction、septentrigintuple percent-encoded URI userinfo locator value redaction、octotrigintuple percent-encoded URI userinfo locator value redaction、novemtrigintuple percent-encoded URI userinfo locator value redaction、quadragintuple percent-encoded URI userinfo locator value redaction、unquadragintuple percent-encoded URI userinfo locator value redaction、duoquadragintuple percent-encoded URI userinfo locator value redaction、trequadragintuple percent-encoded URI userinfo locator value redaction、quattuorquadragintuple percent-encoded URI userinfo locator value redaction、quinquadragintuple percent-encoded URI userinfo locator value redaction、sexquadragintuple percent-encoded URI userinfo locator value redaction、septenquadragintuple percent-encoded URI userinfo locator value、octoquadragintuple percent-encoded URI userinfo locator value、novemquadragintuple percent-encoded URI userinfo locator value redaction、quinquagintuple percent-encoded URI userinfo locator value redaction、unquinquagintuple percent-encoded URI userinfo locator value、duoquinquagintuple percent-encoded URI userinfo locator value redaction、trequinquagintuple percent-encoded URI userinfo locator value redaction、quattuorquinquagintuple percent-encoded URI userinfo locator value、quinquinquagintuple percent-encoded URI userinfo locator value、sexquinquagintuple percent-encoded URI userinfo locator value redaction、septenquinquagintuple percent-encoded URI userinfo locator value redaction、octoquinquagintuple percent-encoded URI userinfo locator value redaction、novemquinquagintuple percent-encoded URI userinfo locator value redaction、sexagintuple percent-encoded URI userinfo locator value redaction、unsexagintuple percent-encoded URI userinfo locator value redaction、duosexagintuple percent-encoded URI userinfo locator value redaction、tresexagintuple percent-encoded URI userinfo locator value redaction、quattuorsexagintuple percent-encoded URI userinfo locator value redaction、quinsexagintuple percent-encoded URI userinfo locator value redaction、sexsexagintuple percent-encoded URI userinfo locator value redaction、septensexagintuple percent-encoded URI userinfo locator value、octosexagintuple percent-encoded URI userinfo locator value redaction、novemsexagintuple percent-encoded URI userinfo locator value redaction、septuagintuple percent-encoded URI userinfo locator value redaction、unseptuagintuple percent-encoded URI userinfo locator value redaction、duoseptuagintuple percent-encoded URI userinfo locator value redaction、treseptuagintuple percent-encoded URI userinfo locator value redaction、quattuorseptuagintuple percent-encoded URI userinfo locator value redaction、quinseptuagintuple percent-encoded URI userinfo locator value redaction、sexseptuagintuple percent-encoded URI userinfo locator value redaction、septenseptuagintuple percent-encoded URI userinfo locator value redaction、octoseptuagintuple percent-encoded URI userinfo locator value redaction、novemseptuagintuple percent-encoded URI userinfo locator value redaction、octogintuple percent-encoded URI userinfo locator value redaction、unoctogintuple percent-encoded URI userinfo locator value redaction、duooctogintuple percent-encoded URI userinfo locator value redaction、tresoctogintuple percent-encoded URI userinfo locator value redaction、quattuoroctogintuple percent-encoded URI userinfo locator value redaction、quinoctogintuple percent-encoded URI userinfo locator value redaction、sexoctogintuple percent-encoded URI userinfo locator value redaction、septemoctogintuple percent-encoded URI userinfo locator value redaction、octooctogintuple percent-encoded URI userinfo locator value redaction、percent-encoded username-only URI userinfo locator value redaction、raw username-only URI userinfo locator value redaction、raw username-only URI userinfo delimiter locator value redaction、percent-encoded bracketed IPv6 bare URI userinfo locator value redaction、percent-encoded localhost URI userinfo locator value redaction、percent-encoded IPv4 URI userinfo locator value redaction、percent-encoded URI userinfo query locator value redaction、percent-encoded URI userinfo fragment locator value redaction、percent-encoded URI userinfo semicolon locator value redaction、percent-encoded URI userinfo port locator value redaction、percent-encoded URI userinfo password delimiter locator value redaction、PEM private key value redaction、PEM private key direct regex coverage、PGP private key block value redaction、PGP private key block direct regex coverage、PuTTY private key value redaction 與 PuTTY private key direct regex coverage 已補齊;coverage 使用 synthetic metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- source catalog data connection secret pattern table:
ADMIN_SOURCE_CATALOG_DATA_CONNECTION_SECRET_PATTERN_VALUES鎖定 cloud storage SAS / Azure connection-string / generic database connection-string regex traversal order,讓_is_data_connection_secret_pattern_value()只迭代 shared pattern table 並 short-circuit first match;仍 metadata-only,不回 durable path、source payload、credential、connection string、token 或 raw feed locator。 - source catalog provider token long-tail pattern table:
ADMIN_SOURCE_CATALOG_PROVIDER_TOKEN_LONGTAIL_PATTERN_VALUES鎖定剩餘 provider/API token regex traversal order,讓_is_provider_token_longtail_pattern_value()只迭代 shared pattern table 並 short-circuit first match;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog sensitive-string dispatch table:
ADMIN_SOURCE_CATALOG_SENSITIVE_STRING_DISPATCH_HELPERS鎖定 save-time redaction helper dispatch order,讓_is_sensitive_string_value()只迭代 shared helper table 並 short-circuit first match;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog sensitive-string dispatch helper exact-contract drift guard / exact-string guard / exact-tuple guard:
_sensitive_string_dispatch_helpers會在 save-time redaction dispatch 前拒絕 non-tuple、tuple subclass、duplicate、unknown、missing、reordered 或 str-subclass helper name drift,且 empty invalid dispatch contract 會觸發 fail-closed redaction(把字串視為 sensitive 並移除),避免 helper table 漂移時 silently widening/duplicating/reordering sensitive-string traversal;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog sensitive-key marker exact-contract drift guard / source catalog sensitive-key marker exact-string guard / source catalog sensitive-key marker exact-tuple guard:
_sensitive_key_markers會在 save-time redaction key-name traversal 前拒絕 non-tuple、tuple subclass、duplicate、empty、non-exact string、missing 或 reorderedSENSITIVE_MARKERSdrift,且 empty invalid marker contract 會同時 gate_redact_sequencesequence helper-only traversal 並觸發 fail-closed redaction(mapping/list traversal 都不保留可疑欄位),避免 marker table 漂移時 silently 保留 credential/token/raw-feed 類欄位;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog pattern table shape fail-closed redaction guard / source catalog pattern table exact-tuple guard:
_pattern_table_patterns會在 save-time redaction regex dispatch 前拒絕 non-tuple/non-iterable、tuple subclass、duplicate、non-searchable 或 missing/reordered pattern table entry drift,且 empty invalid pattern contract 會觸發 fail-closed redaction(把字串視為 sensitive 並移除),避免 regex table 漂移時 silently 保留可能敏感字串;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level key-set payload exact-string guard:
_has_valid_top_level_key_set現在會在 required/allowed set membership 前要求 payload top-level keys 維持 exact JSONstr,拒絕 str subclass helper-only drift 被 Python set comparison 靜默接受;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level type helper payload key exact-string guard:
_has_valid_top_level_scalar_types與_has_valid_top_level_wrapper_types現在也會先要求 direct-helper payload top-level keys 維持 exact JSONstr,再做.get()/ membership-driven scalar 與 wrapper type validation,避免 str subclass helper-only drift 繞過 key-set helper後被 type helpers 靜默接受;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level scalar type validation helper / exact-dict guard:
_has_valid_top_level_scalar_types集中 Durable Source Catalog Store V0 load-timeschema_version/catalog_sha256exact scalar type validation,並先拒絕 payload dict subclass helper-only drift;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level nested wrapper dispatch exact-source-list guard / source catalog top-level nested wrapper dispatch key-table exact-tuple guard:
_top_level_nested_wrapper_dispatch()現在先拒絕 direct helper raw sources list subclass drift,且ADMIN_SOURCE_CATALOG_TOP_LEVEL_NESTED_WRAPPER_DISPATCH_KEYS必須維持 exacttuple後才建立 storage/contains/redaction/atomic-write/load-validation validators,避免 contains validator closure 捕捉 caller-controlled source-list 或 tuple subclass 改寫 dispatch table traversal;仍只處理 source-only metadata validation,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog durable payload load-validation key exact-string guard / source catalog durable payload load-validation backing value exact-string guard / source catalog durable payload load-validation value exact-type guard / source catalog durable payload load-validation value exact-value guard:
_durable_payload_load_validation()現在先拒絕 emitted load-validation value key table / mapping、required/optional backing value table keys 的 str subclass drift 與順序漂移,並要求 emitted/required/optional safe marker values 維持 exact str/bool 與 canonical schema/marker safe values,拒絕 same-type safe-value drift 後才建立admin_source_catalog_v1.load_validationmetadata-only proof;仍只處理 source-only wrapper metadata,不公開 durable path、source payload、credential、token、checksum 或 raw feed locator。 - source catalog durable payload restart-consistency mapping exact-proxy guard:
_durable_payload_restart_consistency()現在先要求 fixed safe-value table 維持 exact read-onlyMappingProxyType,拒絕 dict subclass drift 後才 materializeadmin_source_catalog_v1.restart_consistencychecksum metadata proof;仍只處理 source-only wrapper metadata,不公開 durable path、source payload、credential、token、checksum 或 raw feed locator。 - source catalog exact-value helper primitive/list-type guard:
_has_exact_value()現在只對 exact JSON primitive fixed values(str/bool/int/float/None)與 exact list/tuple fixed-value sequences 執行遞迴 equality,比對 required-value proof 前先拒絕 arbitrary comparable object helper-only drift,避免 caller-controlled__eq__hook 影響 Durable Source Catalog wrapper fixed-value validation;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog exact value-type optional-key drift guard:
_has_exact_value_types()現在也要求 optional key table 沒有 duplicate 且所有 optional key 都屬於 canonical check key table,拒絕 helper-only caller 以 unknown/duplicate optional key 改寫 strict wrapper traversal semantics;仍只處理 source-only wrapper metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog redaction mapping depth exact-int guard:
_redact_mapping()現在先要求 direct/helper-only redaction mappingdepth維持 exactint,拒絕 comparable object、bool、float 或 string drift 後才做 top-level source text-list/shape-limit dispatch 與 recursive redaction,避免 caller-controlled equality hook 影響 source-only metadata redaction;仍不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog durable payload contains key exact-string guard / source catalog durable payload contains key-table exact-tuple guard / source catalog durable payload contains mapping exact-proxy guard / source catalog durable payload contains required-value exact-keyset guard:
_durable_payload_contains()現在先拒絕 contains required-value key table 的 tuple subclass drift、safe-value table 的 dict subclass drift、key table / mapping 的 str subclass drift,以及 unused/extra fixed-value key drift,再建立admin_source_catalog_v1.containssource-count metadata-only proof;仍只處理 source-only wrapper metadata,不公開 durable path、source payload、credential、token、checksum 或 raw feed locator。 - source catalog top-level scalar type contract key table:
ADMIN_SOURCE_CATALOG_TOP_LEVEL_SCALAR_TYPE_CONTRACT_KEYS鎖定ADMIN_SOURCE_CATALOG_TOP_LEVEL_SCALAR_TYPE_CONTRACTtraversal order,讓_top_level_scalar_type_contract()在 key table drift 時 fail-closed,再由_has_valid_top_level_scalar_types共用;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level type contract values exact-type guard:
_top_level_scalar_type_contract()與_top_level_wrapper_type_contract()現在會在 mapping equality 前要求 scalar/wrapper contract values 維持 exact type objects,避免 comparable helper-only drift 觸發 caller-controlled equality 或改寫 Durable Source Catalog load-time type proof;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level key contract immutable guard / source catalog top-level key contract exact-proxy guard / top-level invalid key contract immutable guard / source catalog top-level key contract value exact-tuple guard:
ADMIN_SOURCE_CATALOG_TOP_LEVEL_KEY_CONTRACT與_top_level_key_contract()invalid fail-closed contract 現在都使用 exact read-only mapping 鎖定 durable top-level required/allowed/optional key contract,且 contract mapping 內 required/allowed/optional value 必須維持 exacttuple,避免 test/runtime helper 直接 mutation、mapping subclass 或 tuple subclass 改寫 load-time wrapper key validation;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog contains required values immutable guard:
_contains_required_values_contract(source_count)現在回傳 read-only mapping,鎖定 durablecontains.sourcessource-count required value,避免 test/runtime helper 直接 mutation 改寫 source-only catalog wrapper count validation;仍不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level restart-consistency helper exact-boundary guard:
_has_valid_top_level_restart_consistency_wrapper()現在會先要求 top-level payload 維持 exactdict、catalog_sha256維持 exactstr,再委派 nested restart-consistency checksum validation,避免 helper-only caller 以 dict/str subclass 混入重啟一致性 proof;仍只處理 source-only metadata,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog checksum exact-string guard:
_has_valid_catalog_checksum()與 restart-consistency checksum mirror helper 現在要求 comparedcatalog_sha256值維持 exactstr,拒絕 str subclass helper-only drift 後才做 regex/mirror/digest comparison;仍只處理 source-only metadata,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog load-validation empty value contract immutable guard:Durable Source Catalog Store V0 的 load-validation required/optional 與 emitted value helper 在 fail-closed drift path 現在也回傳 read-only empty mapping,避免 caller 取得 invalid
{}contract 後直接 mutation 成看似有效的 value contract;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health required/runtime value immutable guard:
SOURCE_CATALOG_HEALTH_REQUIRED_VALUES與SOURCE_CATALOG_HEALTH_RUNTIME_SYNC_VALUE_CONTRACT現在使用 read-only mapping 鎖定 admin health fixed safe values 與 runtime sync field/type contract,避免 test/runtime helper 直接 mutation 改寫 metadata-only health surface;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health storage/load checksum value immutable guard:
SOURCE_CATALOG_HEALTH_STORAGE_LOAD_VALUE_CONTRACT與SOURCE_CATALOG_HEALTH_CHECKSUM_VALUE_CONTRACT現在使用 read-only mapping 鎖定 admin health storage/load 與 checksum safe-value contract,避免 test/runtime helper 直接 mutation 改寫 durable storage mode、checksum length/alphabet 或 metadata-only/path-hidden markers;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public summary value immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_SUMMARY_VALUE_CONTRACT現在使用 read-only mapping 鎖定 publicsource_catalog_healthsummary projection field map 與 metadata/path hidden safe values,避免 test/runtime helper 直接 mutation 改寫 public summary 欄位投影或metadata_only/paths_hiddenmarker;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public restart-reload value immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_VALUE_CONTRACT現在使用 read-only mapping 鎖定 publicsource_catalog_health.restart_reload_checkfixed safe values、endpoint names 與 metadata/path hidden markers;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public restart-reload field type immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_FIELD_TYPE_CONTRACT現在使用 read-only mapping 鎖定 publicsource_catalog_health.restart_reload_checknested schema/version/endpoint string fields 與 metadata/path/exposure bool field-type contract,避免 test/runtime helper 直接 mutation 改寫 restart reload nested type validation;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public checksum value immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_VALUE_CONTRACT現在使用 read-only mapping 鎖定 publiccatalog_sha256summary field、sha256 algorithm、64 字元 lowercase hex alphabet 與 metadata/path hidden guards,避免 test/runtime helper 直接 mutation 改寫 checksum public projection contract;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public storage/load value immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_VALUE_CONTRACT現在使用 read-only mapping 鎖定 publicconfigured_durable/loaded_from_durableprojection fields、strict bool types、hiddensource_catalog_storageguard 與 metadata/path hidden safe values,避免 test/runtime helper 直接 mutation 改寫 storage/load public projection contract;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public metadata-safety value immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_METADATA_SAFETY_VALUE_CONTRACT現在使用 read-only mapping 鎖定 publicmetadata_only/paths_hiddenprojection fields、strict bool types、hiddenredactionguard 與requires_redaction_payload_exposure=falsesafe value,避免 test/runtime helper 直接 mutation 改寫 metadata/path redaction public projection contract;仍不回 redaction payload、durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public write-scope safety value immutable guard / source catalog health public write-scope safety value contract exact-proxy guard:
SOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_VALUE_CONTRACT現在使用 read-only mapping 鎖定 hiddenwrite_scope=sources_only、cameras_written=0、clients_written=0、production_apply_locked=true與requires_write_scope_payload_exposure=falsesafe value;public summary projection 也會先要求此 value contract 維持 exact read-only mapping,避免 dict subclass 在 tuple traversal 或 field lookup 前改寫 hidden write-scope / camera-client / production-lock guard;仍不回 durable path、source payload、credential、token、camera/client payload 或 raw feed locator。 - source catalog health public required value immutable guard / source catalog health public required value exact-proxy guard:
SOURCE_CATALOG_HEALTH_PUBLIC_REQUIRED_VALUES現在使用 read-only mapping 鎖定 publicsource_catalog_health固定schema_version、metadata_only=true與paths_hidden=truesafe values;public summary projection 也會先要求此 required-value table 維持 exact read-only mapping,避免 dict subclass 在 tuple traversal 或 lookup 前改寫固定 public markers;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public field type immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_FIELD_TYPE_CONTRACT現在使用 read-only mapping 鎖定 publicsource_catalog_healthsummary 每個欄位的 strict type contract,避免 test/runtime helper 直接 mutation 改寫 public field-type validation;仍不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public nested required value immutable guard:
SOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_REQUIRED_VALUES、SOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_REQUIRED_VALUES、SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_REQUIRED_VALUES、SOURCE_CATALOG_HEALTH_PUBLIC_RUNTIME_SYNC_REQUIRED_VALUES、SOURCE_CATALOG_HEALTH_PUBLIC_METADATA_SAFETY_REQUIRED_VALUES與SOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_REQUIRED_VALUES現在使用 read-only mapping 鎖定 public nested/source-catalog-health fixed safe values,避免 test/runtime helper 直接 mutation 改寫 restart/checksum/storage/runtime/metadata/write-scope required-value validation;仍不回 durable path、source payload、credential、token、camera/client payload 或 raw feed locator。 - source catalog restart verify envfile parser guard:
scripts/source_catalog_restart_verify.py --env-file可由 Python 直接解析 staging runtime env file,不需 shell source;helper 只載入明確要求的 env name,parse/missing failure 固定 generic error,不回 durable path、env value、credential、token、checksum、source payload 或 raw feed locator。 - source catalog redaction required helper nested value immutable guard:
_redaction_required_values_contract()現在回傳 read-only mapping,且removed_categories保持 immutable tuple;_has_valid_redaction_wrapper()只在 durable JSON validation boundary materialize 成 list,避免 caller append 改寫 helper-return nested value;仍只處理 source-only metadata,不回 durable path、credential、token 或 raw feed locator。 - source catalog durable payload defensive source copy guard:
_durable_payload()在組裝admin_source_catalog_v1前會 deep-copysources,避免 helper caller 透過 durable payload surface mutate 原始 source metadata/list 物件;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不回 durable path、credential、token 或 raw feed locator。 - source catalog nested wrapper dispatch immutable guard:
_top_level_nested_wrapper_dispatch()現在回傳 read-only dispatch mapping,避免 helper caller mutate durable wrapper validators 後繞過admin_source_catalog_v1storage/contains/redaction/atomic-write/load-validation load checks;仍只處理 source-only metadata,不回 durable path、credential、token 或 raw feed locator。 - source catalog parsed metadata defensive copy guard:
_source_from_dict()現在會在 metadata 驗證後 deep-copy nested metadata 再建立DataSourceCapability,避免 caller-owned raw payload 後續 mutation 改寫 loaded source metadata;仍只處理 source-only durable catalog parse surface。 - source catalog source-from-dict exact-source-object guard:
_source_from_dict()現在先拒絕 dict subclass direct-helper drift,再做source_idlookup、text-list / metadata validation與 runtime source parsing,避免 helper-only caller 改寫 durable sources[] item lookup 或越過 exact JSON object boundary;仍只處理 source-only metadata,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog parsed text-list exact-type guard:
_source_from_dict()現在會拒絕supports_intents/safety_notes的 list subclass 與 str subclass entry drift,讓 load/parse 後的 source text-list boundary 維持 exact JSON array/string;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不回 durable path、credential、token 或 raw feed locator。 - source catalog text-list length helper exact-container guard:
_raise_for_source_text_list_lengths()現在會拒絕supports_intents/safety_notes的 list/tuple subclass helper-only drift,再做 redaction 前 text-list count checks;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不回 durable path、credential、token 或 raw feed locator。 - source catalog optional string field exact-input guard:
_optional_string_field()現在要求 source item、field name 與 fallback default 分別維持 exactdict/str/str,拒絕 dict/key/default subclass helper-only drift 後才做.get()與 parsed scalar-string exact-type validation;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog parsed scalar-string exact-type guard:
_source_from_dict()現在會拒絕source_id/name/provider/source_type/integration_status/license_note的 str subclass drift,讓 loaded source scalar string boundary 維持 exact JSON string;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不回 durable path、credential、token 或 raw feed locator。 - source catalog parsed priority exact-int guard:
_source_from_dict()現在會拒絕priority的 int subclass / bool drift,讓 loaded source numeric priority 維持 exact JSON integer boundary;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不回 durable path、credential、token 或 raw feed locator。 - source catalog error message table exact-string guard / source catalog error message key table exact-string guard / source catalog error message key-table exact-tuple guard / source catalog error message table exact-proxy guard:Durable Source Catalog Store V0 的 generic error-message table 現在要求每個固定錯誤訊息與固定錯誤 key table 維持 exact
str、key table 維持 exacttuple,且 error-message/baseline mappings 維持 exact read-onlyMappingProxyType;拒絕 str/tuple/mapping subclass helper-only drift 後才供 duplicate-id / invalid source item / too-many-sources save/load error classification 使用;錯誤仍固定 generic,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level key contract key-table exact-tuple guard:Durable Source Catalog Store V0 的
_top_level_key_contract()現在要求 required / load-required / allowed key tables 維持 exacttuple,拒絕 tuple subclass helper-only drift 後才做 tuple equality、set membership 與 duplicate-key validation;仍只處理 source-only wrapper metadata,不回 durable path、source payload、credential、token 或 raw feed locator。 - admin import source item metadata defensive copy guard / admin import source item metadata redaction guard:
_source_from_import_item()現在會 deep-copy 並 redacts source-only import item 的 nested metadata,再建立DataSourceCapability,避免 helper caller 在 merge/catalog 建立前透過原始 payload metadata reference 改寫 staging source-only write state,並避免敏感 metadata key 留在 helper output;仍不擴大到 cameras/clients/secrets,不回 durable path、credential、token 或 raw feed locator。 - public sources response metadata redaction guard:
/v1/reality/sources在 response boundary 對 runtime catalog source metadata 再套用 source catalog sensitive-key redaction,避免 runtime catalog mutation 或未落盤 source object 帶有 sensitive metadata key 時公開回應外洩;仍只回 metadata-only source catalog,不回 durable path、credential、token 或 raw feed locator。 - data source capability to_dict defensive copy guard:
DataSourceCapability.to_dict()會匯出新的supports_intents/safety_noteslist 與 deep-copied nested metadata,避免 response/payload mutation 反向改寫 in-memory source capability state。 - source catalog top-level wrapper type contract key table:
ADMIN_SOURCE_CATALOG_WRAPPER_TYPE_CONTRACT_KEYS鎖定ADMIN_SOURCE_CATALOG_WRAPPER_TYPE_CONTRACTtraversal order,讓_top_level_wrapper_type_contract()在 key table drift 時 fail-closed,再由_has_valid_top_level_wrapper_types共用;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level type contract key-table exact-tuple guard:
ADMIN_SOURCE_CATALOG_TOP_LEVEL_SCALAR_TYPE_CONTRACT_KEYS/ADMIN_SOURCE_CATALOG_WRAPPER_TYPE_CONTRACT_KEYS必須維持 exact tuple,避免 helper-only caller 以 tuple subclass 改寫或攔截 top-level scalar/wrapper durable load type contract traversal;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level type contract drift guard:top-level scalar/wrapper helper 會拒絕 duplicate/unknown-key fail-closed drift,並鎖定 fixed expected type values(
schema_version/catalog_sha256為str、sources為list、wrapper 欄位為dict),避免新增未知頂層欄位或 wrapper contract type-value drift 後被 durable load silently 接受;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog top-level type contract immutable runtime guard:
ADMIN_SOURCE_CATALOG_TOP_LEVEL_SCALAR_TYPE_CONTRACT與ADMIN_SOURCE_CATALOG_WRAPPER_TYPE_CONTRACT現在使用 read-only mapping 鎖定 runtime scalar/wrapper type table,避免 test/runtime helper 直接 mutation 改寫 durable load type contract;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog storage/contains/redaction value type contract helper drift guard / source catalog storage/contains/redaction value-type exact-proxy guard / source catalog value-type expected-contract exact-proxy guard:
_storage_value_type_contract()/_contains_value_type_contract()/_redaction_value_type_contract()會共用 allowed-key exact-order helper,且 shared_value_type_contract_for_allowed_keys()要求 storage/contains/redaction fixed value-type contract tables 與 helper expected-contract baseline 維持 exact read-onlyMappingProxyType,拒絕 mutable dict replacement、dict subclass、mutable expected-contract、duplicate/unknown-key contract drift,讓 durable load 對 storage metadata、source-count metadata 與 redaction metadata fail-closed;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog storage/contains/redaction required values helper drift guard:
_storage_required_values_contract()/_contains_required_values_contract()/_redaction_required_values_contract()會集中驗證 storage、contains 與 redaction wrapper 的 required-value key tables 與 fixed safe values,拒絕 duplicate/unknown-key/value drift 後才讓 durable load 接受;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog exact required-values helper exact-dict/exact-mapping/exact-proxy guard:
_has_exact_required_values()會先拒絕 payloaddictsubclass、mutabledictrequired-value replacement、required-value mapping subclass 與 required-value mapping 的strsubclass key,再做 durable wrapper fixed safe-value lookup/comparison,避免 helper-only caller 透過 subclass payload/mapping/key 影響 storage/contains/redaction/restart/atomic/load fixed-value validation;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog storage/contains/redaction required values immutable guard:
ADMIN_SOURCE_CATALOG_STORAGE_REQUIRED_VALUES、ADMIN_SOURCE_CATALOG_CONTAINS_REQUIRED_VALUES與ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_VALUES現在使用 read-only mapping 鎖定 durable wrapper safe-value table,避免 test/runtime helper 直接 mutation 改寫 storage/contains/redaction safe-value contract;仍 metadata-only,不回 durable path、source payload、credential、token 或 raw feed locator。 - Source Catalog Restart Reload Helper V0:內部
reload_admin_source_catalog_state_for_restart()使用source_catalog_restart_reload_v0metadata-only contract,從既有ADMIN_SOURCE_CATALOG_PATHstore 重新載入 durable catalog、同步 runtime catalog 與 Evidence Planner,並回 redactedcatalog_sha256/compare_field=catalog_sha256/ redaction flags;source catalog health emitted key tableSOURCE_CATALOG_HEALTH_EMITTED_KEYS、source catalog health required value tableSOURCE_CATALOG_HEALTH_REQUIRED_VALUES、source catalog top-level scalar type contract tableADMIN_SOURCE_CATALOG_TOP_LEVEL_SCALAR_TYPE_CONTRACT、source catalog wrapper type contract tableADMIN_SOURCE_CATALOG_WRAPPER_TYPE_CONTRACT、restart-consistency value type contract tableADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_VALUE_TYPE_CONTRACT、atomic-write value type contract tableADMIN_SOURCE_CATALOG_ATOMIC_WRITE_VALUE_TYPE_CONTRACT、load-validation value type contract tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_VALUE_TYPE_CONTRACT、storage/contains/redaction value type contract tableADMIN_SOURCE_CATALOG_STORAGE_VALUE_TYPE_CONTRACT/ADMIN_SOURCE_CATALOG_CONTAINS_VALUE_TYPE_CONTRACT/ADMIN_SOURCE_CATALOG_REDACTION_VALUE_TYPE_CONTRACT、source catalog storage mode contract tableADMIN_SOURCE_CATALOG_STORAGE_MODE_CONTRACT、source catalog storage fallback contract tableADMIN_SOURCE_CATALOG_STORAGE_FALLBACK_VALUES、source catalog env contract tableADMIN_SOURCE_CATALOG_ENV_CONTRACT、source catalog env required key tableADMIN_SOURCE_CATALOG_ENV_CONTRACT_REQUIRED_KEYS、source catalog contains required value key tableADMIN_SOURCE_CATALOG_CONTAINS_REQUIRED_VALUE_KEYS、source catalog contains value type key tableADMIN_SOURCE_CATALOG_CONTAINS_VALUE_TYPE_CONTRACT_KEYS、source catalog restart-reload helper required value tableSOURCE_CATALOG_RESTART_RELOAD_HELPER_REQUIRED_VALUES、source item value type contract tableADMIN_SOURCE_CATALOG_SOURCE_ITEM_VALUE_TYPE_CONTRACT、metadata value type contract tableADMIN_SOURCE_CATALOG_METADATA_VALUE_TYPE_CONTRACT、metadata scalar exact type contract tableADMIN_SOURCE_CATALOG_METADATA_SCALAR_TYPE_CONTRACT、metadata type contract drift guard(ADMIN_SOURCE_CATALOG_METADATA_VALUE_TYPE_CONTRACT_KEYS/ADMIN_SOURCE_CATALOG_METADATA_SCALAR_TYPE_CONTRACT_KEYSduplicate/unknown-key fail-closed)與 metadata container exact type contract、source catalog health runtime-sync key tableSOURCE_CATALOG_HEALTH_RUNTIME_SYNC_KEYS、source catalog health runtime-sync value contract tableSOURCE_CATALOG_HEALTH_RUNTIME_SYNC_VALUE_CONTRACT、source catalog health storage/load key tableSOURCE_CATALOG_HEALTH_STORAGE_LOAD_KEYS、source catalog health storage/load value contract tableSOURCE_CATALOG_HEALTH_STORAGE_LOAD_VALUE_CONTRACT、source catalog health checksum key tableSOURCE_CATALOG_HEALTH_CHECKSUM_KEYS、source catalog health checksum value contract tableSOURCE_CATALOG_HEALTH_CHECKSUM_VALUE_CONTRACT、source catalog health public summary key tableSOURCE_CATALOG_HEALTH_PUBLIC_SUMMARY_KEYS、source catalog health public summary value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_SUMMARY_VALUE_CONTRACT、source catalog health public restart-reload value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_VALUE_CONTRACT、source catalog health public checksum value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_VALUE_CONTRACT、source catalog health public storage/load value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_VALUE_CONTRACT、source catalog health allowed key tableSOURCE_CATALOG_HEALTH_ALLOWED_KEYS與 schema version constantSOURCE_CATALOG_HEALTH_SCHEMA_VERSION維護source_catalog_health_v0top-level metadata-only health contract(write_scope、durable/load flags、checksum、restart_reload_check、redaction、paths_hidden),避免 health payload drift;durableadmin_source_catalog_v1wrapper schema 由 source catalog wrapper schema version constantADMIN_SOURCE_CATALOG_SCHEMA_VERSION、top-level required key tableADMIN_SOURCE_CATALOG_TOP_LEVEL_REQUIRED_KEYS與 top-level allowed key tableADMIN_SOURCE_CATALOG_TOP_LEVEL_ALLOWED_KEYS維護,storage allowed key tableADMIN_SOURCE_CATALOG_STORAGE_ALLOWED_KEYS維護 durable storage wrapper allowlist(只允許mode/durable)與 unexpected-key fail-closed,restart-consistency schema version constantADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_SCHEMA_VERSION維護 metadata-onlysource_catalog_restart_consistency_v0save/load schema 與 tampered schema fail-closed,restart-consistency compare-field constantADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_COMPARE_FIELD維護compare_field=catalog_sha256save/load contract 與 tampered compare-field fail-closed,restart-consistency key tablesADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_REQUIRED_KEYS/ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_ALLOWED_KEYS共同維持 required/allowed key allowlist 與 unexpected-key fail-closed 一致,另含由 atomic-write schema version constantADMIN_SOURCE_CATALOG_ATOMIC_WRITE_SCHEMA_VERSION維護的 metadata-onlysource_catalog_atomic_write_v0;atomic-write required value tableADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_VALUES維護schema_version=source_catalog_atomic_write_v0、strategy=write_temp_fsync_replace_fsync_parent、replacement=atomic_os_replace、metadata_only=true、paths_hidden=truesave/load value contract 與 tampered value fail-closed;atomic-write optional value tableADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_VALUES維護 optional proof markers 均為true(temp filename hidden、owner-only file mode、final path identity、temp fsync/close、parent directory fsync)且 tampered optional proof marker fail-closed;atomic-write key tablesADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_KEYS/ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_KEYS與 atomic-write allowed key tableADMIN_SOURCE_CATALOG_ATOMIC_WRITE_ALLOWED_KEYS共同維持 required/optional key allowlist 與 unexpected-key fail-closed 一致(same-directory temp file、temp fsync、atomicos.replace、parent directory fsync、paths_hidden=true、temporary_filename_hidden=true、owner_only_file_mode=true、final_path_identity_checked=true、temporary_file_fsync_checked=true、temporary_file_close_checked=true、parent_directory_fsync_checked=true,且 load 仍接受舊版未含 temp filename / owner-only / final path identity / temporary file fsync markers 的 wrapper),並含 metadata-onlysource_catalog_load_validation_v0(fd_path_identity_checked=true、parent_dir_identity_checked=true、catalog_sha256_recomputed_on_load=true、file_size_limit_checked=true、json_constant_rejection_checked=true、catalog_file_close_checked=true、parent_directory_close_checked=true、catalog_open_no_follow_checked=true、catalog_fd_identity_rechecked_after_read=true、catalog_owner_mode_rechecked_after_read=true、parent_directory_owner_mode_rechecked_after_read=true、catalog_hardlink_rechecked_after_read=true、catalog_file_size_rechecked_after_read=true、catalog_sha256_format_rechecked_after_read=true、parent_directory_fd_identity_rechecked_after_read=true、parent_directory_open_no_follow_rechecked_after_read=true、integration_status_control_chars_rechecked_after_read=true、priority_integer_rechecked_after_read=true、priority_range_rechecked_after_read=true、load_validation_wrapper_keys_rechecked_after_read=true、source_item_wrapper_keys_rechecked_after_read=true、redacted_source_items_rechecked_after_read=true、contains_source_count_rechecked_after_read=true、contains_wrapper_keys_rechecked_after_read=true、contains_wrapper_values_rechecked_after_read=true、redaction_wrapper_keys_rechecked_after_read=true、redaction_removed_categories_rechecked_after_read=true、redaction_secrets_removed_rechecked_after_read=true、source_ids_unique_rechecked_after_read=true、source_id_strings_rechecked_after_read=true、source_id_control_chars_rechecked_after_read=true、source_id_length_rechecked_after_read=true、name_control_chars_rechecked_after_read=true、source_type_string_rechecked_after_read=true、source_type_unpadded_rechecked_after_read=true、source_type_length_rechecked_after_read=true、source_type_control_chars_rechecked_after_read=true、provider_string_rechecked_after_read=true、provider_unpadded_rechecked_after_read=true/provider_length_rechecked_after_read=true、provider_control_chars_rechecked_after_read=true、supports_intents_list_rechecked_after_read=true、supports_intents_strings_rechecked_after_read=true、supports_intents_count_rechecked_after_read=true、supports_intents_entries_rechecked_after_read=true、safety_notes_list_rechecked_after_read=true、safety_notes_strings_rechecked_after_read=true、safety_notes_count_rechecked_after_read=true、safety_notes_entries_rechecked_after_read=true、safety_notes_unpadded_rechecked_after_read=true、safety_notes_length_rechecked_after_read=true、safety_notes_control_chars_rechecked_after_read=true、license_note_string_rechecked_after_read=true、license_note_length_rechecked_after_read=true、license_note_unpadded_rechecked_after_read=true/license_note_control_chars_rechecked_after_read=true/metadata_keys_control_chars_rechecked_after_read=true、metadata_keys_length_rechecked_after_read=true/metadata_string_values_control_chars_rechecked_after_read=true、metadata_string_values_length_rechecked_after_read=true、metadata_numbers_finite_rechecked_after_read=true、metadata_object_rechecked_after_read=true、metadata_collection_sizes_rechecked_after_read=true、metadata_total_nodes_rechecked_after_read=true、metadata_serialized_size_rechecked_after_read=true、metadata_keys_unpadded_rechecked_after_read=true、metadata_boolean_values_rechecked_after_read=true、metadata_null_values_rechecked_after_read=true、metadata_integer_values_rechecked_after_read=true、metadata_float_values_rechecked_after_read=true、metadata_array_values_rechecked_after_read=true、metadata_object_values_rechecked_after_read=true、duplicate keys rejected、paths_hidden=true),標示落盤與 startup/load validation 策略但不曝光 path/source payload;fresh startup env path load 也會在 app import/startup 時讀取ADMIN_SOURCE_CATALOG_PATH的admin_source_catalog_v1,讓 service restart 後/v1/reality/sources仍可看見 source-only imported source;fresh startup relative env path fallback 會拒絕非絕對ADMIN_SOURCE_CATALOG_PATH(source catalog path must be absolute),fallback seed catalog /in_memory_v0;relative path storage metadata fallback 也會讓 store storage metadata 回in_memory_v0/durable=false,避免無效相對 path 被誤報為 durable;control character source catalog path fallback 會拒絕含換行/control character 或 padding 的ADMIN_SOURCE_CATALOG_PATH,metadata 也回in_memory_v0/durable=false,避免將可疑 path 誤報或寫入為 durable;DEL control character source catalog path fallback 也會把含 ASCII DEL (0x7f) 的 absolute-looking catalog path 視為 control-character path,fail closed 為in_memory_v0/durable=false且不寫入;padded absolute source catalog path load fallback 也會在 load/startup 階段拒絕尾端或前端 padding 的 absolute catalog path,即使該 padded filename 已存在也不載入為 durable;non-string source catalog path fallback 會把 non-string / bytes-like storage path 視為in_memory_v0,避免型別錯誤外拋或被誤報為 durable;fspath error source catalog path fallback 也會在 path-like__fspath__()轉換失敗時 fail closed 到in_memory_v0,不外拋、不寫檔、不誤報 durable;unexpected fspath error source catalog path fallback 會同樣 fail closed,即使 path-like conversion 丟出非 TypeError/ValueError 的一般例外也不外拋、不寫檔、不誤報 durable;truthiness-safe source catalog path handling 則避免對 path-like storage object 做 boolean coercion,改以os.fspath()後的 non-empty string 判斷,讓有效 absolute path-like 仍可 durable write/load。health 仍只回 metadata-only、paths_hidden=true,不回相對路徑值或 control-character / padded / non-string / fspath-error path 值。publicGET /v1/reality/source-health的source_catalog_runtime_status_v0也回source_catalog_runtime_restart_consistency_v0compare guide,讓 client/operator 以 redactedcatalog_sha256驗證 restart consistency。Admin-only/admin/sources/health另有source_catalog_health_write_scope_v0marker,回write_scope=sources_only、cameras_written=0、clients_written=0、production_apply_locked=true,明確避免把 source catalog health 誤解為 cameras/clients/secrets write surface。這些 health/reload surfaces 只回loaded_from_durable、source_catalog_storage、source_count、redactedcatalog_sha256、compare_field=catalog_sha256、redaction flags、metadata_only=true、paths_hidden=true等安全欄位;不回 durable file path、source payload、API key/hash、tokens、passwords、credentials 或 raw feed locators。 - source catalog health public runtime-sync value contract table / source catalog health public runtime-sync value immutable guard / source catalog health public runtime-sync value contract exact-proxy guard:
SOURCE_CATALOG_HEALTH_PUBLIC_RUNTIME_SYNC_VALUE_CONTRACT使用 read-only mapping 鎖定 publicsource_catalog_health的planner_source_countint 與runtime_catalog_in_syncbool,public summary projection 也會先要求此 value contract 維持 exact read-only mapping,避免 dict subclass 在 tuple traversal 或 field lookup 前改寫 public runtime-sync projection 或 hiddensource_countguard,且source_count維持 hidden;source catalog health public metadata-safety value contract table / source catalog health public metadata-safety value contract exact-proxy guardSOURCE_CATALOG_HEALTH_PUBLIC_METADATA_SAFETY_VALUE_CONTRACT也鎖定 publicmetadata_only=true/paths_hidden=truebool projection 與 hiddenredactionguard,public summary projection 會先要求 exact read-only mapping,避免 dict subclass 改寫 metadata/path redaction public projection且不要求 redaction payload public exposure; source catalog health public write-scope safety value contract key tableSOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_VALUE_CONTRACT_KEYS、source catalog health public write-scope safety required value tableSOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_REQUIRED_VALUES與 source catalog health public write-scope safety required value key tableSOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_REQUIRED_VALUE_KEYS鎖定 hidden admin-only write-scope guard values(write_scope=sources_only、cameras_written=0、clients_written=0、production_apply_locked=true)與 exposure guard(requires_write_scope_payload_exposure=false)且不要求 public exposure;source catalog health public hidden-payload field tableSOURCE_CATALOG_HEALTH_PUBLIC_HIDDEN_PAYLOAD_FIELDS集中鎖定 public summary 必須隱藏的 admin/storage payload fields(source_catalog_storage、source_count、write_scope、cameras_written、clients_written、production_apply_locked、redaction);source catalog health public required value tableSOURCE_CATALOG_HEALTH_PUBLIC_REQUIRED_VALUES與 source catalog health public required value key tableSOURCE_CATALOG_HEALTH_PUBLIC_REQUIRED_VALUE_KEYS集中鎖定 public summary 固定值(schema_version=source_catalog_health_v0、metadata_only=true、paths_hidden=true)與 key order;source catalog health public field type contract tableSOURCE_CATALOG_HEALTH_PUBLIC_FIELD_TYPE_CONTRACT鎖定 public summary 每個欄位的 strict type;source catalog health public restart-reload field type contract tableSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_FIELD_TYPE_CONTRACT鎖定 nestedrestart_reload_check每個 public 欄位的 strict type;source catalog health public restart-reload value contract key tableSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_VALUE_CONTRACT_KEYS鎖定 nested restart reload value contract key order;source catalog health public restart-reload required value tableSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_REQUIRED_VALUES從 emitted key table 投影 nested restart reload public required safe values,並排除 wrapper-onlysummary_field;source catalog health public restart-reload emitted key tableSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_EMITTED_KEYS鎖定 nested public restart reload proof key order;source catalog health public restart-reload value fail-closed validation 會先驗證 admin health readback 的restart_reload_checkexact contract values,再回 public metadata-only summary,避免 silently overwrite restart reload drift;source catalog health public restart-reload key fail-closed validation 也要求 nested restart reload readback keys exact matchSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_FIELD_TYPE_CONTRACT,拒絕 sidecar/path/locator fields;public checksum value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_VALUE_CONTRACT拒絕非 64 字元 lowercase sha256 hex 的 publiccatalog_sha256;public storage/load value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_VALUE_CONTRACT拒絕 non-bool 的configured_durable/loaded_from_durablepublic durable/load markers;public runtime-sync value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_RUNTIME_SYNC_VALUE_CONTRACT拒絕 non-int 的planner_source_count與 non-bool 的runtime_catalog_in_syncpublic runtime markers;public metadata-safety value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_METADATA_SAFETY_VALUE_CONTRACT拒絕非 strict true bool 的metadata_only/paths_hiddenpublic safety markers 與 admin redactionpaths_hiddenreadback;public required value fail-closed validation 會先驗證 admin healthschema_versionreadback 仍等於source_catalog_health_v0,避免 public summary silently overwrite drift;public write-scope safety value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_VALUE_CONTRACT拒絕不等於sources_only/0/0/ stricttrue的 hidden write-scope guard values,之後才移除 hidden admin-only fields;仍不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public summary emitted key table:
SOURCE_CATALOG_HEALTH_PUBLIC_SUMMARY_EMITTED_KEYS鎖定 publicsource_catalog_healthouter emitted key order,並與SOURCE_CATALOG_HEALTH_PUBLIC_SUMMARY_KEYS/SOURCE_CATALOG_HEALTH_PUBLIC_FIELD_TYPE_CONTRACT共用 key set;仍 metadata-only、paths_hidden=true,不回 durable path、credential、source payload 或 raw feed locator。 - source catalog health public checksum value contract key table:
SOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_VALUE_CONTRACT_KEYS鎖定 publiccatalog_sha256checksum value contract key order,讓 sha256 algorithm、64 字元 lowercase hex alphabet 與 metadata/path hidden guard 持續同步;仍 metadata-only、paths_hidden=true,不回 durable path、credential、source payload 或 raw feed locator。 - source catalog health public checksum required value table:
SOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_REQUIRED_VALUES從 checksum value contract key table 投影 fixed safe checksum guard values(algorithm=sha256、64 字元 lowercase hex alphabet、metadata/path hidden booleans、requires_path_exposure=false),並排除 wrapper-onlysummary_field;public summary 仍只回 checksum digest 本身,不回 durable path、credential、source payload 或 raw feed locator。 - source catalog health public checksum required value key table:
SOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_REQUIRED_VALUE_KEYS鎖定 checksum required-values table key order(algorithm/hex_length/hex_alphabet/ metadata/path hidden guards),避免 public checksum required safe values 與 fail-closed validation drift;public summary 仍只回 digest,不回 durable path、credential、source payload 或 raw feed locator。 - source catalog health public storage/load value contract key table:
SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_VALUE_CONTRACT_KEYS鎖定 public durable/load value contract key order(configured_durable/loaded_from_durablebool types、hiddensource_catalog_storageguard、metadata/path hidden booleans、requires_storage_payload_exposure=false),避免 storage/load public projection 與 hidden payload validation drift;不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public storage/load required value table:
SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_REQUIRED_VALUES從 storage/load value contract key table 投影 fixed safe guard values(metadata_only=true、paths_hidden=true、requires_storage_payload_exposure=false),避免 storage/load safe required values 與 fail-closed validation drift;public summary 仍不回 hidden storage payload、durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public storage/load required value key table:
SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_REQUIRED_VALUE_KEYS鎖定 storage/load required-values table key order(metadata_only/paths_hidden/requires_storage_payload_exposure),避免 storage/load fixed safe values 與 validation coverage drift;public summary 仍不回 hidden storage payload、durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public runtime-sync value contract key table:
SOURCE_CATALOG_HEALTH_PUBLIC_RUNTIME_SYNC_VALUE_CONTRACT_KEYS鎖定 public runtime-sync value contract key order(publicplanner_source_count/runtime_catalog_in_syncfields、hiddensource_countguard、strict int/bool types、metadata/path hidden booleans、requires_source_count_exposure=false),避免 public count/sync projection 與 hidden source_count validation drift;source catalog health public runtime-sync required value key table:SOURCE_CATALOG_HEALTH_PUBLIC_RUNTIME_SYNC_REQUIRED_VALUE_KEYS鎖定 runtime-sync required-values table key order(metadata_only/paths_hidden/requires_source_count_exposure),避免 fixed safe values 與 fail-closed validation coverage drift;不回 source payload、durable path、credential、token 或 raw feed locator。 - source catalog health public metadata-safety value contract key table:
SOURCE_CATALOG_HEALTH_PUBLIC_METADATA_SAFETY_VALUE_CONTRACT_KEYS鎖定 public metadata-safety value contract key order(publicmetadata_only/paths_hiddenfields、strict bool types、hiddenredactionguard、requires_redaction_payload_exposure=false),避免 metadata/path projection 與 hidden redaction validation drift;source catalog health public metadata-safety required value key table:SOURCE_CATALOG_HEALTH_PUBLIC_METADATA_SAFETY_REQUIRED_VALUE_KEYS鎖定 required-values table key order(metadata_only/paths_hidden/requires_redaction_payload_exposure),避免 fixed safe values 與 fail-closed validation coverage drift;不回 redaction payload、source payload、durable path、credential、token 或 raw feed locator。 - source catalog storage value type key table:
ADMIN_SOURCE_CATALOG_STORAGE_VALUE_TYPE_CONTRACT_KEYS鎖定 durable wrapperstoragevalue type contract key order(mode/durable),並與ADMIN_SOURCE_CATALOG_STORAGE_VALUE_TYPE_CONTRACT/ADMIN_SOURCE_CATALOG_STORAGE_ALLOWED_KEYS同步;load 時由 shared exact-type helper fail-closed 驗證 storage metadata,不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog atomic-write value key tables:
ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_VALUE_KEYS/ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_VALUE_KEYS鎖定 durable wrapperatomic_writerequired/optional safe value table traversal,save/load 共用同一組 key tables 驗證 schema version、atomic replace strategy、metadata/path hidden guards 與 fsync/temp-file safety markers,避免 atomic-write metadata wrapper value coverage drift;source catalog atomic-write value type key table:ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_VALUE_TYPE_CONTRACT_KEYS鎖定atomic_writevalue type contract traversal,load 時先 fail-closed 驗證 contract key table 與 allowed keys 同步,再由 shared exact-type helper 檢查 required/optional markers;source catalog atomic-write validation helper:_has_valid_atomic_write_wrapper集中 durable wrapperatomic_write的 required/allowed keys、value type key table、required/optional safe values validation,並由 top-level wrapper 共用;source catalog restart-consistency value type key table:ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_VALUE_TYPE_CONTRACT_KEYS鎖定 durable wrapperrestart_consistencyvalue type contract traversal,load 時先 fail-closed 驗證 contract key table 與 allowed keys 同步,再由 shared exact-type helper 檢查 schema/checksum/metadata-path hidden markers;不回 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public storage/redaction hidden payload type/value guard:admin source catalog storage metadata fail-closed validation 要求
_configured_admin_source_catalog_storage()只接受 exact safemode/durablestorage metadata,拒絕 extra path/locator fields、non-dict payload 或 non-bool durable drift;public metadata-safety redaction payload value fail-closed validation 要求 hidden adminredactionreadback 保持 exact keys 與 safe true booleans,才允許投影 public summary;public response 仍不暴露 storage payload、durable path、source payload、credential、token 或 raw feed locator。 - source catalog health check storage/load strict bool sanitization:
scripts/source_catalog_health_check.pyoperator output 只把 top-levelconfigured_durable/loaded_from_durableexact bool true 視為 true,truthy string drift 會變成 false,避免 helper 回顯 path、locator、credential 或 source payload text。 - source catalog health check restart-consistency allowlist sanitization:
scripts/source_catalog_health_check.pyoperator output 只輸出 allowlisted nestedrestart_consistency.schema_version/compare_field,drift 值改成unknown,避免 nested restart check 欄位回顯 path、locator、credential 或 source payload text。 - source catalog health check write-scope strict value sanitization / source catalog health check write-scope safe values immutable guard:
scripts/source_catalog_health_check.pyoperator output 只輸出 exact safe write-scope guard values(write_scope=sources_only、cameras_written=0、clients_written=0、production_apply_locked=true),drift 值改成unknown/0/false;SOURCE_CATALOG_HEALTH_CHECK_WRITE_SCOPE_SAFE_VALUES現為 read-only mapping,避免 helper mutation 改寫 safe markers 成 path、locator、credential、camera/client payload 或 source payload echo drift。 - source catalog health check redaction safe value table / source catalog health check redaction safe values immutable guard:
SOURCE_CATALOG_HEALTH_CHECK_REDACTION_SAFE_VALUES鎖定 helper redaction output 只回secrets_removed=true/paths_hidden=trueexact safe booleans,且現為 read-only mapping,避免 helper mutation 或 redaction wrapper drift 回顯 durable path、locator、credential、checksum 或 source payload text。 - source catalog health check catalog-sha256 lowercase hex sanitization:
scripts/source_catalog_health_check.pyoperator output 只在catalog_sha256是 64 字元 lowercase hex digest 時輸出 checksum,drift 值改成unknown,避免 checksum 欄位回顯 path、locator、credential 或 source payload text。 - source catalog health check required contract values immutable guard:
SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_CONTRACT_VALUES現為 read-only mapping,鎖定--require-*staging restart verification 的 durable/load/restart/metadata safe markers,避免 helper mutation 改寫成 durable path、locator、credential、checksum drift 或 source payload echo。 - source catalog health check required output field table / source catalog health check required output fields immutable guard:
SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_OUTPUT_FIELDS鎖定--require-*restart verification 只輸出固定 required/ok boolean 欄位名,且現為 read-only mapping,避免 helper mutation 或 output 欄位 drift 成 path、locator、credential、checksum 或 source payload echo fields。 - source catalog health check output field order table / source catalog health check output field order coverage guard:
SOURCE_CATALOG_HEALTH_CHECK_OUTPUT_FIELD_ORDER鎖定 helper sanitized metadata、所有 currentSAFE_TOP_LEVEL_FIELDS(含 sources-only write-scope booleans/counts)與--require-*required/ok booleans 的 operator JSON output 順序,避免 known safe fields 靜默附加到表尾造成 restart verification output ordering drift。 - source catalog health check required failure result shape table:
SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_FAILURE_RESULT鎖定 helper--require-*失敗時只回 fixederror/ metadata-only / paths-hidden shape,避免 failure path 回顯 durable path、locator、credential、checksum drift 或 source payload。 - source catalog health check required failure result immutable guard:
SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_FAILURE_RESULT現為 read-only mapping,避免 test/runtime helper 直接 mutation fixed generic failure shape 成 operator-visible durable path、locator、credential、checksum drift 或 source payload echo fields。 - source catalog health check required failure JSON output contract:helper
--require-*失敗時會把SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_FAILURE_RESULT以 safe JSON 印到 stdout,stderr 只保留同一個 generic error,讓 staging wrapper 可 machine-read failure 而不回顯 durable path、locator、credential、checksum drift 或 source payload。 - source catalog health check failure JSON error-first ordering:
SOURCE_CATALOG_HEALTH_CHECK_OUTPUT_FIELD_ORDER讓 helper--require-*failure JSON 固定先輸出 genericerror,再輸出metadata_only=true/paths_hidden=true,方便 staging operator parser fail-closed 讀取且不回顯 durable path、locator、credential、checksum drift 或 source payload。 - source catalog health admin-key-env name validation guard:
scripts/source_catalog_health_check.py會先驗證--admin-key-env是 POSIX-style environment variable name,才讀取 admin key;若 operator 誤貼 admin key、path 或 locator-like 字串會 fail closed,stderr/stdout 不回顯該值,也不輸出 credential、hash 或 raw feed locator。 - source catalog health base-url query fragment guard:
scripts/source_catalog_health_check.py會拒絕含 query string 或 fragment 的--base-url,避免 operator 誤把參數或 anchor 放入 process listing、request、stderr/stdout 或 operator JSON;錯誤訊息維持 generic,不回顯原始 base URL。 - source catalog health base-url whitespace control guard:
scripts/source_catalog_health_check.py會在urlsplit與 request construction 前拒絕含空白、換行或 control character 的--base-url,避免 pasted multiline/hidden characters 改寫 request 或產生回顯輸入的 network error;錯誤訊息維持 generic,不回顯原始 base URL、env name、admin key、credential 或 raw feed locator。 - source catalog health base-url path guard:
scripts/source_catalog_health_check.py會在urljoin與 request construction 前拒絕非空/非 root path 的--base-url,避免 operator 誤貼 endpoint path 造成 helper target drift 或 input-echoing network error;錯誤訊息維持 generic,不回顯原始 base URL、env name、admin key、credential 或 raw feed locator。 - source catalog health timeout finite bounds guard:
scripts/source_catalog_health_check.py會在urlopen前拒絕 non-finite、零/負數或過大的--timeout-seconds,讓 staging helper fail closed,且錯誤輸出不回顯 base URL、env name、admin key、credential 或 raw feed locator。 - source catalog health network error redaction guard:
scripts/source_catalog_health_check.py現在對URLError只輸出 generic request failure,不附上 resolver/network reason,避免 operator 誤貼的 locator、credential、admin key、durable path、hash 或 source payload 被錯誤訊息回顯。 - Source Catalog Integration Status Validation Marker:durable
source_catalog_load_validation_v0現在公開 metadata-onlyintegration_status_string_rechecked_after_read=true、integration_status_unpadded_rechecked_after_read=true與integration_status_length_rechecked_after_read=true、supports_intents_unpadded_rechecked_after_read=true、supports_intents_length_rechecked_after_read=true、supports_intents_control_chars_rechecked_after_read=true,表示 startup/load 會在 read-after-load 階段確認 integration_status string、unpadded 與長度 ≤ 256 contract,以及 supports_intents entry unpadded / length ≤ 256 / no control characters contract;load-validation schema version constantADMIN_SOURCE_CATALOG_LOAD_VALIDATION_SCHEMA_VERSION、required boolean marker tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_BOOLEAN_MARKERS、optional boolean marker shared marker table、load-validation required key tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_KEYS、allowed key tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_ALLOWED_KEYS、emitted boolean marker tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_BOOLEAN_MARKERS、load-validation emitted key tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_KEYS、load-validation required boolean value tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_BOOLEAN_VALUES、load-validation optional value tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_OPTIONAL_VALUES與 load-validation required value tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_VALUES共同維持 schema version、save/load required-key gate、allowlist、write coverage、required/optional marker value contract、required value contract 與 false-marker fail-closed 一致;舊 wrapper 缺 marker 仍可 reload,false marker fail closed;不回 source payload、credentials 或 locator values。 - Source Catalog Query Locator Redaction:Durable Source Catalog Store V0 已涵蓋 percent-encoded bare host query locator value、raw bare host query locator value、RTMPS streaming locator value、SRT streaming locator value、RTP/UDP streaming locator value、WebSocket streaming locator value、secure RTSP streaming locator value、RTMP streaming locator value(legacy RTMP streaming scheme locators)、percent-encoded MQTT broker locator value、percent-encoded AMQP broker locator value、percent-encoded NATS broker locator value、percent-encoded Redis cache locator value、raw Redis cache locator value、raw Memcached cache locator value、percent-encoded Kafka broker locator value、percent-encoded Snowflake connection locator value、raw Snowflake connection locator value、percent-encoded CockroachDB connection locator value、raw CockroachDB connection locator value、raw Oracle connection locator value、raw JDBC Oracle thin/OCI connection locator value、raw SQL Server connection locator value、raw MSSQL connection locator value、raw MySQL connection locator value、raw MariaDB connection locator value、raw SQLite connection locator value、raw JDBC connection locator value、raw JDBC DB2 connection locator value、raw JDBC H2 connection locator value、raw ODBC connection locator value、raw JDBC Teradata connection locator value、raw JDBC Snowflake connection locator value、raw JDBC Trino/Presto connection locator value、raw JDBC Hive/Impala connection locator value、raw JDBC Informix/Firebird connection locator value、raw JDBC Derby/JTDS connection locator value、percent-encoded raw JDBC connection locator value、raw JDBC memory connection locator value、percent-encoded raw JDBC memory connection locator value、percent-encoded raw JDBC Oracle thin connection locator value、percent-encoded raw JDBC Sybase TDS connection locator value、raw JDBC Sybase TDS connection locator value、raw LDAP directory locator value、raw FTP directory locator value、percent-encoded FTP directory locator value、percent-encoded Git SSH locator value、percent-encoded SCP-like Git repository locator value、raw SCP-like Git repository locator value、single-segment SCP-like Git repository locator value、IPv4 SCP-like Git repository locator value、IPv6 SCP-like Git repository locator value、raw bracketed IPv6 zone-id SCP-like Git repository locator value、localhost SCP-like Git repository locator value、percent-encoded bracketed IPv6 SCP-like Git repository locator value、percent-encoded bracketed IPv6 zone-id SCP-like Git repository locator value、percent-encoded Neo4j connection locator value、percent-encoded Bolt graph locator value、raw Neo4j/Bolt graph locator value、percent-encoded Solr search locator value、raw Solr search locator value、percent-encoded IMAP/SMTP mail transport locator value、raw IMAP/SMTP mail transport locator value、raw Kafka broker locator value、raw AMQP broker locator value、raw NATS broker locator value、percent-encoded HDFS storage locator value、raw HDFS storage locator value、percent-encoded NFS storage locator value、percent-encoded Rsync storage locator value、percent-encoded SMB/CIFS storage locator value、raw NFS/Rsync storage locator value、raw SMB/CIFS storage locator value、percent-encoded ZooKeeper/etcd coordination locator value、percent-encoded Consul coordination locator value、raw ZooKeeper/etcd/Consul coordination locator value、percent-encoded ZeroMQ transport locator value、raw ZeroMQ transport locator value、raw ZeroMQ zmq+tcp transport locator value、percent-encoded Cloudinary URL value、raw Cloudinary URL value、percent-encoded ABFS storage locator value、raw ABFS/WASBS storage locator value、percent-encoded WebDAV storage locator value、raw WebDAV storage locator value、percent-encoded Git repository locator value、percent-encoded SVN repository locator value、percent-encoded Mercurial repository locator value、percent-encoded MongoDB URI value、raw MongoDB +srv connection locator value、percent-encoded Cassandra connection locator value、raw Cassandra connection locator value、percent-encoded ClickHouse connection locator value、raw ClickHouse connection locator value、percent-encoded Elasticsearch/OpenSearch connection locator value、raw Elasticsearch/OpenSearch connection locator value、percent-encoded Redshift/DynamoDB connection locator value、raw Redshift connection locator value、raw DynamoDB connection locator value、percent-encoded Oracle/SQL Server connection locator value、percent-encoded LDAP directory locator value、percent-encoded Memcached cache locator value、percent-encoded PostgreSQL connection locator value、raw PostgreSQL connection locator value 與 percent-encoded MySQL/MariaDB connection locator value / percent-encoded SQLite connection locator value metadata-only redaction,例如 encoded/raw domain host + query-shaped locator values、secure streaming scheme locators、low-latency streaming scheme locators、transport streaming scheme locators、WebSocket scheme locators、secure RTSP scheme locators、encoded MQTT/MQTTS broker locator-shaped metadata values、encoded AMQP/AMQPS broker locator-shaped metadata values、encoded NATS/TLS+NATS broker locator-shaped metadata values、encoded Redis/Rediss cache locator-shaped metadata values、encoded Cloudinary URL-shaped metadata values、encoded ABFS/ABFSS/WASBS storage locator-shaped metadata values、encoded WebDAV/WebDAVS storage locator-shaped metadata values、encoded Git/Git+SSH repository locator-shaped metadata values、encoded SVN/SVN+SSH repository locator-shaped metadata values、encoded MongoDB/MongoDB+SRV URI-shaped metadata values、encoded Cassandra connection locator-shaped metadata values 與 encoded ClickHouse/ClickHouse+native connection locator-shaped metadata values;不會寫入 cameras/clients/secrets,也不公開 raw CCTV/feed URL。
- Source Catalog Startup Preflight Fail-closed:Durable source catalog
load()若在 startup preflight 遇到 catalog path inspection /lstatOSError,會安全回到 in-memory seed catalog;lstat inspection 也會在原生Path.lstat被 patchedPath.stat影響時 fallback 到 no-followos.lstat,避免誤用 follow-stat metadata;不外拋例外、不載入可疑 durable catalog;不回 durable path、source payload、API key/hash、tokens、passwords、credentials 或 raw feed locators。 - Source Health JSON:Source Catalog Health JSON V0 提供 admin-only
/admin/sources/healthmetadata-only JSON health endpoint;回source_catalog_health_v0、source_count、source_catalog_storage、loaded_from_durable、redactedcatalog_sha256與source_catalog_restart_consistency_v0compare guide(含health restart_consistency.paths_hidden=true),讓 operator restart 前後只比較 checksum;startup/load 會驗證admin_source_catalog_v1wrapper 的catalog_sha256、restart_consistency.schema_version=source_catalog_restart_consistency_v0、restart_consistency.compare_field=catalog_sha256、restart_consistency.metadata_only=true、restart_consistency.paths_hidden=true、restart_consistency.catalog_sha256、storage=durable_json_v1、contains.sources與redaction.secrets_removed/removed categories(必須是 list of strings,redaction wrapper 不可含 unexpected redaction wrapper fields,removed_categories不可含 unexpected redaction removed_categories,restart consistency wrapper 不可含 unexpected restart consistency fields,且 durable JSON object 不可含 duplicate JSON object keys),unexpected source item fields、incomplete source item wrapper、boolean contains.sources、numeric storage.durable、unowned catalog file(source catalog path must be owned by the service user)、relative storage path(source catalog path must be absolute)、symlink storage path(source catalog path must not be a symlink)、directory storage path / non-regular storage path(source catalog path must be a regular file)、parent path file(source catalog parent path must be a directory)或 symlink parent/ancestor directory;建立缺少 parent directory 後會做 post-mkdir parent symlink recheck(source catalog parent directory must not be a symlink)、too many sources(source catalog cannot contain more than 1000 sources)、out-of-range priority(priority must be between 0 and 10000)、checksum mismatch、non-string removed_categories、non-object source entries、空白/前後含空白/非字串、overlong source_id、overlong text fields(source identity / license_note / supports_intents / safety_notes 必須 256 characters or fewer)、source text list overflow(supports_intents cannot contain more than 100 items/safety_notes cannot contain more than 100 items)、overlong metadata string values(metadata key/value string 必須 256 characters or fewer)、non-finite metadata numbers(metadata numbers must be finite)、non-standard JSON constants(non-standard JSON constants are not allowed)、oversized source catalog file / write-before-temp-file size guard(source catalog file cannot exceed 1000000 bytes)、metadata total node count overflow(metadata total node count cannot exceed 1000)、metadata serialized size overflow(metadata serialized size cannot exceed 16384 bytes)、metadata depth overflow(metadata depth cannot exceed 8 levels)、metadata collection overflow(metadata collections cannot contain more than 100 items)、blank/paddedsupports_intents/ blank/padded safety_notes / blank/padded license_note / blank/padded identity fields(name/provider/source_type/integration_status,必須是 non-empty unpadded strings)、blank/padded metadata keys、unsupported characters(例如 slash/path-like)的source_id、supports_intents/safety_notes非 list of strings、metadata非 object/null、name/provider/source_type/integration_status/license_note非 string、priority非 int(含 bool 或 string coercion)、duplicate source_id、restart wrapper incomplete 或 top-level wrapper incomplete 時不載入 durable file;可用scripts/source_catalog_health_check.py搭配--admin-key-env執行 metadata-only restart consistency check,並可在重啟後傳入--expect-catalog-sha256,或加--require-durable/--require-loaded-from-durable/--require-restart-consistency/--require-catalog-sha256/--require-metadata-only/--require-paths-hidden做 fail-closed staging verify,只輸出 safe health metadata、expected_catalog_sha256_matches、durable_storage_ok、loaded_from_durable_ok、restart_consistency_ok、catalog_sha256_ok、metadata_only_ok與paths_hidden_ok,sanitized output 明確標示metadata_only=true/paths_hidden=true;helper 具有 base URL userinfo / non-http scheme guard,會拒絕含 userinfo credential 的 base URL 與非 http/https scheme;hash 不符、缺少/無效 requiredcatalog_sha256或 required health contract 不符時 exit non-zero;不回 durable file path、source record payload、API key/hash、tokens、passwords、credentials、URL credential 或 raw feed locators。 - Remote Smoke:Staging Remote Smoke Test Policy 規範 staging runtime venv 若缺少
pytest / httpx2,應執行python -m compileall -q app加 live endpoint verification,不要在緊急驗證時安裝 test-only dependencies;最後必須確認 service active、/healthzok、ADMIN_IMPORT_APPLY_ENABLED=false。 - Local pytest PYTHONPATH isolation:Hermes/Python mixed PYTHONPATH 可能讓 project venv collection 走到不相容的
pydantic_core._pydantic_core;local/CI 測試請用env -u PYTHONPATH .venv/bin/python -m pytest ...,避免外部 site-packages 混入專案 venv。這只影響本機測試環境,不改 staging runtime、不輸出 key/path/secret。 - Deploy Guard:Rsync runtime path guard 要求 staging deploy 保留 runtime-managed paths;使用 rsync 時至少排除
--exclude '.venv'、--exclude '.env'、--exclude '__pycache__',並 do not use --delete without explicit runtime exclusions,避免刪除 server runtime venv、env file、durable catalog 或 logs。建議使用scripts/safe_staging_rsync.py先以--print-command審查部署命令;此 helper defaults to --dry-run、does not include --delete,且必須明確傳入--execute才會移除 dry-run。Allowlist deploy mode 可加--allowlist,使用--relative並只同步 reviewed project paths:./app、./docs、./scripts、./tests、./README.md、./pyproject.toml。 - 匯入功能 V0 不會寫入 cameras、clients、API keys、raw feed URL 或 secrets;未來擴大 write scope 必須另做 schema validation、SSRF/security scan、dry-run diff、human confirmation、rollback/export snapshot 與 admin audit log。
查詢資料源能力
curl -s https://taiwanworldmodel.thesense.biz/v1/reality/sources -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
依 intent 過濾:
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/sources?intent=traffic_congestion" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
送出 Reality Check
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"阿里山現在有雲海嗎?"}'
Weather Reality API Usage:TrueSight 氣象查詢
TrueSight 目前可以先用 Reality API 查氣象資訊,暫時不啟用攝影機驗證。支援的 weather runtime intents 包含 rain_now、weather_suitability、flooding_risk。
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"阿里山現在有下雨嗎?"}'
| Status | 意義 | TrueSight UI 建議 |
|---|---|---|
live_data | 已取得 CWA 觀測/雨量/短時預報 signals | 可顯示為氣象現況查證結果,但仍需顯示 limitations |
configuration_required | runtime 已接好,但服務尚未設定 CWA_API_KEY | 顯示為介接已就緒、等待金鑰設定,不可顯示成即時天氣 |
insufficient_data | 該地點或意圖沒有足夠資料 | 顯示無足夠資料,不做明確建議 |
{
"intent": "rain_now",
"status": "configuration_required",
"current_state": "unknown",
"data_sources": ["cwa_weather_observation", "cwa_rainfall_observation", "cwa_weather_forecast"],
"signals": [],
"limitations": ["需要在服務環境設定 CWA_API_KEY"]
}
Short-term Forecast Runtime V0
Weather Reality runtime 現在會嘗試讀取中央氣象署短時/鄉鎮區預報資料集 F-D0047-091,normalize 成 signal_type=short_term_forecast、source_id=cwa_weather_forecast,欄位包含 rain_probability_percent、forecast_uncertainty、weather_description、min_temperature_c、max_temperature_c、forecast_time、valid_time、valid_from、valid_to 與 evidence_role=forecast_not_observation。
POST /v1/reality/check 的 Weather Reality response 會加入 forecast_context / cwa_forecast_context_v0,用 disagreement_status 標示觀測與預報是否一致;例如 forecast_possible_rain_but_observation_no_rain 表示目前地面觀測無明顯降雨,但短時預報顯示後續降雨機率偏高。freshness_status 會標示 valid、expired、missing_valid_time 或 not_yet_valid;measurement_status 另行驗證降雨機率,只有 finite 且落在 0–100% 才是 available,缺漏或越界固定為 missing_or_invalid_rain_probability。有效時間與 measurement proof 必須同時成立,decision_usable=true 的預報才可提高 confidence。政策是 forecast_is_future_context_not_current_observation,不可把預報包裝成現在已發生的現況。
當 short_term_forecast 成功接入時,evidence_plan 會把 short_term_forecast -> cwa_weather_forecast 標成 live_data,Evidence Fusion 可避免因缺短時預報而降級;若 forecast 尚不可用,仍會誠實標成 planned 或 configuration_required。
注意:短時預報不是現況觀測;它用來回答「接下來一段時間是否會受雨影響」,不可取代測站觀測或現場攝影機驗證。
官方訊號優先:產品主線是中央氣象署與其他合法官方 weather、parking、traffic、tourism 訊號;既有攝影機僅保留為低權重 on-demand 輔助,不取代官方資料,也不推進外部 vision 或持續監控。
Location Resolution:地點解析與最近測站
Location Resolution Engine V1 會先把 query 中的地點解析成可解釋 contract,而不是只回單一座標。location_resolution 會包含 status、confidence、source_provenance、candidates 與 limitations;若短地名有多個接近候選,會回 ambiguous_location,避免過度自信。未解析到單一地點前,不會呼叫天氣、交通或攝影機 runtime,以避免錯用資料源;呼叫端應讓使用者選擇候選或補充縣市/行政區/地標。地名解析的核心不是相似字串,而是依照用戶關鍵字與背後目的/意圖找到正確目標;不確定時必須候選/追問或低信心。若 internal registry 找不到,V1.2 可用 OSM/Nominatim 作 external_geocoding_fallback,回 resolved_low_confidence 並標明 provenance/limitations。天氣 runtime 的最近測站選擇則放在 location_resolution.data_source_resolution,例如 data_source_resolution.method=coordinates_nearest_station。
地點解析不應把未知或非阿里山地點掉回阿里山。已支援將 林口光曜車業 類查詢解析為 新北市林口區附近;也支援 東湖現在的雨量,解析為 臺北市內湖區東湖附近 與 rain_now intent。
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"林口光曜車業現在有下雨嗎?"}'
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"東湖現在的雨量"}'
若 POI 尚無第一手精準座標,會先降級為行政區或區域附近,例如 新北市林口區附近、臺北市內湖區東湖附近;結果仍需顯示測站距離與 limitations,不可宣稱代表單一店門口或街角微氣候。
Query Understanding V0:理解問題背後目的
POST /v1/reality/check 會回傳 query_understanding,用來說明系統如何從字面問題推斷使用者真正想做的現實決策。欄位包含 surface_query、place_keywords、condition_keywords、time_scope、explicit_intent、inferred_underlying_task、answer_goal、evidence_requirements、clarification_required。
例如 南港展覽館現在雨量 不只是查 mm 數字;V0 會推斷 inferred_underlying_task=go_or_wait_decision,目標是判斷現在前往是否會受雨影響,並要求 evidence_requirements 至少包含最近雨量站、氣象觀測、短時預報與可選攝影機驗證。若使用者只問「台北車站現在怎樣」,會標示 clarification_required=true,先釐清想查天氣/人潮/交通/事件安全狀況。
Evidence Planner V0:證據需求到資料源計畫
query_understanding.evidence_requirements 會進一步轉成 evidence_plan,說明每個 evidence requirement 對應哪個資料源、目前是 live_data、planned、configuration_required、blocked_by_location_ambiguity 或 planned_or_gated,以及是否 blocking。欄位包含 status、summary、required_count、primary_ready_count 與 items。
例如 南港展覽館現在雨量 目前可得到 evidence_plan.status=partially_satisfied:最近雨量站與氣象觀測可由 CWA live data 支援;short_term_forecast 仍是 planned;optional_camera_visual_validation 會標成 planned_or_gated,不可假裝已用於判斷,也不可把第三方/攝影機 optional evidence 當成第一手官方資料。
Evidence Fusion V0:證據完整度與信心降級
evidence_fusion 會根據 evidence_plan 的 readiness 與 blocking 狀態,產生 status、completeness、base_confidence、adjusted_confidence、confidence_delta、applied_rules 與 fusion limitations。當必要 evidence 缺少時會套用 missing_required_evidence,回 partial_evidence 並降低 confidence;當地點仍歧義時會 blocked,不可進行 fusion。
例如 南港展覽館現在雨量 目前 CWA 觀測與雨量 live,但短時預報仍 planned,所以 base confidence 會被降級為 adjusted_confidence,並把缺少 short_term_forecast 的限制加到 response limitations。
Temperature Definitions:溫度定義
Weather Reality 會明確區分 室外實測氣溫 與 體感溫度,避免把測站溫度誤解為人體實際感受。
| 欄位 | 中文定義 | 資料意義 |
|---|---|---|
air_temperature_c | 室外實測氣溫 | 中央氣象署測站量到的空氣溫度,不等於人在太陽、濕度、風速下的感受。 |
apparent_temperature_c | 體感溫度 | 由氣溫、濕度、風速估算;炎熱潮濕時使用 heat index,寒冷有風時使用 wind chill。 |
Reality Graph 資料源原則
Taiwan World Model 不是 CCTV 聚合器。官方資料是現實證據的一等公民;攝影機是眼睛,不是整個世界模型。
| 資料類型 | 例子 | 角色 |
|---|---|---|
| 官方公告 | 封路、停班停課、災害警戒、施工公告 | 權威狀態來源 |
| 感測器 | 雨量、水位、AQI、VD 車流、溫度 | 量化現實狀態 |
| 交通資訊 | CMS、事故、路況、旅行時間 | 道路可用性與壅塞判斷 |
| 攝影機 | 景點 webcam、交通 CCTV、河川影像 | 視覺驗證與補充 |
Multi-dimensional Fusion:多維融合與單一維度檢視
多維度融合是預設:Taiwan World Model 會把官方觀測、雷達、衛星、攝影機、交通、水文、防災告警、新聞/社群等多個維度互相驗證,形成可解釋、有 confidence、有 limitations 的現實判斷。
單一維度檢視 也可提供,例如只看攝影機、只看衛星、只看雨量站或只看交通;這是 single_dimension_view,適合除錯、透明度、專業查核與使用者只想「看看」某一層。但單一維度只能回答局部狀況,不能包裝成完整 world model 答案。
| 模式 | 用途 | 限制 |
|---|---|---|
multi_dimensional_fusion | 預設 Reality Engine;回答是否適合出門、是否真的下雨/塞車/危險 | 成本較高,需要治理與來源分級 |
single_dimension_view | 只看某一資料層,例如 camera / satellite / rainfall / traffic | 太大材小用;只能代表局部 layer,不代表完整現實判斷 |
公共資源 catalog
| Source ID | 類型 | 狀態 | 備註 |
|---|---|---|---|
cwa_weather_observation | weather | client_ready_requires_cwa_api_key | 中央氣象署觀測資料;CWA client v0 已完成,需環境變數 API key 才能 live fetch |
cwa_rainfall_observation | rainfall | client_ready_requires_cwa_api_key | 中央氣象署雨量資料;CWA client v0 已完成,需記錄測站、觀測時間與 freshness |
cwa_weather_forecast | forecast | planned | 週末/假期預報、forecast_uncertainty、forecast_divergence |
cwa_radar_echo | radar | planned | 短時降雨 nowcast 與雨帶移動 |
cwa_satellite_cloud | satellite | planned | 雲帶、颱風外圍環流、能見度趨勢 |
cwa_typhoon_forecast | forecast_alert | planned | 颱風路徑、警報與不確定性 |
tdx_transport_traffic | traffic | planned | TDX 交通資料 |
freeway_vd_traffic | traffic_sensor | planned | 高速公路 VD 車流/車速/占有率 |
freeway_cms_messages | traffic_bulletin | planned | 高速公路 CMS 資訊可變標誌 |
official_road_closure_bulletins | official_bulletin | planned | 封路、施工、災害通報 |
scenic_camera_public_feeds | camera | candidate_review_required | 景點公開攝影機;需白名單審查 |
freeway_traffic_cctv | traffic_camera | candidate_review_required | 高速公路 CCTV;不公開原始 URL,不做車牌/車輛追蹤 |
river_water_level_observation | water_level | planned | 河川水位觀測 |
flood_alerts | disaster_alert | planned | 淹水警戒與防災告警 |
reservoir_status | reservoir | planned | 水庫水情與洩洪資料 |
aqi_observation | air_quality | planned | 環境部空氣品質 AQI |
public_parking_availability | parking | client_ready_requires_official_dataset_locators | 新北市官方即時剩餘車位/停車場基本資料;九份/瑞芳 answer runtime 回 source lineage、freshness、coverage 與 honest unavailable,不以 camera 補值 |
tourism_scenic_spots | tourism | runtime_available_requires_explicit_enable | 交通部觀光署官方景點/活動資料;九份精確匹配與瑞芳鄰近 bounded runtime 回 source lineage、dataset freshness、活動有效期間與 partial coverage;營業時間不推算為現在開放,announcements_covered=false,不以 camera 或聚合站補值 |
cwa_earthquake_reports | earthquake | planned | 中央氣象署地震報告與地震速報;地震資訊需以官方發布時間、震央、規模、深度為準 |
cwa_tsunami_messages | tsunami_alert | planned | 中央氣象署海嘯資訊與警報;海嘯警報不可由攝影機或社群訊號取代官方告警 |
nfa_disaster_alerts | disaster_alert | planned | 消防署 / 災防告警與防災資訊 |
soil_debris_flow_alerts | landslide_alert | planned | 土石流與大規模崩塌警戒資料 |
Decision Reality:現在進行式狀態 → 決策
Reality API 的核心不是展示資料,而是回答會影響行動的 現在進行式 狀態:現在是否真的在下雨?現在是否真的在塞車?資料是否夠新,能不能支援即時決策?
| 使用者決策 | 需要的 current_state | decision_impact / recommendation |
|---|---|---|
| 騎車要不要穿雨衣 | rain_now、drizzle_now、road_wetness、rain_trend | 穿雨衣 / 輕便雨衣即可 / 可暫不穿但 30 分鐘內注意 |
| 走路撐傘是否夠 | rain_intensity、wind_gust、sideways_rain、distance_duration | 撐傘可行 / 需雨衣 / 建議延後 |
| 開車或改搭火車 | traffic_congestion、road_availability、stuckness、incident_risk | 開車可接受 / 改搭火車較穩 / 延後出發 |
{
"current_state": "drizzle_now",
"decision_impact": "騎車會被淋濕,走路短程撐傘可接受",
"recommendation": "騎車穿雨衣;步行可撐傘",
"confidence": 0.78,
"limitations": ["最近雨量站距離 4.2 公里"]
}
Now Freshness Contract:現在資料必須夠新
若資料不夠新,Reality API 不可假裝是「現在」。每個可用於即時決策的 signal 都應回報 observed_at、fetched_at、freshness_seconds、staleness。資料過舊時應降級為 stale 或 unknown,並提示不要用於即時決策。
| 狀態 | 意義 | 決策處理 |
|---|---|---|
fresh | 資料足夠新,可支援現在判斷 | 可給 recommendation |
stale | 資料已過時,不代表現在 | 只能給保守建議或要求重查 |
unknown | 沒有足夠資料判斷現在 | 不可做明確決策建議 |
Weather Reality:天氣現狀如何掌握?
天氣不能只看預報。Reality API 會區分 預報 forecast、觀測 observation、現場視覺 visual evidence、nowcasting 臨近推估。當氣象說天晴但現場毛毛雨,常見原因是微氣候、地形雲霧、測站距離、雷達解析度或降雨胞偏移。
| 問題 | 主要訊號 | 判斷重點 |
|---|---|---|
| 預報晴但現場毛毛雨 | 雨量站、雷達回波、濕度/露點、攝影機地面濕潤、社群回報 | 標記為微尺度降雨或地形性毛毛雨;以資料新鮮度與近距離觀測提高 confidence。 |
| 預報雨但現場大太陽 | 雷達雨帶位置、衛星雲圖、日照/能見度、攝影機天空狀態、最近雨量 | 判斷雨帶是否偏移、已通過或只影響同預報區的其他地點。 |
| 山區雲海/霧/能見度 | 濕度、露點差、風速、地形高度、攝影機視覺、雷達/衛星 | 把雨、霧、雲海分開;不把看不清楚一律當成下雨。 |
Forecast Reality:Weekend / Holiday Planning
CWA Rain Forecast Answer V0:POST /v1/reality/check 可將「阿里山下午會下雨嗎?」這類 future rain query 分流成 rain_forecast,並回傳 forecast_answer / cwa_rain_forecast_answer_v0。回應會保留 current_observation_state 與 forecast_context,政策固定為 forecast_is_future_context_not_current_observation,避免把短時預報包裝成現在已下雨。
幾天後或週末假期的天氣預測有價值,但必須顯示 forecast_uncertainty 與 forecast_divergence。颱風生成、外圍環流、下沉氣流、雲雨帶位置與路徑偏移,都可能讓「預測大雨」與「當地實際很熱很晴」同時成立。
| 情境 | 需要比較的訊號 | 回答方式 |
|---|---|---|
| 颱風預測大雨但當地大太陽 | 颱風路徑、外圍環流、下沉氣流、雲雨帶位置、衛星雲圖 | 顯示預測分歧,標示短期可能熱但後續風險仍高 |
| 預報好天氣但烏雲籠罩並下雨 | 雷達回波、衛星雲圖、局部對流、地形雲、即時雨量 | 用 nowcast 修正 forecast,提醒現況已偏離預報 |
| 週末露營是否適合 | 多模型比較、預報變動趨勢、雨量機率、風速陣風、地形影響 | 回傳可行/觀望/不建議,並列出不確定性來源 |
Mountain / Camping Nowcast:山區與露營短時天氣
露營最怕天氣快速變化,因此不能只回答現在有沒有下雨,而要判斷 30–120 分鐘內是短時轉好還是短時轉壞。山區天氣會被地形、地勢、海拔高度、坡向、迎風/背風面、谷地/稜線差異強烈影響。
| 訊號 | 用途 | 露營判斷 |
|---|---|---|
| 雲的型態與移動 | 判斷雲底是否抬升、雲量是否減少、雨帶是否離開 | 雲層變薄、雲底抬升 → 可能短時轉好 |
| 濕度/露點差 | 判斷霧、低雲、毛毛雨與凝結風險 | 露點差很小 + 風弱 → 霧/毛毛雨可能持續 |
| 風速風向 | 判斷迎風坡降雨、背風面轉晴、雲霧移動速度 | 風向轉乾、風速增加且雨帶離開 → 可能轉好 |
| 雨量趨勢 | 比較近 10/30/60 分鐘雨量變化 | 雨量下降 + 雷達回波遠離 → 可能短時轉好 |
| 雷達回波移動 | 追蹤降雨胞是否接近或遠離營地 | 回波增強接近 + 高濕 → 短時轉壞 |
| 地形/海拔/坡向 | 修正模型預報與測站資料 | 同一行政區內,稜線、谷地、迎風坡可能完全不同 |
若當地沒有風速觀測,像 Windy 這類服務通常使用 ECMWF/GFS/ICON 等數值天氣模型推估網格風場,再依位置顯示;Reality API 需標示為 model_estimated_wind,不可假裝是現場實測。
Camera Visual Evidence:攝影機作為現場驗證
攝影機不是唯一資料源,但很適合作為 現場驗證 與 sanity check,用來確認預報、模型、感測器與官方公告是否符合實際畫面。
| 用途 | 可驗證內容 | 限制 |
|---|---|---|
| 天氣 | 是否真的下雨、地面是否濕、天空是否放晴、雲霧是否降低 | 鏡頭髒污、逆光、夜間畫面會降低可信度 |
| 交通 | 車流是否停滯、是否積水、事故/封路是否可視 | 不做車牌或個別車輛追蹤 |
| 景點 | 人潮、能見度、海況、現場可用性 | 不做人臉或個體追蹤 |
治理原則:不公開原始 CCTV URL、不做人臉、不做車牌、不長期保存原始影像;對外只輸出 summary / confidence / limitations。
Identity-Level Analysis Governance:身分層級分析治理
公開版 Reality Search 不追蹤個體。車牌辨識、人臉辨識與個體追蹤不是目前公開 API 的核心能力,也不應混入一般天氣、交通、景點與災害查詢。
| 模式 | 定位 | 治理要求 |
|---|---|---|
| Public Reality Search | 回答地方狀態:下雨、塞車、人潮、淹水、道路可用性 | 不做人臉、不做車牌、不追蹤個體,只回聚合狀態 |
| Law Enforcement Module | 未來可與警政單位合作的警政授權模組 | 必須獨立權限、合法授權、任務限定、資料最小化、完整審計、用途審查 |
原則:身分層級的分析只能存在於合法授權、可稽核、政府核准的受管制部署中;不能成為一般公開 Reality Search 的預設能力。
Satellite Evidence:衛星畫面
衛星畫面可以取得,並會作為 Reality Search 的大範圍天氣與災害環境 evidence。策略是:衛星負責大範圍雲系與趨勢,攝影機負責地面現場驗證;衛星影像不可單獨代表某個地點正在下雨或安全。
| source_id | 來源 | 狀態 | 用途 |
|---|---|---|---|
cwa_satellite_cloud | 中央氣象署衛星雲圖 | metadata_endpoint_found | 已確認 CWA dataset O-B0033-003:全解析紅外線衛星雲圖KMZ檔-東亞,10 分鐘更新,metadata 欄位含 Datetime / ProductURL。data.gov.tw 可作 discovery/provenance,runtime 優先接 CWA fileapi / 官方 bucket。 |
himawari_8_9_open_satellite | JMA / NOAA Open Data on AWS | candidate_open_data_raw_pipeline_required | Himawari-8/9 原始開放衛星資料;需裁切台灣區域、投影與處理後才能作 evidence。 |
Camera Source Discovery v0:攝影機多來源盤點
攝影機大項目目前進入來源盤點階段,原則是多來源,不單點依賴。第一批 registry seed 已涵蓋山區、海岸、景點、交通與水文防災候選來源;多數仍是 discovery_only 或 license_review_required,不代表已可抓取或可作 production evidence。
| location_id | 類型 | 用途 | 狀態 |
|---|---|---|---|
alishan | scenic_camera | 雲海、下雨、能見度 | 1 個 optional proxy source 可抓 metadata;另有候選來源待審查 |
hehuanshan | mountain_camera | 雲霧、積雪、能見度 | discovery_only |
wuling_farm | mountain_camera | 天氣、人潮、能見度 | discovery_only |
kenting | coastal_camera | 玩水條件、浪況視覺輔助、人潮 | discovery_only |
river_disaster_general | water_disaster_camera | 淹水、水位、河川現場驗證 | requires_authorization |
Camera Whitelist Workflow:攝影機白名單介接流程
公共公開攝影機不會直接全量接入。每個來源都必須完成候選來源盤點、授權審查、隱私風險審查、技術可用性檢查與白名單啟用。
- 候選來源盤點:記錄 provider、頁面來源、地點、用途、更新頻率與初步風險。
- 授權審查:確認是否允許抓取、AI 分析、展示截圖或僅可連回原頁。
- 隱私風險審查:排除住宅、學校、醫院、私人空間與容易識別個體的角度。
- 技術可用性檢查:確認格式、穩定性、更新頻率、延遲與是否需要只存 metadata。
- 白名單啟用:只允許通過審查的 camera source 進入 on-demand visual evidence pipeline。
API Key Application / Partner Client Onboarding
早期合作夥伴、政府 PoC 或 TrueSight client 應使用獨立 API key,以便累積 usage metering / shadow billing。建立 client 時使用 scripts/create_api_client.py,stdout 只顯示一次 api_key_once;registry file 只保存 api_key_sha256。不要把 plaintext API key commit 到 repo、docs、tests、logs 或 Codex prompt。
.venv311/bin/python scripts/create_api_client.py --client-id partner-demo --tier pilot --billing-mode shadow_billing --allow-endpoint v1.reality.auth_whoami --allow-endpoint v1.reality.billing_current --allow-endpoint v1.reality.sources --output /tmp/partner-demo-client.json
完整文件:docs/API_KEY_APPLICATION_AND_CLIENT_ONBOARDING.md。Codex 不應要求使用者把 API key 貼進 prompt;只應使用 runtime env / secret store 中的 key。
Usage Quota Guard:用量上限與成本防護
早期 partner / government PoC client 可設定 monthly_request_limit 與 monthly_ru_limit。受保護 API 在執行昂貴工作前會先做 quota pre-flight check;超過上限時回 429 usage_limit_exceeded,不再產生新的 billable usage event。
{
"error": {
"code": "usage_limit_exceeded",
"message": "API client monthly usage limit has been exceeded.",
"details": {
"reason": "monthly_request_limit_exceeded",
"monthly_request_limit": 100000,
"current_requests": 100000,
"current_reality_units": 8420.5,
"estimated_reality_units": 0.1
}
}
}
v0 enforcement 已涵蓋 metered endpoints:sources、cameras、camera selection、snapshot、visual evidence、stability、cross-check 與 reality check。monthly_spend_limit_twd 目前仍作為 profile / shadow-billing 欄位,正式金額停權需等 pricing model 校準後再啟用。
Partner Pilot Report:合作夥伴 / 政府 PoC 月報
scripts/generate_partner_report.py 可從 server-side JSONL usage log 產出 partner_pilot_monthly_report_v0,支援 JSON 與 Markdown。用途是對 partner / government PoC 說明本月使用量、Reality Units、endpoint 分布、quota 使用率、高成本功能與下一步建議;它不是正式 invoice。
/opt/taiwan-world-model/.venv/bin/python scripts/generate_partner_report.py --usage-log /var/lib/taiwan-world-model/usage-events.jsonl --client-id partner-demo --period 2026-06 --billing-mode shadow_billing --monthly-request-limit 100000 --monthly-ru-limit 250000 --monthly-spend-limit-twd 5000 --format markdown
報告只應分享 aggregate summary;不要公開 raw usage log,因為其中可能包含 client_id、endpoint、intent、location_id、status 等 operational metadata。
Admin Console V0:API client 管理平台
Durable Source Catalog Store V0 load-time hardening:load-time catalog fstat failure fail-closed guard、load-time catalog fd fstat before read TypeError fail-closed guard、load-time catalog lstat failure fail-closed guard、load-time catalog open TypeError fail-closed guard、load-time catalog fdopen TypeError fail-closed guard、load parent-dir open TypeError fail-closed guard、initial load-time catalog lstat failure fail-closed guard、initial load-time catalog lstat TypeError fail-closed guard、existing write-time catalog lstat TypeError fail-closed guard、pre-read catalog path lstat TypeError fail-closed guard、write parent-dir lstat TypeError fail-closed guard、write parent-dir helper lstat TypeError fail-closed guard、temp file fsync TypeError fail-closed guard、temp file lstat during fsync TypeError fail-closed guard、parent-dir fsync lstat TypeError fail-closed guard、parent-dir fsync TypeError fail-closed guard、initial load preflight lstat-only metadata validation guard、ancestor symlink lstat-only scanner guard / ancestor symlink lstat TypeError fail-closed guard、load-time catalog fd primary failure precedence guard、load-time catalog fd close-before-read TypeError fail-closed guard、missing restart_consistency.paths_hidden / restart consistency paths_hidden required load guard、source catalog wrapper strict bool marker fail-closed validation、redaction removed_categories deterministic order load guard、load parent-dir fstat failure fail-closed guard、load parent-dir fstat TypeError fail-closed guard、load parent-dir lstat TypeError fail-closed guard、load parent-dir lstat failure fail-closed guard、load parent-dir primary failure precedence guard、load parent-dir close TypeError fail-closed guard、load-time catalog parse primary failure precedence guard、post-read catalog fd fileno failure fail-closed guard、post-read catalog fd fileno TypeError fail-closed guard、post-read catalog fd fstat failure fail-closed guard、post-read catalog fd fstat TypeError fail-closed guard、post-read catalog path lstat failure fail-closed guard、post-read catalog lstat TypeError fail-closed guard、post-read parent-dir fstat failure fail-closed guard、post-read parent-dir fstat TypeError fail-closed guard、post-read parent-dir lstat TypeError fail-closed guard、post-read parent-dir lstat failure fail-closed guard、post-read parent-dir close TypeError fail-closed guard 與 post-read parent-dir primary failure precedence guard、post-replace parent-dir fstat TypeError fail-closed guard、post-replace catalog close TypeError fail-closed guard、post-read catalog close TypeError fail-closed guard 會在 load-time catalog fd/path、parent fd/path、catalog parse 與 wrapper validation/post-read fd/path/parent metadata recheck 前,把 catalog fd/path、parent-dir inspection/close failure、parser TypeError 或 reordered redaction.removed_categories wrapper 收斂為 fail-closed fallback,不載入非 canonical durable catalog;inspection/parse/close errors 仍使用 source catalog fd must be inspectable before read / source catalog path must be inspectable before read / source catalog parent directory must be inspectable before read / source catalog parent directory fd must be closable before read / source catalog JSON must be parseable / source catalog fd must be inspectable after read / source catalog path must be inspectable after read / source catalog parent directory must be inspectable after read / source catalog fd must be closable after read / source catalog parent directory fd must be closable after read 這類固定訊息,且不暴露 durable path/source payload/API key/hash/token/password/credential/raw feed locator。
內部管理平台已提供最小 V0:/admin、/admin/clients、/admin/clients/{client_id}、/admin/clients/{client_id}/report。Admin Console 需 server-side REALITY_ADMIN_KEY,呼叫時使用 header X-Admin-Key;不顯示 plaintext API key 或 key hash。
Admin Source Registry Persistence V0:staging sources-only apply 在設定 ADMIN_SOURCE_CATALOG_PATH 後,會以 admin_source_catalog_v1 / durable_json_v1 原子寫入 source metadata;redaction allowed key table ADMIN_SOURCE_CATALOG_REDACTION_ALLOWED_KEYS、redaction required value table ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_VALUES、redaction required list-value table ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_LIST_VALUES 與 redaction removed-categories table ADMIN_SOURCE_CATALOG_REDACTION_REMOVED_CATEGORIES 維護 deterministic redaction wrapper key allowlist、secrets_removed=true value contract、removed_categories save/load contract、missing/unexpected key fail-closed、tampered secrets_removed fail-closed 與 reordered-category fail-closed;storage allowed key table ADMIN_SOURCE_CATALOG_STORAGE_ALLOWED_KEYS 與 storage required value table ADMIN_SOURCE_CATALOG_STORAGE_REQUIRED_VALUES 共同維護 durable storage wrapper allowlist/value contract(只允許 mode / durable,且必須為 mode=durable_json_v1 / durable=true,tampered mode/durable fail-closed);contains allowed key table ADMIN_SOURCE_CATALOG_CONTAINS_ALLOWED_KEYS 與 contains required value table ADMIN_SOURCE_CATALOG_CONTAINS_REQUIRED_VALUES 維護 metadata-only contains wrapper allowlist/value contract(只允許 sources count placeholder;save 時以實際 count 覆寫)與 unexpected-key / invalid count / mismatched count fail-closed;source-item allowed key table ADMIN_SOURCE_CATALOG_SOURCE_ITEM_ALLOWED_KEYS 維護每筆 source item wrapper allowlist 與 unexpected-key fail-closed;restart-consistency required value table ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_REQUIRED_VALUES 維護 schema_version=source_catalog_restart_consistency_v0 / compare_field=catalog_sha256 / metadata_only=true / paths_hidden=true value contract 與 tampered values fail-closed;並只在 durable save 成功後切換 runtime catalog / Evidence Planner;若 durable save I/O 失敗或 store validation error(例如 duplicate source_id)拒絕 catalog,會 fail closed 回 source_catalog_persist_failed_v0、sources_written=0、不切換 runtime state、audit 只記 metadata-only storage/plan 欄位,避免 save failure 時 imported source 只存在 memory;restore apply 也有 restore durable save failure fail-closed:若 snapshot restore 的 durable source catalog save 失敗,回 source_catalog_restore_persist_failed_v0、restored_sources=0,不切換 runtime catalog / Evidence Planner。service restart 後仍可由 /v1/reality/sources 看到 imported sources。source_catalog_storage 只在 catalog 實際從 durable file 載入或本次成功 durable save 後回 durable_json_v1;若 path 已設定但檔案不存在、schema 不符或無法讀取,會 fallback seed catalog 並回 in_memory_v0,避免誤標示 durable runtime。durable catalog 寫入與啟動載入都會移除 raw feed URL、一般 http(s) URL value、streaming scheme URL-like value(rtsp:// / rtmp:// / ws:// / wss:// / ftp:// / sftp://)、embedded URL-like string value、scheme-relative URL value、bare host/path URL-like value、bare IP host/path URL-like value、API credential、password、token 與 authorization/bearer header hints;initial write-time catalog lstat failure fail-closed guard、initial write-time catalog lstat TypeError fail-closed guard 與 existing write-time catalog lstat TypeError fail-closed guard 會在建立或覆寫既有 catalog 前把 lstat inspection failure 收斂為 source catalog path must be inspectable before write,且既有 durable catalog 覆寫前遇到 TypeError 會保留原 catalog;temporary source catalog symlink guard 會在 payload write 前拒絕 temporary source catalog file must be a regular file;load-time symlink no-follow guard 會在開啟 catalog 讀取前拒絕 source catalog path must not be a symlink before read;load-time parent symlink guard 會在開啟 catalog 讀取前拒絕 source catalog parent directory must not be a symlink before read;ancestor symlink lstat-only scanner guard / ancestor symlink lstat TypeError fail-closed guard 會以 parent lstat 檢查 ancestor symlink,不依賴 Path.is_symlink();load-time fstat owner/mode recheck 會在 os.open 後再次確認已開啟 fd 仍是 service-user owned、single hard link、owner-only regular file;load-time catalog open fail-closed guard 會在 durable catalog file 無法被 no-follow 開啟時回一致錯誤(source catalog path must be openable before read);load-time catalog fd close-before-read fail-closed guard 會在 fdopen/read 前 catalog fd 關閉失敗時回一致錯誤(source catalog fd must be closable before read);load-time catalog read failure fail-closed guard 會在 JSON parse 前 payload read 失敗時回一致錯誤(source catalog file must be readable before parse);load-time catalog JSON parse fail-closed guard 會將 malformed JSON 統一拒絕為 source catalog JSON must be parseable、load-time catalog UTF-8 decode fail-closed guard(`source catalog file must be valid UTF-8`);load-time catalog fd/path identity recheck 會在讀取 payload 前比對 path.lstat() 與已開啟 fd,若 catalog path 被換成另一個 inode 會 fail closed(source catalog path changed before read);post-read catalog fd/path identity recheck 會在 JSON parse 後再次比對已開啟 fd 與 catalog path,若讀取期間 path 被替換會 fail closed(source catalog path changed after read);post-read catalog fd metadata recheck 會在 JSON parse 後再次確認已開啟 fd 仍是 owner-only regular file,若讀取期間變成 world-readable 會 fail closed(source catalog path must be owner-only readable/writable after read);post-read parent-dir fd metadata recheck 會在 JSON parse 後再次確認 parent directory fd/path metadata,若讀取期間 parent 變成 group/world-writable 會 fail closed(source catalog parent directory must not be group/world-writable after read);post-read parent-dir open fail-closed guard / post-read parent-dir open TypeError fail-closed guard / post-read parent-dir close failure fail-closed guard 會在 JSON parse 後若無法重新開啟 parent directory 時 fail closed(source catalog parent directory must be openable after read / source catalog parent directory fd must be closable after read);post-read catalog fd primary failure precedence guard 會在 JSON parse 後 fd metadata recheck 已有主要錯誤且 close cleanup 也失敗時保留主要錯誤(source catalog fd must be inspectable after read);post-read catalog close failure fail-closed guard 會在 JSON parse / fd-path recheck / parent recheck 後若 catalog fd close 失敗時 fail closed(source catalog fd must be closable after read);invalid UTF-8/unreadable catalog text、corrupt JSON、wrong schema、unexpected top-level fields、top-level non-object JSON、non-list sources、non-object source metadata 與 malformed items 會安全忽略並 fallback seed catalog;不擴大到 cameras、clients 或 secrets。Production apply 仍 hard-locked。
source catalog env required value table:ADMIN_SOURCE_CATALOG_ENV_CONTRACT_REQUIRED_VALUES 鎖定 ADMIN_SOURCE_CATALOG_PATH / admin_source_catalog_v1 / durable_json_v1 / metadata-only / paths-hidden safe marker values,並與 ADMIN_SOURCE_CATALOG_ENV_CONTRACT_REQUIRED_KEYS / ADMIN_SOURCE_CATALOG_ENV_CONTRACT 同步。
source catalog redaction required value key table:ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_VALUE_KEYS 鎖定 durable wrapper redaction required-values key order(目前為 secrets_removed),並與 ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_VALUES / ADMIN_SOURCE_CATALOG_REDACTION_ALLOWED_KEYS 同步;仍 metadata-only、paths-hidden,不公開 removed payload、durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction required list-value key table:ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_LIST_VALUE_KEYS 鎖定 durable wrapper redaction required list-values key order(目前為 removed_categories),並與 ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_LIST_VALUES / ADMIN_SOURCE_CATALOG_REDACTION_ALLOWED_KEYS 同步;仍 metadata-only、paths-hidden,不公開 removed payload、durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction value type key table:ADMIN_SOURCE_CATALOG_REDACTION_VALUE_TYPE_CONTRACT_KEYS 鎖定 durable wrapper redaction value type contract key order(secrets_removed / removed_categories),並與 ADMIN_SOURCE_CATALOG_REDACTION_VALUE_TYPE_CONTRACT / ADMIN_SOURCE_CATALOG_REDACTION_ALLOWED_KEYS 同步;load 時由 shared exact-type helper fail-closed 驗證 redaction metadata;仍 metadata-only、paths-hidden,不公開 removed payload、durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction validation helper / source catalog redaction wrapper exact-dict guard:_has_valid_redaction_wrapper 集中 durable wrapper redaction 的 allowed keys、value type key table、required safe values、deterministic removed-categories list validation 與 exact dict helper boundary,並由 top-level wrapper 共用;確保 redaction metadata/list 或 dict-subclass helper drift 時 fail-closed,不公開 removed payload、durable path、source payload、credential、token 或 raw feed locator。
source catalog restart-consistency required value key table:ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_REQUIRED_VALUE_KEYS 鎖定 durable wrapper restart_consistency required safe value traversal(schema_version / compare_field / metadata_only / paths_hidden),並與 ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_REQUIRED_VALUES / ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_ALLOWED_KEYS 同步;source catalog restart-consistency runtime value contract immutable guard 讓 required values 與 value-type runtime table 維持 read-only,避免 test/runtime helper 直接 mutation 改寫 restart checksum metadata guard;save/load 共用同一 key table 驗證 restart checksum metadata guard,避免 required-value coverage drift;不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog restart-consistency validation helper / source catalog restart-consistency wrapper exact-dict guard:_has_valid_restart_consistency_wrapper 集中 durable wrapper restart_consistency 的 required/allowed keys、value type key table、required safe values、catalog_sha256 mirror check 與 exact dict helper boundary;確保 restart-consistency metadata 或 dict-subclass helper drift 時 fail-closed,仍 metadata-only、paths-hidden,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog restart-consistency required value helper / source catalog restart-consistency required-values exact-dict guard:_has_valid_restart_consistency_required_values 集中 durable wrapper restart_consistency required safe value checks 與 exact dict helper boundary,並由 _has_valid_restart_consistency_wrapper 共用;確保 schema/compare field、metadata-only、paths-hidden required values 或 dict-subclass helper drift 時 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog restart-consistency checksum mirror helper / source catalog restart-consistency checksum mirror exact-dict guard:_has_valid_restart_consistency_checksum_mirror 集中 durable wrapper restart_consistency.catalog_sha256 對 top-level catalog_sha256 的 mirror check 與 exact dict helper boundary,並要求雙方皆為 64 字元 lowercase hex SHA-256 digest;確保 checksum mirror、format 或 dict-subclass helper drift 時 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog storage validation helper / source catalog storage wrapper exact-dict guard:_has_valid_storage_wrapper 集中 durable wrapper storage 的 allowed keys、value type key table、required safe values validation 與 exact dict helper boundary,並由 top-level wrapper 共用;確保 storage metadata 或 dict-subclass helper drift 時 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog storage required values exact-value-type guard:_storage_required_values_contract() 會在 storage fixed-value mapping equality 前,先要求 ADMIN_SOURCE_CATALOG_STORAGE_REQUIRED_VALUES 的 mode / durable values 維持 exact str / bool,拒絕 str/bool subclass helper-only drift;仍只處理 admin_source_catalog_v1 metadata-only storage wrapper,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog contains validation helper / source catalog contains wrapper exact-dict guard:_has_valid_contains_wrapper 集中 durable wrapper contains 的 allowed keys、value type key table、source-count mirror validation 與 exact dict helper boundary,並由 top-level wrapper 共用;確保 source count metadata 或 dict-subclass helper drift 時 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog contains required value exact-type guard / source catalog restart-consistency required value exact-type guard / source catalog redaction required value exact-type guard:_contains_required_values_contract() 會在 contains fixed-value mapping equality 前,先要求 ADMIN_SOURCE_CATALOG_CONTAINS_REQUIRED_VALUES["sources"] 維持 exact NoneType sentinel;_restart_consistency_required_values_contract() 會在 restart-consistency fixed-value mapping equality 前,先要求 schema_version / compare_field / metadata_only / paths_hidden 維持 exact str/bool primitives;_redaction_required_values_contract() 也會在 redaction fixed-value mapping equality 前,先要求 secrets_removed / removed_categories 維持 exact bool / tuple,拒絕 comparable object helper-only drift;仍只處理 admin_source_catalog_v1 source-count/restart/redaction metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation required value key tables / source catalog load-validation value key-table exact-tuple guard / source catalog load-validation value mapping exact-proxy guard / source catalog load-validation required/optional value exact-type guard:ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_VALUE_KEYS 與 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_OPTIONAL_VALUE_KEYS 鎖定 durable wrapper load_validation required/optional marker value order,並要求 key table 維持 exact tuple、ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_BOOLEAN_VALUES / ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_OPTIONAL_VALUES / ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_VALUES 維持 exact read-only MappingProxyType,且 fixed safe values 維持 exact str/bool primitives 後才做 mapping equality 與 fixed safe-marker validation;仍 metadata-only、paths-hidden,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation emitted value key table:ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_VALUE_KEYS 與 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_VALUES 鎖定 durable wrapper load_validation save-time emitted marker/value contract,並與 emitted key table、allowed key table同步;optional marker 缺席仍相容舊檔,寫新檔時用 shared emitted-values helper,避免 save/load helper drift;不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation allowed value key table:ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_ALLOWED_VALUE_KEYS 鎖定 durable wrapper load_validation allowed marker/value key set,並與 allowed key table、value type contract 與 emitted value key table同步;load 時先 fail-closed 驗證 allowed-value table 未 drift,再拒絕 unexpected marker,避免 load-validation wrapper coverage drift;不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation value type key table:ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_VALUE_TYPE_CONTRACT_KEYS 鎖定 durable wrapper load_validation value type contract key order,並與 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_VALUE_TYPE_CONTRACT / allowed-value key table同步;load 時先 fail-closed 驗證 type-contract key table 未 drift,再做 strict exact type validation,避免 schema_version/bool marker type coverage drift;不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation exact type check key table / source catalog load-validation exact type check key-table exact-tuple guard:ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EXACT_TYPE_CHECK_KEYS 鎖定 durable wrapper load_validation exact-type validation traversal order,並由 shared helper 驗證 key table 維持 exact tuple、type-contract key table 未 drift、optional marker 缺席相容舊檔、present marker 必須 strict exact type;不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation validation helper / source catalog load-validation wrapper value type mapping exact-proxy guard:_has_valid_load_validation_wrapper 集中 durable wrapper load_validation 的 required/allowed keys、allowed-value/type-contract key table、exact type 與 emitted safe values validation;wrapper validation 現在也會先要求 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_VALUE_TYPE_CONTRACT 維持 exact read-only MappingProxyType,再做 set comparison 與 strict type validation,拒絕 dict subclass helper-only drift;不公開 durable path、source payload、credential、token、checksum 或 raw feed locator。
source catalog restart/atomic/load type contract helper drift guard:_restart_consistency_value_type_contract() / _atomic_write_value_type_contract() / _load_validation_value_type_contract() 會共用 allowed-key exact-order helper,拒絕 duplicate/unknown-key contract drift,讓 durable load 對 restart-consistency checksum metadata、atomic-write safety metadata 與 load-validation metadata fail-closed;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog restart/atomic/load value-type value drift guard:_restart_consistency_value_type_contract() / _atomic_write_value_type_contract() / _load_validation_value_type_contract() 現在也鎖定 fixed expected type values,拒絕 bool marker 被改成 int/string 等 type-value drift,讓 restart-consistency、atomic-write 與 load-validation wrapper validation 先 fail-closed;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog restart/atomic/load value-type exact-proxy guard:restart-consistency、atomic-write 與 load-validation durable wrapper value-type tables 現在必須維持 read-only MappingProxyType,避免 mutable dict replacement 在 helper boundary 改寫 metadata-only type proof;仍不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog restart-consistency required values exact-proxy guard:restart-consistency load-time fixed safe-value table 現在必須維持 read-only mapping,避免 dict subclass 在 helper boundary 改寫 required-value proof;仍不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog atomic-write required/optional values helper drift guard / source catalog atomic-write values helper key-table exact-tuple guard / source catalog atomic-write required/optional values exact-proxy guard:_atomic_write_required_optional_values_contract() 集中驗證 ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_VALUE_KEYS / ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_VALUE_KEYS 的 exact tuple boundary 與 required/optional fixed safe value tables,要求 value tables 維持 exact read-only mapping,先拒絕 tuple/mutable dict/dict subclass drift,再拒絕 duplicate/unknown-key/value drift 以及 safe-marker False drift,供 atomic-write wrapper validation 共用;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog atomic-write wrapper value mapping exact-proxy guard:_has_valid_atomic_write_wrapper() load-time wrapper validation 現在先要求 atomic_write required/optional safe-value tables 維持 exact read-only MappingProxyType,再做 tuple traversal、key lookup 與 metadata-only proof comparison;拒絕 dict subclass helper-only drift,不公開 durable path、source payload、credential、token、checksum 或 raw feed locator。
source catalog atomic-write key contract exact-string guard / source catalog atomic-write key contract exact-tuple guard:_atomic_write_key_contract() 鎖定 ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_KEYS / ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_KEYS / ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_ALLOWED_KEYS exact tuple table、exact order 與 exact str key boundary,先拒絕 tuple subclass traversal,再拒絕 str subclass、duplicate/unknown-key fail-closed drift,讓 atomic-write value type contract 與 wrapper validation 先共用同一份 key contract;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_VALUES、ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_VALUES 與 ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_VALUE_TYPE_CONTRACT 現在使用 read-only mapping 鎖定 atomic-write required/optional safe values 與 value-type table,避免 test/runtime helper 直接 mutation 改寫 durable atomic-write safety metadata contract;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。_restart_consistency_key_contract 與 _atomic_write_key_contract 現在回傳 read-only mapping,鎖定 durable restart-consistency 與 atomic-write required/optional/allowed key groups,避免 caller 取得 helper 結果後直接 mutation 改寫 load-time key validation;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_BOOLEAN_VALUES、ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_OPTIONAL_VALUES、ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_VALUES、ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_VALUES 與 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_VALUE_TYPE_CONTRACT 現在使用 read-only mapping 鎖定 durable load-validation metadata safe markers,避免 test/runtime helper 直接 mutation 改寫 load-validation proof;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。source catalog storage/contains/redaction runtime value-type contract immutable guard:ADMIN_SOURCE_CATALOG_STORAGE_VALUE_TYPE_CONTRACT、ADMIN_SOURCE_CATALOG_CONTAINS_VALUE_TYPE_CONTRACT 與 ADMIN_SOURCE_CATALOG_REDACTION_VALUE_TYPE_CONTRACT 使用 read-only mapping 鎖定 storage/contains/redaction wrapper value-type tables,避免 test/runtime helper 直接 mutation 改寫 durable wrapper load-time contracts;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog exact value-type helper exact-dict guard / source catalog exact value-type helper exact-proxy guard / source catalog exact value-type helper exact-tuple guard / source catalog exact value-type expected-type guard:_has_exact_value_types() 現在拒絕 payload dict subclass、mutable dict value-type contract、check_keys / optional_keys tuple subclass、非 exact string key drift,以及 expected type tuple subclass / non-type value drift,再做 durable wrapper value-type traversal,避免 helper-only caller 以 subclass payload/key/type table 改變 strict type validation semantics;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog storage fallback/list runtime value contract immutable guard:ADMIN_SOURCE_CATALOG_STORAGE_FALLBACK_VALUES 與 ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_LIST_VALUES 使用 read-only mapping 鎖定 fallback storage 與 redaction list safe-value tables,避免 test/runtime helper 直接 mutation 改寫 durable fallback/list contracts;仍只處理 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction list nested value immutable guard:ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_LIST_VALUES["removed_categories"] 使用 immutable tuple 鎖定 removed-category contract;durable JSON payload boundary 仍 materialize 成 list,避免 nested list append 直接改寫 redaction required list-value contract;仍只處理 source-only metadata,不公開 durable path、credential、token 或 raw feed locator。
source catalog load-validation emitted values helper drift guard:_load_validation_emitted_values_contract() 集中驗證 emitted value keys、emitted values、required values 與 value type contract 同步,拒絕 duplicate/emitted-value drift,讓 durable load 對 load-validation safe marker metadata fail-closed;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation emitted values key-table exact-tuple guard / source catalog load-validation emitted values mapping exact-proxy guard / source catalog durable payload load-validation backing mapping exact-proxy guard:_load_validation_emitted_values_contract() 現在要求 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_VALUE_KEYS 維持 exact tuple,且 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_VALUES 維持 exact read-only mapping,拒絕 tuple/dict subclass helper-only drift 後才做 emitted-order、allowed-key 與 fixed safe-value validation;_durable_payload_load_validation() 也先拒絕 emitted/required/optional mutable or dict-subclass backing value maps,仍只處理 source-only wrapper metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog restart verify healthz input validation order guard:scripts/source_catalog_restart_verify.py 會先驗證 bounded/finite healthz retry timeout/interval,再解析 base URL / 建立 request;當 helper caller 同時傳入 non-finite interval 與 pasted locator-like base URL 時,會固定回 generic interval error,不回顯 URL、credential、durable path、hash 或 source payload。
source catalog load-validation key contract drift guard:_load_validation_key_contract() 鎖定 required/allowed/optional/emitted load-validation key tables,拒絕 duplicate/unknown-key drift,讓 _load_validation_value_type_contract() 與 durable load wrapper validation fail-closed;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation exact type check helper drift guard:_load_validation_exact_type_check_keys() 鎖定 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EXACT_TYPE_CHECK_KEYS 與 value-type/allowed-key table 同步,拒絕 duplicate/unknown-key drift,讓 durable load 的 strict exact-type traversal fail-closed;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog load-validation required/optional values helper drift guard:_load_validation_required_optional_values_contract() 集中驗證 ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_VALUE_KEYS / ADMIN_SOURCE_CATALOG_LOAD_VALIDATION_OPTIONAL_VALUE_KEYS 與 required/optional boolean value tables,拒絕 duplicate/unknown-key/value drift 以及 safe-marker False drift,再供 emitted-value validation 共用;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item validation helper / source catalog source-item wrapper exact-dict guard / source catalog durable source-item exact-dict guard:_has_valid_source_item_wrapper 與 _has_valid_durable_source_item 都要求 durable sources[] item 維持 exact dict helper boundary,再進入 allowed-key/value-type/semantic conversion validation;_invalid_durable_source_item_error 也先拒絕 dict subclass drift,確保 source item wrapper/helper dict-subclass drift、bool-shaped priority、unexpected marker 或 non-object metadata 在 load/save 時 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item list exact-list guard / source catalog durable source-list exact-list guard:_has_valid_source_item_wrappers() 與 _has_valid_durable_source_items() 現在會先拒絕 list subclass helper-only drift,再進入 load-time source wrapper traversal 或 save-time max-count/per-item validation;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item allowed-key contract helper / source catalog source-item key helper immutable guard / source catalog source-item allowed-keys exact-dict guard:_source_item_key_contract() 現在集中鎖定 durable sources[] item allowed-key table exact order並回傳 read-only mapping;_has_valid_source_item_allowed_keys 先要求 exact dict helper boundary,再委派此 contract helper 與 _source_item_value_type_contract() 做 exact source-item key validation,拒絕 caller mutation、dict-subclass helper drift、duplicate/reordered key table drift 或 unexpected/missing source item keys;仍不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item value-type validation helper / source catalog source-item value-type exact-dict guard:_has_valid_source_item_value_types 先要求 exact dict helper boundary,再集中 durable sources[] item 欄位的 strict exact type traversal,並由 _has_valid_source_item_wrapper 共用;確保 dict-subclass helper drift、source_id list drift、bool-shaped priority、string-shaped supports_intents 或 non-object metadata 在 load 時 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog unique source-id exact-list guard / source catalog unique source-id exact-dict guard / source catalog durable duplicate-id exact-dict guard:_has_unique_source_ids 現在先要求 load-time sources[] container 是 exact list,再與 _has_unique_durable_source_ids 一起要求每個 item 是 exact dict,拒絕 list/dict subclass helper drift 後才 parse source_id 或建立 duplicate set;仍只處理 source-only metadata catalog,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item value-type key table / source catalog source-item value-type contract key table:ADMIN_SOURCE_CATALOG_SOURCE_ITEM_VALUE_TYPE_CONTRACT_KEYS 鎖定 durable sources[] item value type contract key order,讓 _source_item_value_type_contract() 共享 fail-closed type contract,並與 _has_valid_source_item_value_types / allowed key table 同步;load 時先 fail-closed 驗證 key table 未 drift,再逐欄做 strict exact type check,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item/metadata value-type value drift guard:_source_item_value_type_contract()、_metadata_value_type_contract() 與 _metadata_scalar_type_contract() 現在也鎖定 fixed expected type values,拒絕 source item priority 或 metadata str 等 contract value 被改成其它 type 後才進入 durable load / metadata validation;仍只處理 metadata-only source catalog,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item value-type empty-contract helper guard:_has_valid_source_item_value_types() 現在會先拒絕 _source_item_value_type_contract() 回空的 invalid contract,且 exact type check key table 不可為空,避免 helper-only path 在 source-item allowed/value/exact tables 同時漂移成 empty 時接受空 source item;仍只處理 metadata-only source catalog,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item exact type check key table:ADMIN_SOURCE_CATALOG_SOURCE_ITEM_EXACT_TYPE_CHECK_KEYS 鎖定 durable sources[] item strict exact-type traversal,並由 _has_valid_source_item_value_types 透過 shared _has_exact_value_types(含 nullable metadata tuple contract)共用;source_id list drift、bool-shaped priority 或 array-shaped metadata 會 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog optional string field exact-input guard:_optional_string_field() 現在先拒絕 source item dict subclass、field key str subclass 與 default str subclass helper-only drift,再進入 .get() / fallback 與 parsed scalar-string exact-type validation,避免 caller-controlled lookup 或 fallback 行為影響 loaded source descriptive string boundary;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item semantic exact-dict guard:_has_valid_source_item_semantics 現在也只接受 exact dict,避免 helper-only caller 以 dict subclass 繞過 durable sources[] item semantic validation boundary;仍與 source catalog source-item semantic validation helper 共同集中 source_id/name/provider/source_type/integration_status/license_note unpadded/control-character、priority range、list entry 與 metadata shape semantic validation,semantic drift 會在 load 時 fail-closed,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog metadata type contract key-table exact-tuple guard / source catalog metadata type contract key tables:ADMIN_SOURCE_CATALOG_METADATA_VALUE_TYPE_CONTRACT_KEYS / ADMIN_SOURCE_CATALOG_METADATA_SCALAR_TYPE_CONTRACT_KEYS 現在必須維持 exact tuple,拒絕 tuple subclass helper-only drift 後才鎖定 metadata JSON-safe value/scalar type contract order,讓 _metadata_value_type_contract() 與 _metadata_scalar_type_contract() 供 metadata validation/redaction helpers 共用 fail-closed type traversal;仍只允許 safe scalar/object/array/null,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog metadata validation exact-container guard:_raise_for_valid_metadata 現在先拒絕 dict/list subclass helper-only drift,再進入 recursive metadata key/scalar/collection/serialized-size validation,讓 metadata validation 維持 exact JSON object/array boundary;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog metadata parse-time value-contract guard:_source_from_dict() 現在先委派 _metadata_value_type_contract() 驗證 metadata JSON-safe value baseline;若 value contract drift/empty,parse-time 直接 fail-closed 拒絕 metadata object,即使 metadata 為 empty object 也不繞過 helper。source catalog metadata scalar expected-contract guard / source catalog metadata expected-contract immutable baseline guard:EXPECTED_ADMIN_SOURCE_CATALOG_METADATA_VALUE_TYPE_CONTRACT / EXPECTED_ADMIN_SOURCE_CATALOG_METADATA_VALUE_TYPE_CONTRACT_KEYS / EXPECTED_ADMIN_SOURCE_CATALOG_METADATA_SCALAR_TYPE_CONTRACT / EXPECTED_ADMIN_SOURCE_CATALOG_METADATA_SCALAR_TYPE_CONTRACT_KEYS 鎖定 metadata JSON-safe value/scalar read-only baseline contract;_metadata_value_type_contract() 與 _metadata_scalar_type_contract() 會用 expected baseline 拒絕 reordered/missing/value drift,讓 save-time redaction 的 _is_json_safe_scalar() 在 invalid contract 下 fail-closed 不保留 helper-only scalar;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog metadata key validation helper:_raise_for_valid_metadata_key 集中 metadata object key non-empty/unpadded、control-character 與 length checks,讓 nested metadata dict traversal 共用同一個 fail-closed key guard;source catalog metadata key exact-string guard 會拒絕 str subclass helper-only drift,維持 durable metadata object key exact JSON string boundary;仍只驗證 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog metadata scalar constraint helper:_raise_for_valid_metadata_scalar_constraints 集中 metadata scalar string length/control-character、finite number 與 JSON-safe value-type checks,讓 dict/list traversal 共用同一個 fail-closed guard;source catalog metadata scalar exact-string guard 會在 length/control-character helper 前拒絕 str subclass drift,避免 helper-only scalar value 觸發覆寫的 string 行為;仍只驗證 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog metadata collection limit helper / source catalog metadata limit helper exact-container guard / source catalog metadata node-count nested exact-container guard / source catalog metadata node-count depth exact-int guard:_raise_for_metadata_shape_limits / _raise_for_metadata_collection_limits / _metadata_node_count 集中 metadata depth、collection-size 與 node-count fail-closed checks,並在 helper-only limit boundary 與 node-count traversal 每一層拒絕 dict/list/tuple subclass drift;_metadata_node_count 也會先拒絕 bool/float/string depth drift 再做 recursive max-depth 與 collection-size checks;redaction-only tuple traversal仍只作 metadata-only 清理並 materialize safe JSON list,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog metadata serialized-size helper / source catalog metadata serialized-size exact-container guard / source catalog metadata serialized-size nested exact-json guard:_metadata_serialized_byte_count 集中 metadata serialized UTF-8 byte count 計算,讓 _raise_for_metadata_serialized_size 共用同一個 deterministic JSON size guard;direct byte-count boundary 會先拒絕 dict/list subclass drift,並在 json.dumps 前重新確認 nested containers、mapping keys、scalar classes 與 finite numbers 都維持 exact JSON,避免 tuple/set/mapping subclass、非字串 key、非 exact scalar 或 NaN/Infinity 被靜默正規化或觸發 richer serialization behavior;仍只驗證 source-only metadata,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction collection limit helper / source catalog redaction tuple exact-container guard:redaction traversal 現在共用 _raise_for_metadata_collection_limits 驗證 mapping/list/tuple depth 與 collection-size guard,且只允許 redaction-only exact tuple traversal 後 materialize safe JSON list、拒絕 tuple subclass drift,讓 save-time redaction 與 metadata validation 使用同一個 fail-closed collection helper;仍為 metadata-only,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction mapping exact-dict guard:_redact_mapping() 現在於 save-time source-only metadata redaction traversal 入口先拒絕 dict subclass helper-only drift,避免 text-list length helper 或 mapping traversal 呼叫 caller-provided .get() / .items() 行為;仍只處理 durable source metadata redaction,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction sequence exact-container guard:_redact_sequence() 現在只接受 exact list/tuple traversal boundary,helper-only list/tuple subclass、dict 或其他非 sequence caller input 會在 collection traversal 前 fail-closed,避免 subclass traversal 或 key/value mapping 被錯誤 materialize 成 durable safe JSON array;仍只處理 source-only metadata redaction,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction scalar helper:_redact_scalar 集中 save-time redaction 的 scalar finite-number check、sensitive-string drop 與 JSON-safe scalar keep/skip 決策,且 redaction scalar exact-type guard 會在 sensitive-string dispatch / finite-number checks 前拒絕 str/int/float primitive subclass helper-only drift,避免非 exact JSON scalar 被靜默 drop 或保留;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog sensitive-string pattern helper:_is_sensitive_string_pattern_value 集中 save-time redaction 的 generic sensitive-string regex dispatch,讓 _is_sensitive_string_value 在 URL-like guard 後共用同一個 fail-closed pattern helper;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog URL-like pattern helper:_is_url_like_pattern_value 集中 save-time redaction 的 URL-like / locator regex dispatch,讓 _is_url_like_value 只負責 trim 後委派同一個 fail-closed pattern helper;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction pattern value exact-string guard:direct regex scanner helpers(包含 _is_sensitive_string_pattern_value 與 _is_url_like_pattern_value)現在會把 str subclass helper-only value drift 視為 sensitive,避免 regex search 將非 exact JSON string 分類為 public metadata;仍只處理 source-only redaction,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog pattern table exact-regex guard / source catalog pattern table exact-regex equality guard:_pattern_table_patterns() 現在要求 active 與 expected redaction pattern table 內每個項目都是 exact re.Pattern,並在 tuple equality 前拒絕 comparable/search-like object helper-only drift,之後才允許 regex search 決定 source-only metadata 是否敏感;仍只處理 source-only redaction,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level nested wrapper exact-input guard:_has_valid_top_level_nested_wrappers() 現在先拒絕 payload dict subclass 與 raw sources list subclass helper-only drift,再進入 storage/contains/redaction/atomic-write/load-validation wrapper dispatch 與 .get() traversal;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog URL-like pattern table:ADMIN_SOURCE_CATALOG_URL_LIKE_PATTERN_VALUES 鎖定 save-time redaction 的 URL-like / locator regex traversal order,讓 _is_url_like_pattern_value 只迭代 shared pattern table 並 short-circuit first match,避免新增 locator regex 時 helper/table drift;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog control-character helper exact-string guard:_contains_control_character() 現在要求 direct helper value 是 exact str,拒絕 str subclass helper-only drift 後才做 iteration / ord() control-character validation,避免非 exact JSON string 靜默通過 source identity、text-list 與 metadata key/value text guard;仍只處理 source-only metadata validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog credential primitive pattern table:ADMIN_SOURCE_CATALOG_CREDENTIAL_PRIMITIVE_PATTERN_VALUES 鎖定 save-time redaction 的 JWT/userinfo/private-key/cloud credential primitive regex traversal order,讓 _is_credential_primitive_pattern_value 只迭代 shared pattern table 並 short-circuit first match;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog provider token pattern table:ADMIN_SOURCE_CATALOG_PROVIDER_TOKEN_PATTERN_VALUES 鎖定 save-time redaction 的 provider/API token regex traversal order,讓 _is_provider_token_pattern_value 只迭代 shared pattern table 並 short-circuit first match;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog connection locator pattern table:ADMIN_SOURCE_CATALOG_CONNECTION_LOCATOR_PATTERN_VALUES 鎖定 save-time redaction 的 database/cache/search connection locator regex traversal order,讓 _is_connection_locator_pattern_value 只迭代 shared pattern table 並 short-circuit first match;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog filesystem path pattern table:ADMIN_SOURCE_CATALOG_FILESYSTEM_PATH_PATTERN_VALUES 鎖定 save-time redaction 的 local/Windows/UNC/relative/tilde/percent-encoded filesystem path regex traversal order,讓 _is_filesystem_path_pattern_value 只迭代 shared pattern table 並 short-circuit first match;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog credential hash pattern table:ADMIN_SOURCE_CATALOG_CREDENTIAL_HASH_PATTERN_VALUES 鎖定 save-time redaction 的 credential hash regex traversal order,讓 _is_credential_hash_pattern_value 只迭代 shared pattern table 並 short-circuit first match;仍只處理 metadata-only durable source catalog,不擴大到 cameras/clients/secrets,也不公開 durable path、source payload、credential hash、token 或 raw feed locator。
source catalog source-item unique-id helper:_has_unique_source_ids 集中 durable sources[] list-level source_id uniqueness validation,先重用 source-item semantic parser 確認每筆 source_id,再 fail-closed 拒絕 duplicate source_id;仍為 metadata-only,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog duplicate-id save helper / source catalog durable duplicate-id exact-list guard / source catalog durable duplicate-id exact-string guard:_has_unique_durable_source_ids 集中 save-time durable sources[] source_id uniqueness guard,先要求 sources container 是 exact list,再要求每筆 source_id 是 exact str(拒絕 list / str subclass drift),讓 _raise_for_duplicate_source_ids 共用同一個 duplicate/non-string/non-object fail-closed helper;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog duplicate-id error helper:_duplicate_durable_source_ids_error 集中 save-time durable sources[] duplicate-id error selection,讓 _raise_for_duplicate_source_ids 在 shared uniqueness guard fail 後保留 duplicate/non-string/non-object regression message;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog save source-list validation helper:_has_valid_durable_source_items 集中 save-time durable sources[] semantic validation 與 max-count guard,讓 _raise_for_invalid_source_items 共用同一個 malformed/non-object/priority drift fail-closed helper;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog source-item save validation helper:_has_valid_durable_source_item 集中 save-time durable sources[] 單筆 item semantic validation,讓 _has_valid_durable_source_items 只負責 max-count 與逐筆委派;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog invalid-source error helper:_invalid_durable_source_items_error 集中 save-time durable sources[] invalid-source error selection,讓 _raise_for_invalid_source_items 在 shared validation fail 後保留 max-count、priority 與 malformed source item regression messages。
source catalog invalid-source item error helper:_invalid_durable_source_item_error 集中單筆 save-time durable sources[] invalid-source error selection,讓 list-level _invalid_durable_source_items_error 只負責 max-count 與逐筆委派;仍只處理 sources metadata、不擴大到 cameras/clients/secrets。
source catalog error message table:ADMIN_SOURCE_CATALOG_ERROR_MESSAGES 集中 save-time durable sources[] duplicate / invalid / too-many-sources fixed error strings,讓 error helpers 共用同一個 message table;仍只處理 sources metadata,不觸碰 cameras/clients/secrets。
source catalog error message key table:ADMIN_SOURCE_CATALOG_ERROR_MESSAGE_KEYS 鎖定 save-time durable sources[] fixed error message key order,讓 _source_catalog_error_message 先 fail-closed 驗證 key table 與 ADMIN_SOURCE_CATALOG_ERROR_MESSAGES 未 drift,再回傳 duplicate / invalid / too-many-sources regression strings;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog error message validation helper:_has_valid_source_catalog_error_message_table 集中 save-time durable sources[] fixed error message table/key-table drift validation,讓 _source_catalog_error_message 共用同一個 fail-closed guard;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog error message immutable exact-value drift guard / runtime read-only error message table guard:ADMIN_SOURCE_CATALOG_ERROR_MESSAGES 與 EXPECTED_ADMIN_SOURCE_CATALOG_ERROR_MESSAGES 現在都以 read-only baseline / read-only mapping 鎖定 fixed error string;_has_valid_source_catalog_error_message_table 會拒絕 reordered/key drift、non-string/empty value drift 與 altered message text drift,且 runtime table / baseline 本身不可被 test/runtime helper mutation 改寫;仍只處理 source-only admin catalog errors,不公開 source payload、credential、token、durable path 或 raw feed locator。
source catalog error message key validation helper:_has_valid_source_catalog_error_message_key 集中 save-time durable sources[] fixed error message key membership validation,讓 _source_catalog_error_message 在 table drift guard 後共用同一個 fail-closed key guard;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog error message key exact-string guard:_has_valid_source_catalog_error_message_key 現在要求 caller key 為 exact str,拒絕 str subclass helper-only drift 後才進入 fixed key membership validation;仍只處理 source-only durable catalog generic error selection,不擴大到 cameras/clients/secrets、不公開 durable path 或 raw feed locator。
source catalog error message key redaction guard:_source_catalog_error_message 對 unknown/drifted error-message key 統一丟 generic KeyError,不 echo caller 傳入的 key;即使測試/呼叫端誤傳 locator-like 或 secret-like 字串,operator log 也不會帶出該值。此 guard 只收斂 source-only durable catalog error helper,不擴大到 cameras/clients/secrets、不公開 durable path 或 raw feed locator。
source catalog sha256 non-finite JSON digest guard:_catalog_sha256() 現在用 strict JSON(allow_nan=False)計算 durable checksum,避免 NaN/Infinity drift 先產生 checksum、後續 atomic durable JSON write 才拒絕 payload;此 guard 只收斂 source-only metadata checksum path,不擴大到 cameras/clients/secrets、不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog sha256 allow-non-finite flag exact-bool guard:_catalog_sha256(..., allow_non_finite=...) 的 legacy fixture escape hatch 只接受 exact bool,truthy numeric/caller drift 會在 JSON digest 前 fail closed;正常 durable save path 維持 strict JSON checksum,不擴大到 cameras/clients/secrets、不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog sha256 sources container exact-list guard:_catalog_sha256(sources, ...) 要求 digest input 保持 save/load validation 邊界產出的 exact list;tuple/generator/caller drift 會在 JSON digest 前 fail closed,避免繞過 list-specific validation assumption,且不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog sha256 source-item exact-dict guard:_catalog_sha256(sources, ...) 現在要求每筆 digest input source item 保持 redacted/validated exact dict;tuple-pair/list item caller drift 會在 JSON digest 前 fail closed,避免 JSON 將非 source object 靜默 hash 成 array,且不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog sha256 source-item key exact-string guard:_catalog_sha256(sources, ...) 現在要求每筆 digest input source item key 保持 exact string;non-string key caller drift 會在 JSON sorting/conversion 前 fail closed,避免 noisy TypeError 或 key coercion 影響 durable checksum boundary,且不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog sha256 nested mapping key exact-string guard:_catalog_sha256(sources, ...) 現在也要求巢狀 metadata/safety mapping key 保持 exact string;nested non-string key caller drift 會在 JSON key coercion 前 fail closed,避免 durable checksum boundary 被靜默改寫,且不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog sha256 nested array exact-list guard:_catalog_sha256(sources, ...) 現在也要求巢狀 metadata/safety array container 保持 exact JSON list;tuple/caller drift 會在 JSON serialization 前 fail closed,避免 durable checksum boundary 被靜默改寫成 array,且不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog sha256 nested unsupported-container guard:_catalog_sha256(sources, ...) 現在也會在 JSON digest 前拒絕巢狀 metadata/safety set、frozenset 或 mapping-proxy 類非 JSON container caller drift,固定 fail closed,避免 JSON serializer 產生 type-specific error 或 repr container content;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog sha256 nested unsupported-scalar guard:_catalog_sha256(sources, ...) 現在也會在 JSON digest 前拒絕巢狀 metadata/safety object、bytes 或非 JSON primitive scalar caller drift,固定 fail closed,避免 JSON serializer 產生 type-specific error 或 repr class name;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog sha256 nested non-finite scalar guard:_catalog_sha256(sources, ...) normal durable checksum 路徑會在 JSON serializer 前拒絕巢狀 metadata/safety NaN 或 Infinity numeric drift,固定 fail closed,避免 serializer 回顯巢狀欄位路徑或 scalar repr;legacy fixture 必須明確 allow_non_finite=True,且不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog finite-number helper exact-number guard:Durable Source Catalog finite-number traversal helper 現在會拒絕 direct/helper-only int/float subclass drift,避免繞過 shared exact JSON scalar guard 後仍被當成 finite JSON number;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog finite-number helper exact-container guard:Durable Source Catalog finite-number traversal helper 現在也拒絕 dict/list subclass 與 tuple/set/mapping 類 container drift,避免 helper-only caller 在 checksum/payload 邊界前把非 exact JSON container 視為 finite-number safe;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog checksum helper exact-boundary guard:load-time _has_valid_catalog_checksum() helper 現在要求 payload 是 exact dict、raw sources 是 exact list、每筆 source item 是 exact dict,再做 restart-consistency checksum mirror、redaction 與 digest 比對,避免 helper-only caller 以 dict/list subclass 或 tuple-like sources container 繞過 validation;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload sha256 lowercase-hex guard:Durable Source Catalog payload 與 restart-consistency helpers 會在 wrapper construction 前要求 catalog_sha256 是 canonical lowercase 64-hex sha256,helper-only checksum drift 固定 fail closed;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload sources container exact-list guard:Durable Source Catalog payload helper 也要求 sources wrapper input 維持 exact list,tuple/generator 類 helper-only caller drift 會在 contains/sources durable wrapper construction 前固定 fail closed;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload contains sources exact-list guard:Durable Source Catalog _durable_payload_contains() direct helper 現在會先拒絕 list subclass sources drift,再建構 contains.sources source-count proof,避免 caller-controlled __len__ 改寫 metadata-only durable wrapper;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload restart-consistency key exact-string guard / key-table exact-tuple guard:Durable Source Catalog _durable_payload_restart_consistency() 會先確認 restart-consistency required-value key table 是 exact tuple,且 key table 與 safe-value mapping keys 都是 exact str,再 materialize metadata-only restart_consistency checksum mirror proof,避免 tuple/str subclass helper-only drift 進入 admin_source_catalog_v1 restart JSON;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload atomic-write key exact-string guard / source catalog durable payload atomic-write key-table exact-tuple guard / source catalog durable payload atomic-write mapping exact-proxy guard / value exact-type guard / source catalog atomic-write required/optional value exact-type guard:Durable Source Catalog _durable_payload_atomic_write() 與 _atomic_write_required_optional_values_contract() 會先確認 required/optional atomic-write payload key table 維持 exact tuple、required/optional safe-value tables 維持 exact read-only MappingProxyType,且 key table、safe-value mapping keys 與 safe values 維持 exact str/bool 類型,再於 mapping equality 前 fail closed,materialize metadata-only atomic_write proof,避免 tuple/dict/str subclass helper-only drift 或 comparison-hook drift 進入 admin_source_catalog_v1 atomic JSON;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload load-validation key exact-string guard / source catalog durable payload load-validation key-table exact-tuple guard / source catalog durable payload load-validation backing value exact-string guard / source catalog durable payload load-validation value exact-type guard:Durable Source Catalog _durable_payload_load_validation() 會先確認 emitted/required/optional load-validation key table 維持 exact tuple,且 key table 與 backing safe-value mapping keys 都是 exact str 並維持順序一致,safe marker values 也維持 exact str/bool,再 materialize metadata-only load_validation proof;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload redaction key exact-string guard / source catalog durable payload redaction key-table exact-tuple guard / source catalog durable payload redaction mapping exact-proxy guard / source catalog durable payload redaction value exact-type guard / source catalog durable payload redaction value exact-value guard:Durable Source Catalog _durable_payload_redaction() 會先確認 redaction required/list value key table 維持 exact tuple、fixed value table 維持 exact read-only MappingProxyType,且 key table、mapping keys 與 safe values 都是 exact str/bool/tuple 並等於 canonical redaction proof,再 materialize metadata-only redaction proof,避免 tuple/dict/str/int subclass或 same-type safe-value drift 進入 admin_source_catalog_v1 redaction JSON;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog storage required-value key-table exact-tuple guard / source catalog storage required values exact-proxy guard:Durable Source Catalog _storage_required_values_contract() 會先確認 storage required-value key table 維持 exact tuple,且 ADMIN_SOURCE_CATALOG_STORAGE_REQUIRED_VALUES 維持 exact read-only mapping,再驗證 admin_source_catalog_v1.storage fixed-value proof,避免 tuple/dict subclass helper-only drift 進入 load-time storage metadata validation;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog storage mode contract exact-proxy guard:Durable Source Catalog _storage_required_values_contract() 現在也會先確認 ADMIN_SOURCE_CATALOG_STORAGE_MODE_CONTRACT 維持 exact read-only MappingProxyType,再讀取 durable/fallback storage-mode fixed value,避免 dict subclass __getitem__ drift 改寫 admin_source_catalog_v1.storage proof;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog storage required-value key exact-string guard:Durable Source Catalog _storage_required_values_contract() 現在也會在 tuple/mapping equality 前確認 ADMIN_SOURCE_CATALOG_STORAGE_REQUIRED_VALUE_KEYS 與 ADMIN_SOURCE_CATALOG_STORAGE_REQUIRED_VALUES keys 都是 exact str,拒絕 str subclass helper-only drift 後才接受 admin_source_catalog_v1.storage durable-mode proof;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog health public storage/load value contract exact-proxy guard:public source_catalog_health summary projection 現在先確認 SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_VALUE_CONTRACT 維持 exact read-only MappingProxyType,再做 tuple traversal、hidden source_catalog_storage readback 與 public field lookup,避免 dict subclass helper-only drift 改寫 storage/load projection;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog contains required-value key-table exact-tuple guard / source catalog contains required values exact-proxy guard / source catalog redaction required-value key-table exact-tuple guard / source catalog redaction required values exact-proxy guard:Durable Source Catalog _contains_required_values_contract() 與 _redaction_required_values_contract() 會先確認 contains/redaction required-value key tables 維持 exact tuple,且 contains 與 redaction fixed-value tables 維持 exact read-only mapping,再驗證 admin_source_catalog_v1.contains source-count proof 與 redaction fixed-value proof,避免 tuple/dict subclass helper-only drift 進入 load-time wrapper metadata validation;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog restart-consistency key contract exact-tuple guard / source catalog restart-consistency key contract exact-string guard:Durable Source Catalog _restart_consistency_key_contract() 會先確認 required/allowed key tables 維持 exact tuple,且每個 key 維持 exact str,再驗證 restart-consistency wrapper key-set;避免 tuple/str subclass helper-only drift 進入 load-time restart metadata validation;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog restart-consistency required-value key-table exact-tuple guard:Durable Source Catalog _restart_consistency_required_values_contract() 會先確認 restart-consistency required-value key table 維持 exact tuple,再驗證 admin_source_catalog_v1.restart_consistency fixed-value proof,避免 tuple subclass helper-only drift 進入 load-time restart metadata validation;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog error message key-table exact-tuple guard:Durable Source Catalog _has_valid_source_catalog_error_message_table() 會先確認 ADMIN_SOURCE_CATALOG_ERROR_MESSAGE_KEYS 維持 exact tuple,再迭代固定 generic error keys,避免 tuple subclass helper-only drift 觸發非預期 traversal 或改寫 save/load error classification;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog invalid source-items error exact-list guard:Durable Source Catalog _invalid_durable_source_items_error() 現在會先拒絕 list subclass helper-only drift,再做 too-many/source-item generic error classification,避免 direct helper caller 以 __len__ 或 iteration 改寫 save/load error selection;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog load payload exact-dict guard:Durable Source Catalog AdminSourceCatalogStore.load() 現在會在讀取 admin_source_catalog_v1 後先要求 top-level payload 維持 exact dict,再呼叫 .get() 與 wrapper validators;避免 loader/helper drift 以 dict subclass 改寫 top-level traversal 或漏出非 generic exception;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload source-item exact-dict guard:Durable Source Catalog payload helper 也要求每筆 source item 維持 exact dict,tuple-pair/list item 類 helper-only caller drift 會在 atomic sources wrapper construction 前固定 fail closed;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload nested mapping key exact-string guard:Durable Source Catalog payload helper 也要求 nested metadata/safety mapping keys 維持 exact string;non-string nested key helper-only caller drift 會在 atomic durable sources wrapper construction 前固定 fail closed,避免 JSON key coercion 或 sort drift;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload nested container guard:Durable Source Catalog payload helper 也要求 nested metadata/safety containers 維持 exact JSON dict/list,tuple/set/mapping-proxy 類 helper-only caller drift 會在 atomic durable sources wrapper construction 前固定 fail closed;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload nested scalar guard:Durable Source Catalog payload helper 也要求 nested metadata/safety scalars 維持 exact JSON primitive,object/bytes 類 helper-only caller drift 會在 atomic durable sources wrapper construction 前固定 fail closed;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
source catalog durable payload nested non-finite scalar guard:Durable Source Catalog payload helper 也要求 nested metadata/safety numeric scalars 維持 finite JSON number,NaN/Infinity 類 helper-only caller drift 會在 atomic durable sources wrapper construction 前固定 fail closed;不公開 durable path、source payload、credential、checksum 或 raw feed locator。
safe staging rsync source catalog restart verify reminder:scripts/safe_staging_rsync.py --allowlist --print-command --with-source-catalog-restart-verify 會在 rsync command review 時同時印出 one-shot post-deploy smoke wrapper command scripts/source_catalog_post_deploy_smoke.py --base-url http://127.0.0.1:8000 --admin-key-env REALITY_ADMIN_KEY --env-file /etc/taiwan-world-model.env --restart-unit taiwan-world-model.service 與最後 ADMIN_IMPORT_APPLY_ENABLED=false reminder;safe staging rsync source catalog post-deploy smoke wrapper reminder 讓 printed checklist 指向 source_catalog_post_deploy_smoke_v0,把 compileall、metadata-only restart verification、final runtime env booleans 綁在同一個 staging sync 後 smoke。不含 key value、durable path、checksum、source payload、camera/feed URL 或 production apply。safe staging rsync source catalog restart verify envfile reminder:printed command 包含 --env-file,可用 Python envfile parser 載入 runtime admin-key env name,不需 shell source,也不印 key value。
source catalog post-deploy smoke wrapper:scripts/source_catalog_post_deploy_smoke.py 可在 staging host 上一鍵執行 compileall、metadata-only restart verify、final runtime envfile guard;success schema 為 source_catalog_post_deploy_smoke_v0,只輸出 count/boolean metadata,確認 ADMIN_IMPORT_APPLY_ENABLED=false 與 ADMIN_SOURCE_CATALOG_PATH configured,不輸出 env file path、admin key、durable path、checksum、source payload、credential、token 或 raw feed locator。source catalog post-deploy smoke output exact-type guard 要求 wrapper summary 維持 exact schema/status strings、exact booleans 與 non-negative integer counts,避免 helper drift 字串化 safety booleans 或混入 richer detail。source catalog post-deploy smoke output exact-mapping guard 先拒絕 Mapping/dict subclass summary payload drift,再做 `.get()` 與 item traversal,避免 caller-provided helpers 改寫 metadata-only smoke 結果或混入 richer detail。source catalog post-deploy restart output exact-schema guard 會在 wrapper 解析 nested restart verify stdout 時拒絕 unknown field drift,避免 path/payload/hash 類 richer restart metadata 被摘要成安全結果。source catalog post-deploy restart output duplicate-key guard 會拒絕 nested restart verify JSON stdout 的 duplicate object names,避免 last-wins parser drift 掩蓋 safety boolean。source catalog post-deploy restart count consistency guard 會要求 nested restart verify before/after source counts 完全一致,避免 restart/reload count drift 被摘要成安全 durable persistence。source catalog post-deploy restart output field-order guard 會要求 nested restart verify stdout 維持 documented metadata-only field order,避免 reorder drift 隱藏 helper/output semantics 變更。source catalog post-deploy runtime env nonblank guard 會要求 final envfile summary 中 admin key 與 source catalog path 是 exact nonblank string,quoted whitespace drift 不會被當成 configured。source catalog post-deploy runtime env duplicate-name guard 會拒絕 final envfile 中重複的 requested runtime env names,避免 last-wins drift 把 apply-off/source-catalog readiness 摘要成安全。
source catalog save source-items builder helper:_durable_source_items 集中 save-time DataSourceCatalog → durable sources[] metadata-only builder,讓 save() 先共用同一個 redacted source item builder 再進 duplicate / invalid-source guards;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog save payload builder helper:_durable_payload 集中 save-time durable wrapper payload 組裝(schema/storage/contains/checksum/restart/atomic/load-validation/redaction/sources),讓 save() 在 checksum 後共用同一個 metadata-only payload builder;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog save payload contains helper:_durable_payload_contains 集中 save-time durable wrapper contains metadata 組裝(固定 safe values + redacted source count),讓 _durable_payload 共用同一個 metadata-only contains builder;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog save payload restart-consistency helper:_durable_payload_restart_consistency 集中 save-time durable wrapper restart_consistency metadata 組裝(固定 safe values + catalog checksum mirror),讓 _durable_payload 共用同一個 metadata-only restart consistency builder;仍只處理 sources metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog save payload atomic-write helper:_durable_payload_atomic_write 集中 save-time durable wrapper atomic_write metadata 組裝(required/optional fixed safe values),讓 _durable_payload 共用同一個 metadata-only atomic-write builder;仍只處理 wrapper safety metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog save payload load-validation helper:_durable_payload_load_validation 集中 save-time durable wrapper load_validation metadata 組裝(emitted safe values),讓 _durable_payload 共用同一個 metadata-only load-validation builder;仍只處理 wrapper safety metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog save payload redaction helper:_durable_payload_redaction 集中 save-time durable wrapper redaction metadata 組裝(required safe values + deterministic removed-categories list),讓 _durable_payload 共用同一個 metadata-only redaction builder;仍只處理 wrapper safety metadata,不公開 removed payload,且不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
source catalog redaction removed-category exact-string guard:_has_valid_redaction_wrapper 現在拒絕 removed_categories 內的 str subclass helper-only drift,再進 durable wrapper safe-value comparison,讓 redaction metadata category list 維持 exact JSON string boundary;仍只處理 source-only metadata,不公開 durable path、credential、token 或 raw feed locator。
source catalog already-redacted source-item exact-dict guard:_has_already_redacted_source_items 現在先拒絕 dict-subclass source item helper drift,再做 load-time redaction equality proof,避免 redaction traversal exception drift;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog already-redacted source-list exact-list guard:_has_already_redacted_source_items 現在也會先拒絕 list-subclass source array helper drift,再做 per-source redaction traversal,避免 helper-only caller 改寫 iteration 或觸發非預期例外;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog redaction required categories exact-string guard:_redaction_required_values_contract 現在拒絕 required removed_categories 內的 str subclass helper-only drift,再讓 wrapper validation materialize durable JSON list,讓 redaction required-value category contract 維持 exact JSON string boundary;仍只處理 source-only metadata,不公開 durable path、credential、token 或 raw feed locator。
source catalog redaction mapping key exact-string guard:_redact_mapping 現在會對 str subclass key drift fail closed,而不是在 durable redaction helper boundary 靜默丟棄或保留到 redacted metadata;non-string caller input 仍只被 omit;仍只處理 source-only metadata,不公開 durable path、credential、token 或 raw feed locator。
source catalog string mapping key helper exact-container guard:_has_only_string_mapping_keys 現在拒絕 dict/list subclass 與 tuple/set 類 container drift,再遞迴檢查 nested mapping key exact-string contract,避免 checksum/payload helper-only path 把非 exact JSON container 視為 nested-key safe;仍只處理 source-only metadata,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level key-set validation helper / exact-dict guard:_has_valid_top_level_key_set 集中 load-time durable wrapper required/allowed top-level key-set guard,並先拒絕 dict subclass helper-only drift,讓 _has_valid_top_level_wrapper 先共用 fail-closed key-set validation 再驗證 wrapper value types;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level scalar type validation helper / exact-dict guard:_has_valid_top_level_scalar_types 集中 load-time schema_version / catalog_sha256 / sources exact scalar type validation,並先拒絕 payload dict subclass helper-only drift,讓 _has_valid_top_level_wrapper 在 key-set guard 後共用 fail-closed scalar contract;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level key contract table:ADMIN_SOURCE_CATALOG_TOP_LEVEL_KEY_CONTRACT / ADMIN_SOURCE_CATALOG_TOP_LEVEL_LOAD_REQUIRED_KEY_GROUPS 集中 load-time top-level required/allowed/optional wrapper key contract,讓 _has_valid_top_level_key_set 只讀 shared fail-closed key contract;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level wrapper type validation helper:_has_valid_top_level_wrapper_types 集中 load-time durable wrapper nested object exact type validation,讓 _has_valid_top_level_wrapper 在 scalar contract 後共用 fail-closed wrapper type guard;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level wrapper type helper exact-payload guard:_has_valid_top_level_wrapper_types 現在先拒絕 payload dict subclass helper drift,再進入 wrapper type contract 與 nested object .get() exact-type validation;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level wrapper exact-dict guard:_has_valid_top_level_wrapper 先拒絕 top-level payload dict subclass helper drift,再進入 key/scalar/nested wrapper validation dispatch,讓 Durable Source Catalog Store V0 load boundary 維持 parser 產出的 exact JSON object;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level nested wrapper dispatch helper:_has_valid_top_level_nested_wrappers 集中 load-time storage / contains / redaction 與 optional atomic_write / load_validation wrapper validation dispatch,讓 _has_valid_top_level_wrapper 不再直接串接 nested helper;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level nested wrapper dispatch table:_top_level_nested_wrapper_dispatch 集中 load-time storage / contains / redaction 與 optional atomic_write / load_validation validator table,讓 _has_valid_top_level_nested_wrappers 只迭代 shared fail-closed dispatch;仍只處理 metadata-only wrapper shape,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level nested wrapper dispatch drift guard / exact-string guard:ADMIN_SOURCE_CATALOG_TOP_LEVEL_NESTED_WRAPPER_DISPATCH_KEYS 鎖定 _top_level_nested_wrapper_dispatch 的 load-time wrapper validator order,並拒絕 str subclass dispatch-key drift;duplicate/unknown-key fail-closed drift 會回空 dispatch 並讓 _has_valid_top_level_nested_wrappers 拒絕 durable load;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog top-level restart-consistency wrapper guard:_has_valid_top_level_restart_consistency_wrapper 會在 _has_valid_top_level_wrapper 階段先共用 restart-consistency wrapper validation,要求 checksum metadata wrapper 的 schema、required safe booleans、path hiding marker 與 catalog_sha256 mirror 在 top-level wrapper validation 就 fail-closed;仍為 metadata-only validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog atomic-write validation helper、source catalog atomic-write wrapper exact-dict guard、source catalog atomic-write value key tables(`ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_VALUE_KEYS` / `ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_VALUE_KEYS`)、source catalog atomic-write value type key table(`ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_VALUE_TYPE_CONTRACT_KEYS`)與 source catalog restart-consistency value type key table(`ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_VALUE_TYPE_CONTRACT_KEYS`)markers 維持 Durable Source Catalog Store V0 docs/test contract;這些 marker 只描述 metadata-only wrapper validation,不公開 durable path、source payload、credential、token 或 raw feed locator。
source catalog source-item allowed-key duplicate drift guard:_source_item_value_type_contract 現在也會拒絕 duplicate 或 reordered ADMIN_SOURCE_CATALOG_SOURCE_ITEM_ALLOWED_KEYS drift,避免 source-item allowed key table 重複/順序漂移被 set comparison silently 接受;仍只處理 source-only metadata,不擴大到 cameras、clients、secrets、durable path 或 raw feed locator。
Durable Source Catalog Store V0 current load-validation marker index: redaction allowed key table ADMIN_SOURCE_CATALOG_REDACTION_ALLOWED_KEYS、redaction required value table ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_VALUES、redaction required list-value table ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_LIST_VALUES、redaction removed-categories table ADMIN_SOURCE_CATALOG_REDACTION_REMOVED_CATEGORIES 與 redaction wrapper validation helper _has_valid_redaction_wrapper 維護 deterministic redaction wrapper。Storage wrapper validation helper _has_valid_storage_wrapper、contains wrapper validation helper _has_valid_contains_wrapper、restart consistency validation helper _has_valid_restart_consistency_wrapper、restart required-values helper _has_valid_restart_consistency_required_values、restart checksum mirror helper _has_valid_restart_consistency_checksum_mirror、atomic-write validation helper _has_valid_atomic_write_wrapper、load-validation validation helper _has_valid_load_validation_wrapper 與 source-item validation helper _has_valid_source_item_wrapper、source-item value-type validation helper _has_valid_source_item_value_types、source-item allowed-key validation helper _has_valid_source_item_allowed_keys、source-item semantic validation helper _has_valid_source_item_semantics、source-item unique-id helper _has_unique_source_ids、duplicate-id save helper _has_unique_durable_source_ids、duplicate-id error helper _duplicate_durable_source_ids_error、invalid-source error helper _invalid_durable_source_items_error / _invalid_durable_source_item_error、source-item save validation helper _has_valid_durable_source_item、save source-list validation helper _has_valid_durable_source_items、save source-items builder helper _durable_source_items、save payload builder helper _durable_payload、save payload contains helper _durable_payload_contains 與 save payload load-validation helper _durable_payload_load_validation 保持 save/load metadata-only wrappers deterministic;後續增量可繼續拆分 save payload redaction builders。
| 能力 | V0 狀態 |
|---|---|
| Client list / detail | 可檢視 status、tier、billing profile、allowed endpoints、usage summary |
| Partner report | 可從 usage log 產生 client 月報 |
| Suspend / restore / revoke | 可更新 runtime client status;V0 為 in-memory,重啟後需由 registry/env/DB 持久化 |
| Security | 需 X-Admin-Key;不可公開 raw usage log、API key、raw CCTV URL |
Camera Integration Foundation:攝影機介接基礎
攝影機是大項目,會分階段接入。第一階段先建立安全 registry endpoint:GET /v1/reality/cameras,回傳攝影機候選/白名單狀態,不公開原始 CCTV URL。MVP 的使用者驗證連結 contract 是:提供 public_source_url / public_page_url 作為「查看官方來源頁」入口,並明確回 can_user_verify、verification_label、source_link_policy=public_source_page_only、technical_stream_url_exposed=false;使用者可開公開來源頁自行驗證,但公開來源頁,不是技術取流網址、m3u8、RTSP、thumbnail、signed URL 或任何帶 token 的網址。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras?location_id=alishan" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第二階段新增第一個 server-side snapshot metadata endpoint:GET /v1/reality/cameras/{camera_id}/snapshot。此 endpoint 只回 snapshot metadata,不回傳影像內容、不公開 raw URL;若尚未在 server 設定來源,會回 configuration_required,但不公開 locator 或 env var 名稱/值。攝影機策略改為歡迎多來源:第一手優先但不阻塞 MVP;YouTube proxy / embed / thumbnail 可作為 source_usage_policy=optional_toggle 的輔助來源,但必須標註 source_lineage、quality profile、evidence tier 與 limitations。camera_l2_official_html_dataset_resolver_v0 會在已白名單官方 data.gov.tw HTML dataset page 中只 follow process-local allowlisted first-party resource link,再交給 JSON resolver 與 CCD identifier / parent-station matching guard;camera_l2_official_camera_html_showone_resolver_v0 只針對已 review 的官方 MOA/ARDSWC camera HTML page,在 process 內解析 same-site displayed frame,再回 L2 snapshot metadata;仍不公開 resource endpoint、raw locator、env/credential、HTML/JSON payload、frame id 或原圖。成功抓到 snapshot 時會回 evidence_scoring,其中 stability_score 會修正來源可信度成 effective_source_trust_score,最後產生 evidence_weight。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/snapshot" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第三階段新增 visual observation usable V0 endpoint:GET /v1/reality/cameras/{camera_id}/visual-evidence。目前定義 camera_visual_observation_v0 schema,欄位包含 visible_rain、wet_ground、visibility、cloud_or_fog、crowd_level、traffic_density、water_level_visual_risk、scene_usable、observed_at、fetched_at、confidence、limitations。若 server-side snapshot 可用,runtime 會回 visual_evidence_available / metadata_only_snapshot_available,並附 snapshot_metadata 與 evidence_scoring;若接上安全的 analyzer runtime,會回 camera_ai_visual_analysis_v0 / ai_visual_analysis_available,但只允許 low-risk scene/weather fields only:雨、地面濕、能見度、雲霧等低風險欄位;dry-run analyzer 可由 server-side CAMERA_VISION_DRY_RUN_ENABLED=true 開啟,回 camera_vision_dry_run_v0 / vision_dry_run_available 與 external_call_performed=false、would_call_provider=false、budget_decision、deny_reason,只驗證 pipeline/budget/cache 決策,不呼叫外部 API、不產生成本;Provider fixture analyzer 可由 server-side CAMERA_VISION_PROVIDER_FIXTURE_ENABLED=true 開啟,回 camera_vision_provider_fixture_analyzer_v0、fixture_result_used=true、fixture_analysis_plumbing_verified 與 raw_provider_response_returned=false,只用本地 fixture provider result 測試 adapter parser flow,仍不呼叫外部 API、不產生成本,且不得算 L3 或當成即時畫面判讀;人潮、交通、水位仍可維持 unknown,且不做臉、車牌、個體追蹤。若 snapshot 未設定則誠實回 snapshot_not_available / configuration_required;不回 raw image bytes、不回 raw URL。第三方/proxy 來源只能作 auxiliary_proxy_evidence,不得包裝成第一手或等權重官方 evidence。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/visual-evidence" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
Camera Vision Provider Status V0:GET /v1/reality/cameras/vision-provider/status 回 camera_vision_provider_status_v0,只報告 provider/model/credential 是否 configured;若 provider/model/key 都有設定但安全 gates 未齊,回 configured_disabled。Camera AI Visual Runtime V0 已支援 OpenAI-compatible external analyzer,但預設 fail-closed;必須同時具備 provider/model/credential、CAMERA_VISION_BUDGET_GUARD_ENABLED=true 與 CAMERA_VISION_EXTERNAL_CALLS_ENABLED=true,且未啟用 fixture/dry-run analyzer,才會進入 runtime_enabled / ai_visual_analysis_available。此 endpoint 本身仍 external_call_performed=false、raw_prompt_hidden=true、raw_image_bytes_returned=false、raw_camera_url_returned=false、credential_value_exposed=false,不輸出 API key、env var name、raw prompt、raw image 或 raw URL。Camera Vision Call Budget Guard V0 以 camera_vision_call_budget_guard_v0 宣告接 vision API 前的成本護欄:enabled=false by default、external_calls_allowed=false by default、max_calls_per_camera_per_hour、cache_ttl_seconds、max_image_bytes、denied_requests_billable=false。Camera Vision Provider Adapter Contract V0 以 camera_vision_provider_adapter_contract_v0 / camera_vision_provider_adapter_request_v0 / camera_weather_scene_prompt_v0 固定 request/prompt/output parser contract,預設 parser_status=contract_ready_no_call、raw_provider_response_returned=false;parser 只接受低風險 weather/scene 欄位,會把人潮、交通、水位、臉、車牌、個體追蹤等欄位丟棄或 forced unknown。Camera Vision Provider Call Preflight Guard V0 以 camera_vision_provider_call_preflight_guard_v0 在任何真外部 call 前 fail-closed;預設 external_call_denied,只有 provider/model/credential configured、fixture_analyzer_verified、budget guard enabled 與 explicit_external_call_enabled 全部為 true 時才會進入 external_call_preflight_passed。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/vision-provider/status" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第四階段新增 Camera Stability Monitor v0 endpoint:GET /v1/reality/cameras/{camera_id}/stability。欄位包含 fetch_success_rate_24h、fetch_success_rate_7d、median_latency_ms、content_type_consistency、byte_size_consistency、last_success_at、last_failure_at、history_status 與 effective_stability_score。v0 使用 in-memory latest fetch history,所以若尚無長期資料會誠實標示 limited_history;runtime stability 可修正 effective_source_trust_score 與 evidence_weight,但不可作 production SLA。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/stability" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第五階段新增 Camera × Official Data Cross-check v0 endpoint:GET /v1/reality/cameras/{camera_id}/cross-check,把原本規劃的氣象交叉驗證擴展為 CWA / radar / satellite / traffic / water/disaster 官方資料 cross-check。目前定義 camera_official_cross_check_v0 contract,狀態 enum 包含 supports_official_observation、contradicts_official_observation、inconclusive、insufficient_data、configuration_required。因尚未啟用真 AI visual observation,runtime 誠實回 insufficient_data / visual_analysis_not_enabled;攝影機只作 visual validation,不取代 CWA、雷達、衛星、交通、水文或防災官方來源。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/cross-check" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第六階段新增 Multi-source Camera Selection v0 endpoint:GET /v1/reality/cameras/select。它依 location_id 與 intent 排序候選鏡頭,schema 為 multi_source_camera_selection_v0;排序因素包含 source trust、visual quality、stability、first-party score、review status、usage policy、evidence tier 與 privacy risk。此 endpoint 只做 candidate ranking,不表示 discovery-only 或 requires-authorization 來源可抓影像。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/select?location_id=alishan&intent=cloud_sea_visual_evidence" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
| 階段 | 狀態 | 說明 |
|---|---|---|
| Quality Profile | quality_profile_v0_complete | 所有已 lineage-reviewed 的來源已補齊 source_trust_score、visual_quality_score、stability_score、first_party_score、latency_risk、stability_risk、resolution_quality、license_certainty、privacy_risk;仍不代表授權完成。 |
| Visual Observation Schema | camera_visual_observation_v0 | 已升級為 visual evidence usable V0;snapshot 可用時回 visual_evidence_available / metadata_only_snapshot_available,但內容判讀仍為 uncertain/unknown,第三方/proxy 僅作 auxiliary_proxy_evidence。 |
| Stability Monitor | limited_history | 已建立 runtime foundation,可回報成功率、延遲、content-type 與 byte-size 一致性,並以 effective_stability_score 修正 trust/weight;長期 24h/7d 仍需 DB。 |
| Cross-check | camera_official_cross_check_v0 | 已建立 camera visual evidence × official data contract;尚未啟用 AI 視覺分析時回 insufficient_data / visual_analysis_not_enabled。 |
| Multi-source Selection | multi_source_camera_selection_v0 | 已建立 location/intent 候選鏡頭排序;不把 discovery_only 或 requires_authorization 來源當成可抓取影像。 |
| Registry | camera_registry_only | 已可查候選/白名單 metadata,不含 raw URL。 |
| Next milestone | connect_more_reviewed_snapshot_fetchers | 下一步將更多已通過授權/隱私/技術審查的來源接到 server-side snapshot fetcher。 |
Traffic Reality:交通如何測量?
交通不能只用「車速低」判斷。Reality API 會把交通問題拆成 道路可用性、壅塞程度、真卡死/假塞車、資料盲區 四類。
| 問題 | 主要訊號 | 判斷重點 |
|---|---|---|
| 風災豪雨造成道路不可用 | 封路/事故通報、CMS、VD 車流、CCTV、雨量、水位、地方災情 | 不能把「沒速度資料」直接當成順暢;需判斷封路、資料中斷、或車輛已無法前行。 |
| 連假高速公路壅塞 | VD 車流/車速/占有率、ETag/旅行時間、CMS、交流道回堵、歷史連假 baseline | 區分短暫降速的假塞車與低速、低流量、排隊長度增加的真卡死。 |
| 沒顯示塞車但實際不能動 | 上游/下游偵測點落差、CCTV、事故通報、社群/新聞、資料新鮮度 | 標記為資料盲區或異常阻斷,不把官方未顯示塞車視為道路可用。 |
互動式文件
安全限制
- 不支援人臉辨識、車牌辨識、個人追蹤、私人空間監控。
- CCTV / webcam 類資料源必須白名單審查。
- 不公開原始攝影機 URL,不長期保存原始影像。