Skip to content

test(sweettest): NDO Layer 0 test suite (#76)#86

Open
Soushi888 wants to merge 2 commits intodevfrom
test/76-ndo-layer0-sweettest
Open

test(sweettest): NDO Layer 0 test suite (#76)#86
Soushi888 wants to merge 2 commits intodevfrom
test/76-ndo-layer0-sweettest

Conversation

@Soushi888
Copy link
Copy Markdown
Collaborator

@Soushi888 Soushi888 commented Apr 8, 2026

Intent

Implements the Sweettest integration suite for NondominiumIdentity (NDO Layer 0) as specified in issue #76. The NDO Layer 0 implementation is feature-complete (PRs #80, #82, #84 merged) and this PR adds the missing test coverage.

Changes

New files:

  • dnas/nondominium/tests/src/nondominium/mod.rs — module grouping for all NDO-related test modules (future ndo_layer1, ndo_layer2 go here)
  • dnas/nondominium/tests/src/nondominium/ndo_layer0/mod.rs — 8 integration tests with local mirror types

Modified files:

  • dnas/nondominium/tests/Cargo.toml — adds [[test]] name = "nondominium" binary
  • dnas/nondominium/tests/src/lib.rs — adds pub mod nondominium

Test coverage (8 scenarios)

Test What it verifies
ndo_create_and_get Stable action hash as Layer 0 identity; get_ndo resolves update chain
ndo_lifecycle_forward_progression Monotonic Ideation→Spec→Dev; immutable fields unchanged (REQ-NDO-L0-04)
ndo_invalid_lifecycle_transitions Step-skipping and Hibernating self-loop rejected (REQ-NDO-LC-04)
ndo_hibernation_cycle hibernation_origin set on suspend, cleared on resume
ndo_deprecated_requires_successor Coordinator pre-flight rejects missing successor_ndo_hash (REQ-NDO-LC-06)
ndo_deprecation_with_successor Full Deprecated→EndOfLife path; tombstone guarantee (REQ-NDO-L0-06)
ndo_cross_agent_discovery Two agents, await_consistency, get_all_ndos / get_ndos_by_lifecycle_stage / get_my_ndos
ndo_lifecycle_anchor_moves_on_update Mutable lifecycle anchor vs immutable nature/regime anchors (issue #75)

Decisions

  • Local mirror types instead of importing zome crates: test binary is not WASM-compiled and cannot import zome_resource_integrity. Follows the pattern established in person/mod.rs.
  • call_fallible for validation tests: used instead of #[should_panic] to verify specific error conditions cleanly.
  • Known limitations documented via TODO comments: direct immutable-field mutation tests and delete-enforcement tests require a future test-only coordinator function. Documented inline as // TODO(#76-immutability).
  • nondominium/ module grouping: NDO Layer 1 and Layer 2 tests will be added as nondominium/ndo_layer1/mod.rs etc., all under the same nondominium test binary.

How to test

nix develop
bun run build:happ
CARGO_TARGET_DIR=target/native-tests cargo test --test nondominium

Run a single scenario:

CARGO_TARGET_DIR=target/native-tests cargo test --test nondominium ndo_cross_agent_discovery

Related

Closes #76

Documentation

  • Updated documentation/TEST_COMMANDS.md: refreshed section heading and description to reflect the three active Sweettest binaries; added nondominium test target with NDO Layer 0 run commands.
  • Updated documentation/Testing_Infrastructure.md: updated "Current status" and Sweettest directory tree to include person/ and nondominium/ndo_layer0/ modules.

Open with Devin

Implements the Sweettest integration suite for NondominiumIdentity (NDO Layer 0)
as specified in issue #76. Covers 8 test scenarios across creation, retrieval,
lifecycle progression, hibernation, deprecation, discovery anchors, and validation.

## New files
- dnas/nondominium/tests/src/nondominium/mod.rs — module grouping for NDO test modules
- dnas/nondominium/tests/src/nondominium/ndo_layer0/mod.rs — 8 integration tests

## Modified files
- dnas/nondominium/tests/Cargo.toml — add [[test]] nondominium binary
- dnas/nondominium/tests/src/lib.rs — add pub mod nondominium

## Test coverage
1. ndo_create_and_get — creation and retrieval via stable action hash
2. ndo_lifecycle_forward_progression — monotonic Ideation→Specification→Development;
   verifies immutable fields unchanged after update (REQ-NDO-L0-04)
3. ndo_invalid_lifecycle_transitions — step-skipping and Hibernating self-loop rejected
4. ndo_hibernation_cycle — hibernation_origin set on suspend, cleared on resume
5. ndo_deprecated_requires_successor — coordinator pre-flight rejects missing hash
6. ndo_deprecation_with_successor — full Deprecated→EndOfLife path; tombstone guarantee
7. ndo_cross_agent_discovery — two agents, await_consistency, get_all_ndos / by_stage / get_my_ndos
8. ndo_lifecycle_anchor_moves_on_update — mutable stage anchor vs immutable nature/regime anchors

## Known limitations (TODOs in test file)
- Direct mutation of immutable fields (name, property_regime, resource_nature) cannot
  be triggered through update_lifecycle_stage; requires a future test-only coordinator fn
- Delete enforcement not testable without a delete_ndo coordinator function
@Soushi888 Soushi888 marked this pull request as ready for review April 8, 2026 01:40
devin-ai-integration[bot]

This comment was marked as resolved.

… tests

- TEST_COMMANDS.md: update heading from scaffold to primary, list 3 active
  [[test]] binaries (misc/person/nondominium), add --test nondominium commands
- Testing_Infrastructure.md: update current-status sentence and Sweettest
  directory tree to include person/ and nondominium/ndo_layer0/ modules

Addresses documentation gap flagged in PR #86 review.
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 8 additional findings in Devin Review.

Open in Devin Review

@@ -1 +1,2 @@
pub mod common;
pub mod nondominium;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 pub mod nondominium in lib.rs re-introduces a previously fixed bug causing test binary self-import

Adding pub mod nondominium; to dnas/nondominium/tests/src/lib.rs re-introduces the exact same problem that was already identified and fixed for the person module in commit bd059b0 ("fix(sweettest): remove person from lib.rs — test binaries are standalone"). That commit's message explicitly states: "Adding pub mod person to lib.rs caused the lib to try to self-import, which fails. Only common/ belongs in lib.rs." The nondominium module is a [[test]] binary target (dnas/nondominium/tests/Cargo.toml:31-33), not a library module. Declaring it in lib.rs causes the library crate to include the test module, which imports back from the library via use nondominium_sweettest::common::*; (dnas/nondominium/tests/src/nondominium/ndo_layer0/mod.rs:20), creating the same self-import / double-compilation issue. At best this causes the 8 NDO tests to run twice under cargo test -p nondominium_sweettest; at worst it causes compilation failures as seen with the person module.

Suggested change
pub mod nondominium;
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Sweettest] NDO Layer 0 test suite

1 participant