Add Daml code-snippet modules for Canton Network documentation - #1
Open
8bitpal wants to merge 1 commit into
Open
Add Daml code-snippet modules for Canton Network documentation#18bitpal wants to merge 1 commit into
8bitpal wants to merge 1 commit into
Conversation
29 Daml code snippets from docs.canton.network wrapped into 15 compilable modules in sdk/docs/source/sdk/docs-canton-network/code-snippets/. Added daml_test Bazel target (docs-canton-network-daml-test) in BUILD.bazel. All modules compile successfully with dpm build (SDK 3.4.10).
coldice
pushed a commit
that referenced
this pull request
Jul 10, 2026
…23127) ## Summary - Default integration test output now hides passing tests via Tasty's `HideSuccesses` option, applied in the shared integration-lib so it covers all LF version targets (v21, v22, v23, v2dev). - Override with `TASTY_HIDE_SUCCESSES=False` to restore full output. ## Verification **All tests pass** — output is a single summary line: ``` All 892 tests passed (122.70s) ``` **Deliberate failure** (`assert False` added to `ContractKeys.daml`) — only the failing test is printed with full diagnostics: ``` Failed with status: UNHANDLED_EXCEPTION/DA.Exception.AssertionFailed:AssertionFailed: Assertion failed Using Canton Error Category InvalidGivenCurrentSystemStateOther Ledger time: 1970-01-01T00:00:00Z Committed transactions: TX 0 1970-01-01T00:00:00Z (ContractKeys:38:22) #0:0 │ consumed by: #1:0 │ referenced by #1:0 │ disclosed to (since): 'Alice' (0), 'Bank' (0) └─> 'Bank' creates ContractKeys:AccountInvitation with account = (ContractKeys:Account with bank = 'Bank'; accountHolder = 'Alice'; accountNumber = (DA.Types:Tuple2 with _1 = "CH"; _2 = 123)) TX 1 1970-01-01T00:00:00Z (ContractKeys:40:19) #1:0 │ disclosed to (since): 'Alice' (1), 'Bank' (1) └─> 'Alice' exercises Accept on #0:0 (ContractKeys:AccountInvitation) children: #1:1 │ disclosed to (since): 'Alice' (1), 'Bank' (1) └─> 'Alice' and 'Bank' create ContractKeys:Account with bank = 'Bank'; accountHolder = 'Alice'; accountNumber = (DA.Types:Tuple2 with _1 = "CH"; _2 = 123) Wrong number of diagnostics, expected 0, but got 1 Use -p '/ContractKeys.daml.Check diagnostics/' to rerun this test only. 1 out of 892 tests failed (103.92s) ``` ## Test plan - [x] Ran `bazel run //compiler/damlc/tests:integration-v2dev` — all 892 tests pass - [x] Introduced intentional failure in `ContractKeys.daml`, confirmed only the failure is shown with full diagnostics - [x] Reverted the test file Signed-off-by: Roger Bosman <roger.bosman@digitalasset.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
15 compilable Daml modules wrapping 29 code snippets from docs.canton.network. These ensure that Daml code examples shown in the documentation are compilation-checked by the existing
daml_testinfrastructure.What's included
.damlmodules insdk/docs/source/sdk/docs-canton-network/code-snippets/docs-canton-network-daml-test) added tosdk/docs/BUILD.bazeldaml.yamlfor local validation withdpm buildModule list
DocsCN_AppdevDeepDivesCompositionMultiPartyDocsCN_AppdevDeepDivesPrivacyModelDocsCN_AppdevModulesM1MentalModelsDocsCN_AppdevModulesM2MigrationChecklistDocsCN_AppdevModulesM2MultiPartyWorkflowsDocsCN_AppdevModulesM2SmartContractParadigmDocsCN_AppdevModulesM3DesignPatternsDocsCN_AppdevModulesM3LanguageFundamentalsDocsCN_AppdevModulesM4BackendDevDocsCN_AppdevModulesM7PerformanceDocsCN_AppdevReferenceDamlLanguageReferenceDocsCN_AppdevTroubleshootingGuideDevelopmentIssuesDocsCN_OverviewLearnLedgerModelDocsCN_OverviewLearnPrivacyModelDocsCN_SdksToolsCliToolsDamlScriptHow it works
The Bazel target uses the same pattern as existing doc snippet tests:
New
.damlfiles added tocode-snippets/are auto-discovered by the glob.Validation
All modules compile successfully with
dpm build(SDK 3.4.10). Fragment snippets (choice bodies, expressions) are included as comments within wrapper templates for documentation traceability.