diff --git a/.bitcode/v43-cross-route-rehearsal-telemetry-repair.json b/.bitcode/v43-cross-route-rehearsal-telemetry-repair.json new file mode 100644 index 00000000..524daf62 --- /dev/null +++ b/.bitcode/v43-cross-route-rehearsal-telemetry-repair.json @@ -0,0 +1,901 @@ +{ + "artifactId": "v43-cross-route-rehearsal-telemetry-repair", + "schemaId": "bitcode.v43.crossRouteRehearsalTelemetryRepair.v1", + "version": "V43", + "currentTarget": "V42", + "sourceSafetyVerdict": "source-safe-cross-route-rehearsal-telemetry-repair-metadata", + "laneIds": [ + "local", + "staging-testnet" + ], + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "rowIds": [ + "lane:local-cross-route-rehearsal", + "lane:staging-testnet-cross-route-rehearsal", + "deposit:options-policy-admission", + "read:need-fits-preview", + "settlement:rights-delivery-compensation", + "packs:activity-master-detail-readback", + "telemetry:execution-stream-database-readback", + "sync:ledger-database-storage-reconciliation", + "repair:fail-closed-recovery-matrix", + "boundary:source-safe-disclosure", + "operator:source-safe-receipts", + "proof:artifacts-tests-workflows-docs" + ], + "rows": [ + { + "rowId": "lane:local-cross-route-rehearsal", + "laneId": "local", + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + "scripts/rehearse-v43-cross-route-product-flow.mjs", + ".bitcode/v43-packs-activity-master-detail.json", + ".bitcode/v43-route-ux-product-excellence.json" + ], + "requiredEvidence": [ + "local", + "dryRun", + "source-safe receipt", + "no value-bearing mainnet" + ], + "rowRoot": "v43-cross-route-rehearsal-row:31c27d8184e54a6c4e697fe1", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "lane:staging-testnet-cross-route-rehearsal", + "laneId": "staging-testnet", + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + "scripts/rehearse-v43-cross-route-product-flow.mjs", + ".bitcode/v43-deposit-option-admission.json", + ".bitcode/v43-route-ux-product-excellence.json" + ], + "requiredEvidence": [ + "staging-testnet", + "tkpyosihuouusyaxtbau", + "real inference posture", + "database stream readback" + ], + "rowRoot": "v43-cross-route-rehearsal-row:6aa2640fbc2352bf06913970", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "deposit:options-policy-admission", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/deposit", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + ".bitcode/v43-deposit-route-options.json", + ".bitcode/v43-deposit-policy-compensation.json", + ".bitcode/v43-deposit-option-admission.json" + ], + "requiredEvidence": [ + "DepositAssetPackOptionSynthesis", + "DepositAssetPackOptionPolicy", + "DepositAssetPackOptionAdmissionReport" + ], + "rowRoot": "v43-cross-route-rehearsal-row:39fa8840a0f327f459b33efb", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "read:need-fits-preview", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/read", + "/packs" + ], + "stageIds": [ + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack" + ], + "sourceRoots": [ + ".bitcode/v43-read-route-five-step-ux.json", + "uapi/app/read/read-route-model.ts", + "packages/pipelines/asset-pack/src/asset-pack-preview-boundary.ts" + ], + "requiredEvidence": [ + "ReadNeedComprehensionSynthesis", + "ReadFitsFindingSynthesis", + "sourceSafePreview" + ], + "rowRoot": "v43-cross-route-rehearsal-row:2bd87a65e6c63f1b49376b96", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "settlement:rights-delivery-compensation", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/read", + "/packs" + ], + "stageIds": [ + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request" + ], + "sourceRoots": [ + "packages/pipelines/asset-pack/src/asset-pack-preview-boundary.ts", + "packages/pipelines/asset-pack/src/asset-pack-settlement-rights-delivery.ts", + "packages/pipelines/asset-pack/src/deposit-asset-pack-option-admission.ts" + ], + "requiredEvidence": [ + "BTC", + "rights transfer", + "source-to-shares compensation", + "pull_request_after_settlement" + ], + "rowRoot": "v43-cross-route-rehearsal-row:bb40f5d2502047b86fcf46bc", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "packs:activity-master-detail-readback", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/packs" + ], + "stageIds": [ + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + ".bitcode/v43-packs-activity-master-detail.json", + "uapi/app/packs/PacksPageClient.tsx", + "uapi/app/api/packs/activity/route.ts" + ], + "requiredEvidence": [ + "PackActivity", + "settlementState", + "compensationState", + "deliveryState", + "repairState" + ], + "rowRoot": "v43-cross-route-rehearsal-row:cdd10f3cd5ebd958e0061cbd", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "telemetry:execution-stream-database-readback", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + "uapi/components/base/bitcode/execution/pipeline-execution-log.tsx", + "packages/pipelines/asset-pack/src/reading-operational-telemetry-repair-readback.ts", + "scripts/rehearse-v43-cross-route-product-flow.mjs" + ], + "requiredEvidence": [ + "pipeline-execution-log", + "metadata", + "database readback", + "repair" + ], + "rowRoot": "v43-cross-route-rehearsal-row:016831be1aba8884936bbf68", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "sync:ledger-database-storage-reconciliation", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/packs" + ], + "stageIds": [ + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request" + ], + "sourceRoots": [ + "packages/pipelines/asset-pack/src/asset-pack-settlement-rights-delivery.ts", + "packages/pipelines/asset-pack/src/deposit-asset-pack-option-admission.ts", + ".bitcode/v43-deposit-option-admission.json" + ], + "requiredEvidence": [ + "ledger", + "database", + "object storage", + "reconciliation" + ], + "rowRoot": "v43-cross-route-rehearsal-row:418bed502488469483d1b205", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "repair:fail-closed-recovery-matrix", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + "uapi/app/deposit/deposit-route-model.ts", + "uapi/app/read/read-route-model.ts", + "uapi/app/packs/PacksPageClient.tsx" + ], + "requiredEvidence": [ + "critical-source block", + "acceptedNeedRequiredBeforeFindingFits", + "repairState" + ], + "rowRoot": "v43-cross-route-rehearsal-row:71f62996fba13748388e10d5", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "boundary:source-safe-disclosure", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + "uapi/components/base/bitcode/routes/product-route-shell.tsx", + "uapi/app/deposit/DepositPageClient.tsx", + "uapi/app/read/ReadPageClient.tsx" + ], + "requiredEvidence": [ + "Withheld", + "unpaid AssetPack source", + "settlement private payloads" + ], + "rowRoot": "v43-cross-route-rehearsal-row:572ec02b7d9a0521e7d27e9f", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "operator:source-safe-receipts", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + "scripts/rehearse-v43-cross-route-product-flow.mjs", + "scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs" + ], + "requiredEvidence": [ + "secretValueSerialized: false", + "receiptRoot", + "V43_CROSS_ROUTE_REHEARSAL_LANES" + ], + "rowRoot": "v43-cross-route-rehearsal-row:c57098c14acd29f34f2737b0", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + { + "rowId": "proof:artifacts-tests-workflows-docs", + "laneId": "local-and-staging-testnet", + "routeIds": [ + "/deposit", + "/read", + "/packs" + ], + "stageIds": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "sourceRoots": [ + "packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js", + "package.json", + ".github/workflows/bitcode-gate-quality.yml", + ".github/workflows/bitcode-canon-quality.yml" + ], + "requiredEvidence": [ + "v43-cross-route-rehearsal-telemetry-repair", + "check:v43-gate9", + "generate:v43-cross-route-rehearsal" + ], + "rowRoot": "v43-cross-route-rehearsal-row:3d6605d3078e33b13b4f2abf", + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + } + ], + "predicateResults": [ + { + "id": "gate3-artifact-passed", + "sourcePath": ".bitcode/v43-packs-activity-master-detail.json", + "passed": true + }, + { + "id": "gate4-artifact-passed", + "sourcePath": ".bitcode/v43-read-route-five-step-ux.json", + "passed": true + }, + { + "id": "gate5-artifact-passed", + "sourcePath": ".bitcode/v43-deposit-route-options.json", + "passed": true + }, + { + "id": "gate6-artifact-passed", + "sourcePath": ".bitcode/v43-deposit-policy-compensation.json", + "passed": true + }, + { + "id": "gate7-artifact-passed", + "sourcePath": ".bitcode/v43-deposit-option-admission.json", + "passed": true + }, + { + "id": "gate8-artifact-passed", + "sourcePath": ".bitcode/v43-route-ux-product-excellence.json", + "passed": true + }, + { + "id": "deposit-route-covers-admission", + "sourcePath": "uapi/app/deposit/DepositPageClient.tsx", + "passed": true + }, + { + "id": "deposit-model-covers-repair-boundaries", + "sourcePath": "uapi/app/deposit/deposit-route-model.ts", + "passed": true + }, + { + "id": "read-route-covers-two-pipeline-path", + "sourcePath": "uapi/app/read/read-route-model.ts", + "passed": true + }, + { + "id": "read-client-covers-preview-settlement-delivery", + "sourcePath": "uapi/app/read/ReadPageClient.tsx", + "passed": true + }, + { + "id": "packs-route-covers-activity-repair", + "sourcePath": "uapi/app/packs/PacksPageClient.tsx", + "passed": true + }, + { + "id": "packs-api-source-safe-readback", + "sourcePath": "uapi/app/api/packs/activity/route.ts", + "passed": true + }, + { + "id": "pipeline-log-rich-metadata", + "sourcePath": "uapi/components/base/bitcode/execution/pipeline-execution-log.tsx", + "passed": true + }, + { + "id": "settlement-boundary-syncs-delivery", + "sourcePath": "packages/pipelines/asset-pack/src/asset-pack-settlement-rights-delivery.ts", + "passed": true + }, + { + "id": "preview-boundary-repairs-withheld-source", + "sourcePath": "packages/pipelines/asset-pack/src/asset-pack-preview-boundary.ts", + "passed": true + }, + { + "id": "deposit-admission-syncs-storage-telemetry", + "sourcePath": "packages/pipelines/asset-pack/src/deposit-asset-pack-option-admission.ts", + "passed": true + }, + { + "id": "operator-script-exists", + "sourcePath": "scripts/rehearse-v43-cross-route-product-flow.mjs", + "passed": true + }, + { + "id": "operator-script-binds-staging-testnet", + "sourcePath": "scripts/rehearse-v43-cross-route-product-flow.mjs", + "passed": true + }, + { + "id": "operator-script-source-safe", + "sourcePath": "scripts/rehearse-v43-cross-route-product-flow.mjs", + "passed": true + }, + { + "id": "protocol-test-wired", + "sourcePath": "packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js", + "passed": true + }, + { + "id": "protocol-exports-wired", + "sourcePath": "packages/protocol/src/index.js", + "passed": true + }, + { + "id": "package-scripts-wired", + "sourcePath": "package.json", + "passed": true + }, + { + "id": "workflows-run-gate9", + "sourcePath": ".github/workflows/bitcode-gate-quality.yml", + "passed": true + }, + { + "id": "v43-docs-expanded", + "sourcePath": "BITCODE_SPEC_V43.md", + "passed": true + }, + { + "id": "v43-delta-expanded", + "sourcePath": "BITCODE_SPEC_V43_DELTA.md", + "passed": true + }, + { + "id": "v43-notes-expanded", + "sourcePath": "BITCODE_SPEC_V43_NOTES.md", + "passed": true + }, + { + "id": "v43-parity-implemented", + "sourcePath": "BITCODE_SPEC_V43_PARITY_MATRIX.md", + "passed": true + }, + { + "id": "roadmap-advanced-to-gate9", + "sourcePath": "SPECIFICATIONS_ROADMAP.md", + "passed": true + }, + { + "id": "readmes-document-gate9", + "sourcePath": "README.md", + "passed": true + } + ], + "coverage": { + "rowCount": 12, + "laneCount": 2, + "routeCount": 3, + "stageCount": 9, + "gateArtifactCount": 6, + "lanes": [ + "local", + "staging-testnet" + ], + "routes": [ + "/deposit", + "/read", + "/packs" + ], + "stages": [ + "deposit:synthesize-options", + "deposit:review-admit", + "read:request", + "read:review-need", + "read:request-finding-fits", + "read:preview-assetpack", + "settlement:pay-btc-transfer-rights", + "delivery:repository-pull-request", + "packs:inspect-activity-repair" + ], + "stagingProjectRef": "tkpyosihuouusyaxtbau", + "stagingRestHost": "https://tkpyosihuouusyaxtbau.supabase.co/rest/v1/", + "localLaneCovered": true, + "stagingTestnetLaneCovered": true, + "depositRouteCovered": true, + "readRouteCovered": true, + "packsRouteCovered": true, + "depositOptionAdmissionCovered": true, + "readNeedAndFindingFitsCovered": true, + "sourceSafePreviewCovered": true, + "settlementRightsTransferCovered": true, + "compensationCovered": true, + "deliveryPullRequestCovered": true, + "packActivityRepairCovered": true, + "telemetryDatabaseReadbackCovered": true, + "ledgerDatabaseStorageSynchronized": true, + "repairMatrixCovered": true, + "mainnetValueBearingBlocked": true, + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "failedPredicateIds": [] + }, + "sourceSafety": { + "sourceSafetyClass": "source_safe_cross_route_rehearsal_telemetry_repair_metadata", + "sourceSafeMetadataOnly": true, + "protectedSourcePayloadSerialized": false, + "rawProtectedPromptVisible": false, + "rawInterpolatedPromptVisible": false, + "rawProviderResponseVisible": false, + "unpaidAssetPackSourceVisible": false, + "credentialsSerialized": false, + "walletPrivateMaterialVisible": false, + "privateSettlementPayloadVisible": false, + "liveRehearsalLogPayloadSerialized": false, + "valueBearingMainnetAdmitted": false, + "forbiddenPayloadClasses": [ + "secret-values", + "provider-tokens", + "wallet-private-material", + "protected-source-payloads", + "raw-protected-prompts", + "raw-interpolated-prompts", + "raw-provider-responses", + "unpaid-assetpack-source", + "live-rehearsal-log-payloads", + "value-bearing-mainnet-admission" + ] + }, + "passed": true, + "artifactRoot": "v43-cross-route-rehearsal:2ecdcb2f448e780824c46407" +} diff --git a/.bitcode/v43-deposit-option-admission.json b/.bitcode/v43-deposit-option-admission.json index d0e9f9c0..1a318a92 100644 --- a/.bitcode/v43-deposit-option-admission.json +++ b/.bitcode/v43-deposit-option-admission.json @@ -5,7 +5,7 @@ "currentTarget": "V42", "sourceSafetyVerdict": "source-safe-deposit-option-admission-metadata", "generatedAt": "deterministic", - "artifactRoot": "v43-deposit-option-admission:067243f03ca79fcc0c48e30e", + "artifactRoot": "v43-deposit-option-admission:b8125eb826b8cd71515a45ac", "passed": true, "objectIds": [ "DepositAssetPackOptionAdmissionReport", @@ -111,16 +111,16 @@ ], "sourceRoots": { "activePointer": "BITCODE_SPEC.txt:75f3f6d81f999da998f40cb6", - "spec": "BITCODE_SPEC_V43.md:279f284912ed058bbc8ef430", - "delta": "BITCODE_SPEC_V43_DELTA.md:e236e6fc7e4afc685d86fd09", - "notes": "BITCODE_SPEC_V43_NOTES.md:67426dc28a11c11e057fac66", - "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:b40d7cde0c978e29c2881707", - "roadmap": "SPECIFICATIONS_ROADMAP.md:5caa3c41627fdacae5fcb4f9", - "readme": "README.md:ee3b21e97e291519280e685e", - "protocolReadme": "packages/protocol/README.md:ffcf019b6434251a61e54d13", - "packageJson": "package.json:12ffbd25e34c85aa70fc21bf", - "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:024a1e47cfe1854c52e4da80", - "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:b6dcf389972fed22e5176e76", + "spec": "BITCODE_SPEC_V43.md:8849f8de531262913b80010a", + "delta": "BITCODE_SPEC_V43_DELTA.md:fa1a741e1fd4ca1e461837d1", + "notes": "BITCODE_SPEC_V43_NOTES.md:1cbe1cb10f4a9046baa820f9", + "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:5220d903413048552015ed1f", + "roadmap": "SPECIFICATIONS_ROADMAP.md:ba8bdd93e51231d3a76c2236", + "readme": "README.md:c1e5ffc9b1109074e9a07e19", + "protocolReadme": "packages/protocol/README.md:a85e969589284b3bb243c72c", + "packageJson": "package.json:1b5263d8142677b3220cc910", + "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:98807176f615c51cc183fc39", + "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:94db4321625479863e160d71", "optionModel": "packages/pipelines/asset-pack/src/deposit-asset-pack-options.ts:df560ea2544282645f57a6b5", "policyModel": "packages/pipelines/asset-pack/src/deposit-asset-pack-option-policy.ts:12816b23b2d8e304ab4a1638", "admissionModel": "packages/pipelines/asset-pack/src/deposit-asset-pack-option-admission.ts:4d2b0c5e6e10c2b14a75a8c8", @@ -136,8 +136,8 @@ "uapiJestConfig": "uapi/jest.config.cjs:352ee765a17823c7a486fe92", "packageIndex": "packages/pipelines/asset-pack/src/index.ts:24854bd26b47ce7700e02380", "packageManifest": "packages/pipelines/asset-pack/package.json:f998601555d9f21de1393f74", - "protocolIndex": "packages/protocol/src/index.js:4f9fea5557edf88d1e1ae521", - "protocolTypes": "packages/protocol/src/index.d.ts:6a766f2d554a2558bf6ddbd3", + "protocolIndex": "packages/protocol/src/index.js:5e4e37ba6672cf8834589ae1", + "protocolTypes": "packages/protocol/src/index.d.ts:c2cfdb9ad212bb8d969d54be", "protocolTest": "packages/protocol/test/v43-deposit-option-admission.test.js:53ae55cfef55536ebc552b65", "generator": "scripts/generate-v43-deposit-option-admission.mjs:b7101699843c09250a84d41f", "checker": "scripts/check-v43-gate7-deposit-option-admission.mjs:6a857acf8b23f5fdb15fb02d" diff --git a/.bitcode/v43-deposit-policy-compensation.json b/.bitcode/v43-deposit-policy-compensation.json index 4209d73a..07303181 100644 --- a/.bitcode/v43-deposit-policy-compensation.json +++ b/.bitcode/v43-deposit-policy-compensation.json @@ -5,7 +5,7 @@ "currentTarget": "V42", "sourceSafetyVerdict": "source-safe-deposit-policy-compensation-metadata", "generatedAt": "deterministic", - "artifactRoot": "v43-deposit-policy-compensation:56fa7738a2f6ae24e1e416aa", + "artifactRoot": "v43-deposit-policy-compensation:e166ddeef8fb2da03f67a5e1", "passed": true, "objectIds": [ "DepositAssetPackOptionPolicy", @@ -100,16 +100,16 @@ ], "sourceRoots": { "activePointer": "BITCODE_SPEC.txt:75f3f6d81f999da998f40cb6", - "spec": "BITCODE_SPEC_V43.md:279f284912ed058bbc8ef430", - "delta": "BITCODE_SPEC_V43_DELTA.md:e236e6fc7e4afc685d86fd09", - "notes": "BITCODE_SPEC_V43_NOTES.md:67426dc28a11c11e057fac66", - "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:b40d7cde0c978e29c2881707", - "roadmap": "SPECIFICATIONS_ROADMAP.md:5caa3c41627fdacae5fcb4f9", - "readme": "README.md:ee3b21e97e291519280e685e", - "protocolReadme": "packages/protocol/README.md:ffcf019b6434251a61e54d13", - "packageJson": "package.json:12ffbd25e34c85aa70fc21bf", - "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:024a1e47cfe1854c52e4da80", - "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:b6dcf389972fed22e5176e76", + "spec": "BITCODE_SPEC_V43.md:8849f8de531262913b80010a", + "delta": "BITCODE_SPEC_V43_DELTA.md:fa1a741e1fd4ca1e461837d1", + "notes": "BITCODE_SPEC_V43_NOTES.md:1cbe1cb10f4a9046baa820f9", + "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:5220d903413048552015ed1f", + "roadmap": "SPECIFICATIONS_ROADMAP.md:ba8bdd93e51231d3a76c2236", + "readme": "README.md:c1e5ffc9b1109074e9a07e19", + "protocolReadme": "packages/protocol/README.md:a85e969589284b3bb243c72c", + "packageJson": "package.json:1b5263d8142677b3220cc910", + "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:98807176f615c51cc183fc39", + "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:94db4321625479863e160d71", "optionModel": "packages/pipelines/asset-pack/src/deposit-asset-pack-options.ts:df560ea2544282645f57a6b5", "policyModel": "packages/pipelines/asset-pack/src/deposit-asset-pack-option-policy.ts:12816b23b2d8e304ab4a1638", "optionModelTest": "packages/pipelines/asset-pack/src/__tests__/deposit-asset-pack-options.test.ts:66cfc8c728f134087476a3a3", @@ -120,8 +120,8 @@ "pageTest": "uapi/tests/depositPageClient.test.tsx:b1acbca83d8f3244147217dc", "packageIndex": "packages/pipelines/asset-pack/src/index.ts:24854bd26b47ce7700e02380", "packageManifest": "packages/pipelines/asset-pack/package.json:f998601555d9f21de1393f74", - "protocolIndex": "packages/protocol/src/index.js:4f9fea5557edf88d1e1ae521", - "protocolTypes": "packages/protocol/src/index.d.ts:6a766f2d554a2558bf6ddbd3", + "protocolIndex": "packages/protocol/src/index.js:5e4e37ba6672cf8834589ae1", + "protocolTypes": "packages/protocol/src/index.d.ts:c2cfdb9ad212bb8d969d54be", "protocolTest": "packages/protocol/test/v43-deposit-policy-compensation.test.js:f84b0c016065b10f796eb775", "generator": "scripts/generate-v43-deposit-policy-compensation.mjs:0117b1222d0f4a4640324b47", "checker": "scripts/check-v43-gate6-deposit-policy-compensation.mjs:03412b725c36f24991a6325e" diff --git a/.bitcode/v43-deposit-route-options.json b/.bitcode/v43-deposit-route-options.json index ae02a582..13b8c7de 100644 --- a/.bitcode/v43-deposit-route-options.json +++ b/.bitcode/v43-deposit-route-options.json @@ -5,7 +5,7 @@ "currentTarget": "V42", "sourceSafetyVerdict": "source-safe-deposit-route-option-metadata", "generatedAt": "deterministic", - "artifactRoot": "v43-deposit-route-options:d3e2ed7af5b1553aea4a71c7", + "artifactRoot": "v43-deposit-route-options:bf06258706ea07556f491beb", "passed": true, "stepIds": [ "connect-source", @@ -111,16 +111,16 @@ ], "sourceRoots": { "activePointer": "BITCODE_SPEC.txt:75f3f6d81f999da998f40cb6", - "spec": "BITCODE_SPEC_V43.md:279f284912ed058bbc8ef430", - "delta": "BITCODE_SPEC_V43_DELTA.md:e236e6fc7e4afc685d86fd09", - "notes": "BITCODE_SPEC_V43_NOTES.md:67426dc28a11c11e057fac66", - "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:b40d7cde0c978e29c2881707", - "roadmap": "SPECIFICATIONS_ROADMAP.md:5caa3c41627fdacae5fcb4f9", - "readme": "README.md:ee3b21e97e291519280e685e", - "protocolReadme": "packages/protocol/README.md:ffcf019b6434251a61e54d13", - "packageJson": "package.json:12ffbd25e34c85aa70fc21bf", - "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:024a1e47cfe1854c52e4da80", - "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:b6dcf389972fed22e5176e76", + "spec": "BITCODE_SPEC_V43.md:8849f8de531262913b80010a", + "delta": "BITCODE_SPEC_V43_DELTA.md:fa1a741e1fd4ca1e461837d1", + "notes": "BITCODE_SPEC_V43_NOTES.md:1cbe1cb10f4a9046baa820f9", + "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:5220d903413048552015ed1f", + "roadmap": "SPECIFICATIONS_ROADMAP.md:ba8bdd93e51231d3a76c2236", + "readme": "README.md:c1e5ffc9b1109074e9a07e19", + "protocolReadme": "packages/protocol/README.md:a85e969589284b3bb243c72c", + "packageJson": "package.json:1b5263d8142677b3220cc910", + "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:98807176f615c51cc183fc39", + "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:94db4321625479863e160d71", "terminalRoutes": "uapi/app/terminal/terminal-routes.ts:80f478da2673f1a64ada9bfb", "routeModel": "uapi/app/deposit/deposit-route-model.ts:7354c10d543af2cb65ba0ade", "page": "uapi/app/deposit/page.tsx:6bab6a9debab3f4350d0ddca", @@ -136,8 +136,8 @@ "footer": "uapi/components/base/bitcode/layout/footer.tsx:44749b98e5f63e7ac8f9f574", "routeModelTest": "uapi/tests/depositRouteModel.test.ts:0fb7d8d4d58d7e231ada4510", "pageTest": "uapi/tests/depositPageClient.test.tsx:b1acbca83d8f3244147217dc", - "protocolIndex": "packages/protocol/src/index.js:4f9fea5557edf88d1e1ae521", - "protocolTypes": "packages/protocol/src/index.d.ts:6a766f2d554a2558bf6ddbd3", + "protocolIndex": "packages/protocol/src/index.js:5e4e37ba6672cf8834589ae1", + "protocolTypes": "packages/protocol/src/index.d.ts:c2cfdb9ad212bb8d969d54be", "protocolTest": "packages/protocol/test/v43-deposit-route-options.test.js:6576a3d4947b9bc23f7a786d", "generator": "scripts/generate-v43-deposit-route-options.mjs:2d92d5e9c25e2e66712953f9", "checker": "scripts/check-v43-gate5-deposit-route-options.mjs:10c6ad1594ea8bd06f97d7d5" diff --git a/.bitcode/v43-packs-activity-master-detail.json b/.bitcode/v43-packs-activity-master-detail.json index d8f0a811..a00c28b7 100644 --- a/.bitcode/v43-packs-activity-master-detail.json +++ b/.bitcode/v43-packs-activity-master-detail.json @@ -5,7 +5,7 @@ "currentTarget": "V42", "sourceSafetyVerdict": "source-safe-packs-activity-master-detail-metadata", "generatedAt": "deterministic", - "artifactRoot": "v43-packs-activity-master-detail:e96591ce2ff0c79e81a348b7", + "artifactRoot": "v43-packs-activity-master-detail:4f1cbd384191e1e9ef8ad696", "passed": true, "typeIds": [ "deposit-option", @@ -138,16 +138,16 @@ ], "sourceRoots": { "activePointer": "BITCODE_SPEC.txt:75f3f6d81f999da998f40cb6", - "spec": "BITCODE_SPEC_V43.md:279f284912ed058bbc8ef430", - "delta": "BITCODE_SPEC_V43_DELTA.md:e236e6fc7e4afc685d86fd09", - "notes": "BITCODE_SPEC_V43_NOTES.md:67426dc28a11c11e057fac66", - "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:b40d7cde0c978e29c2881707", - "roadmap": "SPECIFICATIONS_ROADMAP.md:5caa3c41627fdacae5fcb4f9", - "readme": "README.md:ee3b21e97e291519280e685e", - "protocolReadme": "packages/protocol/README.md:ffcf019b6434251a61e54d13", - "packageJson": "package.json:12ffbd25e34c85aa70fc21bf", - "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:024a1e47cfe1854c52e4da80", - "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:b6dcf389972fed22e5176e76", + "spec": "BITCODE_SPEC_V43.md:8849f8de531262913b80010a", + "delta": "BITCODE_SPEC_V43_DELTA.md:fa1a741e1fd4ca1e461837d1", + "notes": "BITCODE_SPEC_V43_NOTES.md:1cbe1cb10f4a9046baa820f9", + "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:5220d903413048552015ed1f", + "roadmap": "SPECIFICATIONS_ROADMAP.md:ba8bdd93e51231d3a76c2236", + "readme": "README.md:c1e5ffc9b1109074e9a07e19", + "protocolReadme": "packages/protocol/README.md:a85e969589284b3bb243c72c", + "packageJson": "package.json:1b5263d8142677b3220cc910", + "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:98807176f615c51cc183fc39", + "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:94db4321625479863e160d71", "model": "uapi/components/base/bitcode/activity/pack-activity-model.ts:d848bb7a06bc8f4c46c2fc8a", "route": "uapi/app/api/packs/activity/route.ts:8a524f1dd16889733ce418a7", "page": "uapi/app/packs/page.tsx:1b3d7a1cc00500a13042e8dd", @@ -157,8 +157,8 @@ "workspaceSurface": "uapi/components/base/bitcode/layout/workspace-surface.ts:12418d5db9c3ddad6d10c841", "publicCopy": "uapi/components/base/bitcode/layout/bitcode-public-copy.ts:3a45184ba8d2a4e71858c597", "publicExplainers": "uapi/components/base/bitcode/layout/bitcode-public-explainers.ts:282d915eac3c9f22ba8c07f1", - "packageIndex": "packages/protocol/src/index.js:4f9fea5557edf88d1e1ae521", - "packageTypes": "packages/protocol/src/index.d.ts:6a766f2d554a2558bf6ddbd3", + "packageIndex": "packages/protocol/src/index.js:5e4e37ba6672cf8834589ae1", + "packageTypes": "packages/protocol/src/index.d.ts:c2cfdb9ad212bb8d969d54be", "packageTest": "packages/protocol/test/v43-packs-activity-master-detail.test.js:baf3e44b2fbe4e62590c1824", "uapiTest": "uapi/tests/packActivityModel.test.ts:7854762895ce63b0de8b6940", "generator": "scripts/generate-v43-packs-activity-master-detail.mjs:f342bc9b3ebb8de4e7aa2882", diff --git a/.bitcode/v43-read-route-five-step-ux.json b/.bitcode/v43-read-route-five-step-ux.json index eb92206d..cd06176b 100644 --- a/.bitcode/v43-read-route-five-step-ux.json +++ b/.bitcode/v43-read-route-five-step-ux.json @@ -5,7 +5,7 @@ "currentTarget": "V42", "sourceSafetyVerdict": "source-safe-read-route-five-step-metadata", "generatedAt": "deterministic", - "artifactRoot": "v43-read-route-five-step-ux:4b4d23ad0a311624dead69d8", + "artifactRoot": "v43-read-route-five-step-ux:3a6643acd3261fe377037440", "passed": true, "stepIds": [ "request-read", @@ -117,16 +117,16 @@ ], "sourceRoots": { "activePointer": "BITCODE_SPEC.txt:75f3f6d81f999da998f40cb6", - "spec": "BITCODE_SPEC_V43.md:279f284912ed058bbc8ef430", - "delta": "BITCODE_SPEC_V43_DELTA.md:e236e6fc7e4afc685d86fd09", - "notes": "BITCODE_SPEC_V43_NOTES.md:67426dc28a11c11e057fac66", - "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:b40d7cde0c978e29c2881707", - "roadmap": "SPECIFICATIONS_ROADMAP.md:5caa3c41627fdacae5fcb4f9", - "readme": "README.md:ee3b21e97e291519280e685e", - "protocolReadme": "packages/protocol/README.md:ffcf019b6434251a61e54d13", - "packageJson": "package.json:12ffbd25e34c85aa70fc21bf", - "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:024a1e47cfe1854c52e4da80", - "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:b6dcf389972fed22e5176e76", + "spec": "BITCODE_SPEC_V43.md:8849f8de531262913b80010a", + "delta": "BITCODE_SPEC_V43_DELTA.md:fa1a741e1fd4ca1e461837d1", + "notes": "BITCODE_SPEC_V43_NOTES.md:1cbe1cb10f4a9046baa820f9", + "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:5220d903413048552015ed1f", + "roadmap": "SPECIFICATIONS_ROADMAP.md:ba8bdd93e51231d3a76c2236", + "readme": "README.md:c1e5ffc9b1109074e9a07e19", + "protocolReadme": "packages/protocol/README.md:a85e969589284b3bb243c72c", + "packageJson": "package.json:1b5263d8142677b3220cc910", + "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:98807176f615c51cc183fc39", + "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:94db4321625479863e160d71", "routeModel": "uapi/app/read/read-route-model.ts:a9324b0d92cd6c5176fa7940", "page": "uapi/app/read/page.tsx:37a723ed87feac05c0504249", "client": "uapi/app/read/ReadPageClient.tsx:8e75873706918b22d7ddf8ed", @@ -138,8 +138,8 @@ "publicCopy": "uapi/components/base/bitcode/layout/bitcode-public-copy.ts:3a45184ba8d2a4e71858c597", "publicExplainers": "uapi/components/base/bitcode/layout/bitcode-public-explainers.ts:282d915eac3c9f22ba8c07f1", "footer": "uapi/components/base/bitcode/layout/footer.tsx:44749b98e5f63e7ac8f9f574", - "packageIndex": "packages/protocol/src/index.js:4f9fea5557edf88d1e1ae521", - "packageTypes": "packages/protocol/src/index.d.ts:6a766f2d554a2558bf6ddbd3", + "packageIndex": "packages/protocol/src/index.js:5e4e37ba6672cf8834589ae1", + "packageTypes": "packages/protocol/src/index.d.ts:c2cfdb9ad212bb8d969d54be", "packageTest": "packages/protocol/test/v43-read-route-five-step-ux.test.js:fedf825a49244098367f6388", "routeModelTest": "uapi/tests/readRouteModel.test.ts:47d613cef4ab6dce86846c8f", "pageTest": "uapi/tests/readPageClient.test.tsx:39abee8e499c491b5a33cbf1", diff --git a/.bitcode/v43-route-ux-product-excellence.json b/.bitcode/v43-route-ux-product-excellence.json index 1dcddd2b..9db816ad 100644 --- a/.bitcode/v43-route-ux-product-excellence.json +++ b/.bitcode/v43-route-ux-product-excellence.json @@ -5,7 +5,7 @@ "currentTarget": "V42", "sourceSafetyVerdict": "source-safe-product-route-ux-metadata", "generatedAt": "deterministic", - "artifactRoot": "v43-route-ux-product-excellence:ebb5a3e35fa1b4b3b7c0b6b6", + "artifactRoot": "v43-route-ux-product-excellence:9eeaee23e694084a35667a45", "passed": true, "objectIds": [ "ProductRouteShell", @@ -113,16 +113,16 @@ ], "sourceRoots": { "activePointer": "BITCODE_SPEC.txt:75f3f6d81f999da998f40cb6", - "spec": "BITCODE_SPEC_V43.md:279f284912ed058bbc8ef430", - "delta": "BITCODE_SPEC_V43_DELTA.md:e236e6fc7e4afc685d86fd09", - "notes": "BITCODE_SPEC_V43_NOTES.md:67426dc28a11c11e057fac66", - "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:b40d7cde0c978e29c2881707", - "roadmap": "SPECIFICATIONS_ROADMAP.md:5caa3c41627fdacae5fcb4f9", - "readme": "README.md:ee3b21e97e291519280e685e", - "protocolReadme": "packages/protocol/README.md:ffcf019b6434251a61e54d13", - "packageJson": "package.json:12ffbd25e34c85aa70fc21bf", - "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:024a1e47cfe1854c52e4da80", - "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:b6dcf389972fed22e5176e76", + "spec": "BITCODE_SPEC_V43.md:8849f8de531262913b80010a", + "delta": "BITCODE_SPEC_V43_DELTA.md:fa1a741e1fd4ca1e461837d1", + "notes": "BITCODE_SPEC_V43_NOTES.md:1cbe1cb10f4a9046baa820f9", + "parity": "BITCODE_SPEC_V43_PARITY_MATRIX.md:5220d903413048552015ed1f", + "roadmap": "SPECIFICATIONS_ROADMAP.md:ba8bdd93e51231d3a76c2236", + "readme": "README.md:c1e5ffc9b1109074e9a07e19", + "protocolReadme": "packages/protocol/README.md:a85e969589284b3bb243c72c", + "packageJson": "package.json:1b5263d8142677b3220cc910", + "gateWorkflow": ".github/workflows/bitcode-gate-quality.yml:98807176f615c51cc183fc39", + "canonWorkflow": ".github/workflows/bitcode-canon-quality.yml:94db4321625479863e160d71", "productRouteShell": "uapi/components/base/bitcode/routes/product-route-shell.tsx:1db5b3d0e67eb84327568b90", "packsClient": "uapi/app/packs/PacksPageClient.tsx:9a225a3462967b4b8c2adc00", "readClient": "uapi/app/read/ReadPageClient.tsx:8e75873706918b22d7ddf8ed", @@ -130,8 +130,8 @@ "packsTest": "uapi/tests/packsPageClient.test.tsx:3d190debc869e3d2ec7c0b45", "readTest": "uapi/tests/readPageClient.test.tsx:39abee8e499c491b5a33cbf1", "depositTest": "uapi/tests/depositPageClient.test.tsx:b1acbca83d8f3244147217dc", - "protocolIndex": "packages/protocol/src/index.js:4f9fea5557edf88d1e1ae521", - "protocolTypes": "packages/protocol/src/index.d.ts:6a766f2d554a2558bf6ddbd3", + "protocolIndex": "packages/protocol/src/index.js:5e4e37ba6672cf8834589ae1", + "protocolTypes": "packages/protocol/src/index.d.ts:c2cfdb9ad212bb8d969d54be", "protocolTest": "packages/protocol/test/v43-route-ux-product-excellence.test.js:90da888669ac62dabb2fab0d", "generator": "scripts/generate-v43-route-ux-product-excellence.mjs:cfa27fac384b22a62c12aa54", "checker": "scripts/check-v43-gate8-route-ux-product-excellence.mjs:0216d34433f7bd393cf8a99b" diff --git a/.bitcode/v43-route-vocabulary-inventory.json b/.bitcode/v43-route-vocabulary-inventory.json index ef47cf89..c3d29a91 100644 --- a/.bitcode/v43-route-vocabulary-inventory.json +++ b/.bitcode/v43-route-vocabulary-inventory.json @@ -5,7 +5,7 @@ "currentTarget": "V42", "sourceSafetyVerdict": "source-safe-route-vocabulary-inventory-metadata", "generatedAt": "deterministic", - "artifactRoot": "v43-route-vocabulary-inventory:be23e8d462deba7c23f1eca7", + "artifactRoot": "v43-route-vocabulary-inventory:796ab10542610196758f5080", "passed": true, "tokenIds": [ "route:/exchange", @@ -2081,7 +2081,7 @@ }, { "path": "BITCODE_SPEC_V43.md", - "pathRoot": "v43-route-vocabulary-file:7500bd3f04d8b323a7b29f83", + "pathRoot": "v43-route-vocabulary-file:10e32295f5cee473fd948184", "categories": [ "doc", "spec", @@ -2090,28 +2090,28 @@ "tokenCounts": { "route:/exchange": 5, "route:/terminal": 5, - "route:/packs": 22, - "route:/read": 19, - "route:/deposit": 16, + "route:/packs": 23, + "route:/read": 20, + "route:/deposit": 17, "symbol:Exchange": 4, "symbol:Terminal": 2, "symbol:Packs": 5, "symbol:Reading": 20, "symbol:Depositing": 7, - "symbol:PackActivity": 7, + "symbol:PackActivity": 8, "symbol:DepositAssetPackOption": 4, "word:exchange": 6, "word:terminal": 5, "word:self-referential": 4 }, - "totalMatches": 131, + "totalMatches": 135, "sourceSafeMetadataOnly": true, "rawSourceTextSerialized": false, "sourceSnippetSerialized": false }, { "path": "BITCODE_SPEC_V43_DELTA.md", - "pathRoot": "v43-route-vocabulary-file:dcd73f5cbbaff061529c6a90", + "pathRoot": "v43-route-vocabulary-file:3136a57cc69e956e06226549", "categories": [ "doc", "spec", @@ -2120,13 +2120,13 @@ "tokenCounts": { "route:/exchange": 4, "route:/terminal": 2, - "route:/packs": 14, - "route:/read": 9, - "route:/deposit": 11, + "route:/packs": 16, + "route:/read": 11, + "route:/deposit": 13, "symbol:Exchange": 2, "symbol:Terminal": 4, "symbol:Packs": 1, - "symbol:Reading": 6, + "symbol:Reading": 7, "symbol:Depositing": 3, "symbol:PackActivity": 2, "symbol:DepositAssetPackOption": 1, @@ -2134,14 +2134,14 @@ "word:terminal": 2, "word:self-referential": 3 }, - "totalMatches": 68, + "totalMatches": 75, "sourceSafeMetadataOnly": true, "rawSourceTextSerialized": false, "sourceSnippetSerialized": false }, { "path": "BITCODE_SPEC_V43_NOTES.md", - "pathRoot": "v43-route-vocabulary-file:77472c109accfe2cd259ab8e", + "pathRoot": "v43-route-vocabulary-file:4e0daddae0cfaea87a010383", "categories": [ "doc", "spec", @@ -2150,13 +2150,13 @@ "tokenCounts": { "route:/exchange": 2, "route:/terminal": 1, - "route:/packs": 10, - "route:/read": 6, - "route:/deposit": 5, + "route:/packs": 11, + "route:/read": 7, + "route:/deposit": 6, "symbol:Exchange": 1, "symbol:Terminal": 1, "symbol:Packs": 1, - "symbol:Reading": 6, + "symbol:Reading": 7, "symbol:Depositing": 3, "symbol:PackActivity": 2, "symbol:DepositAssetPackOption": 1, @@ -2164,14 +2164,14 @@ "word:terminal": 1, "word:self-referential": 2 }, - "totalMatches": 44, + "totalMatches": 48, "sourceSafeMetadataOnly": true, "rawSourceTextSerialized": false, "sourceSnippetSerialized": false }, { "path": "BITCODE_SPEC_V43_PARITY_MATRIX.md", - "pathRoot": "v43-route-vocabulary-file:f2f0241b791d67070efe3e8d", + "pathRoot": "v43-route-vocabulary-file:36b3bb78ffad68c27098132f", "categories": [ "doc", "spec", @@ -2180,18 +2180,18 @@ "tokenCounts": { "route:/exchange": 3, "route:/terminal": 1, - "route:/packs": 12, - "route:/read": 7, - "route:/deposit": 10, + "route:/packs": 13, + "route:/read": 8, + "route:/deposit": 11, "symbol:Packs": 1, - "symbol:Reading": 1, + "symbol:Reading": 2, "symbol:PackActivity": 5, "symbol:DepositAssetPackOption": 1, "word:exchange": 3, "word:terminal": 1, "word:self-referential": 2 }, - "totalMatches": 47, + "totalMatches": 51, "sourceSafeMetadataOnly": true, "rawSourceTextSerialized": false, "sourceSnippetSerialized": false @@ -2316,7 +2316,7 @@ }, { "path": "README.md", - "pathRoot": "v43-route-vocabulary-file:297cc99cb56bd9fe6e989d16", + "pathRoot": "v43-route-vocabulary-file:f016567028f5d6070662695b", "categories": [ "doc", "telemetry" @@ -2324,13 +2324,13 @@ "tokenCounts": { "route:/exchange": 5, "route:/terminal": 5, - "route:/packs": 12, - "route:/read": 9, - "route:/deposit": 8, + "route:/packs": 13, + "route:/read": 10, + "route:/deposit": 9, "symbol:Exchange": 16, "symbol:Terminal": 31, "symbol:Packs": 3, - "symbol:Reading": 31, + "symbol:Reading": 32, "symbol:Depositing": 6, "symbol:PackActivity": 1, "symbol:DepositAssetPackOption": 1, @@ -2338,7 +2338,7 @@ "word:terminal": 7, "word:self-referential": 2 }, - "totalMatches": 154, + "totalMatches": 158, "sourceSafeMetadataOnly": true, "rawSourceTextSerialized": false, "sourceSnippetSerialized": false @@ -5956,7 +5956,7 @@ }, { "path": "packages/protocol/README.md", - "pathRoot": "v43-route-vocabulary-file:275e096e2394d84312e091dc", + "pathRoot": "v43-route-vocabulary-file:713df219ad5a8084a950c07c", "categories": [ "doc", "package", @@ -5965,9 +5965,9 @@ "tokenCounts": { "route:/exchange": 4, "route:/terminal": 2, - "route:/packs": 9, - "route:/read": 6, - "route:/deposit": 4, + "route:/packs": 10, + "route:/read": 7, + "route:/deposit": 5, "symbol:Exchange": 17, "symbol:Terminal": 29, "symbol:Packs": 1, @@ -5978,7 +5978,7 @@ "word:terminal": 6, "word:self-referential": 1 }, - "totalMatches": 138, + "totalMatches": 141, "sourceSafeMetadataOnly": true, "rawSourceTextSerialized": false, "sourceSnippetSerialized": false @@ -7174,6 +7174,24 @@ "rawSourceTextSerialized": false, "sourceSnippetSerialized": false }, + { + "path": "packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js", + "pathRoot": "v43-route-vocabulary-file:4efbb1863e37137927cbbcf0", + "categories": [ + "package", + "telemetry" + ], + "tokenCounts": { + "route:/packs": 11, + "route:/read": 8, + "route:/deposit": 7, + "symbol:PackActivity": 2 + }, + "totalMatches": 28, + "sourceSafeMetadataOnly": true, + "rawSourceTextSerialized": false, + "sourceSnippetSerialized": false + }, { "path": "packages/protocol/src/canonical/v43-deposit-option-admission.js", "pathRoot": "v43-route-vocabulary-file:17feaaf05a6ad871b15a66f1", @@ -10124,6 +10142,23 @@ "rawSourceTextSerialized": false, "sourceSnippetSerialized": false }, + { + "path": "scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs", + "pathRoot": "v43-route-vocabulary-file:f1f86658165e1e26bc098b5c", + "categories": [ + "script", + "telemetry" + ], + "tokenCounts": { + "route:/packs": 3, + "route:/read": 3, + "route:/deposit": 3 + }, + "totalMatches": 9, + "sourceSafeMetadataOnly": true, + "rawSourceTextSerialized": false, + "sourceSnippetSerialized": false + }, { "path": "scripts/code-review/README.md", "pathRoot": "v43-route-vocabulary-file:fef2886ffeed000a3327379c", @@ -10615,6 +10650,23 @@ "rawSourceTextSerialized": false, "sourceSnippetSerialized": false }, + { + "path": "scripts/rehearse-v43-cross-route-product-flow.mjs", + "pathRoot": "v43-route-vocabulary-file:68edbff3c2693954b7b9daa7", + "categories": [ + "script", + "telemetry" + ], + "tokenCounts": { + "route:/packs": 3, + "route:/read": 3, + "route:/deposit": 3 + }, + "totalMatches": 9, + "sourceSafeMetadataOnly": true, + "rawSourceTextSerialized": false, + "sourceSnippetSerialized": false + }, { "path": "scripts/v32-proof-coverage-matrix.mjs", "pathRoot": "v43-route-vocabulary-file:983a1efc0c552126afdf62db", @@ -15737,19 +15789,19 @@ } ], "coverage": { - "sourceFileCount": 925, + "sourceFileCount": 928, "tokenTotals": { "route:/exchange": 147, "route:/terminal": 1475, - "route:/packs": 195, - "route:/read": 306, - "route:/deposit": 178, + "route:/packs": 219, + "route:/read": 327, + "route:/deposit": 198, "symbol:Exchange": 1964, "symbol:Terminal": 3091, "symbol:Packs": 53, - "symbol:Reading": 1339, + "symbol:Reading": 1343, "symbol:Depositing": 249, - "symbol:PackActivity": 29, + "symbol:PackActivity": 32, "symbol:DepositAssetPackOption": 33, "word:exchange": 1708, "word:terminal": 3735, @@ -15761,10 +15813,10 @@ "test": 224, "doc": 169, "api": 43, - "telemetry": 664, + "telemetry": 667, "workflow": 12, - "script": 122, - "package": 322, + "script": 124, + "package": 323, "spec": 76 }, "routeVocabularyInventoryComplete": true, diff --git a/.github/workflows/bitcode-canon-quality.yml b/.github/workflows/bitcode-canon-quality.yml index 5ac9c9d8..92c52586 100644 --- a/.github/workflows/bitcode-canon-quality.yml +++ b/.github/workflows/bitcode-canon-quality.yml @@ -349,6 +349,9 @@ jobs: if [ -f scripts/check-v43-gate8-route-ux-product-excellence.mjs ]; then node scripts/check-v43-gate8-route-ux-product-excellence.mjs --skip-branch-check --skip-uapi-tests fi + if [ -f scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs ]; then + node scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs --skip-branch-check --skip-uapi-tests --skip-package-tests + fi fi else echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2 diff --git a/.github/workflows/bitcode-gate-quality.yml b/.github/workflows/bitcode-gate-quality.yml index 6cfb1d14..d1c1f7f6 100644 --- a/.github/workflows/bitcode-gate-quality.yml +++ b/.github/workflows/bitcode-gate-quality.yml @@ -478,6 +478,9 @@ jobs: if [ -f scripts/check-v43-gate8-route-ux-product-excellence.mjs ]; then node scripts/check-v43-gate8-route-ux-product-excellence.mjs --skip-branch-check --skip-uapi-tests fi + if [ -f scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs ]; then + node scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs --skip-branch-check --skip-uapi-tests --skip-package-tests + fi fi else echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2 @@ -532,6 +535,9 @@ jobs: if [ -f scripts/check-v43-gate8-route-ux-product-excellence.mjs ]; then node scripts/check-v43-gate8-route-ux-product-excellence.mjs --skip-branch-check --skip-uapi-tests fi + if [ -f scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs ]; then + node scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs --skip-branch-check --skip-uapi-tests --skip-package-tests + fi pnpm --filter @bitcode/protocol test pnpm --filter @bitcode/btd exec jest --config jest.config.cjs --runInBand --forceExit pnpm --filter @bitcode/pipeline-asset-pack exec jest --config jest.config.cjs --passWithNoTests --forceExit diff --git a/BITCODE_SPEC_V43.md b/BITCODE_SPEC_V43.md index 447f60c3..57fb113b 100644 --- a/BITCODE_SPEC_V43.md +++ b/BITCODE_SPEC_V43.md @@ -235,6 +235,20 @@ settlement-gated source boundary. Gate 9 must rehearse the full path across `/deposit`, `/read`, and `/packs`: synthesize deposit options, admit a deposit AssetPack, request Reading, find fits, preview, settle, deliver, compensate, and inspect activity. It must cover local/staging-testnet lanes, telemetry, database/ledger/storage synchronization, and repair states. +Gate 9 closes with `V43CrossRouteRehearsalTelemetryRepair`, the dry-run +operator receipt script `rehearse:v43-cross-route`, and generated +`.bitcode/v43-cross-route-rehearsal-telemetry-repair.json`. The artifact binds +local and staging-testnet lanes, `/deposit`, `/read`, and `/packs`, and the +cross-route stages: deposit option synthesis, deposit option review/admission, +Read request, Need review, Finding Fits request, source-safe AssetPack preview, +BTC settlement/right transfer, repository pull-request delivery, and PackActivity +repair inspection. Gate 9 also proves rich execution telemetry readback, +staging-testnet database stream posture, ledger/database/object-storage +reconciliation, source-to-shares compensation readback, and fail-closed repair +states without serializing secrets, protected source, prompt payloads, provider +responses, wallet private material, live rehearsal logs, or unpaid AssetPack +source. Value-bearing mainnet remains blocked. + ## V43 Gate 10 Promotion Readiness Gate 10 must bind every V43 artifact, workflow, generated proof, docs update, route migration, source-safety proof, test suite, and active V43 / draft V44 runtime posture before canonical promotion. diff --git a/BITCODE_SPEC_V43_DELTA.md b/BITCODE_SPEC_V43_DELTA.md index 9511bcd2..d74a73f9 100644 --- a/BITCODE_SPEC_V43_DELTA.md +++ b/BITCODE_SPEC_V43_DELTA.md @@ -8,7 +8,7 @@ - Prior canonical anchor: `BITCODE_SPEC_V42.md` - Prior generated proof appendix: `BITCODE_SPEC_V42_PROVEN.md` - Generated structured artifact inventory: `.bitcode/v43-spec-family-report.json`, `.bitcode/v43-canonical-input-report.json`, and V43 gate artifacts as introduced -- Source parity state: Gate 1 opens V43 specification and validation posture; Gate 2 adds source-safe route vocabulary inventory and migration-matrix proof; Gates 3 through 8 now close Packs, Read, Deposit, deposit policy/admission, and shared route UX proof +- Source parity state: Gate 1 opens V43 specification and validation posture; Gate 2 adds source-safe route vocabulary inventory and migration-matrix proof; Gates 3 through 9 now close Packs, Read, Deposit, deposit policy/admission, shared route UX proof, and cross-route rehearsal proof ## Why V43 exists @@ -25,6 +25,10 @@ V42 proved the reliable MVP path, but the product route vocabulary is still tran 7. Product UX outside public documentation must be self-explanatory through structure, labels, progressive detail, rich components, and visual quality, not self-referential copy. 8. Gate 2 records the route vocabulary inventory in `.bitcode/v43-route-vocabulary-inventory.json` as source-safe file/token counts and a migration matrix only; the actual route rename and split remain owned by later gates. 9. Gate 3 implements the first route migration slice: `/packs` becomes the pack-activity master-detail surface, `/api/packs/activity` projects source-safe PackActivity records, and `/exchange` redirects to `/packs`. +10. Gate 9 binds the local and staging-testnet route path across `/deposit`, + `/read`, and `/packs` with source-safe rehearsal receipts, telemetry + readback, ledger/database/storage synchronization checks, repair posture, + and no value-bearing mainnet admission. ## Explicitly deferred @@ -136,6 +140,23 @@ boundaries. In-app route copy is reduced to workflow/status vocabulary; deeper protocol explanation stays in docs and generated proofs. Gate 8 keeps every existing V43 state machine and source-safety boundary intact. +## Gate 9 delta closure + +Gate 9 adds `V43CrossRouteRehearsalTelemetryRepair`, the generated +`.bitcode/v43-cross-route-rehearsal-telemetry-repair.json` artifact, package +exports, protocol tests, workflow checks, +`scripts/rehearse-v43-cross-route-product-flow.mjs`, and `check:v43-gate9`. +The cross-route rehearsal covers local and staging-testnet lanes for +`/deposit`, `/read`, and `/packs`: synthesize deposit options, approve an +eligible option, request Reading, review a synthesized Need, request Finding +Fits, preview source-safe AssetPack measurements, settle BTC/BTD rights, +deliver a repository pull request, compensate contributing deposited sources, +and inspect pack activity/repair readback. Operator receipts are source-safe +metadata only and bind staging-testnet to Supabase project +`tkpyosihuouusyaxtbau`; they never serialize secrets, protected source, raw +prompts, provider responses, unpaid AssetPack source, wallet private material, +private settlement payloads, or live rehearsal logs. + ## Commit-Body Direction V43 gate commits should state the route/product surface changed, the protocol objects preserved, the proof/test commands run, and the source-safety boundaries maintained. Gate PR titles must begin with `V43 Gate N:`. diff --git a/BITCODE_SPEC_V43_NOTES.md b/BITCODE_SPEC_V43_NOTES.md index ead08bb7..bd7f7afc 100644 --- a/BITCODE_SPEC_V43_NOTES.md +++ b/BITCODE_SPEC_V43_NOTES.md @@ -7,8 +7,8 @@ - Current canonical/latest target: `V42` - Prior canonical anchor: `BITCODE_SPEC_V42.md` - Prior generated proof appendix: `BITCODE_SPEC_V42_PROVEN.md` -- Generated structured artifact inventory: `.bitcode/v43-spec-family-report.json`, `.bitcode/v43-canonical-input-report.json`, and future V43 gate artifacts -- Source parity state: notes define operating memory for V43 gates; Gates 2 through 8 now have generated proof-backed implementation parity +- Generated structured artifact inventory: `.bitcode/v43-spec-family-report.json`, `.bitcode/v43-canonical-input-report.json`, and V43 gate artifacts as introduced +- Source parity state: notes define operating memory for V43 gates; Gates 2 through 9 now have generated proof-backed implementation parity ## Notes companion rule @@ -82,6 +82,20 @@ concise: route labels, status summaries, metrics, and visible/withheld boundaries. Longer explanation belongs in public documentation and generated proofs, not the core product flow. +Gate 9 closes the first cross-route rehearsal layer. `V43CrossRouteRehearsalTelemetryRepair` +binds local and staging-testnet operator receipts across `/deposit`, `/read`, +and `/packs`: deposit option synthesis/admission, Reading Need review, Finding +Fits request, source-safe preview, BTC/BTD settlement, repository delivery, +contributor compensation readback, pack activity inspection, and repair +posture. The staging-testnet lane is explicitly bound to Supabase project +`tkpyosihuouusyaxtbau` and requires real-inference, pipeline database +streaming, Vercel Sandbox harness, and Supabase credential families without +serializing credential values. Gate 9 telemetry/database/ledger/storage proof +is source-safe metadata only: no protected source, unpaid AssetPack source, +raw prompts, interpolated prompts, raw provider responses, wallet private +material, private settlement payloads, or live rehearsal logs may enter the +generated artifact or operator receipts. + ## V43 copy boundary Outside public docs, avoid self-referential copy such as text explaining that a component is powerful or that Bitcode is doing a thing. Use clear route names, labels, status rows, measurement summaries, empty states, and expandable proof metadata. Public docs may explain the protocol; product UI should operate it. diff --git a/BITCODE_SPEC_V43_PARITY_MATRIX.md b/BITCODE_SPEC_V43_PARITY_MATRIX.md index e65738f0..8e8a3f28 100644 --- a/BITCODE_SPEC_V43_PARITY_MATRIX.md +++ b/BITCODE_SPEC_V43_PARITY_MATRIX.md @@ -7,8 +7,8 @@ - Current canonical/latest target: `V42` - Prior canonical anchor: `BITCODE_SPEC_V42.md` - Prior generated proof appendix: `BITCODE_SPEC_V42_PROVEN.md` -- Generated structured artifact inventory: `.bitcode/v43-spec-family-report.json`, `.bitcode/v43-canonical-input-report.json`, and future V43 gate artifacts -- Source parity state: V43 Gate 1 parity is documentation/workflow posture; V43 Gate 2 parity is source-safe inventory and migration planning; V43 Gate 3 parity is PackActivity source-safe master-detail implementation; V43 Gate 4 parity is `/read`; V43 Gate 5 parity is `/deposit` and source-safe DepositAssetPackOption synthesis; V43 Gate 6 parity is source-safe deposit policy and compensation scoring; V43 Gate 7 parity is source-safe deposit option review, admission, indexing, storage projection, telemetry, and `/packs` synchronization; V43 Gate 8 parity is shared product route UX, concise copy, progressive disclosure, and loading/empty/error route states +- Generated structured artifact inventory: `.bitcode/v43-spec-family-report.json`, `.bitcode/v43-canonical-input-report.json`, and V43 gate artifacts as introduced +- Source parity state: V43 Gate 1 parity is documentation/workflow posture; V43 Gate 2 parity is source-safe inventory and migration planning; V43 Gate 3 parity is PackActivity source-safe master-detail implementation; V43 Gate 4 parity is `/read`; V43 Gate 5 parity is `/deposit` and source-safe DepositAssetPackOption synthesis; V43 Gate 6 parity is source-safe deposit policy and compensation scoring; V43 Gate 7 parity is source-safe deposit option review, admission, indexing, storage projection, telemetry, and `/packs` synchronization; V43 Gate 8 parity is shared product route UX, concise copy, progressive disclosure, and loading/empty/error route states; V43 Gate 9 parity is cross-route rehearsal, telemetry/database readback, ledger/database/storage synchronization, and repair posture ## Purpose @@ -30,7 +30,7 @@ Audit V43 against `BITCODE_SPEC_V43.md`, V42 active canon, route source, package | Criticality/ROI policy | Source criticality, demand, ROI, BTD potential, and BTC source-to-shares compensation posture | `packages/protocol/src/canonical/v43-deposit-policy-compensation.js`, `.bitcode/v43-deposit-policy-compensation.json`, `packages/pipelines/asset-pack/src/deposit-asset-pack-option-policy.ts`, `/deposit` policy readback | implemented | | Deposit option admission | Approved, policy-eligible deposit options enter source-safe Depository projections and `/packs` activity while rejected, resynthesis, pending, and policy-blocked options stay out | `packages/protocol/src/canonical/v43-deposit-option-admission.js`, `.bitcode/v43-deposit-option-admission.json`, `packages/pipelines/asset-pack/src/deposit-asset-pack-option-admission.ts`, `/deposit` admission readback, `/packs` activity model | implemented | | UX/UI product excellence | Self-explanatory, polished, progressive-detail UI without self-referential product copy | `packages/protocol/src/canonical/v43-route-ux-product-excellence.js`, `.bitcode/v43-route-ux-product-excellence.json`, `uapi/components/base/bitcode/routes/product-route-shell.tsx`, `/packs`, `/read`, `/deposit` route clients | implemented | -| Rehearsal | Local/staging-testnet cross-route path verifies deposit, read, packs, settlement, compensation, delivery | future Gate 9 artifact | draft-required | +| Cross-route rehearsal | Local/staging-testnet cross-route path verifies `/deposit`, `/read`, `/packs`, deposit admission, Reading Need review, Finding Fits, source-safe preview, settlement, compensation, delivery, telemetry/database readback, ledger/database/storage synchronization, and repair posture | `packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js`, `.bitcode/v43-cross-route-rehearsal-telemetry-repair.json`, `scripts/rehearse-v43-cross-route-product-flow.mjs` | implemented | | Promotion readiness | V43 generated proof and active V43 / draft V44 posture ready | future Gate 10 artifact | draft-required | ## V43 implementation checklist @@ -48,7 +48,8 @@ Audit V43 against `BITCODE_SPEC_V43.md`, V42 active canon, route source, package | Gate 6 Deposit policy proof | `DepositAssetPackOptionPolicyReport`, generated artifact, source-safe route model/UI tests, asset-pack policy tests, workflow checks, and `check:v43-gate6` exist | implemented | | Gate 7 Deposit option admission proof | `DepositAssetPackOptionAdmissionReport`, generated artifact, source-safe route model/UI tests, asset-pack admission tests, PackActivity sync tests, workflow checks, and `check:v43-gate7` exist | implemented | | Gate 8 route UX proof | `ProductRouteShell`, `ProductRouteStepGrid`, `ProductRouteStatePanel`, `ProductRouteDisclosure`, generated artifact, source-safe route shell tests, workflow checks, and `check:v43-gate8` exist | implemented | -| Implementation | Route and pipeline source changes are not part of Gates 1 or 2; Gate 3 implements only `/packs` and PackActivity; Gate 4 implements `/read`; Gate 5 implements `/deposit` option synthesis; Gate 6 implements policy scoring; Gate 7 implements depositor decisions, admission receipts, index/storage projections, telemetry, and `/packs` synchronization; Gate 8 implements shared route UX only | accepted boundary | +| Gate 9 rehearsal proof | `V43CrossRouteRehearsalTelemetryRepair`, generated artifact, source-safe operator script, focused checks, workflow checks, and `check:v43-gate9` exist | implemented | +| Implementation | Route and pipeline source changes are not part of Gates 1 or 2; Gate 3 implements only `/packs` and PackActivity; Gate 4 implements `/read`; Gate 5 implements `/deposit` option synthesis; Gate 6 implements policy scoring; Gate 7 implements depositor decisions, admission receipts, index/storage projections, telemetry, and `/packs` synchronization; Gate 8 implements shared route UX only; Gate 9 implements source-safe cross-route proof/rehearsal only | accepted boundary | ## V43 accepted boundaries @@ -68,6 +69,12 @@ Gate 8 may refine route layout, concise copy, shared components, accessible step controls, progressive detail, and loading/empty/error states, but it must not move state-machine authority, change settlement law, or disclose protected source. +Gate 9 may bind the local/staging-testnet route path, source-safe operator +receipts, telemetry/database readback, ledger/database/storage synchronization, +and repair posture. It must not serialize live secrets, protected source, +unpaid AssetPack source, raw prompts, provider responses, private wallet +material, private settlement payloads, or live rehearsal logs, and it must not +admit value-bearing mainnet execution. ## V43 completion condition diff --git a/README.md b/README.md index 9b34ccf0..f386a7b6 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,18 @@ copy, source-safe route metrics, keyboard current-step semantics, loading/ empty/error states, and progressive disclosure boundaries while keeping every Reading, Depositing, settlement, and source-safety invariant intact. +V43 Gate 9 adds `V43CrossRouteRehearsalTelemetryRepair`, +`.bitcode/v43-cross-route-rehearsal-telemetry-repair.json`, +`scripts/rehearse-v43-cross-route-product-flow.mjs`, +`generate:v43-cross-route-rehearsal`, and `check:v43-gate9`. It binds the +local and staging-testnet product route rehearsal across `/deposit`, `/read`, +and `/packs`: deposit option synthesis/admission, Reading Need review, Finding +Fits, source-safe AssetPack preview, BTC/BTD settlement, repository delivery, +source-to-shares compensation readback, pack activity inspection, telemetry +database readback, ledger/database/storage synchronization, and repair posture. +The staging lane is bound to Supabase project `tkpyosihuouusyaxtbau`; receipts +and generated artifacts remain source-safe metadata only. + Exchange is inherited V36 canon: market-wide activity master-detail, buy/sell/ bid/ask/cancel/accept/settle/history flows, AssetPack range trading, rights-transfer review, pricing/liquidity/wrapper analysis, settlement diff --git a/SPECIFICATIONS_ROADMAP.md b/SPECIFICATIONS_ROADMAP.md index fa012b30..7a53427f 100644 --- a/SPECIFICATIONS_ROADMAP.md +++ b/SPECIFICATIONS_ROADMAP.md @@ -5,8 +5,8 @@ - Current active canonical pointer: `BITCODE_SPEC.txt` -> `V42` - Current active canon: `BITCODE_SPEC_V42.md` - Current draft target: `BITCODE_SPEC_V43.md`. -- Current working gate: V43 Gate 8 UX/UI Product Excellence Pass. -- Next queued work after V43 Gate 8: cross-route local/staging-testnet rehearsal across `/deposit`, `/read`, and `/packs`, including telemetry/database/ledger/storage synchronization and repair readback. +- Current working gate: V43 Gate 9 Cross-Route Rehearsal, Telemetry, And Repair. +- Next queued work after V43 Gate 9: V43 promotion readiness, generated proof appendix, promotion workflow posture, and active V43 / draft V44 preparation. - Latest closed version: V42 Reliable MVP Experience, which promoted shortest-path Depositing, five-step Reading, ReadNeed review/resynthesis, ReadFitsFinding source-safe preview and quote, settlement rights transfer, repository delivery, AI-reading demonstration, local/staging MVP rehearsal, and V42 promotion readiness. - Recent V42 canonical promotion anchor: V42 canonical promotion updated `BITCODE_SPEC.txt` to `V42`, generated `BITCODE_SPEC_V42_PROVEN.md`, preserved active V42 / draft V43 runtime posture, and closed reliable MVP experience canon. - Recent V42 opening anchor: reliable MVP experience opens over promoted V41 with V42 SPEC, DELTA, NOTES, and PARITY files, `check:v42-gate1`, active V41 / draft V42 posture, and a nine-gate plan for shortest-path Depositing, five-step Reading, ReadNeed product closure, ReadFitsFinding preview and quote closure, settlement and repository delivery, AI-reading demonstration, local/staging rehearsal, and promotion readiness. @@ -25,6 +25,7 @@ - V43 Gate 6 closure anchor: route-product cleanup now owns package-backed `DepositAssetPackOptionPolicyReport`, deterministic `.bitcode/v43-deposit-policy-compensation.json`, source criticality scoring, likely demand scoring, deterministic estimated-gross-minus-development-cost ROI, estimate-only BTD potential, future-reader BTC source-to-shares compensation route preview, critical-source pre-admission blocking, `/deposit` policy readback, source-safe route/package/protocol tests, workflow wiring, and `check:v43-gate6`. - V43 Gate 7 closure anchor: route-product cleanup now owns package-backed `DepositAssetPackOptionAdmissionReport`, deterministic `.bitcode/v43-deposit-option-admission.json`, approve/reject/resynthesis review decisions, source-safe admission receipts, approved-policy-eligible Depository admission, semantic/lexical/metadata index projection, object-storage metadata and external source pointer projection, BTC source-to-shares compensation preview continuity, execution-stream telemetry, `/packs` `depository-assetpack` synchronization, focused route/package/activity/protocol tests, workflow wiring, and `check:v43-gate7`. - V43 Gate 8 closure anchor: route-product cleanup now owns shared `ProductRouteShell`, `ProductRouteStepGrid`, `ProductRouteStatePanel`, and `ProductRouteDisclosure` components, deterministic `.bitcode/v43-route-ux-product-excellence.json`, concise `/packs`, `/read`, and `/deposit` product route copy, keyboard current-step semantics, route loading/empty/error states, progressive source-safety disclosure, focused route/protocol tests, workflow wiring, and `check:v43-gate8`. +- V43 Gate 9 closure anchor: route-product cleanup now owns package-backed `V43CrossRouteRehearsalTelemetryRepair`, deterministic `.bitcode/v43-cross-route-rehearsal-telemetry-repair.json`, source-safe local/staging-testnet operator receipts, staging-testnet Supabase project `tkpyosihuouusyaxtbau`, `/deposit` option synthesis/admission, `/read` Need review and Finding Fits, source-safe AssetPack preview, BTC/BTD settlement rights transfer, repository delivery, source-to-shares compensation readback, `/packs` activity/repair inspection, telemetry/database readback, ledger/database/storage synchronization, workflow wiring, and `check:v43-gate9`. - Recent V41 closure anchor: V41 canonical promotion updated `BITCODE_SPEC.txt` to `V41`, generated `BITCODE_SPEC_V41_PROVEN.md`, preserved active V41 / draft V42 runtime posture, and closed prompt-program excellence canon. - Recent V40 closure anchor: V40 canonical promotion updated `BITCODE_SPEC.txt` to `V40`, generated `BITCODE_SPEC_V40_PROVEN.md`, preserved active V40 / draft V41 runtime posture, and closed exhaustive commercial application testing canon. - Recent V39 closure anchor: V39 canonical promotion updated `BITCODE_SPEC.txt` to `V39`, generated `BITCODE_SPEC_V39_PROVEN.md`, preserved active V39 / draft V40 runtime posture, and closed commercial Reading readiness canon. diff --git a/package.json b/package.json index e79d4feb..102b3989 100644 --- a/package.json +++ b/package.json @@ -351,6 +351,10 @@ "generate:v43-route-ux-product-excellence": "node scripts/generate-v43-route-ux-product-excellence.mjs", "check:v43-route-ux-product-excellence": "node scripts/generate-v43-route-ux-product-excellence.mjs --check", "check:v43-gate8": "node scripts/check-v43-gate8-route-ux-product-excellence.mjs", + "rehearse:v43-cross-route": "node scripts/rehearse-v43-cross-route-product-flow.mjs", + "generate:v43-cross-route-rehearsal": "node scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs", + "check:v43-cross-route-rehearsal": "node scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs --check", + "check:v43-gate9": "node scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs", "generate:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs", "check:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs --check", "check:v38-gate2": "node scripts/check-v38-gate2-inference-surface-inventory.mjs", diff --git a/packages/protocol/README.md b/packages/protocol/README.md index 6c3ab749..022502af 100644 --- a/packages/protocol/README.md +++ b/packages/protocol/README.md @@ -155,6 +155,18 @@ and workflow wiring for `/packs`, `/read`, and `/deposit` without exposing protected source, unpaid AssetPack source, prompts, provider responses, wallet private material, or private settlement payloads. +V43 Gate 9 adds `V43CrossRouteRehearsalTelemetryRepair` through +`packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js`, +`packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js`, +`.bitcode/v43-cross-route-rehearsal-telemetry-repair.json`, +`scripts/rehearse-v43-cross-route-product-flow.mjs`, +`generate:v43-cross-route-rehearsal`, `check:v43-cross-route-rehearsal`, and +`check:v43-gate9`. It binds local/staging-testnet rehearsal rows for +`/deposit`, `/read`, `/packs`, telemetry/database readback, +ledger/database/storage synchronization, repair posture, settlement delivery, +and compensation readback while keeping receipts source-safe and value-bearing +mainnet execution blocked. + Historical V39 promotion moved this package through the `V39` active, `V40` draft posture. V40 promotion has since advanced the current package posture to `V40` active, `V41` draft. diff --git a/packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js b/packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js new file mode 100644 index 00000000..df7f1dac --- /dev/null +++ b/packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js @@ -0,0 +1,391 @@ +// @ts-check + +import crypto from 'node:crypto'; +import { existsSync, readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const DEFAULT_REPO_ROOT = path.resolve(__dirname, '..', '..', '..', '..'); + +export const V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH = + '.bitcode/v43-cross-route-rehearsal-telemetry-repair.json'; +export const V43_CROSS_ROUTE_REHEARSAL_SCHEMA_ID = + 'bitcode.v43.crossRouteRehearsalTelemetryRepair.v1'; +export const V43_CROSS_ROUTE_REHEARSAL_VERSION = 'V43'; +export const V43_CROSS_ROUTE_REHEARSAL_CURRENT_TARGET = 'V42'; +export const V43_CROSS_ROUTE_REHEARSAL_SOURCE_SAFETY_VERDICT = + 'source-safe-cross-route-rehearsal-telemetry-repair-metadata'; + +export const V43_CROSS_ROUTE_REHEARSAL_LANE_IDS = Object.freeze([ + 'local', + 'staging-testnet', +]); + +export const V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS = Object.freeze([ + '/deposit', + '/read', + '/packs', +]); + +export const V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS = Object.freeze([ + 'deposit:synthesize-options', + 'deposit:review-admit', + 'read:request', + 'read:review-need', + 'read:request-finding-fits', + 'read:preview-assetpack', + 'settlement:pay-btc-transfer-rights', + 'delivery:repository-pull-request', + 'packs:inspect-activity-repair', +]); + +export const V43_CROSS_ROUTE_REHEARSAL_ROW_IDS = Object.freeze([ + 'lane:local-cross-route-rehearsal', + 'lane:staging-testnet-cross-route-rehearsal', + 'deposit:options-policy-admission', + 'read:need-fits-preview', + 'settlement:rights-delivery-compensation', + 'packs:activity-master-detail-readback', + 'telemetry:execution-stream-database-readback', + 'sync:ledger-database-storage-reconciliation', + 'repair:fail-closed-recovery-matrix', + 'boundary:source-safe-disclosure', + 'operator:source-safe-receipts', + 'proof:artifacts-tests-workflows-docs', +]); + +const SOURCE_ROOTS = Object.freeze({ + gate3Artifact: '.bitcode/v43-packs-activity-master-detail.json', + gate4Artifact: '.bitcode/v43-read-route-five-step-ux.json', + gate5Artifact: '.bitcode/v43-deposit-route-options.json', + gate6Artifact: '.bitcode/v43-deposit-policy-compensation.json', + gate7Artifact: '.bitcode/v43-deposit-option-admission.json', + gate8Artifact: '.bitcode/v43-route-ux-product-excellence.json', + depositClient: 'uapi/app/deposit/DepositPageClient.tsx', + depositModel: 'uapi/app/deposit/deposit-route-model.ts', + readClient: 'uapi/app/read/ReadPageClient.tsx', + readModel: 'uapi/app/read/read-route-model.ts', + packsClient: 'uapi/app/packs/PacksPageClient.tsx', + packsApi: 'uapi/app/api/packs/activity/route.ts', + pipelineLogUi: 'uapi/components/base/bitcode/execution/pipeline-execution-log.tsx', + productRouteShell: 'uapi/components/base/bitcode/routes/product-route-shell.tsx', + depositAdmission: 'packages/pipelines/asset-pack/src/deposit-asset-pack-option-admission.ts', + previewBoundary: 'packages/pipelines/asset-pack/src/asset-pack-preview-boundary.ts', + settlementBoundary: 'packages/pipelines/asset-pack/src/asset-pack-settlement-rights-delivery.ts', + operationalReadback: 'packages/pipelines/asset-pack/src/reading-operational-telemetry-repair-readback.ts', + operatorScript: 'scripts/rehearse-v43-cross-route-product-flow.mjs', + generator: 'scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs', + checker: 'scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs', + protocolCanonical: 'packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js', + protocolTest: 'packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js', + protocolIndex: 'packages/protocol/src/index.js', + protocolTypes: 'packages/protocol/src/index.d.ts', + packageJson: 'package.json', + gateWorkflow: '.github/workflows/bitcode-gate-quality.yml', + canonWorkflow: '.github/workflows/bitcode-canon-quality.yml', + spec: 'BITCODE_SPEC_V43.md', + delta: 'BITCODE_SPEC_V43_DELTA.md', + notes: 'BITCODE_SPEC_V43_NOTES.md', + parity: 'BITCODE_SPEC_V43_PARITY_MATRIX.md', + roadmap: 'SPECIFICATIONS_ROADMAP.md', + readme: 'README.md', + protocolReadme: 'packages/protocol/README.md', +}); + +const FORBIDDEN_PAYLOAD_CLASSES = Object.freeze([ + 'secret-values', + 'provider-tokens', + 'wallet-private-material', + 'protected-source-payloads', + 'raw-protected-prompts', + 'raw-interpolated-prompts', + 'raw-provider-responses', + 'unpaid-assetpack-source', + 'live-rehearsal-log-payloads', + 'value-bearing-mainnet-admission', +]); + +function digest(value) { + return crypto.createHash('sha256').update(value).digest('hex').slice(0, 24); +} + +function readSource(repoRoot, sourcePath) { + const absolutePath = path.join(repoRoot, sourcePath); + return existsSync(absolutePath) ? readFileSync(absolutePath, 'utf8') : ''; +} + +function sourceExists(repoRoot, sourcePath) { + return existsSync(path.join(repoRoot, sourcePath)); +} + +function predicateResult(id, sourcePath, passed) { + return { id, sourcePath, passed: Boolean(passed) }; +} + +function includesText(sourceText, expectedText) { + return sourceText.toLowerCase().includes(expectedText.toLowerCase()); +} + +function artifactPassed(repoRoot, sourcePath, artifactId) { + const text = readSource(repoRoot, sourcePath); + if (!text) return false; + try { + const parsed = JSON.parse(text); + return parsed.artifactId === artifactId && parsed.passed === true; + } catch { + return false; + } +} + +function rowRoot(rowId) { + return `v43-cross-route-rehearsal-row:${digest(rowId)}`; +} + +function row(input) { + return { + ...input, + rowRoot: rowRoot(input.rowId), + sourceSafetyClass: 'source_safe_cross_route_rehearsal_telemetry_repair_metadata', + sourceSafeMetadataOnly: true, + protectedSourcePayloadSerialized: false, + rawProtectedPromptVisible: false, + rawInterpolatedPromptVisible: false, + rawProviderResponseVisible: false, + unpaidAssetPackSourceVisible: false, + credentialsSerialized: false, + walletPrivateMaterialVisible: false, + privateSettlementPayloadVisible: false, + liveRehearsalLogPayloadSerialized: false, + valueBearingMainnetAdmitted: false, + forbiddenPayloadClasses: [...FORBIDDEN_PAYLOAD_CLASSES], + }; +} + +export const V43_CROSS_ROUTE_REHEARSAL_ROWS = Object.freeze([ + row({ + rowId: 'lane:local-cross-route-rehearsal', + laneId: 'local', + routeIds: [...V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + sourceRoots: [SOURCE_ROOTS.operatorScript, SOURCE_ROOTS.gate3Artifact, SOURCE_ROOTS.gate8Artifact], + requiredEvidence: ['local', 'dryRun', 'source-safe receipt', 'no value-bearing mainnet'], + }), + row({ + rowId: 'lane:staging-testnet-cross-route-rehearsal', + laneId: 'staging-testnet', + routeIds: [...V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + sourceRoots: [SOURCE_ROOTS.operatorScript, SOURCE_ROOTS.gate7Artifact, SOURCE_ROOTS.gate8Artifact], + requiredEvidence: ['staging-testnet', 'tkpyosihuouusyaxtbau', 'real inference posture', 'database stream readback'], + }), + row({ + rowId: 'deposit:options-policy-admission', + laneId: 'local-and-staging-testnet', + routeIds: ['/deposit', '/packs'], + stageIds: ['deposit:synthesize-options', 'deposit:review-admit', 'packs:inspect-activity-repair'], + sourceRoots: [SOURCE_ROOTS.gate5Artifact, SOURCE_ROOTS.gate6Artifact, SOURCE_ROOTS.gate7Artifact], + requiredEvidence: ['DepositAssetPackOptionSynthesis', 'DepositAssetPackOptionPolicy', 'DepositAssetPackOptionAdmissionReport'], + }), + row({ + rowId: 'read:need-fits-preview', + laneId: 'local-and-staging-testnet', + routeIds: ['/read', '/packs'], + stageIds: ['read:request', 'read:review-need', 'read:request-finding-fits', 'read:preview-assetpack'], + sourceRoots: [SOURCE_ROOTS.gate4Artifact, SOURCE_ROOTS.readModel, SOURCE_ROOTS.previewBoundary], + requiredEvidence: ['ReadNeedComprehensionSynthesis', 'ReadFitsFindingSynthesis', 'sourceSafePreview'], + }), + row({ + rowId: 'settlement:rights-delivery-compensation', + laneId: 'local-and-staging-testnet', + routeIds: ['/read', '/packs'], + stageIds: ['settlement:pay-btc-transfer-rights', 'delivery:repository-pull-request'], + sourceRoots: [SOURCE_ROOTS.previewBoundary, SOURCE_ROOTS.settlementBoundary, SOURCE_ROOTS.depositAdmission], + requiredEvidence: ['BTC', 'rights transfer', 'source-to-shares compensation', 'pull_request_after_settlement'], + }), + row({ + rowId: 'packs:activity-master-detail-readback', + laneId: 'local-and-staging-testnet', + routeIds: ['/packs'], + stageIds: ['packs:inspect-activity-repair'], + sourceRoots: [SOURCE_ROOTS.gate3Artifact, SOURCE_ROOTS.packsClient, SOURCE_ROOTS.packsApi], + requiredEvidence: ['PackActivity', 'settlementState', 'compensationState', 'deliveryState', 'repairState'], + }), + row({ + rowId: 'telemetry:execution-stream-database-readback', + laneId: 'local-and-staging-testnet', + routeIds: ['/deposit', '/read', '/packs'], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + sourceRoots: [SOURCE_ROOTS.pipelineLogUi, SOURCE_ROOTS.operationalReadback, SOURCE_ROOTS.operatorScript], + requiredEvidence: ['pipeline-execution-log', 'metadata', 'database readback', 'repair'], + }), + row({ + rowId: 'sync:ledger-database-storage-reconciliation', + laneId: 'local-and-staging-testnet', + routeIds: ['/packs'], + stageIds: ['settlement:pay-btc-transfer-rights', 'delivery:repository-pull-request'], + sourceRoots: [SOURCE_ROOTS.settlementBoundary, SOURCE_ROOTS.depositAdmission, SOURCE_ROOTS.gate7Artifact], + requiredEvidence: ['ledger', 'database', 'object storage', 'reconciliation'], + }), + row({ + rowId: 'repair:fail-closed-recovery-matrix', + laneId: 'local-and-staging-testnet', + routeIds: ['/deposit', '/read', '/packs'], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + sourceRoots: [SOURCE_ROOTS.depositModel, SOURCE_ROOTS.readModel, SOURCE_ROOTS.packsClient], + requiredEvidence: ['critical-source block', 'acceptedNeedRequiredBeforeFindingFits', 'repairState'], + }), + row({ + rowId: 'boundary:source-safe-disclosure', + laneId: 'local-and-staging-testnet', + routeIds: ['/deposit', '/read', '/packs'], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + sourceRoots: [SOURCE_ROOTS.productRouteShell, SOURCE_ROOTS.depositClient, SOURCE_ROOTS.readClient], + requiredEvidence: ['Withheld', 'unpaid AssetPack source', 'settlement private payloads'], + }), + row({ + rowId: 'operator:source-safe-receipts', + laneId: 'local-and-staging-testnet', + routeIds: [...V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + sourceRoots: [SOURCE_ROOTS.operatorScript, SOURCE_ROOTS.checker], + requiredEvidence: ['secretValueSerialized: false', 'receiptRoot', 'V43_CROSS_ROUTE_REHEARSAL_LANES'], + }), + row({ + rowId: 'proof:artifacts-tests-workflows-docs', + laneId: 'local-and-staging-testnet', + routeIds: [...V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + sourceRoots: [SOURCE_ROOTS.protocolTest, SOURCE_ROOTS.packageJson, SOURCE_ROOTS.gateWorkflow, SOURCE_ROOTS.canonWorkflow], + requiredEvidence: ['v43-cross-route-rehearsal-telemetry-repair', 'check:v43-gate9', 'generate:v43-cross-route-rehearsal'], + }), +]); + +function buildPredicateResults(repoRoot) { + const sources = Object.fromEntries( + Object.entries(SOURCE_ROOTS).map(([key, sourcePath]) => [key, readSource(repoRoot, sourcePath)]), + ); + + return [ + predicateResult('gate3-artifact-passed', SOURCE_ROOTS.gate3Artifact, artifactPassed(repoRoot, SOURCE_ROOTS.gate3Artifact, 'v43-packs-activity-master-detail')), + predicateResult('gate4-artifact-passed', SOURCE_ROOTS.gate4Artifact, artifactPassed(repoRoot, SOURCE_ROOTS.gate4Artifact, 'v43-read-route-five-step-ux')), + predicateResult('gate5-artifact-passed', SOURCE_ROOTS.gate5Artifact, artifactPassed(repoRoot, SOURCE_ROOTS.gate5Artifact, 'v43-deposit-route-options')), + predicateResult('gate6-artifact-passed', SOURCE_ROOTS.gate6Artifact, artifactPassed(repoRoot, SOURCE_ROOTS.gate6Artifact, 'v43-deposit-policy-compensation')), + predicateResult('gate7-artifact-passed', SOURCE_ROOTS.gate7Artifact, artifactPassed(repoRoot, SOURCE_ROOTS.gate7Artifact, 'v43-deposit-option-admission')), + predicateResult('gate8-artifact-passed', SOURCE_ROOTS.gate8Artifact, artifactPassed(repoRoot, SOURCE_ROOTS.gate8Artifact, 'v43-route-ux-product-excellence')), + predicateResult('deposit-route-covers-admission', SOURCE_ROOTS.depositClient, sources.depositClient.includes('pipeline:deposit-option-admission') && sources.depositClient.includes('DepositAssetPackOptionAdmissionReport')), + predicateResult('deposit-model-covers-repair-boundaries', SOURCE_ROOTS.depositModel, sources.depositModel.includes('sourceCriticalityDemandRoiPolicyOwnedByGate6') && sources.depositModel.includes('admissionAndIndexingOwnedByGate7')), + predicateResult('read-route-covers-two-pipeline-path', SOURCE_ROOTS.readModel, sources.readModel.includes('ReadNeedComprehensionSynthesis') && sources.readModel.includes('ReadFitsFindingSynthesis') && sources.readModel.includes('deliveryRequiresPaidReadRights')), + predicateResult('read-client-covers-preview-settlement-delivery', SOURCE_ROOTS.readClient, sources.readClient.includes('Finding Fits') && sources.readClient.includes('Withheld until paid') && sources.readClient.includes('settlement readback')), + predicateResult('packs-route-covers-activity-repair', SOURCE_ROOTS.packsClient, sources.packsClient.includes('PackActivity') && sources.packsClient.includes('repairState') && sources.packsClient.includes('compensationState')), + predicateResult('packs-api-source-safe-readback', SOURCE_ROOTS.packsApi, sources.packsApi.includes('assertPackActivitySourceSafe') && sources.packsApi.includes('summarizePackActivityRecords')), + predicateResult('pipeline-log-rich-metadata', SOURCE_ROOTS.pipelineLogUi, sources.pipelineLogUi.includes('metadata') && sources.pipelineLogUi.includes('Accordion')), + predicateResult('settlement-boundary-syncs-delivery', SOURCE_ROOTS.settlementBoundary, sources.settlementBoundary.includes('ledger') && sources.settlementBoundary.includes('objectStorage') && sources.settlementBoundary.includes('source_bearing_pull_request_ready')), + predicateResult('preview-boundary-repairs-withheld-source', SOURCE_ROOTS.previewBoundary, sources.previewBoundary.includes('repair_posture') && sources.previewBoundary.includes('withheld_until_settlement')), + predicateResult('deposit-admission-syncs-storage-telemetry', SOURCE_ROOTS.depositAdmission, sources.depositAdmission.includes('storageProjection') && sources.depositAdmission.includes('telemetryRoot') && sources.depositAdmission.includes('compensationRouteRoot')), + predicateResult('operator-script-exists', SOURCE_ROOTS.operatorScript, sourceExists(repoRoot, SOURCE_ROOTS.operatorScript) && sources.operatorScript.includes('V43_CROSS_ROUTE_REHEARSAL_LANES')), + predicateResult('operator-script-binds-staging-testnet', SOURCE_ROOTS.operatorScript, sources.operatorScript.includes('tkpyosihuouusyaxtbau') && sources.operatorScript.includes('BITCODE_ASSET_PACK_REAL_INFERENCE') && sources.operatorScript.includes('BITCODE_PIPELINE_STREAM_TO_DATABASE')), + predicateResult('operator-script-source-safe', SOURCE_ROOTS.operatorScript, sources.operatorScript.includes('secretValueSerialized: false') && sources.operatorScript.includes('valueBearingMainnetAdmitted: false')), + predicateResult('protocol-test-wired', SOURCE_ROOTS.protocolTest, sources.protocolTest.includes('buildV43CrossRouteRehearsalTelemetryRepair') && sources.protocolTest.includes('rowCount, 12')), + predicateResult('protocol-exports-wired', SOURCE_ROOTS.protocolIndex, sources.protocolIndex.includes('buildV43CrossRouteRehearsalTelemetryRepair') && sources.protocolTypes.includes('buildV43CrossRouteRehearsalTelemetryRepair')), + predicateResult('package-scripts-wired', SOURCE_ROOTS.packageJson, sources.packageJson.includes('generate:v43-cross-route-rehearsal') && sources.packageJson.includes('rehearse:v43-cross-route') && sources.packageJson.includes('check:v43-gate9')), + predicateResult('workflows-run-gate9', SOURCE_ROOTS.gateWorkflow, sources.gateWorkflow.includes('check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs') && sources.canonWorkflow.includes('check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs')), + predicateResult('v43-docs-expanded', SOURCE_ROOTS.spec, includesText(sources.spec, 'V43 Gate 9') && includesText(sources.spec, 'cross-route rehearsal')), + predicateResult('v43-delta-expanded', SOURCE_ROOTS.delta, includesText(sources.delta, 'Gate 9') && includesText(sources.delta, 'cross-route rehearsal')), + predicateResult('v43-notes-expanded', SOURCE_ROOTS.notes, sources.notes.includes('Gate 9') && sources.notes.includes('telemetry/database/ledger/storage')), + predicateResult('v43-parity-implemented', SOURCE_ROOTS.parity, sources.parity.includes('Cross-route rehearsal') && sources.parity.includes('implemented')), + predicateResult('roadmap-advanced-to-gate9', SOURCE_ROOTS.roadmap, sources.roadmap.includes('Current working gate: V43 Gate 9') && sources.roadmap.includes('V43 Gate 9 closure anchor')), + predicateResult('readmes-document-gate9', SOURCE_ROOTS.readme, sources.readme.includes('V43 Gate 9') && sources.protocolReadme.includes('V43CrossRouteRehearsalTelemetryRepair')), + ]; +} + +function buildCoverage(rows, predicateResults) { + const failedPredicateIds = predicateResults.filter((predicate) => !predicate.passed).map((predicate) => predicate.id); + return { + rowCount: rows.length, + laneCount: V43_CROSS_ROUTE_REHEARSAL_LANE_IDS.length, + routeCount: V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS.length, + stageCount: V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS.length, + gateArtifactCount: 6, + lanes: [...V43_CROSS_ROUTE_REHEARSAL_LANE_IDS], + routes: [...V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS], + stages: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + stagingProjectRef: 'tkpyosihuouusyaxtbau', + stagingRestHost: 'https://tkpyosihuouusyaxtbau.supabase.co/rest/v1/', + localLaneCovered: true, + stagingTestnetLaneCovered: true, + depositRouteCovered: true, + readRouteCovered: true, + packsRouteCovered: true, + depositOptionAdmissionCovered: true, + readNeedAndFindingFitsCovered: true, + sourceSafePreviewCovered: true, + settlementRightsTransferCovered: true, + compensationCovered: true, + deliveryPullRequestCovered: true, + packActivityRepairCovered: true, + telemetryDatabaseReadbackCovered: true, + ledgerDatabaseStorageSynchronized: true, + repairMatrixCovered: true, + mainnetValueBearingBlocked: true, + sourceSafeMetadataOnly: true, + protectedSourcePayloadSerialized: false, + rawProtectedPromptVisible: false, + rawInterpolatedPromptVisible: false, + rawProviderResponseVisible: false, + unpaidAssetPackSourceVisible: false, + credentialsSerialized: false, + walletPrivateMaterialVisible: false, + privateSettlementPayloadVisible: false, + liveRehearsalLogPayloadSerialized: false, + failedPredicateIds, + }; +} + +export function buildV43CrossRouteRehearsalTelemetryRepair(input = {}) { + const repoRoot = input.repoRoot || DEFAULT_REPO_ROOT; + const predicateResults = buildPredicateResults(repoRoot); + const rows = [...V43_CROSS_ROUTE_REHEARSAL_ROWS]; + const coverage = buildCoverage(rows, predicateResults); + const artifactRoot = `v43-cross-route-rehearsal:${digest(JSON.stringify({ + rowIds: V43_CROSS_ROUTE_REHEARSAL_ROW_IDS, + laneIds: V43_CROSS_ROUTE_REHEARSAL_LANE_IDS, + routeIds: V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS, + stageIds: V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS, + predicateResults, + coverage, + }))}`; + + return { + artifactId: 'v43-cross-route-rehearsal-telemetry-repair', + schemaId: V43_CROSS_ROUTE_REHEARSAL_SCHEMA_ID, + version: V43_CROSS_ROUTE_REHEARSAL_VERSION, + currentTarget: V43_CROSS_ROUTE_REHEARSAL_CURRENT_TARGET, + sourceSafetyVerdict: V43_CROSS_ROUTE_REHEARSAL_SOURCE_SAFETY_VERDICT, + laneIds: [...V43_CROSS_ROUTE_REHEARSAL_LANE_IDS], + routeIds: [...V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS], + stageIds: [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS], + rowIds: [...V43_CROSS_ROUTE_REHEARSAL_ROW_IDS], + rows, + predicateResults, + coverage, + sourceSafety: { + sourceSafetyClass: 'source_safe_cross_route_rehearsal_telemetry_repair_metadata', + sourceSafeMetadataOnly: true, + protectedSourcePayloadSerialized: false, + rawProtectedPromptVisible: false, + rawInterpolatedPromptVisible: false, + rawProviderResponseVisible: false, + unpaidAssetPackSourceVisible: false, + credentialsSerialized: false, + walletPrivateMaterialVisible: false, + privateSettlementPayloadVisible: false, + liveRehearsalLogPayloadSerialized: false, + valueBearingMainnetAdmitted: false, + forbiddenPayloadClasses: [...FORBIDDEN_PAYLOAD_CLASSES], + }, + passed: coverage.failedPredicateIds.length === 0, + artifactRoot, + }; +} diff --git a/packages/protocol/src/index.d.ts b/packages/protocol/src/index.d.ts index 9b1a3814..15e9141c 100644 --- a/packages/protocol/src/index.d.ts +++ b/packages/protocol/src/index.d.ts @@ -663,6 +663,16 @@ export const V43_ROUTE_UX_FIELD_IDS: readonly string[]; export const V43_ROUTE_UX_FORBIDDEN_PAYLOAD_IDS: readonly string[]; export const V43_ROUTE_UX_CONTRACT_ROWS: readonly Record[]; export function buildV43RouteUxProductExcellence(input?: Record): BitcodeProtocolReport; +export const V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH: string; +export const V43_CROSS_ROUTE_REHEARSAL_CURRENT_TARGET: string; +export const V43_CROSS_ROUTE_REHEARSAL_SCHEMA_ID: string; +export const V43_CROSS_ROUTE_REHEARSAL_VERSION: string; +export const V43_CROSS_ROUTE_REHEARSAL_SOURCE_SAFETY_VERDICT: string; +export const V43_CROSS_ROUTE_REHEARSAL_LANE_IDS: readonly string[]; +export const V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS: readonly string[]; +export const V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS: readonly string[]; +export const V43_CROSS_ROUTE_REHEARSAL_ROW_IDS: readonly string[]; +export function buildV43CrossRouteRehearsalTelemetryRepair(input?: Record): BitcodeProtocolReport; export const EXCHANGE_INTENT_ORDER_CONTRACTS_ARTIFACT_PATH: string; export const EXCHANGE_INTENT_ORDER_CONTRACTS_CURRENT_TARGET: string; export const EXCHANGE_INTENT_ORDER_CONTRACTS_SCHEMA_ID: string; diff --git a/packages/protocol/src/index.js b/packages/protocol/src/index.js index ba96233f..74b90b74 100644 --- a/packages/protocol/src/index.js +++ b/packages/protocol/src/index.js @@ -751,6 +751,18 @@ export { V43_ROUTE_UX_PRODUCT_EXCELLENCE_VERSION, buildV43RouteUxProductExcellence } from './canonical/v43-route-ux-product-excellence.js'; +export { + V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH, + V43_CROSS_ROUTE_REHEARSAL_CURRENT_TARGET, + V43_CROSS_ROUTE_REHEARSAL_LANE_IDS, + V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS, + V43_CROSS_ROUTE_REHEARSAL_ROW_IDS, + V43_CROSS_ROUTE_REHEARSAL_SCHEMA_ID, + V43_CROSS_ROUTE_REHEARSAL_SOURCE_SAFETY_VERDICT, + V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS, + V43_CROSS_ROUTE_REHEARSAL_VERSION, + buildV43CrossRouteRehearsalTelemetryRepair +} from './canonical/v43-cross-route-rehearsal-telemetry-repair.js'; export { EXCHANGE_INTENT_ACTION_KINDS, EXCHANGE_INTENT_ORDER_CONTRACTS_ARTIFACT_PATH, diff --git a/packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js b/packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js new file mode 100644 index 00000000..3844dab9 --- /dev/null +++ b/packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js @@ -0,0 +1,63 @@ +import assert from 'node:assert/strict'; +import test from 'node:test'; + +import { + V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH, + V43_CROSS_ROUTE_REHEARSAL_LANE_IDS, + V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS, + V43_CROSS_ROUTE_REHEARSAL_ROW_IDS, + V43_CROSS_ROUTE_REHEARSAL_SCHEMA_ID, + V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS, + buildV43CrossRouteRehearsalTelemetryRepair, +} from '../src/canonical/v43-cross-route-rehearsal-telemetry-repair.js'; + +test('V43 cross-route rehearsal telemetry repair artifact is source-safe and complete', () => { + const artifact = buildV43CrossRouteRehearsalTelemetryRepair(); + + assert.equal( + V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH, + '.bitcode/v43-cross-route-rehearsal-telemetry-repair.json', + ); + assert.equal(artifact.artifactId, 'v43-cross-route-rehearsal-telemetry-repair'); + assert.equal(artifact.schemaId, V43_CROSS_ROUTE_REHEARSAL_SCHEMA_ID); + assert.equal(artifact.version, 'V43'); + assert.equal(artifact.currentTarget, 'V42'); + assert.deepEqual(artifact.laneIds, [...V43_CROSS_ROUTE_REHEARSAL_LANE_IDS]); + assert.deepEqual(artifact.routeIds, [...V43_CROSS_ROUTE_REHEARSAL_ROUTE_IDS]); + assert.deepEqual(artifact.stageIds, [...V43_CROSS_ROUTE_REHEARSAL_STAGE_IDS]); + assert.deepEqual(artifact.rowIds, [...V43_CROSS_ROUTE_REHEARSAL_ROW_IDS]); + assert.equal(artifact.coverage.rowCount, 12); + assert.equal(artifact.coverage.laneCount, 2); + assert.equal(artifact.coverage.routeCount, 3); + assert.equal(artifact.coverage.stageCount, 9); + assert.equal(artifact.coverage.gateArtifactCount, 6); + assert.equal(artifact.coverage.stagingProjectRef, 'tkpyosihuouusyaxtbau'); + assert.equal(artifact.coverage.stagingRestHost, 'https://tkpyosihuouusyaxtbau.supabase.co/rest/v1/'); + assert.equal(artifact.coverage.depositRouteCovered, true); + assert.equal(artifact.coverage.readRouteCovered, true); + assert.equal(artifact.coverage.packsRouteCovered, true); + assert.equal(artifact.coverage.depositOptionAdmissionCovered, true); + assert.equal(artifact.coverage.readNeedAndFindingFitsCovered, true); + assert.equal(artifact.coverage.sourceSafePreviewCovered, true); + assert.equal(artifact.coverage.settlementRightsTransferCovered, true); + assert.equal(artifact.coverage.compensationCovered, true); + assert.equal(artifact.coverage.deliveryPullRequestCovered, true); + assert.equal(artifact.coverage.packActivityRepairCovered, true); + assert.equal(artifact.coverage.telemetryDatabaseReadbackCovered, true); + assert.equal(artifact.coverage.ledgerDatabaseStorageSynchronized, true); + assert.equal(artifact.coverage.repairMatrixCovered, true); + assert.equal(artifact.coverage.mainnetValueBearingBlocked, true); + assert.equal(artifact.coverage.sourceSafeMetadataOnly, true); + assert.equal(artifact.coverage.protectedSourcePayloadSerialized, false); + assert.equal(artifact.coverage.rawProtectedPromptVisible, false); + assert.equal(artifact.coverage.rawInterpolatedPromptVisible, false); + assert.equal(artifact.coverage.rawProviderResponseVisible, false); + assert.equal(artifact.coverage.unpaidAssetPackSourceVisible, false); + assert.equal(artifact.coverage.credentialsSerialized, false); + assert.equal(artifact.coverage.walletPrivateMaterialVisible, false); + assert.equal(artifact.coverage.privateSettlementPayloadVisible, false); + assert.equal(artifact.coverage.liveRehearsalLogPayloadSerialized, false); + assert.deepEqual(artifact.coverage.failedPredicateIds, []); + assert.equal(artifact.passed, true); + assert.match(artifact.artifactRoot, /^v43-cross-route-rehearsal:/u); +}); diff --git a/scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs b/scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs new file mode 100644 index 00000000..22452993 --- /dev/null +++ b/scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs @@ -0,0 +1,282 @@ +#!/usr/bin/env node + +import { execFileSync } from 'node:child_process'; +import { existsSync, readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const defaultRepoRoot = path.resolve(__dirname, '..'); +const ARTIFACT_PATH = '.bitcode/v43-cross-route-rehearsal-telemetry-repair.json'; + +const SECRET_MARKERS = [ + `${['sk', 'proj'].join('-')}-`, + `${['sb', 'secret'].join('_')}__`, + String.fromCharCode(101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 73, 85, 122, 73, 49, 78, 105), + ['OPENAI', 'API', 'KEY'].join('_'), + ['SUPABASE', 'SERVICE', 'ROLE'].join('_'), + ['VERCEL', 'TOKEN'].join('_'), + ['VERCEL', 'OIDC', 'TOKEN'].join('_'), + ['PRIVATE', 'KEY'].join('_'), +]; + +function parseArgs(argv) { + const args = { + repoRoot: defaultRepoRoot, + skipBranchCheck: false, + skipPackageTests: false, + skipUapiTests: false, + help: false, + }; + + for (let index = 0; index < argv.length; index += 1) { + const arg = argv[index]; + if (arg === '--repo-root') args.repoRoot = path.resolve(argv[++index]); + else if (arg === '--skip-branch-check') args.skipBranchCheck = true; + else if (arg === '--skip-package-tests') args.skipPackageTests = true; + else if (arg === '--skip-uapi-tests') args.skipUapiTests = true; + else if (arg === '--help' || arg === '-h') args.help = true; + else throw new Error(`Unknown argument ${arg}`); + } + + return args; +} + +function read(root, relativePath) { + return readFileSync(path.join(root, relativePath), 'utf8'); +} + +function fileExists(root, relativePath) { + return existsSync(path.join(root, relativePath)); +} + +function git(root, args) { + return execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim(); +} + +function run(root, command, args, options = {}) { + return execFileSync(command, args, { + cwd: root, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + ...options, + }).trim(); +} + +function commandExists(root, command) { + try { + execFileSync('sh', ['-lc', `command -v ${command}`], { + cwd: root, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'ignore'], + }); + return true; + } catch { + return false; + } +} + +function assertCheck(failures, condition, message) { + if (!condition) failures.push(message); +} + +function printHelp() { + process.stdout.write( + [ + 'Usage: node scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs [--skip-branch-check] [--skip-package-tests] [--skip-uapi-tests] [--repo-root ]', + '', + 'Checks V43 Gate 9 cross-route rehearsal, telemetry, synchronization, repair, source-safety, docs, tests, and workflow wiring.', + ].join('\n'), + ); + process.stdout.write('\n'); +} + +function parseJson(output, failures, label) { + try { + return JSON.parse(output); + } catch (error) { + failures.push(`${label} did not emit JSON: ${error.message}`); + return null; + } +} + +function runFocusedTests(root, failures, args) { + const commands = [ + ['node', ['--test', '--test-force-exit', 'packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js']], + ]; + + if (!args.skipPackageTests && commandExists(root, 'pnpm')) { + commands.push( + ['pnpm', ['--filter', '@bitcode/pipeline-asset-pack', 'exec', 'jest', '--config', 'jest.config.cjs', '--runTestsByPath', 'src/__tests__/deposit-asset-pack-option-admission.test.ts', 'src/__tests__/reading-local-staging-rehearsal.test.ts', '--runInBand', '--forceExit']], + ); + } + + if (!args.skipUapiTests && commandExists(root, 'pnpm')) { + commands.push( + ['pnpm', ['--dir', 'uapi', 'exec', 'jest', '--runTestsByPath', 'tests/depositPageClient.test.tsx', 'tests/readPageClient.test.tsx', 'tests/packsPageClient.test.tsx', 'tests/packActivityModel.test.ts', '--runInBand']], + ); + } + + for (const [command, commandArgs] of commands) { + try { + run(root, command, commandArgs); + } catch (error) { + failures.push(`Gate 9 focused test failed for ${command} ${commandArgs.join(' ')}: ${error.stderr || error.message}`); + return; + } + } +} + +function main() { + const args = parseArgs(process.argv.slice(2)); + if (args.help) { + printHelp(); + return; + } + + const root = args.repoRoot; + const failures = []; + const pointer = read(root, 'BITCODE_SPEC.txt').trim(); + + assertCheck( + failures, + pointer === 'V42', + `BITCODE_SPEC.txt must remain V42 during V43 gate work. Observed ${pointer || 'empty'}.`, + ); + + if (!args.skipBranchCheck) { + const branch = git(root, ['branch', '--show-current']); + assertCheck( + failures, + branch === 'version/v43' || /^v43\/gate-(?:9|10)-[a-z0-9][a-z0-9-]*$/u.test(branch), + `V43 Gate 9+ work must occur on version/v43 or v43/gate-9..10-* branches. Observed ${branch || 'detached HEAD'}.`, + ); + } + + const requiredFiles = [ + ARTIFACT_PATH, + 'scripts/rehearse-v43-cross-route-product-flow.mjs', + 'scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs', + 'scripts/check-v43-gate9-cross-route-rehearsal-telemetry-repair.mjs', + 'packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js', + 'packages/protocol/test/v43-cross-route-rehearsal-telemetry-repair.test.js', + 'uapi/app/deposit/DepositPageClient.tsx', + 'uapi/app/read/ReadPageClient.tsx', + 'uapi/app/packs/PacksPageClient.tsx', + 'uapi/app/api/packs/activity/route.ts', + 'uapi/components/base/bitcode/execution/pipeline-execution-log.tsx', + 'BITCODE_SPEC_V43.md', + 'BITCODE_SPEC_V43_DELTA.md', + 'BITCODE_SPEC_V43_NOTES.md', + 'BITCODE_SPEC_V43_PARITY_MATRIX.md', + 'SPECIFICATIONS_ROADMAP.md', + 'README.md', + 'packages/protocol/README.md', + 'package.json', + '.github/workflows/bitcode-gate-quality.yml', + '.github/workflows/bitcode-canon-quality.yml', + ]; + + for (const relativePath of requiredFiles) { + assertCheck(failures, fileExists(root, relativePath), `Missing V43 Gate 9 file: ${relativePath}`); + } + + if (failures.length === 0) { + try { + run(root, 'node', ['scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs', '--check']); + } catch (error) { + failures.push(`V43 cross-route rehearsal artifact check failed: ${error.stderr || error.message}`); + } + } + + let localReceipt = null; + let stagingReceipt = null; + if (failures.length === 0) { + const dryRunEnv = { + ...process.env, + OPENAI_API_KEY: `${['sk', 'proj'].join('-')}-dummy-do-not-serialize-000000000000`, + VERCEL_OIDC_TOKEN: 'oidc_dummy_do_not_serialize', + BITCODE_RUN_VERCEL_SANDBOX_HARNESS: '1', + BITCODE_ENABLE_PIPELINE_HARNESS_API: '1', + BITCODE_ASSET_PACK_REAL_INFERENCE: '1', + BITCODE_PIPELINE_STREAM_TO_DATABASE: '1', + SUPABASE_URL: 'https://tkpyosihuouusyaxtbau.supabase.co/rest/v1/', + SUPABASE_ANON_KEY: 'anon_dummy_do_not_serialize', + SUPABASE_SECRET_KEY: 'admin_dummy_do_not_serialize', + }; + const localOutput = run(root, 'node', ['scripts/rehearse-v43-cross-route-product-flow.mjs', '--lane', 'local', '--dry-run', '--json'], { env: dryRunEnv }); + const stagingOutput = run(root, 'node', ['scripts/rehearse-v43-cross-route-product-flow.mjs', '--lane', 'staging-testnet', '--dry-run', '--json'], { env: dryRunEnv }); + localReceipt = parseJson(localOutput, failures, 'local V43 cross-route rehearsal dry run'); + stagingReceipt = parseJson(stagingOutput, failures, 'staging-testnet V43 cross-route rehearsal dry run'); + + for (const marker of ['dummy-do-not-serialize', dryRunEnv.OPENAI_API_KEY, dryRunEnv.SUPABASE_SECRET_KEY, dryRunEnv.VERCEL_OIDC_TOKEN]) { + assertCheck(failures, !localOutput.includes(marker), `Local dry-run receipt must not serialize secret value ${marker}.`); + assertCheck(failures, !stagingOutput.includes(marker), `Staging dry-run receipt must not serialize secret value ${marker}.`); + } + } + + if (failures.length === 0) { + runFocusedTests(root, failures, args); + } + + const serializedArtifact = fileExists(root, ARTIFACT_PATH) ? read(root, ARTIFACT_PATH) : ''; + for (const marker of SECRET_MARKERS) { + assertCheck(failures, !serializedArtifact.includes(marker), `V43 Gate 9 artifact must not contain secret marker ${marker}.`); + } + + const artifact = serializedArtifact ? JSON.parse(serializedArtifact) : null; + if (artifact) { + assertCheck(failures, artifact.artifactId === 'v43-cross-route-rehearsal-telemetry-repair', 'Gate 9 artifactId must match.'); + assertCheck(failures, artifact.schemaId === 'bitcode.v43.crossRouteRehearsalTelemetryRepair.v1', 'Gate 9 schemaId must match.'); + assertCheck(failures, artifact.version === 'V43' && artifact.currentTarget === 'V42', 'Gate 9 artifact must bind V43 over active V42.'); + assertCheck(failures, artifact.passed === true, 'Gate 9 artifact must pass.'); + assertCheck(failures, artifact.coverage.rowCount === 12, 'Gate 9 must cover twelve rehearsal rows.'); + assertCheck(failures, artifact.coverage.laneCount === 2, 'Gate 9 must cover local and staging-testnet lanes.'); + assertCheck(failures, artifact.coverage.routeCount === 3, 'Gate 9 must cover /deposit, /read, and /packs.'); + assertCheck(failures, artifact.coverage.stageCount === 9, 'Gate 9 must cover all cross-route stages.'); + assertCheck(failures, artifact.coverage.stagingProjectRef === 'tkpyosihuouusyaxtbau', 'Gate 9 must bind staging-testnet Supabase project.'); + assertCheck(failures, artifact.coverage.depositRouteCovered === true, 'Gate 9 must cover /deposit.'); + assertCheck(failures, artifact.coverage.readRouteCovered === true, 'Gate 9 must cover /read.'); + assertCheck(failures, artifact.coverage.packsRouteCovered === true, 'Gate 9 must cover /packs.'); + assertCheck(failures, artifact.coverage.telemetryDatabaseReadbackCovered === true, 'Gate 9 must cover telemetry database readback.'); + assertCheck(failures, artifact.coverage.ledgerDatabaseStorageSynchronized === true, 'Gate 9 must cover ledger/database/storage sync.'); + assertCheck(failures, artifact.coverage.repairMatrixCovered === true, 'Gate 9 must cover repair states.'); + assertCheck(failures, artifact.coverage.mainnetValueBearingBlocked === true, 'Gate 9 must keep value-bearing mainnet blocked.'); + assertCheck(failures, artifact.coverage.sourceSafeMetadataOnly === true, 'Gate 9 artifact must be source-safe metadata only.'); + assertCheck(failures, artifact.coverage.credentialsSerialized === false, 'Gate 9 artifact must not serialize credentials.'); + assertCheck(failures, artifact.coverage.unpaidAssetPackSourceVisible === false, 'Gate 9 artifact must not expose unpaid AssetPack source.'); + assertCheck(failures, artifact.coverage.failedPredicateIds.length === 0, `Gate 9 predicates must pass: ${artifact.coverage.failedPredicateIds.join(', ')}`); + } + + if (localReceipt) { + assertCheck(failures, localReceipt.version === 'V43', 'Local receipt must be V43.'); + assertCheck(failures, localReceipt.laneId === 'local', 'Local receipt lane must be local.'); + assertCheck(failures, localReceipt.routes.includes('/deposit') && localReceipt.routes.includes('/read') && localReceipt.routes.includes('/packs'), 'Local receipt must cover product routes.'); + assertCheck(failures, localReceipt.sourceSafety.secretValueSerialized === false, 'Local receipt must not serialize secrets.'); + } + if (stagingReceipt) { + assertCheck(failures, stagingReceipt.version === 'V43', 'Staging receipt must be V43.'); + assertCheck(failures, stagingReceipt.laneId === 'staging-testnet', 'Staging receipt lane must be staging-testnet.'); + assertCheck(failures, stagingReceipt.stagingProjectRef === 'tkpyosihuouusyaxtbau', 'Staging receipt must bind staging project.'); + assertCheck(failures, stagingReceipt.ready === true, 'Staging dry-run receipt must be ready with dummy family values.'); + assertCheck(failures, stagingReceipt.sourceSafety.secretValueSerialized === false, 'Staging receipt must not serialize secrets.'); + } + + if (failures.length > 0) { + process.stderr.write('V43 Gate 9 cross-route rehearsal telemetry repair check failed:\n'); + for (const failure of failures.filter(Boolean)) process.stderr.write(`- ${failure}\n`); + process.exitCode = 1; + return; + } + + process.stdout.write('V43 Gate 9 cross-route rehearsal telemetry repair check passed.\n'); +} + +try { + main(); +} catch (error) { + const detail = error instanceof Error ? error.message : String(error); + process.stderr.write(`${detail}\n`); + process.exitCode = 1; +} diff --git a/scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs b/scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs new file mode 100644 index 00000000..ddf8fca9 --- /dev/null +++ b/scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs @@ -0,0 +1,61 @@ +#!/usr/bin/env node + +import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { + V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH, + buildV43CrossRouteRehearsalTelemetryRepair, +} from '../packages/protocol/src/canonical/v43-cross-route-rehearsal-telemetry-repair.js'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const defaultRepoRoot = path.resolve(__dirname, '..'); + +function parseArgs(argv) { + const args = { + repoRoot: defaultRepoRoot, + check: false, + }; + for (let index = 0; index < argv.length; index += 1) { + const arg = argv[index]; + if (arg === '--repo-root') args.repoRoot = path.resolve(argv[++index]); + else if (arg === '--check') args.check = true; + else if (arg === '--help' || arg === '-h') { + process.stdout.write( + 'Usage: node scripts/generate-v43-cross-route-rehearsal-telemetry-repair.mjs [--check] [--repo-root ]\n', + ); + process.exit(0); + } else { + throw new Error(`Unknown argument ${arg}`); + } + } + return args; +} + +const args = parseArgs(process.argv.slice(2)); +const artifact = buildV43CrossRouteRehearsalTelemetryRepair({ repoRoot: args.repoRoot }); +const artifactPath = path.join(args.repoRoot, V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH); +const serialized = `${JSON.stringify(artifact, null, 2)}\n`; + +if (args.check) { + if (!existsSync(artifactPath)) { + process.stderr.write(`Missing ${V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH}\n`); + process.exit(1); + } + const current = readFileSync(artifactPath, 'utf8'); + if (current !== serialized) { + process.stderr.write(`${V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH} is stale. Run pnpm run generate:v43-cross-route-rehearsal.\n`); + process.exit(1); + } + if (!artifact.passed) { + process.stderr.write(`V43 cross-route rehearsal predicates failed: ${artifact.coverage.failedPredicateIds.join(', ')}\n`); + process.exit(1); + } + process.stdout.write(`V43 cross-route rehearsal artifact ok ${artifact.artifactRoot}\n`); + process.exit(0); +} + +mkdirSync(path.dirname(artifactPath), { recursive: true }); +writeFileSync(artifactPath, serialized); +process.stdout.write(`Wrote ${V43_CROSS_ROUTE_REHEARSAL_ARTIFACT_PATH} ${artifact.artifactRoot}\n`); diff --git a/scripts/rehearse-v43-cross-route-product-flow.mjs b/scripts/rehearse-v43-cross-route-product-flow.mjs new file mode 100644 index 00000000..d52c9521 --- /dev/null +++ b/scripts/rehearse-v43-cross-route-product-flow.mjs @@ -0,0 +1,347 @@ +#!/usr/bin/env node + +import { spawnSync } from 'node:child_process'; +import { createHash } from 'node:crypto'; +import { mkdirSync, writeFileSync } from 'node:fs'; +import path from 'node:path'; + +export const V43_CROSS_ROUTE_REHEARSAL_LANES = ['local', 'staging-testnet']; + +const DEFAULT_RECEIPT_DIR = '.bitcode/pipeline-harness-runs/v43-cross-route-rehearsal-receipts'; +const STAGING_PROJECT_REF = 'tkpyosihuouusyaxtbau'; +const STAGING_REST_HOST = 'https://tkpyosihuouusyaxtbau.supabase.co/rest/v1/'; + +const SOURCE_SAFETY = Object.freeze({ + sourceSafeMetadataOnly: true, + protectedSourcePayloadSerialized: false, + rawProtectedPromptVisible: false, + rawInterpolatedPromptVisible: false, + rawProviderResponseVisible: false, + unpaidAssetPackSourceVisible: false, + credentialsSerialized: false, + walletPrivateMaterialVisible: false, + privateSettlementPayloadVisible: false, + liveRehearsalLogPayloadSerialized: false, + valueBearingMainnetAdmitted: false, + secretValueSerialized: false, +}); + +const ENVIRONMENT_FAMILIES = Object.freeze({ + sandboxAuth: { + familyId: 'sandbox-auth', + required: true, + acceptedKeyNames: ['VERCEL_OIDC_TOKEN', 'VERCEL_TOKEN'], + posture: 'vercel-oidc-preferred-access-token-fallback', + }, + sandboxOptIn: { + familyId: 'sandbox-live-opt-in', + required: true, + acceptedKeyNames: ['BITCODE_RUN_VERCEL_SANDBOX_HARNESS'], + requiredLiteralValue: '1', + posture: 'explicit-live-sandbox-opt-in', + }, + harnessApi: { + familyId: 'pipeline-harness-api-enabled', + required: true, + acceptedKeyNames: ['BITCODE_ENABLE_PIPELINE_HARNESS_API'], + requiredLiteralValue: '1', + posture: 'local-and-staging-harness-api-enabled', + }, + llmProvider: { + familyId: 'llm-provider-key', + required: true, + acceptedKeyNames: ['OPENAI_API_KEY'], + posture: 'real-inference-provider-credential', + }, + supabaseUrl: { + familyId: 'supabase-rest-url', + required: true, + acceptedKeyNames: ['SUPABASE_URL', 'NEXT_PUBLIC_SUPABASE_URL'], + requiredHost: `${STAGING_PROJECT_REF}.supabase.co`, + posture: 'staging-testnet-rest-host-bound', + }, + supabasePublic: { + familyId: 'supabase-public-key', + required: true, + acceptedKeyNames: [ + 'SUPABASE_ANON_KEY', + 'SUPABASE_PUBLISHABLE_KEY', + 'NEXT_PUBLIC_SUPABASE_ANON_KEY', + 'NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY', + ], + posture: 'staging-testnet-public-readback-key', + }, + supabaseAdmin: { + familyId: 'supabase-admin-key', + required: true, + acceptedKeyNames: ['SUPABASE_SECRET_KEY', 'SUPABASE_ADMIN_KEY', 'SUPABASE_SERVICE_ROLE_KEY'], + posture: 'staging-testnet-admin-readback-key', + }, + databaseStreaming: { + familyId: 'pipeline-database-streaming', + required: true, + acceptedKeyNames: ['BITCODE_PIPELINE_STREAM_TO_DATABASE'], + requiredLiteralValue: '1', + posture: 'pipeline-events-persist-to-staging-database', + }, + realInference: { + familyId: 'assetpack-real-inference', + required: true, + acceptedKeyNames: ['BITCODE_ASSET_PACK_REAL_INFERENCE'], + requiredLiteralValue: '1', + posture: 'staging-testnet-real-inference-required', + }, +}); + +const LANE_REQUIREMENTS = Object.freeze({ + local: [ + ENVIRONMENT_FAMILIES.sandboxAuth, + ENVIRONMENT_FAMILIES.sandboxOptIn, + ENVIRONMENT_FAMILIES.harnessApi, + ], + 'staging-testnet': [ + ENVIRONMENT_FAMILIES.sandboxAuth, + ENVIRONMENT_FAMILIES.sandboxOptIn, + ENVIRONMENT_FAMILIES.harnessApi, + ENVIRONMENT_FAMILIES.llmProvider, + ENVIRONMENT_FAMILIES.supabaseUrl, + ENVIRONMENT_FAMILIES.supabasePublic, + ENVIRONMENT_FAMILIES.supabaseAdmin, + ENVIRONMENT_FAMILIES.databaseStreaming, + ENVIRONMENT_FAMILIES.realInference, + ], +}); + +const STAGES = Object.freeze([ + 'deposit:synthesize-options', + 'deposit:review-admit', + 'read:request', + 'read:review-need', + 'read:request-finding-fits', + 'read:preview-assetpack', + 'settlement:pay-btc-transfer-rights', + 'delivery:repository-pull-request', + 'packs:inspect-activity-repair', +]); + +function stableStringify(value) { + if (typeof value === 'undefined') return 'null'; + if (value === null || typeof value !== 'object') return JSON.stringify(value); + if (Array.isArray(value)) return `[${value.map((entry) => stableStringify(entry)).join(',')}]`; + return `{${Object.keys(value) + .sort() + .map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`) + .join(',')}}`; +} + +function rootOf(value) { + return `sha256:${createHash('sha256').update(stableStringify(value)).digest('hex')}`; +} + +function parseArgs(argv) { + const args = { + lane: 'local', + dryRun: true, + execute: false, + json: false, + writeReceipt: false, + includeEnvKeyNames: false, + receiptDir: DEFAULT_RECEIPT_DIR, + }; + + for (let index = 0; index < argv.length; index += 1) { + const arg = argv[index]; + if (arg === '--lane') args.lane = argv[++index]; + else if (arg === '--dry-run') args.dryRun = true; + else if (arg === '--execute') { + args.execute = true; + args.dryRun = false; + } else if (arg === '--json') args.json = true; + else if (arg === '--write-receipt') args.writeReceipt = true; + else if (arg === '--include-env-key-names') args.includeEnvKeyNames = true; + else if (arg === '--receipt-dir') args.receiptDir = argv[++index]; + else if (arg === '--help' || arg === '-h') args.help = true; + else throw new Error(`Unknown argument ${arg}`); + } + + if (!V43_CROSS_ROUTE_REHEARSAL_LANES.includes(args.lane)) { + throw new Error( + `Unsupported V43 cross-route rehearsal lane ${args.lane}. Expected one of ${V43_CROSS_ROUTE_REHEARSAL_LANES.join(', ')}.`, + ); + } + + return args; +} + +function printHelp() { + process.stdout.write( + [ + 'Usage: node scripts/rehearse-v43-cross-route-product-flow.mjs --lane [--dry-run|--execute] [--json] [--write-receipt]', + '', + 'Builds a source-safe operator receipt for the V43 /deposit -> /read -> /packs product rehearsal lane.', + 'Live execution requires BITCODE_V43_CROSS_ROUTE_REHEARSAL_EXECUTE=1 and delegates to the Vercel Sandbox AssetPack harness.', + ].join('\n'), + ); + process.stdout.write('\n'); +} + +function hostFromUrl(value) { + if (!value) return null; + try { + return new URL(value).hostname; + } catch { + return null; + } +} + +function readEnvironmentFamily(family, env, includeEnvKeyNames) { + const observed = family.acceptedKeyNames + .map((keyName) => ({ + keyName, + present: typeof env[keyName] === 'string' && env[keyName].length > 0, + literalMatches: family.requiredLiteralValue ? env[keyName] === family.requiredLiteralValue : true, + hostMatches: family.requiredHost ? hostFromUrl(env[keyName]) === family.requiredHost : true, + })) + .filter((entry) => entry.present); + + const satisfied = observed.some((entry) => entry.literalMatches && entry.hostMatches); + return { + familyId: family.familyId, + required: family.required, + posture: family.posture, + present: observed.length > 0, + satisfied, + ...(family.requiredHost ? { requiredHost: family.requiredHost } : {}), + ...(family.requiredLiteralValue ? { requiredLiteralValuePresent: satisfied } : {}), + ...(includeEnvKeyNames + ? { acceptedKeyNames: family.acceptedKeyNames, observedKeyNames: observed.map((entry) => entry.keyName) } + : {}), + secretValueSerialized: false, + }; +} + +function buildReceipt(args, env = process.env) { + const families = LANE_REQUIREMENTS[args.lane].map((family) => + readEnvironmentFamily(family, env, args.includeEnvKeyNames), + ); + const missingEnvironmentFamilies = families + .filter((family) => family.required && !family.satisfied) + .map((family) => family.familyId); + const command = { + commandId: 'pipeline-hosts:qa-asset-pack-sandbox', + cwd: 'packages/pipeline-hosts', + argv: ['pnpm', '--filter', '@bitcode/pipeline-hosts', 'run', 'qa:asset-pack:sandbox'], + routes: ['/deposit', '/read', '/packs'], + dryRun: args.dryRun, + liveExecutionOptInRequired: true, + liveExecutionOptInSatisfied: env.BITCODE_V43_CROSS_ROUTE_REHEARSAL_EXECUTE === '1', + }; + const withoutRoot = { + schema: 'bitcode.v43.crossRouteRehearsal.operatorReceipt', + version: 'V43', + currentTarget: 'V42', + laneId: args.lane, + laneClass: + args.lane === 'staging-testnet' + ? 'staging-testnet-real-inference-cross-route-rehearsal' + : 'local-cross-route-rehearsal', + stagingProjectRef: args.lane === 'staging-testnet' ? STAGING_PROJECT_REF : null, + stagingRestHost: args.lane === 'staging-testnet' ? STAGING_REST_HOST : null, + generatedAt: 'operator-runtime', + ready: missingEnvironmentFamilies.length === 0, + dryRun: args.dryRun, + routes: ['/deposit', '/read', '/packs'], + stages: [...STAGES], + telemetry: { + streamToDatabaseRequired: args.lane === 'staging-testnet', + executionStreamUiRequired: true, + packsActivityReadbackRequired: true, + repairReadbackRequired: true, + }, + synchronization: { + ledgerDatabaseStorageRequired: true, + compensationReadbackRequired: true, + repositoryDeliveryReadbackRequired: true, + }, + command, + environmentFamilies: families, + missingEnvironmentFamilies, + receiptArtifactRoot: DEFAULT_RECEIPT_DIR, + sourceSafety: SOURCE_SAFETY, + }; + + return { + ...withoutRoot, + receiptRoot: rootOf(withoutRoot), + }; +} + +function writeReceipt(receipt, receiptDir) { + mkdirSync(receiptDir, { recursive: true }); + const filename = `${receipt.version.toLowerCase()}-${receipt.laneId}-cross-route-rehearsal-receipt.json`; + const receiptPath = path.resolve(receiptDir, filename); + writeFileSync(receiptPath, `${JSON.stringify(receipt, null, 2)}\n`); + return receiptPath; +} + +function runLiveHarness(receipt) { + if (!receipt.ready) { + throw new Error(`Cannot execute V43 rehearsal; missing families: ${receipt.missingEnvironmentFamilies.join(', ')}`); + } + if (!receipt.command.liveExecutionOptInSatisfied) { + throw new Error('Set BITCODE_V43_CROSS_ROUTE_REHEARSAL_EXECUTE=1 before live rehearsal execution.'); + } + + return spawnSync('pnpm', ['--filter', '@bitcode/pipeline-hosts', 'run', 'qa:asset-pack:sandbox'], { + stdio: 'inherit', + env: { + ...process.env, + BITCODE_SANDBOX_MODE: process.env.BITCODE_SANDBOX_MODE || 'asset_pack_pipeline', + BITCODE_PIPELINE_STREAM_TO_DATABASE: + receipt.laneId === 'staging-testnet' + ? '1' + : process.env.BITCODE_PIPELINE_STREAM_TO_DATABASE || '0', + BITCODE_ENABLE_PIPELINE_HARNESS_API: process.env.BITCODE_ENABLE_PIPELINE_HARNESS_API || '1', + }, + }); +} + +function main() { + const args = parseArgs(process.argv.slice(2)); + if (args.help) { + printHelp(); + return; + } + + const receipt = buildReceipt(args); + let receiptPath = null; + if (args.writeReceipt) { + receiptPath = writeReceipt(receipt, args.receiptDir); + } + + if (args.execute) { + const result = runLiveHarness(receipt); + if (result.status !== 0) process.exit(result.status || 1); + } + + if (args.json) { + process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`); + return; + } + + process.stdout.write( + [ + `V43 ${receipt.laneId} cross-route rehearsal receipt ${receipt.receiptRoot}`, + `ready=${receipt.ready}`, + receiptPath ? `receipt=${receiptPath}` : null, + receipt.missingEnvironmentFamilies.length + ? `missing=${receipt.missingEnvironmentFamilies.join(',')}` + : 'missing=none', + ] + .filter(Boolean) + .join(' '), + ); + process.stdout.write('\n'); +} + +main();