← Back to Pull requests

feat: expose consistent workbook and template state controls #1033

Open
drake-nominal opened this pull request with 331 lines diff across 5 files
View on GitHub
drake-nominal drake-nominal commented on Oct 08, 2026 03:52 UTC
Author

Adds publish() and unpublish() to workbooks and templates, is_locked to workbook updates, and is_published to template updates and creation.

Refreshes cached metadata from state-query and update responses without extra fetches.

Diff: 331 lines (+285 / -46) across 5 files Reviewer: stefanv Review duration: 10954m
All Vouch review confidence checks passed
Residual risk 0.06 = Change Risk (0.44) × (1 − Review Confidence (0.87)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 331 lines diff across 5 files
0.44
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 5 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
86%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.347
Real PR Conversation Timeline
11 items
devin-ai-integration[bot] devin-ai-integration[bot] commented on Oct 08, 2026 03:53 UTC
Reviewer

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

<!-- devin-review-badge-begin -->
<a href="https://app.devin.ai/review/nominal-io/nominal-client/pull/1033" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

<!-- devin-review-summary -->

stefanv stefanv commented on code on Oct 08, 2026 07:52 UTC
Code Review
nominal/core/client.py:1
@@ -1798,6 +1798,7 @@ def create_workbook_template(
         labels: list[str] | None = None,
         properties: dict[str, str] | None = None,
         commit_message: str | None = None,
+        is_published: bool = False,

Just to ensure I understand correctly: workbook templates can be published but not locked?

stefanv stefanv commented on code on Oct 08, 2026 07:52 UTC
Code Review
nominal/core/workbook.py:1
@@ -134,11 +134,16 @@ def update(
         properties: Mapping[str, str] | None = None,
         labels: Sequence[str] | None = None,
         is_draft: bool | None = None,
+        is_locked: bool | None = None,
+        is_published: bool | None = None,
     ) -> Self:
         """Replace workbook metadata.
         Updates the current instance, and returns it.
 
         Only the metadata passed in will be replaced, the rest will remain untouched.
+        State flags preserve their current values when None. `is_published` is the inverse of `is_draft`;

Two flags that encode the same information?

stefanv stefanv commented on code on Oct 08, 2026 07:53 UTC
Code Review
nominal/core/workbook.py:1
@@ -134,11 +134,16 @@ def update(
         properties: Mapping[str, str] | None = None,
         labels: Sequence[str] | None = None,
         is_draft: bool | None = None,
+        is_locked: bool | None = None,
+        is_published: bool | None = None,
     ) -> Self:
         """Replace workbook metadata.
         Updates the current instance, and returns it.
 
         Only the metadata passed in will be replaced, the rest will remain untouched.
+        State flags preserve their current values when None. `is_published` is the inverse of `is_draft`;
+        provide only one of these two flags. `is_locked` controls whether the workbook can be edited.
+        For example, `workbook.update(is_published=True, is_locked=True)` publishes and locks it in one request.
 

Args docstring section, or left out on purpose because of all the flags?

stefanv stefanv commented on code on Oct 08, 2026 07:54 UTC
Code Review
nominal/core/workbook_template.py:1
@@ -234,9 +237,22 @@ def create_workbook(
         raw_notebook = self._clients.notebook.create(self._clients.auth_header, request)
         return Workbook._from_conjure(self._clients, raw_notebook)
 
+    def publish(self) -> None:
+        """Publish this template, making it visible to other users."""
+        self.update(is_published=True)
+
+    def unpublish(self) -> None:
+        """Unpublish this template."""
+        self.update(is_published=False)

No pull from API here?

stefanv stefanv commented on code on Oct 08, 2026 07:54 UTC
Code Review
nominal/core/workbook_template.py:1
@@ -234,9 +237,22 @@ def create_workbook(
         raw_notebook = self._clients.notebook.create(self._clients.auth_header, request)
         return Workbook._from_conjure(self._clients, raw_notebook)
 
+    def publish(self) -> None:
+        """Publish this template, making it visible to other users."""
+        self.update(is_published=True)

No pull from API here?

drake-nominal drake-nominal commented on code on Oct 08, 2026 13:54 UTC
Code Review
nominal/core/workbook.py:1
@@ -134,11 +134,16 @@ def update(
         properties: Mapping[str, str] | None = None,
         labels: Sequence[str] | None = None,
         is_draft: bool | None = None,
+        is_locked: bool | None = None,
+        is_published: bool | None = None,
     ) -> Self:
         """Replace workbook metadata.
         Updates the current instance, and returns it.
 
         Only the metadata passed in will be replaced, the rest will remain untouched.
+        State flags preserve their current values when None. `is_published` is the inverse of `is_draft`;

is_published was me making this consistent with how it's exposed with workbook templates, but I'll leave that out as a future "ergonomic improvement" alongside actual deprecation of the old flag.

drake-nominal drake-nominal commented on code on Oct 08, 2026 13:55 UTC
Code Review
nominal/core/client.py:1
@@ -1798,6 +1798,7 @@ def create_workbook_template(
         labels: list[str] | None = None,
         properties: dict[str, str] | None = None,
         commit_message: str | None = None,
+        is_published: bool = False,

correct!

drake-nominal drake-nominal commented on code on Oct 08, 2026 13:56 UTC
Code Review
nominal/core/workbook_template.py:1
@@ -234,9 +237,22 @@ def create_workbook(
         raw_notebook = self._clients.notebook.create(self._clients.auth_header, request)
         return Workbook._from_conjure(self._clients, raw_notebook)
 
+    def publish(self) -> None:
+        """Publish this template, making it visible to other users."""
+        self.update(is_published=True)
+
+    def unpublish(self) -> None:
+        """Unpublish this template."""
+        self.update(is_published=False)

under the hood, we can hit the update() api with only the is_published field & then it returns the latest reference to the object & we update our dataclass fields with the response. So there _is_ a pull, though, we can also just set is_published=False before it as it's idempotent.

drake-nominal drake-nominal commented on code on Oct 08, 2026 13:57 UTC
Code Review
nominal/core/workbook_template.py:1
@@ -234,9 +237,22 @@ def create_workbook(
         raw_notebook = self._clients.notebook.create(self._clients.auth_header, request)
         return Workbook._from_conjure(self._clients, raw_notebook)
 
+    def publish(self) -> None:
+        """Publish this template, making it visible to other users."""
+        self.update(is_published=True)

see other

Reviewers
Assignees
drake-nominal drake-nominal
Labels
risk: low confidence: 86.9% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 43.6% (MEDIUM) · Higher = larger blast radius
43.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 86.9% · Lower = rushed or shallow review
86.9%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 5.7% · Safe to merge
5.7%