xytara 3.1.16 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -92
- package/RELEASE_NOTES.md +7 -3
- package/START_HERE.md +56 -224
- package/bin/xytara.js +21 -8
- package/client.js +79 -1
- package/lib/{delivery_receipt.js → delivery_receipt_verify.js} +14 -100
- package/package.json +25 -35
- package/scripts/verify_client.js +418 -0
- package/scripts/verify_release_candidate.js +146 -45
- package/.env.example +0 -173
- package/ADAPTER_START_HERE.md +0 -56
- package/BSV_TERANODE_PLATFORM_DISCONTINUITY_RUNBOOK.md +0 -126
- package/CARRIED_HANDOFF_DEMO.md +0 -60
- package/EXAMPLE_PATHS.md +0 -53
- package/FINAL_CONTRACT.md +0 -498
- package/PARTNER_READY_PATH.md +0 -71
- package/PUBLIC_DEMO_SCRIPT.md +0 -78
- package/REAL_PAYMENT_SETUP.md +0 -320
- package/SERVICE_CONTRACT.md +0 -419
- package/SUPABASE_RUNTIME_STATE_SETUP.md +0 -61
- package/TERMINOLOGY.md +0 -50
- package/WHY_XYTARA_XOONYA.md +0 -63
- package/XT1_EXECUTION_TRUTH_STANDARD.md +0 -78
- package/XYTARA_ADAPTER_PROTOCOL_TRUTH_MODEL.md +0 -75
- package/XYTARA_AUTONOMOUS_ENTRY_MODEL.md +0 -124
- package/XYTARA_DEFAULT_PATH_MODEL.md +0 -84
- package/XYTARA_EXECUTION_TRUTH_MODEL.md +0 -171
- package/XYTARA_PAYMENT_RAIL_TRUTH_MODEL.md +0 -68
- package/adapters/AUTHORING_GUIDE.md +0 -244
- package/adapters/ONBOARDING_POSTURE.md +0 -61
- package/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md +0 -84
- package/adapters/adapter-manifest.schema.json +0 -283
- package/adapters/examples/example-execution-adapter.js +0 -61
- package/adapters/examples/example-execution-adapter.manifest.json +0 -81
- package/adapters/examples/example-settlement-adapter.js +0 -55
- package/adapters/examples/example-settlement-adapter.manifest.json +0 -78
- package/adapters/examples/example-third-party-acp-registration.submission-bundle.json +0 -124
- package/adapters/examples/example-third-party-erc8004-registration.submission-bundle.json +0 -121
- package/adapters/examples/example-third-party-identity-registration.certification-pack.json +0 -22
- package/adapters/examples/example-third-party-identity-registration.record.json +0 -26
- package/adapters/examples/example-third-party-identity-registration.submission-bundle.json +0 -126
- package/adapters/examples/example-third-party-langchain-registration.submission-bundle.json +0 -124
- package/adapters/examples/example-third-party-mpp-registration.submission-bundle.json +0 -120
- package/adapters/examples/example-third-party-registration.certification-pack.json +0 -22
- package/adapters/examples/example-third-party-registration.record.json +0 -28
- package/adapters/examples/example-third-party-registration.submission-bundle.json +0 -126
- package/adapters/examples/example-third-party-settlement-registration.certification-pack.json +0 -22
- package/adapters/examples/example-third-party-settlement-registration.record.json +0 -26
- package/adapters/examples/example-third-party-settlement-registration.submission-bundle.json +0 -127
- package/adapters/examples/langchain-reference-execution-adapter.js +0 -81
- package/adapters/examples/langchain-reference-execution-adapter.manifest.json +0 -79
- package/adapters/examples/langgraph-reference-execution-adapter.js +0 -81
- package/adapters/examples/langgraph-reference-execution-adapter.manifest.json +0 -79
- package/adapters/examples/minimal-third-party-execution-adapter.js +0 -61
- package/adapters/examples/minimal-third-party-execution-adapter.manifest.json +0 -79
- package/adapters/examples/minimal-third-party-execution-registration.record.json +0 -26
- package/adapters/examples/minimal-third-party-execution.certification-pack.json +0 -22
- package/adapters/examples/minimal-third-party-execution.submission-bundle.json +0 -126
- package/adapters/integration-certification-pack.schema.json +0 -82
- package/adapters/integration-registration-record.schema.json +0 -114
- package/adapters/integration-submission-bundle-set.schema.json +0 -39
- package/adapters/integration-submission-bundle.schema.json +0 -34
- package/adapters/interfaces.js +0 -56
- package/bin/xytara-release.js +0 -1429
- package/examples/_demo_env.js +0 -40
- package/examples/adapter_review_walkthrough.js +0 -54
- package/examples/export_carried_handoff.js +0 -81
- package/examples/funded_runtime_walkthrough.js +0 -71
- package/examples/partner_launch_walkthrough.js +0 -44
- package/examples/quickstart.js +0 -3256
- package/fixtures/catalog.js +0 -1156
- package/index.js +0 -395
- package/integrations/dispatch.js +0 -276
- package/integrations/registry-snapshot.schema.json +0 -36
- package/integrations/registry.js +0 -2261
- package/integrations/views.js +0 -28
- package/lib/a2a_lane_contract.js +0 -104
- package/lib/a2a_rpc.js +0 -287
- package/lib/a2c_lane_contract.js +0 -111
- package/lib/account_auth.js +0 -585
- package/lib/acp_lane_contract.js +0 -54
- package/lib/activity_audit_contract.js +0 -322
- package/lib/adapter_certification_contract.js +0 -130
- package/lib/adapter_depth_contract.js +0 -218
- package/lib/adapter_pack.js +0 -118
- package/lib/adapter_partner_pack.js +0 -89
- package/lib/adapter_promotion_pack.js +0 -89
- package/lib/adapter_protocol_truth_contract.js +0 -229
- package/lib/agent_identity.js +0 -162
- package/lib/announcement_pack.js +0 -61
- package/lib/artifact_distribution_lane_contract.js +0 -54
- package/lib/asyncapi_contract.js +0 -150
- package/lib/auth_interop_contract.js +0 -80
- package/lib/authority_binding_lifecycle_contract.js +0 -182
- package/lib/autonomous_entry_contract.js +0 -409
- package/lib/bolt_adapter.js +0 -187
- package/lib/bolt_lane_contract.js +0 -55
- package/lib/bolt_payment_front.js +0 -224
- package/lib/business_cockpit.js +0 -378
- package/lib/buyer_event_log.js +0 -230
- package/lib/buyer_safety_policy.js +0 -132
- package/lib/capability_execution_truth.js +0 -276
- package/lib/capability_registry.js +0 -633
- package/lib/catalog_contract.js +0 -966
- package/lib/catalog_family_model.js +0 -193
- package/lib/catalog_views.js +0 -55
- package/lib/cdp_jwt.js +0 -57
- package/lib/checkout_event_security.js +0 -142
- package/lib/checkout_processor_adapter.js +0 -217
- package/lib/cloudevents_contract.js +0 -80
- package/lib/command_flow.js +0 -911
- package/lib/commerce_artifacts.js +0 -591
- package/lib/commerce_authority.js +0 -449
- package/lib/commerce_bridge.js +0 -274
- package/lib/commerce_cases.js +0 -399
- package/lib/commerce_checkout.js +0 -509
- package/lib/commerce_coordination.js +0 -346
- package/lib/commerce_economics.js +0 -4017
- package/lib/commerce_identity.js +0 -578
- package/lib/commerce_quotes.js +0 -266
- package/lib/commerce_reports.js +0 -14461
- package/lib/commerce_runtime.js +0 -322
- package/lib/commerce_shell.js +0 -257
- package/lib/crypto_agility_matrix.js +0 -125
- package/lib/default_path_contract.js +0 -412
- package/lib/delivery_summary_contract.js +0 -95
- package/lib/ecosystem_entry.js +0 -64
- package/lib/erc8004_lane_contract.js +0 -65
- package/lib/event_system_lane_contract.js +0 -75
- package/lib/execution_dedupe.js +0 -86
- package/lib/execution_truth_contract.js +0 -234
- package/lib/external_credit_bridge.js +0 -142
- package/lib/external_execution_policy.js +0 -143
- package/lib/external_execution_runtime.js +0 -238
- package/lib/feature_control_lane_contract.js +0 -54
- package/lib/first_run_conversion_contract.js +0 -290
- package/lib/framework_lane_contract.js +0 -89
- package/lib/framework_provider_promotion.js +0 -235
- package/lib/full_catalog_contract.js +0 -525
- package/lib/go_live_operator_pack.js +0 -391
- package/lib/http_transport.js +0 -99
- package/lib/identity_auth.js +0 -175
- package/lib/identity_interop_contract.js +0 -82
- package/lib/integration_matrix_contract.js +0 -102
- package/lib/l402_adapter.js +0 -241
- package/lib/l402_lane_contract.js +0 -55
- package/lib/l402_payment_front.js +0 -265
- package/lib/launch_narrative.js +0 -53
- package/lib/lifecycle_continuity_contract.js +0 -115
- package/lib/machine_identity_registry_contract.js +0 -199
- package/lib/major_rails_lane_contract.js +0 -150
- package/lib/market_lane_contract.js +0 -467
- package/lib/market_lane_depth_contract.js +0 -182
- package/lib/market_lane_promotion_contract.js +0 -210
- package/lib/market_lane_trace_contract.js +0 -278
- package/lib/mcp_lane_contract.js +0 -137
- package/lib/mpp_adapter.js +0 -237
- package/lib/network_transport.js +0 -110
- package/lib/offline_verifiability_recovery_contract.js +0 -155
- package/lib/openapi_contract.js +0 -300
- package/lib/operational_receipt_contract.js +0 -165
- package/lib/operator_intelligence.js +0 -407
- package/lib/outreach_copy_pack.js +0 -51
- package/lib/outreach_message_pack.js +0 -71
- package/lib/outreach_proof.js +0 -71
- package/lib/outreach_target_pack.js +0 -60
- package/lib/partner_intelligence.js +0 -105
- package/lib/payment_config.js +0 -257
- package/lib/payment_front_registry.js +0 -53
- package/lib/payment_protocol_contract.js +0 -165
- package/lib/payment_rail_truth_contract.js +0 -324
- package/lib/payment_verification.js +0 -357
- package/lib/phase_10_closeout_pack.js +0 -45
- package/lib/phase_10_completion_pack.js +0 -76
- package/lib/phase_10_decision_record_pack.js +0 -54
- package/lib/phase_10_decision_resolution_pack.js +0 -53
- package/lib/phase_10_demand_signal_adapters_runtime_pack.js +0 -74
- package/lib/phase_10_ecosystem_backlog_triage_runtime_pack.js +0 -74
- package/lib/phase_10_freeze_baseline_pack.js +0 -67
- package/lib/phase_10_freeze_review_pack.js +0 -64
- package/lib/phase_10_gate_pack.js +0 -57
- package/lib/phase_10_long_tail_continuity_pack.js +0 -80
- package/lib/phase_10_long_tail_ecosystem_pack.js +0 -66
- package/lib/phase_10_niche_extension_registry_runtime_pack.js +0 -74
- package/lib/phase_1_claude_mcp_pack.js +0 -60
- package/lib/phase_1_claude_mcp_runtime_pack.js +0 -52
- package/lib/phase_1_ecosystem_pack.js +0 -67
- package/lib/phase_1_openai_codex_pack.js +0 -60
- package/lib/phase_1_openai_codex_runtime_pack.js +0 -52
- package/lib/phase_2_base_runtime_pack.js +0 -71
- package/lib/phase_2_base_usdc_runtime_pack.js +0 -72
- package/lib/phase_2_closeout_pack.js +0 -65
- package/lib/phase_2_completion_pack.js +0 -113
- package/lib/phase_2_decision_record_pack.js +0 -66
- package/lib/phase_2_decision_resolution_pack.js +0 -69
- package/lib/phase_2_eth_runtime_pack.js +0 -70
- package/lib/phase_2_evm_base_runtime_pack.js +0 -73
- package/lib/phase_2_evm_runtime_pack.js +0 -71
- package/lib/phase_2_flip_preview_pack.js +0 -60
- package/lib/phase_2_freeze_review_pack.js +0 -99
- package/lib/phase_2_gate_pack.js +0 -77
- package/lib/phase_2_payment_rails_pack.js +0 -71
- package/lib/phase_2_usdc_runtime_pack.js +0 -71
- package/lib/phase_3_brc_runtime_pack.js +0 -81
- package/lib/phase_3_bsv_teranode_runtime_pack.js +0 -83
- package/lib/phase_3_closeout_pack.js +0 -62
- package/lib/phase_3_completion_pack.js +0 -94
- package/lib/phase_3_decision_record_pack.js +0 -64
- package/lib/phase_3_decision_resolution_pack.js +0 -69
- package/lib/phase_3_freeze_baseline_pack.js +0 -67
- package/lib/phase_3_freeze_review_pack.js +0 -80
- package/lib/phase_3_gate_pack.js +0 -76
- package/lib/phase_3_metanet_runtime_pack.js +0 -81
- package/lib/phase_3_native_bsv_pack.js +0 -91
- package/lib/phase_3_native_continuity_pack.js +0 -82
- package/lib/phase_4_attestation_runtime_pack.js +0 -75
- package/lib/phase_4_closeout_pack.js +0 -45
- package/lib/phase_4_completion_pack.js +0 -94
- package/lib/phase_4_decision_record_pack.js +0 -54
- package/lib/phase_4_decision_resolution_pack.js +0 -45
- package/lib/phase_4_erc8004_runtime_pack.js +0 -76
- package/lib/phase_4_freeze_baseline_pack.js +0 -67
- package/lib/phase_4_freeze_review_pack.js +0 -68
- package/lib/phase_4_gate_pack.js +0 -58
- package/lib/phase_4_identity_registry_runtime_pack.js +0 -75
- package/lib/phase_4_identity_trust_pack.js +0 -73
- package/lib/phase_4_trust_continuity_pack.js +0 -86
- package/lib/phase_5_antelope_runtime_pack.js +0 -76
- package/lib/phase_5_closeout_pack.js +0 -44
- package/lib/phase_5_completion_pack.js +0 -82
- package/lib/phase_5_constellation_dag_runtime_pack.js +0 -76
- package/lib/phase_5_decision_record_pack.js +0 -54
- package/lib/phase_5_decision_resolution_pack.js +0 -45
- package/lib/phase_5_digibyte_dgb_runtime_pack.js +0 -76
- package/lib/phase_5_freeze_baseline_pack.js +0 -67
- package/lib/phase_5_freeze_review_pack.js +0 -68
- package/lib/phase_5_gate_pack.js +0 -58
- package/lib/phase_5_hedera_hbar_runtime_pack.js +0 -76
- package/lib/phase_5_kaspa_kas_runtime_pack.js +0 -76
- package/lib/phase_5_major_rails_continuity_pack.js +0 -86
- package/lib/phase_5_major_rails_pack.js +0 -110
- package/lib/phase_5_metal_runtime_pack.js +0 -76
- package/lib/phase_5_polkadot_dot_runtime_pack.js +0 -76
- package/lib/phase_5_proton_xpr_runtime_pack.js +0 -76
- package/lib/phase_5_solana_runtime_pack.js +0 -76
- package/lib/phase_6_autogen_runtime_pack.js +0 -72
- package/lib/phase_6_closeout_pack.js +0 -46
- package/lib/phase_6_completion_pack.js +0 -77
- package/lib/phase_6_decision_record_pack.js +0 -54
- package/lib/phase_6_decision_resolution_pack.js +0 -53
- package/lib/phase_6_framework_continuity_pack.js +0 -81
- package/lib/phase_6_framework_runtime_pack.js +0 -68
- package/lib/phase_6_freeze_baseline_pack.js +0 -68
- package/lib/phase_6_freeze_review_pack.js +0 -65
- package/lib/phase_6_gate_pack.js +0 -59
- package/lib/phase_6_langchain_runtime_pack.js +0 -72
- package/lib/phase_6_langgraph_runtime_pack.js +0 -72
- package/lib/phase_6_semantic_kernel_runtime_pack.js +0 -72
- package/lib/phase_7_closeout_pack.js +0 -45
- package/lib/phase_7_completion_pack.js +0 -85
- package/lib/phase_7_decision_record_pack.js +0 -53
- package/lib/phase_7_decision_resolution_pack.js +0 -53
- package/lib/phase_7_event_system_continuity_pack.js +0 -89
- package/lib/phase_7_event_system_pack.js +0 -76
- package/lib/phase_7_freeze_baseline_pack.js +0 -74
- package/lib/phase_7_freeze_review_pack.js +0 -65
- package/lib/phase_7_gate_pack.js +0 -58
- package/lib/phase_7_kafka_runtime_pack.js +0 -74
- package/lib/phase_7_mqtt_runtime_pack.js +0 -74
- package/lib/phase_7_nats_runtime_pack.js +0 -74
- package/lib/phase_7_webhook_event_bus_runtime_pack.js +0 -74
- package/lib/phase_8_closeout_pack.js +0 -46
- package/lib/phase_8_completion_pack.js +0 -82
- package/lib/phase_8_decision_record_pack.js +0 -54
- package/lib/phase_8_decision_resolution_pack.js +0 -53
- package/lib/phase_8_external_receipt_import_runtime_pack.js +0 -74
- package/lib/phase_8_external_result_import_runtime_pack.js +0 -74
- package/lib/phase_8_freeze_baseline_pack.js +0 -71
- package/lib/phase_8_freeze_review_pack.js +0 -64
- package/lib/phase_8_gate_pack.js +0 -58
- package/lib/phase_8_proof_bridge_continuity_pack.js +0 -86
- package/lib/phase_8_proof_bridges_pack.js +0 -72
- package/lib/phase_8_proof_bundle_normalization_runtime_pack.js +0 -74
- package/lib/phase_9_closeout_pack.js +0 -46
- package/lib/phase_9_completion_pack.js +0 -82
- package/lib/phase_9_custody_refs_runtime_pack.js +0 -74
- package/lib/phase_9_decision_record_pack.js +0 -54
- package/lib/phase_9_decision_resolution_pack.js +0 -53
- package/lib/phase_9_freeze_baseline_pack.js +0 -71
- package/lib/phase_9_freeze_review_pack.js +0 -64
- package/lib/phase_9_gate_pack.js +0 -58
- package/lib/phase_9_operator_accounting_bridges_runtime_pack.js +0 -74
- package/lib/phase_9_treasury_connectivity_pack.js +0 -72
- package/lib/phase_9_treasury_continuity_pack.js +0 -86
- package/lib/phase_9_treasury_destinations_runtime_pack.js +0 -74
- package/lib/phase_program_pack.js +0 -120
- package/lib/pricing_optimization_contract.js +0 -775
- package/lib/protocol_lane_contract.js +0 -117
- package/lib/provenance_lane_contract.js +0 -54
- package/lib/provider_lane_contract.js +0 -240
- package/lib/provider_network_contract.js +0 -149
- package/lib/provider_payout_execution.js +0 -155
- package/lib/provider_registry.js +0 -852
- package/lib/provider_runtime_journey_contract.js +0 -183
- package/lib/public_surface_policy_contract.js +0 -111
- package/lib/publish_plan.js +0 -51
- package/lib/rate_limiter.js +0 -81
- package/lib/record_queries.js +0 -48
- package/lib/release_candidate.js +0 -50
- package/lib/release_center.js +0 -1093
- package/lib/release_history.js +0 -205
- package/lib/release_manifest.js +0 -113
- package/lib/release_pack.js +0 -453
- package/lib/request_rate_limit.js +0 -144
- package/lib/resource_views.js +0 -31
- package/lib/revenue_launch_path_contract.js +0 -326
- package/lib/route_matchers.js +0 -34
- package/lib/route_params.js +0 -19
- package/lib/runtime_bridge.js +0 -124
- package/lib/runtime_operations_worker.js +0 -282
- package/lib/runtime_state_store.js +0 -495
- package/lib/settlement_bsv_live.js +0 -600
- package/lib/settlement_bsv_teranode.js +0 -117
- package/lib/settlement_lane_contract.js +0 -111
- package/lib/shared_signals_lane_contract.js +0 -54
- package/lib/signed_audit_provenance_contract.js +0 -83
- package/lib/soft_launch_pack.js +0 -78
- package/lib/stablecoin_lane_contract.js +0 -76
- package/lib/stripe_mpp_lane_contract.js +0 -96
- package/lib/stripe_mpp_payment_front.js +0 -258
- package/lib/telemetry_lane_contract.js +0 -54
- package/lib/treasury_destinations_contract.js +0 -764
- package/lib/treasury_egress_policy_contract.js +0 -91
- package/lib/treasury_lane_contract.js +0 -84
- package/lib/trust_portability_boundary_contract.js +0 -72
- package/lib/x402_facilitator.js +0 -198
- package/lib/x402_lane_contract.js +0 -136
- package/lib/x402_settlement_recovery.js +0 -175
- package/scripts/buyer_events_daily_report.js +0 -79
- package/scripts/registry_cli.js +0 -275
- package/scripts/state_backup_offsite.js +0 -196
- package/scripts/verify_a2a_rpc.js +0 -131
- package/scripts/verify_adapters.js +0 -554
- package/scripts/verify_agent_identity.js +0 -153
- package/scripts/verify_all.js +0 -4963
- package/scripts/verify_bolt_adapter.js +0 -128
- package/scripts/verify_buyer_event_log.js +0 -128
- package/scripts/verify_buyer_safety.js +0 -141
- package/scripts/verify_cdp_facilitator.js +0 -110
- package/scripts/verify_checkout_processor.js +0 -109
- package/scripts/verify_commerce_bridge.js +0 -177
- package/scripts/verify_control_plane_contracts.js +0 -34
- package/scripts/verify_control_plane_routes.js +0 -70
- package/scripts/verify_delivery_summary.js +0 -112
- package/scripts/verify_examples.js +0 -19
- package/scripts/verify_execution_dedupe.js +0 -189
- package/scripts/verify_execution_surfacing.js +0 -76
- package/scripts/verify_external_execution_retry.js +0 -140
- package/scripts/verify_final_activation.js +0 -191
- package/scripts/verify_first_run_conversions.js +0 -81
- package/scripts/verify_framework_provider_promotion.js +0 -152
- package/scripts/verify_full_catalog.js +0 -174
- package/scripts/verify_integrations.js +0 -620
- package/scripts/verify_l402_adapter.js +0 -86
- package/scripts/verify_lifecycle_continuity.js +0 -96
- package/scripts/verify_lifecycle_spend_binding.js +0 -88
- package/scripts/verify_market_lane_depth.js +0 -94
- package/scripts/verify_market_lane_promotion.js +0 -103
- package/scripts/verify_market_lane_traces.js +0 -98
- package/scripts/verify_market_lanes.js +0 -102
- package/scripts/verify_mpp_adapter.js +0 -128
- package/scripts/verify_operator_observability_boundary.js +0 -83
- package/scripts/verify_pricing_experiment_plan.js +0 -124
- package/scripts/verify_production_readiness.js +0 -268
- package/scripts/verify_provider_network.js +0 -819
- package/scripts/verify_provider_runtime_breadth.js +0 -109
- package/scripts/verify_provider_runtime_journeys.js +0 -111
- package/scripts/verify_rate_limiter.js +0 -52
- package/scripts/verify_refund_credit.js +0 -106
- package/scripts/verify_revenue_launch_paths.js +0 -105
- package/scripts/verify_runtime_durability.js +0 -52
- package/scripts/verify_runtime_state_guard.js +0 -117
- package/scripts/verify_service.js +0 -15421
- package/scripts/verify_settlement.js +0 -116
- package/scripts/verify_tooling.js +0 -1412
- package/scripts/verify_treasury_public_boundary.js +0 -97
- package/scripts/verify_verify_execute_settle.js +0 -209
- package/scripts/verify_x402_facilitator.js +0 -307
- package/scripts/verify_x402_settlement_recovery.js +0 -153
- package/server.js +0 -12245
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("assert");
|
|
4
|
-
const { createServer } = require("../server");
|
|
5
|
-
|
|
6
|
-
async function getJson(baseUrl, path) {
|
|
7
|
-
const response = await fetch(`${baseUrl}${path}`);
|
|
8
|
-
return {
|
|
9
|
-
status: response.status,
|
|
10
|
-
json: await response.json()
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async function main() {
|
|
15
|
-
const previousExecutionTargets = process.env.XYTARA_EXECUTION_TARGETS_JSON;
|
|
16
|
-
const previousExternalExecutionRequired = process.env.XYTARA_EXTERNAL_EXECUTION_REQUIRED;
|
|
17
|
-
process.env.XYTARA_EXECUTION_TARGETS_JSON = JSON.stringify([
|
|
18
|
-
{
|
|
19
|
-
target_id: "verify-market-lanes-mcp-target",
|
|
20
|
-
task_ref: "adapter.mcp.invoke",
|
|
21
|
-
provider: "xytara_mcp_executor",
|
|
22
|
-
tool_name: "summarize",
|
|
23
|
-
endpoint_url: "https://example.invalid/tools",
|
|
24
|
-
auth_token: "bounded-public-test-token",
|
|
25
|
-
timeout_ms: 1500,
|
|
26
|
-
enabled: true
|
|
27
|
-
}
|
|
28
|
-
]);
|
|
29
|
-
process.env.XYTARA_EXTERNAL_EXECUTION_REQUIRED = "true";
|
|
30
|
-
const server = createServer();
|
|
31
|
-
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
32
|
-
const address = server.address();
|
|
33
|
-
const baseUrl = `http://127.0.0.1:${address.port}`;
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
const pack = await getJson(baseUrl, "/v1/full-catalog/market-lanes");
|
|
37
|
-
assert.strictEqual(pack.status, 200, "market lane route failed");
|
|
38
|
-
assert.strictEqual(pack.json.category, "machine-commerce-market-lane-pack", "market lane category mismatch");
|
|
39
|
-
assert.strictEqual(Array.isArray(pack.json.market_lanes), true, "market lanes missing");
|
|
40
|
-
assert.strictEqual(pack.json.market_lanes.length >= 6, true, "market lane coverage incomplete");
|
|
41
|
-
assert.strictEqual(
|
|
42
|
-
pack.json.market_lanes.some((entry) => entry.market_class === "compute" && entry.provider_live_task_refs.includes("adapter.mcp.invoke")),
|
|
43
|
-
true,
|
|
44
|
-
"compute market lane missing provider-live anchor"
|
|
45
|
-
);
|
|
46
|
-
assert.strictEqual(
|
|
47
|
-
pack.json.market_lanes.some((entry) => entry.market_class === "device_robotics" && entry.coverage_posture === "protocol_anchor_only"),
|
|
48
|
-
true,
|
|
49
|
-
"device/robotics market lane should stay protocol-anchor only"
|
|
50
|
-
);
|
|
51
|
-
assert.strictEqual(
|
|
52
|
-
pack.json.market_lanes.some((entry) => entry.market_class === "treasury_payments" && entry.call_surfaces.includes("/v1/settlement/bsv-teranode")),
|
|
53
|
-
true,
|
|
54
|
-
"treasury/payments market lane missing settlement surface"
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const summary = await getJson(baseUrl, "/v1/full-catalog/market-lanes/summary");
|
|
58
|
-
assert.strictEqual(summary.status, 200, "market lane summary route failed");
|
|
59
|
-
assert.strictEqual(summary.json.market_lane_count >= 6, true, "market lane summary count missing");
|
|
60
|
-
assert.strictEqual(summary.json.direct_task_backed_market_lane_count >= 5, true, "direct task-backed market lanes missing");
|
|
61
|
-
assert.strictEqual(summary.json.protocol_anchor_only_market_lane_count >= 1, true, "protocol-anchor market lane count missing");
|
|
62
|
-
assert.strictEqual(summary.json.provider_live_anchor_market_lane_count >= 1, true, "provider-live anchor market lane count missing");
|
|
63
|
-
assert.strictEqual(summary.json.callable_market_lane_count >= 5, true, "callable market lane count missing");
|
|
64
|
-
assert.strictEqual(summary.json.preview_only_market_lane_count >= 1, true, "preview-only market lane count missing");
|
|
65
|
-
|
|
66
|
-
const computeDetail = await getJson(baseUrl, "/v1/full-catalog/market-lanes/compute");
|
|
67
|
-
assert.strictEqual(computeDetail.status, 200, "compute market lane detail route failed");
|
|
68
|
-
assert.strictEqual(computeDetail.json.lane.activation_posture, "callable", "compute market lane should be callable");
|
|
69
|
-
assert.strictEqual(
|
|
70
|
-
computeDetail.json.lane.activation_profiles.some((entry) => entry.profile_id === "compute.invoke_primary"),
|
|
71
|
-
true,
|
|
72
|
-
"compute activation profile missing"
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const activationPack = await getJson(baseUrl, "/v1/full-catalog/market-lanes/activation");
|
|
76
|
-
assert.strictEqual(activationPack.status, 200, "market lane activation route failed");
|
|
77
|
-
assert.strictEqual(activationPack.json.category, "machine-commerce-market-lane-activation-pack", "market lane activation category mismatch");
|
|
78
|
-
assert.strictEqual(activationPack.json.callable_market_lane_count >= 5, true, "callable market lane activation count missing");
|
|
79
|
-
assert.strictEqual(
|
|
80
|
-
activationPack.json.market_lanes.some((entry) => entry.market_class === "device_robotics" && entry.activation_posture === "preview_only"),
|
|
81
|
-
true,
|
|
82
|
-
"device/robotics activation posture should remain preview-only"
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const activationSummary = await getJson(baseUrl, "/v1/full-catalog/market-lanes/activation/summary");
|
|
86
|
-
assert.strictEqual(activationSummary.status, 200, "market lane activation summary route failed");
|
|
87
|
-
assert.strictEqual(activationSummary.json.callable_market_lane_count >= 5, true, "market lane activation summary callable count missing");
|
|
88
|
-
|
|
89
|
-
console.log("xytara verify:market-lanes passed");
|
|
90
|
-
} finally {
|
|
91
|
-
await new Promise((resolve) => server.close(resolve));
|
|
92
|
-
if (previousExecutionTargets === undefined) delete process.env.XYTARA_EXECUTION_TARGETS_JSON;
|
|
93
|
-
else process.env.XYTARA_EXECUTION_TARGETS_JSON = previousExecutionTargets;
|
|
94
|
-
if (previousExternalExecutionRequired === undefined) delete process.env.XYTARA_EXTERNAL_EXECUTION_REQUIRED;
|
|
95
|
-
else process.env.XYTARA_EXTERNAL_EXECUTION_REQUIRED = previousExternalExecutionRequired;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
main().catch((error) => {
|
|
100
|
-
console.error(error);
|
|
101
|
-
process.exit(1);
|
|
102
|
-
});
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Verifies the MPP (Stripe per-call) adapter (lib/mpp_adapter.js). Offline: the
|
|
4
|
-
// Stripe GET is injected as a mock. Exercises config gating, header parsing, and
|
|
5
|
-
// the paid/amount/reference verification logic.
|
|
6
|
-
|
|
7
|
-
const assert = require("assert");
|
|
8
|
-
const m = require("../lib/mpp_adapter");
|
|
9
|
-
|
|
10
|
-
function setEnv(env) {
|
|
11
|
-
const saved = {};
|
|
12
|
-
for (const k in env) {
|
|
13
|
-
saved[k] = process.env[k];
|
|
14
|
-
if (env[k] === undefined) delete process.env[k];
|
|
15
|
-
else process.env[k] = env[k];
|
|
16
|
-
}
|
|
17
|
-
return () => {
|
|
18
|
-
for (const k in saved) {
|
|
19
|
-
if (saved[k] === undefined) delete process.env[k];
|
|
20
|
-
else process.env[k] = saved[k];
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function main() {
|
|
26
|
-
// 1. Not configured.
|
|
27
|
-
let restore = setEnv({ XYTARA_MPP_PROVIDER: undefined });
|
|
28
|
-
let cfg = m.loadMppConfig();
|
|
29
|
-
assert.strictEqual(cfg.provider, null);
|
|
30
|
-
assert.strictEqual((await m.verifyMppPayment(cfg, "pi_x", 100)).reason, "mpp_provider_not_configured");
|
|
31
|
-
restore();
|
|
32
|
-
|
|
33
|
-
// 2. Configured (stripe).
|
|
34
|
-
restore = setEnv({ XYTARA_MPP_PROVIDER: "stripe", STRIPE_SECRET_KEY: "sk_test_x" });
|
|
35
|
-
cfg = m.loadMppConfig();
|
|
36
|
-
assert.strictEqual(cfg.provider, "stripe");
|
|
37
|
-
|
|
38
|
-
// Header parsing.
|
|
39
|
-
assert.deepStrictEqual(m.parseMppHeader("SPT pi_abc123"), { reference: "pi_abc123" });
|
|
40
|
-
assert.deepStrictEqual(m.parseMppHeader("SPT cs_abc123"), { reference: "cs_abc123" });
|
|
41
|
-
assert.strictEqual(m.parseMppHeader("SPT not_a_ref"), null);
|
|
42
|
-
assert.strictEqual(m.parseMppHeader("Bearer x"), null);
|
|
43
|
-
|
|
44
|
-
// PaymentIntent succeeded + sufficient amount -> ok.
|
|
45
|
-
let r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 200, json: { status: "succeeded", amount_received: 500, currency: "usd" } }));
|
|
46
|
-
assert.strictEqual(r.ok, true);
|
|
47
|
-
assert.strictEqual(r.amount_minor, 500);
|
|
48
|
-
|
|
49
|
-
// PaymentIntent not succeeded -> not paid.
|
|
50
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 200, json: { status: "requires_payment_method", amount: 500 } }));
|
|
51
|
-
assert.strictEqual(r.reason, "mpp_not_paid");
|
|
52
|
-
|
|
53
|
-
// Insufficient amount -> rejected.
|
|
54
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 200, json: { status: "succeeded", amount_received: 200 } }));
|
|
55
|
-
assert.strictEqual(r.reason, "mpp_amount_insufficient");
|
|
56
|
-
|
|
57
|
-
// Checkout session paid -> ok.
|
|
58
|
-
r = await m.verifyMppPayment(cfg, "cs_1", 500, async () => ({ status: 200, json: { payment_status: "paid", amount_total: 900, currency: "usd" } }));
|
|
59
|
-
assert.strictEqual(r.ok, true);
|
|
60
|
-
assert.strictEqual(r.amount_minor, 900);
|
|
61
|
-
|
|
62
|
-
// Required amount unknown/zero -> never authorize for free.
|
|
63
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 0, async () => ({ status: 200, json: { status: "succeeded", amount_received: 500, currency: "usd" } }));
|
|
64
|
-
assert.strictEqual(r.reason, "mpp_required_amount_unknown");
|
|
65
|
-
|
|
66
|
-
// Wrong currency -> rejected even if nominal amount is high.
|
|
67
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 200, json: { status: "succeeded", amount_received: 500, currency: "jpy" } }));
|
|
68
|
-
assert.strictEqual(r.reason, "mpp_currency_mismatch");
|
|
69
|
-
|
|
70
|
-
// --- Request binding (production-safe) ---
|
|
71
|
-
const quoteA = { quote_id: "quote_aaa", amount_minor: 500, currency: "USD_CENTS" };
|
|
72
|
-
const quoteB = { quote_id: "quote_bbb", amount_minor: 500, currency: "USD_CENTS" };
|
|
73
|
-
const refA = m.computeBindingRef(cfg.bindingSecret, quoteA);
|
|
74
|
-
const refB = m.computeBindingRef(cfg.bindingSecret, quoteB);
|
|
75
|
-
assert.ok(refA.startsWith("nx_"), "binding ref is namespaced");
|
|
76
|
-
assert.strictEqual(refA, m.computeBindingRef(cfg.bindingSecret, quoteA), "binding ref is deterministic");
|
|
77
|
-
assert.notStrictEqual(refA, refB, "binding ref differs per quote");
|
|
78
|
-
|
|
79
|
-
// Paid object carrying the matching ref -> ok.
|
|
80
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 200, json: { status: "succeeded", amount_received: 500, currency: "usd", metadata: { naxytra_ref: refA } } }), { expectedRef: refA });
|
|
81
|
-
assert.strictEqual(r.ok, true, "matching binding ref authorizes");
|
|
82
|
-
|
|
83
|
-
// Paid object with NO ref when one is expected -> rejected (cannot replay an unrelated payment).
|
|
84
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 200, json: { status: "succeeded", amount_received: 500, currency: "usd", metadata: {} } }), { expectedRef: refA });
|
|
85
|
-
assert.strictEqual(r.reason, "mpp_binding_ref_missing");
|
|
86
|
-
|
|
87
|
-
// Paid object bound to a DIFFERENT quote -> rejected.
|
|
88
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 200, json: { status: "succeeded", amount_received: 500, currency: "usd", metadata: { naxytra_ref: refB } } }), { expectedRef: refA });
|
|
89
|
-
assert.strictEqual(r.reason, "mpp_binding_ref_mismatch");
|
|
90
|
-
|
|
91
|
-
// --- Server-side PaymentIntent creation (stamps the binding ref) ---
|
|
92
|
-
let captured = null;
|
|
93
|
-
const created = await m.createMppPaymentIntent(cfg, { amountMinor: 500, currency: "usd", ref: refA, quoteId: quoteA.quote_id }, async (path, form) => {
|
|
94
|
-
captured = { path, form };
|
|
95
|
-
return { status: 200, json: { id: "pi_created", client_secret: "pi_created_secret_x" } };
|
|
96
|
-
});
|
|
97
|
-
assert.strictEqual(created.ok, true);
|
|
98
|
-
assert.strictEqual(created.reference, "pi_created");
|
|
99
|
-
assert.strictEqual(created.client_secret, "pi_created_secret_x");
|
|
100
|
-
assert.strictEqual(captured.path, "/v1/payment_intents");
|
|
101
|
-
assert.strictEqual(captured.form.amount, "500");
|
|
102
|
-
assert.strictEqual(captured.form.currency, "usd");
|
|
103
|
-
assert.strictEqual(captured.form["metadata[naxytra_ref]"], refA);
|
|
104
|
-
|
|
105
|
-
// PI creation rejects a non-positive amount before any network call.
|
|
106
|
-
const badCreate = await m.createMppPaymentIntent(cfg, { amountMinor: 0, ref: refA }, async () => ({ status: 200, json: {} }));
|
|
107
|
-
assert.strictEqual(badCreate.reason, "invalid_amount");
|
|
108
|
-
|
|
109
|
-
// Invalid reference (not pi_/cs_) -> rejected before fetch.
|
|
110
|
-
r = await m.verifyMppPayment(cfg, "xyz", 500);
|
|
111
|
-
assert.strictEqual(r.reason, "mpp_reference_invalid");
|
|
112
|
-
|
|
113
|
-
// Stripe 404 -> not found.
|
|
114
|
-
r = await m.verifyMppPayment(cfg, "pi_1", 500, async () => ({ status: 404, json: { error: { message: "No such payment_intent" } } }));
|
|
115
|
-
assert.strictEqual(r.reason, "stripe_reference_not_found");
|
|
116
|
-
|
|
117
|
-
// Missing secret key -> explicit reason.
|
|
118
|
-
const noKey = Object.assign({}, cfg, { secretKey: "" });
|
|
119
|
-
assert.strictEqual((await m.verifyMppPayment(noKey, "pi_1", 500)).reason, "stripe_secret_key_missing");
|
|
120
|
-
restore();
|
|
121
|
-
|
|
122
|
-
console.log("verify_mpp_adapter: all MPP (Stripe per-call) adapter checks passed");
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
main().catch((error) => {
|
|
126
|
-
console.error("verify_mpp_adapter failed:", error && error.message ? error.message : error);
|
|
127
|
-
process.exitCode = 1;
|
|
128
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("assert");
|
|
4
|
-
const {
|
|
5
|
-
buildOperatorObservabilityPack,
|
|
6
|
-
validateOperatorObservabilityBoundary
|
|
7
|
-
} = require("../lib/operator_intelligence");
|
|
8
|
-
const { createRuntimeState } = require("../lib/commerce_runtime");
|
|
9
|
-
|
|
10
|
-
function clone(value) {
|
|
11
|
-
return JSON.parse(JSON.stringify(value));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function assertRejected(pack, expectedCode) {
|
|
15
|
-
const validation = validateOperatorObservabilityBoundary(pack);
|
|
16
|
-
assert.strictEqual(validation.observability_boundary_valid, false, `expected ${expectedCode} to block operator observability boundary`);
|
|
17
|
-
assert.strictEqual(
|
|
18
|
-
validation.rejection_codes.includes(expectedCode),
|
|
19
|
-
true,
|
|
20
|
-
`missing deterministic rejection code ${expectedCode}`
|
|
21
|
-
);
|
|
22
|
-
return validation;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function main() {
|
|
26
|
-
const pack = buildOperatorObservabilityPack(createRuntimeState());
|
|
27
|
-
const validation = validateOperatorObservabilityBoundary(pack);
|
|
28
|
-
assert.strictEqual(pack.category, "machine-commerce-operator-observability-pack", "operator observability category mismatch");
|
|
29
|
-
assert.strictEqual(validation.observability_boundary_valid, true, "operator observability boundary should validate");
|
|
30
|
-
assert.deepStrictEqual(validation.rejection_codes, [], "operator observability boundary should not carry rejections");
|
|
31
|
-
assert.strictEqual(pack.deterministic_rejection_codes.length >= 8, true, "operator observability rejection codes missing");
|
|
32
|
-
|
|
33
|
-
const missingBoundary = clone(pack);
|
|
34
|
-
missingBoundary.boundary = "unsafe";
|
|
35
|
-
assertRejected(missingBoundary, "boundary_missing");
|
|
36
|
-
|
|
37
|
-
const missingSurface = clone(pack);
|
|
38
|
-
delete missingSurface.linked_surfaces.payment_ledger_ref;
|
|
39
|
-
assertRejected(missingSurface, "missing_linked_surface");
|
|
40
|
-
|
|
41
|
-
const mutationSurface = clone(pack);
|
|
42
|
-
mutationSurface.linked_surfaces.payment_ledger_ref = "/v1/payment-ledger/refund";
|
|
43
|
-
assertRejected(mutationSurface, "mutation_surface_linked");
|
|
44
|
-
|
|
45
|
-
const settlementSubmit = clone(pack);
|
|
46
|
-
settlementSubmit.linked_surfaces.settlement_ref = "/v1/settlement/bsv-teranode/submit";
|
|
47
|
-
assertRejected(settlementSubmit, "settlement_submission_surface_linked");
|
|
48
|
-
|
|
49
|
-
const fundMovement = clone(pack);
|
|
50
|
-
fundMovement.linked_surfaces.operator_intelligence_ref = "/v1/treasury/release";
|
|
51
|
-
assertRejected(fundMovement, "fund_movement_surface_linked");
|
|
52
|
-
|
|
53
|
-
const unsafeAction = clone(pack);
|
|
54
|
-
unsafeAction.attention_queue = [{
|
|
55
|
-
lane: "settlement",
|
|
56
|
-
priority: "high",
|
|
57
|
-
action: "submit_settlement_now",
|
|
58
|
-
surface_ref: "/v1/settlement/bsv-teranode",
|
|
59
|
-
reason: "bad action"
|
|
60
|
-
}];
|
|
61
|
-
assertRejected(unsafeAction, "unsafe_attention_action");
|
|
62
|
-
|
|
63
|
-
const secretMaterial = clone(pack);
|
|
64
|
-
secretMaterial.operator_token = "sk_live_accidental_secret";
|
|
65
|
-
assertRejected(secretMaterial, "secret_material_forbidden");
|
|
66
|
-
|
|
67
|
-
const badCount = clone(pack);
|
|
68
|
-
badCount.counts.quote_count = "1";
|
|
69
|
-
assertRejected(badCount, "count_not_number");
|
|
70
|
-
|
|
71
|
-
const output = {
|
|
72
|
-
ok: true,
|
|
73
|
-
product: "xytara",
|
|
74
|
-
category: "xytara-operator-observability-boundary-verification",
|
|
75
|
-
status: "operator_observability_stays_read_only_without_secret_material_or_mutation_surfaces",
|
|
76
|
-
deterministic_rejection_code_count: pack.deterministic_rejection_codes.length,
|
|
77
|
-
adversarial_case_count: 8,
|
|
78
|
-
boundary: validation.boundary
|
|
79
|
-
};
|
|
80
|
-
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
main();
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("assert");
|
|
4
|
-
const {
|
|
5
|
-
buildPricingExperimentPlan,
|
|
6
|
-
summarizePricingExperimentPlan,
|
|
7
|
-
validatePricingExperimentLaunchRequest
|
|
8
|
-
} = require("../lib/pricing_optimization_contract");
|
|
9
|
-
const { createRuntimeState } = require("../lib/commerce_runtime");
|
|
10
|
-
|
|
11
|
-
function populateMaturePricingState(state) {
|
|
12
|
-
for (let index = 0; index < 100; index += 1) {
|
|
13
|
-
state.quotes.set(`quote_${index}`, {
|
|
14
|
-
quote_id: `quote_${index}`,
|
|
15
|
-
status: index < 50 ? "executed" : "expired",
|
|
16
|
-
amount_minor: 40,
|
|
17
|
-
task_refs: ["adapter.mcp.invoke"],
|
|
18
|
-
payment_protocol: "x402",
|
|
19
|
-
settlement_mode: "bsv_teranode"
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
for (let index = 0; index < 20; index += 1) {
|
|
23
|
-
state.paymentLedger.push({
|
|
24
|
-
payment_id: `payment_${index}`,
|
|
25
|
-
status: "recorded",
|
|
26
|
-
amount_minor: 40
|
|
27
|
-
});
|
|
28
|
-
state.transactions.set(`txn_${index}`, {
|
|
29
|
-
transaction: {
|
|
30
|
-
transaction_id: `txn_${index}`,
|
|
31
|
-
status: "completed"
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function buildValidLaunchRequest(candidate) {
|
|
38
|
-
const rollback_trigger_thresholds = {};
|
|
39
|
-
for (const trigger of candidate.rollback_triggers) {
|
|
40
|
-
rollback_trigger_thresholds[trigger] = "operator_defined_threshold";
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
experiment_id: candidate.experiment_id,
|
|
44
|
-
target_surface: candidate.target_surface,
|
|
45
|
-
operator_approval_ref: "ops.pricing.approval.2026-04-22",
|
|
46
|
-
baseline_metrics_ref: "ops.pricing.baseline.2026-04-22",
|
|
47
|
-
rollback_trigger_thresholds,
|
|
48
|
-
public_checkout_copy_review_ref: "ops.pricing.copy_review.2026-04-22",
|
|
49
|
-
post_experiment_review_window_days: 14
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function assertRejected(plan, request, expectedCode) {
|
|
54
|
-
const validation = validatePricingExperimentLaunchRequest(plan, request);
|
|
55
|
-
assert.strictEqual(validation.launch_allowed, false, `expected ${expectedCode} to block pricing experiment launch`);
|
|
56
|
-
assert.strictEqual(
|
|
57
|
-
validation.rejection_codes.includes(expectedCode),
|
|
58
|
-
true,
|
|
59
|
-
`missing deterministic rejection code ${expectedCode}`
|
|
60
|
-
);
|
|
61
|
-
return validation;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function main() {
|
|
65
|
-
const state = createRuntimeState();
|
|
66
|
-
const plan = buildPricingExperimentPlan(state);
|
|
67
|
-
const summary = summarizePricingExperimentPlan(state);
|
|
68
|
-
|
|
69
|
-
assert.strictEqual(plan.experiment_plan_version, "xytara-pricing-experiment-plan-v1", "pricing experiment plan version mismatch");
|
|
70
|
-
assert.strictEqual(plan.allow_experiment_launch, false, "empty state must not allow pricing experiments");
|
|
71
|
-
assert.strictEqual(plan.experiment_state, "blocked_collect_more_live_data", "empty state experiment gate mismatch");
|
|
72
|
-
assert.strictEqual(plan.required_minimum_live_sample.quote_count, 100, "quote sample floor mismatch");
|
|
73
|
-
assert.strictEqual(plan.required_minimum_live_sample.payment_ledger_count, 20, "payment sample floor mismatch");
|
|
74
|
-
assert.strictEqual(plan.required_minimum_live_sample.execution_transaction_count, 20, "execution sample floor mismatch");
|
|
75
|
-
assert.strictEqual(plan.candidate_experiments.length >= 3, true, "candidate experiments missing");
|
|
76
|
-
assert.strictEqual(
|
|
77
|
-
plan.candidate_experiments.every((entry) => entry.allowed_now === false),
|
|
78
|
-
true,
|
|
79
|
-
"candidate experiments should be blocked while sparse"
|
|
80
|
-
);
|
|
81
|
-
assert.strictEqual(
|
|
82
|
-
plan.blocked_actions.includes("start_price_ab_test_from_sparse_signals"),
|
|
83
|
-
true,
|
|
84
|
-
"sparse-signal blocked action missing"
|
|
85
|
-
);
|
|
86
|
-
assert.strictEqual(summary.category, "machine-commerce-pricing-experiment-plan-summary", "summary category mismatch");
|
|
87
|
-
assert.strictEqual(summary.allow_experiment_launch, false, "summary experiment launch guard mismatch");
|
|
88
|
-
assert.strictEqual(summary.deterministic_rejection_code_count >= 9, true, "pricing rejection code count missing");
|
|
89
|
-
|
|
90
|
-
assertRejected(plan, buildValidLaunchRequest(plan.candidate_experiments[0]), "pricing_sample_too_sparse");
|
|
91
|
-
assertRejected(plan, { experiment_id: "unknown_experiment" }, "experiment_not_registered");
|
|
92
|
-
|
|
93
|
-
const matureState = createRuntimeState();
|
|
94
|
-
populateMaturePricingState(matureState);
|
|
95
|
-
const maturePlan = buildPricingExperimentPlan(matureState);
|
|
96
|
-
const matureCandidate = maturePlan.candidate_experiments[0];
|
|
97
|
-
const validLaunchRequest = buildValidLaunchRequest(matureCandidate);
|
|
98
|
-
const validLaunch = validatePricingExperimentLaunchRequest(maturePlan, validLaunchRequest);
|
|
99
|
-
assert.strictEqual(maturePlan.allow_experiment_launch, true, "mature state should allow operator-reviewed experiments");
|
|
100
|
-
assert.strictEqual(validLaunch.launch_allowed, true, "valid mature launch request should pass");
|
|
101
|
-
assert.deepStrictEqual(validLaunch.rejection_codes, [], "valid launch request must not carry rejection codes");
|
|
102
|
-
|
|
103
|
-
assertRejected(maturePlan, { ...validLaunchRequest, operator_approval_ref: null }, "operator_approval_missing");
|
|
104
|
-
assertRejected(maturePlan, { ...validLaunchRequest, baseline_metrics_ref: null }, "baseline_metrics_missing");
|
|
105
|
-
assertRejected(maturePlan, { ...validLaunchRequest, rollback_trigger_thresholds: {} }, "rollback_trigger_thresholds_missing");
|
|
106
|
-
assertRejected(maturePlan, { ...validLaunchRequest, public_checkout_copy_review_ref: null }, "public_checkout_copy_review_missing");
|
|
107
|
-
assertRejected(maturePlan, { ...validLaunchRequest, post_experiment_review_window_days: 0 }, "post_experiment_review_window_missing");
|
|
108
|
-
assertRejected(maturePlan, { ...validLaunchRequest, target_surface: "wrong_surface" }, "target_surface_mismatch");
|
|
109
|
-
|
|
110
|
-
const output = {
|
|
111
|
-
ok: true,
|
|
112
|
-
product: "xytara",
|
|
113
|
-
category: "xytara-pricing-experiment-plan-verification",
|
|
114
|
-
status: "experiment_plan_blocks_sparse_signal_and_malformed_launch_requests",
|
|
115
|
-
candidate_experiment_count: plan.candidate_experiments.length,
|
|
116
|
-
launch_requirement_count: plan.launch_requirements.length,
|
|
117
|
-
deterministic_rejection_code_count: plan.deterministic_rejection_codes.length,
|
|
118
|
-
adversarial_case_count: 8,
|
|
119
|
-
boundary: plan.boundary
|
|
120
|
-
};
|
|
121
|
-
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
main();
|