daml/compatibility/BUILD
Stephen Compall a1d8e8dc33
replace commands-in-flight argument to trigger rule with getCommandsInFlight action (#7600)
* add getCommandsInFlight as a TriggerA action

* immediately update commandsInFlight on emitCommands

- delay until the rule had returned made sense before submitCommands was launched
  immediately; this also makes `getCommandsInFlight` more sensible

* remove commands-in-flight argument from high-level Trigger rule

CHANGELOG_BEGIN
- [Triggers] The "commands in flight" or ``Map CommandId [Command]`` argument has been
  removed from high-level trigger ``rule`` functions; instead, the current
  commands-in-flight can be retrieved with the new ``getCommandsInFlight`` function, which
  can be done immediately at the beginning of the rule's ``do`` block to preserve exact
  existing trigger behavior.
  See `issue #7600 <https://github.com/digital-asset/daml/pull/7600>`__.
CHANGELOG_END

* remove commands-in-flight argument from trigger tests

* update doc examples and copy in compatibility

- compatibility change will most likely entail another flag day in compatibility tests,
  replacing last_pre_7456_trigger_version

* update doc text for getCommandsInFlight

* test that getCommandsInFlight gets updated during the rule

* flag day for trigger compatibility tests

sdk-version: 1.7.0-snapshot.20201006.5358.0.0c1cadcf
File:     src/CopyTrigger.daml
Hidden:   no
Range:    55:11-55:19
Source:   typecheck
Severity: DsError
Message:
  src/CopyTrigger.daml:55:12: error:
  • Couldn't match type ‘TriggerA ()’ with ‘() -> TriggerA ()’
  Expected type: Party
-> DA.Next.Map.Map CommandId [Command] -> () -> TriggerA ()
  Actual type: Party -> ACS -> () -> TriggerA ()
  • In the ‘rule’ field of a record
  In the expression:
  Trigger
  {initialize = \ _acs -> (), updateState = \ _acs _message () -> (),
  rule = copyRule, registeredTemplates = AllInDar, heartbeat = None}
  In an equation for ‘copyTrigger’:
  copyTrigger
  = Trigger
  {initialize = \ _acs -> (), updateState = \ _acs _message () -> (),
  rule = copyRule, registeredTemplates = AllInDar, heartbeat = None}

* match docs on TriggerAState to current usage of these fields

* remove emittedCommands, as commandsInFlight is now kept up-to-date

* zoomed from where?

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-10-08 12:03:56 -04:00

156 lines
4.2 KiB
Python

# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("@os_info//:os_info.bzl", "is_windows")
load("//bazel_tools:testing.bzl", "create_daml_app_codegen", "create_daml_app_dar", "sdk_platform_test")
load(
"//bazel_tools/daml_script:daml_script.bzl",
"daml_script_dar",
"daml_script_test",
)
load(
"//bazel_tools/daml_trigger:daml_trigger.bzl",
"daml_trigger_dar",
"daml_trigger_test",
)
load(
"//bazel_tools/data_dependencies:data_dependencies.bzl",
"data_dependencies_coins",
"data_dependencies_upgrade_test",
)
load("//bazel_tools:versions.bzl", "versions")
load("//sandbox-migration:util.bzl", "migration_test")
load("//:versions.bzl", "platform_versions", "sdk_versions", "stable_versions")
load("@daml//bazel_tools:haskell.bzl", "da_haskell_binary")
config_setting(
name = "ghci_data",
define_values = {
"ghci_data": "True",
},
)
[
sh_binary(
name = "sandbox-with-postgres-{}".format(version),
srcs = ["@//bazel_tools:sandbox-with-postgres.sh"],
args = ["sandbox"],
data = [
"@//bazel_tools/client_server/with-postgres:with-postgres-exe",
"@daml-sdk-{}//:daml".format(version),
],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
for version in platform_versions
]
[
[
create_daml_app_dar(sdk_version),
create_daml_app_codegen(sdk_version),
]
for sdk_version in sdk_versions
]
[
sdk_platform_test(
platform_version = platform_version,
sdk_version = sdk_version,
)
for sdk_version in sdk_versions
for platform_version in platform_versions
]
[
daml_script_dar(sdk_version)
for sdk_version in sdk_versions
]
[
daml_script_test(
compiler_version = sdk_version,
runner_version = platform_version,
)
for sdk_version in sdk_versions
for platform_version in platform_versions
# Test that the DAML script runner can run DARs built with an older SDK
# version. I.e. where the runner version is at least the SDK version or
# more recent.
if versions.is_at_least(sdk_version, platform_version)
]
last_pre_7600_trigger_version = "1.7.0-snapshot.20201006.5358.0.0c1cadcf"
[
daml_trigger_dar(sdk_version)
for sdk_version in sdk_versions
if not versions.is_at_most(last_pre_7600_trigger_version, sdk_version)
]
[
daml_trigger_test(
compiler_version = sdk_version,
runner_version = platform_version,
)
for sdk_version in sdk_versions
for platform_version in platform_versions
# Test that the DAML trigger runner can run DARs built with an older SDK
# version. I.e. where the runner version is at least the SDK version or
# more recent.
if (not versions.is_at_most(last_pre_7600_trigger_version, sdk_version)) and
versions.is_at_least(sdk_version, platform_version)
]
# We have two migration tests: migration-stable runs through all stable releases
# including current HEAD. migration-all includes snapshot releases.
migration_test(
name = "migration-stable",
timeout = "long",
# Exclusive due to hardcoded postgres ports.
tags = [
"exclusive",
"head-quick",
],
versions = stable_versions,
) if not is_windows else None
migration_test(
name = "meta-migration-test",
tags = [
"exclusive",
"manual",
],
versions = [
"1.0.0",
"0.0.0",
],
)
migration_test(
name = "migration-all",
timeout = "long",
# Exclusive due to hardcoded postgres ports.
tags = ["exclusive"],
versions = platform_versions,
) if not is_windows else None
[
data_dependencies_coins(
sdk_version = sdk_version,
)
for sdk_version in sdk_versions
]
[
data_dependencies_upgrade_test(
new_sdk_version = new_sdk_version,
old_sdk_version = old_sdk_version,
)
for old_sdk_version in sdk_versions
for new_sdk_version in sdk_versions
# Tests that we can build a package with a newer SDK version that has
# data-dependencies on packages built with an older SDK version.
if versions.is_at_least(old_sdk_version, new_sdk_version)
]