Skip to content

FE-1814: List metrics in the Entities pane and edit them in the properties panel - #10632

Draft
kube wants to merge 5 commits into
cf/fe-2424-rename-a-net-objects-id-in-the-editorfrom
cf/fe-1814-metrics-in-entities-and-edit
Draft

kube wants to merge 5 commits into
cf/fe-2424-rename-a-net-objects-id-in-the-editorfrom
cf/fe-1814-metrics-in-entities-and-edit

Conversation

@kube

@kube kube commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Metrics are saved with the model, and the editor has no place that lists them. A reader of a net cannot see which metrics it defines without opening Simulate.

This PR lists the model's metrics in the Entities pane and makes a metric an item the properties panel edits. A Metrics group shows them for the root net, with add and delete. Selecting one opens its ID, Description and Code.

Links

Changes

Core

  • metric joins the selection vocabulary

    selectionItemTypes and SelectionItem carry it, so a PanelTarget can name a metric.

  • deleteItemsByIds deletes metrics

    A metric belongs to the document, so the delete reaches it whichever net targetComponentId names.

  • DEFAULT_METRIC_CODE is exported

    One starting body for a metric added in the Entities pane and for a custom metric of an experiment.

Editor

  • Metrics group in the Entities pane

    Listed for the root net only: a metric reads root places. A component shows no Metrics group.

  • Add from the group header, delete from the row menu or with the Delete key

    A metric added there takes the ID metric_N with the first number the root net has free.
    It is selected at once.

  • Metric properties panel

    ID, Description and Code, committed as for the other entities.
    An ID the net has is refused with a message under the field.

  • Metric code is checked as you type

    The editor runs a language session named after the metric, so completions and errors match the Simulate drawer's.

  • Metrics appear in search and in code navigation

Brunch

  • A reflection that names a metric selects it in the editor

    netElementKinds takes metric from the selection vocabulary.

Known issues

  • Metric errors show in the code editor only

    The Diagnostics tab has no owner for a metric yet.

  • Simulate and Actual modes show no Entities pane

    A metric is edited there through the Simulate drawer.

Next steps

  • Constraints as model entities, listed beside metrics
  • A dedicated syntax for metrics and constraints, with its own checking and completion
  • An editor for that syntax that mixes typed text with structured input

Test coverage

  • actions.test.ts:

    deleteItemsByIds removes one metric of two, with a component as the target.

  • entity-groups.test.ts:

    Metrics group comes last with the given metrics, and is absent where none are passed.

  • item-type-lookup.test.ts:

    A metric id resolves to metric.

  • brunch-ledger-selection.test.ts:

    A metric address becomes a selection, and a scenario address has none.

  • Headless walk of the preview:

    Add, rename, refusal of a taken ID and delete with the key, with no console error.

How to test

  • Open Petrinaut preview on Vercel
  • Menu > Load example > any model
  • Entities > Metrics > +

    Expect a metric_1 row, selected, and its properties on the right

  • Type another ID in Properties > ID, press Tab

    Expect the row and the panel title to follow

  • Add a second metric and type the first one's ID

    Expect an error under ID and the row unchanged

  • Edit Code so it reads a place that does not exist

    Expect an error marker in the editor

  • Row menu > Delete

    Expect the row gone and the panel closed

  • Simulate > Timeline > Metric picker

    Expect the metrics made in Edit

@kube kube self-assigned this Nov 25, 2026
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Dec 3, 2026 7:47pm UTC
petrinaut Ready Ready Preview Dec 3, 2026 7:47pm UTC
petrinaut-docs Ready Ready Preview Dec 3, 2026 7:47pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Dec 3, 2026 7:47pm UTC

Request Review

@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.40%. Comparing base (e86ce78) to head (2719070).

Additional details and impacted files
@@                                Coverage Diff                                @@
##           cf/fe-2424-rename-a-net-objects-id-in-the-editor   #10632   +/-   ##
=================================================================================
  Coverage                                             70.40%   70.40%           
=================================================================================
  Files                                                  2126     2126           
  Lines                                                225388   225388           
  Branches                                               9784     9784           
=================================================================================
  Hits                                                 158674   158674           
  Misses                                                64671    64671           
  Partials                                               2043     2043           
Flag Coverage Δ
apps.hash-ai-worker-ts 9.72% <ø> (ø)
apps.hash-api 25.25% <ø> (ø)
local.hash-backend-utils 28.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kube
kube removed this pull request from stack #10673 December 3, 2026 19:34
@kube
kube changed the base branch from main to cf/fe-2424-rename-a-net-objects-id-in-the-editor December 3, 2026 19:34
@kube
kube force-pushed the cf/fe-1814-metrics-in-entities-and-edit branch from 1052e5f to 2719070 Compare December 3, 2026 19:34
@kube
kube added this pull request to stack #10711 December 3, 2026 19:34

This branch was successfully deployed

4 active (1 outdated) and 1 inactive (outdated) deployments
Preview – hash — 27190700 Deployed Dec 3, 2026 by vercel[bot]
Preview – petrinaut — 27190700 Deployed Dec 3, 2026 by vercel[bot]
Preview – petrinaut-docs — 27190700 Deployed Dec 3, 2026 by vercel[bot]
Preview – hashdotdesign-tokens — 1052e5ff Deployed Dec 2, 2026 by vercel[bot]
pull-request — ef812f16 Deployed Nov 26, 2026 by kube via Sourcemaps (@apps/hash-ai-worker-ts) #46462
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant