Skip to content

Backstage tab: a component's annotation picks its slice of the graph #1076

Closed

Description

@lex00

An "Infrastructure" tab on a component's page in Backstage that draws the Terraform roots, and later the workloads and releases, belonging to that component, with a link to the whole estate. It is frontend only and reads a published graph.json, so the portal needs no checkout or cloud credentials. Filed here under a label until behold-surfaces exists. Part of #1049, phase 2.

Today

  • Backstage 1.49.0 made the new frontend system the default for new apps. @backstage/frontend-plugin-api is 0.18.2, and the latest release is 1.56.5 (2026-11-12).
  • New system: EntityContentBlueprint (path, title, loader, group, icon, routeRef, filter) under an ./alpha export. Legacy apps wire tabs with <EntityLayout.Route>.
  • No well-known infrastructure annotation exists. Plugins define their own: backstage.io/kubernetes-id, backstage.io/kubernetes-namespace, argocd/app-name, terraform/workspaces.
  • proxy.endpoints takes headers, so a private bucket needs no backend code. A frontend-only plugin with both exports works in Backstage, Spotify Portal and Red Hat Developer Hub.
  • The TechDocs publisher serves HTML as text/plain, so the graph cannot be hosted in the TechDocs bucket.

Change

  • One npm package (name to decide), frontend only. Default export: a legacy createPlugin with an EntityInfrastructureContent component. ./alpha: createFrontendPlugin with an EntityContentBlueprint whose filter shows the tab only on entities that resolve to a slice.
  • Config: a default export URL and proxy path. behold.intentius.io/export-url on an entity overrides it.
  • Resolve the slice, first match wins: behold.intentius.io/roots (comma list of root box ids in graph.json); then terraform/workspaces, backstage.io/kubernetes-id and backstage.io/kubernetes-namespace matched against node owner hints. The Kubernetes ones match only once Kubernetes kinds draw (Kubernetes kinds, helm-chart and cloudformation in CONTRACT_READ_KINDS; pass --detail #1056 and phase 3).
  • Fetch graph.json through the proxy, cut it with cutAround seeded by the boxes, and post the cut to the single-file viewer in an iframe.
  • A test app on each frontend system.

Done when

  • On the new frontend system, a component annotated behold.intentius.io/roots: <root> shows a tab drawing only that root and its neighbours from a published example-terraform-estate graph.json.
  • The same works in a legacy app through <EntityLayout.Route>.
  • A component with no matching annotation shows no tab.
  • An export in a private bucket loads through proxy.endpoints with no backend plugin.

Depends on

"Cut: around one resource or root", "Single-file viewer build", "Export writes graph.json and the single-file viewer", and a host for it ("Pages publication template" or --publish).

Not in this issue

Directory listing and Red Hat Developer Hub packaging. A selector annotation and spec.owner mapping. A backend that reads live.

Activity

  1. added
    wave:2
    epic:surfaces
    on Nov 15, 2026
  2. lex00 commented on Nov 15, 2026

    @lex00
    ContributorAuthor

    Progress on the Backstage tab. The viewer checks ran. The tab itself is not part of this work.

    Done when:

    • On the new frontend system, an annotated component shows a tab with its root and the neighbours. Not built.
    • The same works in a legacy app through <EntityLayout.Route>, which is also unbuilt.
    • No tab shows for a component with no matching annotation, since there is no tab yet.
    • An export in a private bucket loads through proxy.endpoints. Nothing here tests that.

    The viewer checks used headless Chrome and the single-file viewer built from behold main with pinhole 0.6.0. The viewer builds now, and src/viewer/viewer-browser.test.ts passes with 3 tests. The graph was the sandbox's published https://intentius.io/behold-sandbox/graph.json.

    • With ?src=graph.json the viewer draws all 9 cards.
    • With ?src=graph.json&focus=behold-sandbox/app it lights 3 cards and dims the other 6. Focus dims and does not remove, so a tab that wants one root's cards has to cut the document first, as the issue plans.
    • A page on another origin that posts a behold:graph message to the framed viewer receives behold:ready and then behold:drawn with 9 cards.

    The tab will meet one oddity. The service[0] and service[1] cards of the app root come from a resource with count. They are drawn in the parent box stack:behold-sandbox, not in stack:behold-sandbox/app, so a focus on the root does not light them.

  3. lex00 commented on Nov 16, 2026

    @lex00
    ContributorAuthor

    The Backstage tab is built and now checked in two scratch Backstage 1.56.0 apps, one on the new frontend system and one legacy. Both read the public sandbox export in headless Chrome. The plugin was copied from surfaces/backstage-plugin-behold into each app by e2e/install-into-app.sh. Nothing was published.

    Done when:

    • On the new frontend system, an annotated component shows a tab with its root and the neighbours. The annotation behold.intentius.io/roots: behold-sandbox/app gave an Infrastructure tab with the 3 cards of that root and 2 edges. Naming the card behold-sandbox/app/random_password.db gave that card and its neighbour db_credentials with 1 edge.
    • The same works in a legacy app through <EntityLayout.Route>. The same two components gave the same text and cards.
    • No tab shows for a component with no matching annotation, in both apps.
    • An export in a private bucket loads through proxy.endpoints. A local server answered 401 without a bearer token. proxy.endpoints./behold added the header, and the tab read http://localhost:7007/api/proxy/behold/graph.json with a 200.

    I also ran the viewer path. With behold.html from npm run build:viewer beside graph.json on a local server, the tab opens the viewer in an iframe and answers its behold:ready with the cut. The viewer drew the 3 cards of the cut and no others. The sandbox's own Pages site has no behold.html, so against it the tab draws the cut itself.

    The cut leaves out the null_resource.service[0] and [1] cards of the app root. A resource with count is drawn in the parent box stack:behold-sandbox, so they are not in the root's box. The folded null_resource ×3 card stays. This is in the README, and src/slice.test.ts now runs the cut over the sandbox's graph.json.

    The sandbox has no edge between its two roots, so a neighbour in another root cannot show against it. src/slice.test.ts keeps a test with one added across roots.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:surfaceswave:2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions