Skip to content

Conversation

@mariusae
Copy link
Member

@mariusae mariusae commented Nov 12, 2025

Stack from ghstack (oldest at bottom):

We formalize a resource controller behavior:


/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);

Anything that is a controller should behave-as a resource::Controller.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing Resource for any mesh:

impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}

This resolves to the same set of bindings and aliases (except we use resource::Controller<Mesh> rather than mesh::Controller<Mesh>) -- the existing behaviors continue to assert.

Differential Revision: D86905562

NOTE FOR REVIEWERS: This PR has internal Meta-specific changes or comments, please review them on Phabricator!

…ms of it

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 12, 2025
…ms of it

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

ghstack-source-id: 322844163
Pull Request resolved: #1841
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 12, 2025
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 12, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
ghstack-source-id: 322864676
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 12, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 322871728

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 13, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 322923564

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 13, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 323030040

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 13, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 323103587

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 14, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 323206577

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 14, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 323217208

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 14, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 323217472

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 14, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 323321906

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
…Mesh in terms of it"

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!

[ghstack-poisoned]
mariusae added a commit that referenced this pull request Nov 14, 2025
…ms of it

Pull Request resolved: #1841

We formalize a resource controller behavior:

```

/// A trait that bundles a set of types that together define a resource.
pub trait Resource {
    /// The spec specification for this resource.
    type Spec: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;

    /// The state for this resource.
    type State: Named + Serialize + for<'de> Deserialize<'de> + Send + Sync + std::fmt::Debug;
}

// A behavior defining the interface for a mesh controller.
hyperactor::behavior!(
    Controller<R: Resource>,
    CreateOrUpdate<R::Spec>,
    GetState<R::State>,
    Stop,
);
```

Anything that is a controller should behave-as a `resource::Controller`.

We then formalize the mesh controller behavior as a specialization of a resource controller, by implementing `Resource` for any mesh:

```
impl<M: Mesh> Resource for M {
    type Spec = Spec<M::Spec>;
    type State = State<M::State>;
}
```

This resolves to the same set of bindings and aliases (except we use `resource::Controller<Mesh>` rather than `mesh::Controller<Mesh>`) -- the existing behaviors continue to assert.
ghstack-source-id: 323322438

Differential Revision: [D86905562](https://our.internmc.facebook.com/intern/diff/D86905562/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D86905562/)!
@meta-codesync meta-codesync bot closed this in cc7ccf8 Nov 14, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 14, 2025

This pull request has been merged in cc7ccf8.

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants