Compare commits

...

11 Commits

Author SHA1 Message Date
Ashwin Bhatkal
a0ee3afec6 ci(jsci): name the report script's limits and test the slow-test reporter 2026-11-24 13:15:42 +05:30
Ashwin Bhatkal
7dc36792ee ci(flakyci): post the week's flaky jest tests to Slack 2026-11-24 11:53:01 +05:30
Ashwin Bhatkal
f837df1125 ci(jsci): list jest tests over 2 s in the job summary 2026-11-24 11:53:01 +05:30
Tushar Vats
da35d99714 test(frontend): raise jest test timeout to 10s (#13721)
#### Description

- Multi-step `userEvent` tests (open a drawer, click, save, wait for the
refetch) pass Jest's default 5s on busy CI runners and fail with
`Exceeded timeout of 5000 ms`, though nothing is wrong.
- `jsci` failed three times on SigNoz/signoz#13713, a rules-only change,
each time on different tests (`QuickFilters`, `InviteMembers`,
`PricedModelsTab`, `AttributeMappingsTab`).
- Raises the default `testTimeout` to 10s. Tests with their own timeout
keep it; a truly hung test now takes 10s to fail.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 05:58:08 +00:00
Vinicius Lourenço
f955bb952a perf(settings): load each settings and alert details tab when it opens (#13694)
#### Description

Settings and alert details import every tab up front, so opening
Settings downloads billing (chart.js, uPlot, `moment-timezone`), service
accounts (CodeMirror) and every other tab before the one you asked for
renders. Each tab now loads when it opens, using the per-tab loading
state from #13691. Tab URLs, order, permissions and license checks stay
as they are.

Opening Settings goes from 11.76 MB to 10.95 MB on main today (3.19 MB
to 2.95 MB gzipped), and to 2.55 MB (0.77 MB gzipped) once the entry PRs
are in. The first time a tab opens in a session it shows a short spinner
beside the settings menu.

The ingestion page relied on the `.learn-more` style that the MCP server
tab happened to load; it now imports it itself.

Part of #10192

#### Screenshots / Screen Recordings

Opening Settings pages in Storybook, main on the left. The network is
slowed to 1.6 Mbps so the loading state is visible; at 4 Mbps a page
shows in about 0.3 s:


https://github.com/user-attachments/assets/02da6227-5dac-43a2-b6fe-dfd4968a009b

Across the 188 Settings and alert stories, the tabs render the same in
both themes once loaded, apart from a focus ring left on the members
search and a 1px edge in the role JSON panel. The other differences are
toasts and play steps caught at different moments.
2026-11-24 03:57:36 +00:00
Gaurav Tewari
cb0adcc618 refactor(ai-assistant): import assistant types from @signozhq/noz-client (#13526)
Some checks failed
cacheci / tests (push) Has been cancelled
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
#### Description

- AI Assistant DTOs and enums now come from the `@signozhq/noz-client`
package (pinned `1.12.2`) instead of a generated copy in
`src/api/ai-assistant/`. The API spec lives in the assistant repo, so
bumping a package version replaces hand-syncing the files on every
release.
- Deleted `sigNozAIAssistantAPI.schemas.ts` and the unused orval hooks
in `index.ts`. `chat.ts` (REST + SSE client) stays and keeps using
`AIAssistantInstance`.
- Only types and enums are imported, so the package's hooks and
`setGeneratedAPIInstance` are not wired.

#### Issues closed by this PR


https://github.com/orgs/SigNoz/projects/59/views/18?pane=issue&itemId=315100999&issue=SigNoz%7Cnerve-pod%7C677

#### Screenshots / Screen Recordings

#### Additional Information

- The package exports the same schemas as the deleted file, plus
`ReadinessChecksDTODrain`.

---------

Co-authored-by: Gaurav Tewari <tewarig@users.noreply.github.com>
2026-11-23 18:36:19 +00:00
Vinicius Lourenço
b14b634bce perf(web): keep the tab bar while a lazy tab loads (#13691)
#### Description

Pages with tabs (Settings, Logs, Traces, Metrics and others) render them
through `RouteTab`, which mounts only the active tab but receives every
tab's component already imported. To let a page load each tab when it
opens, a tab has to be able to suspend. Each tab pane now has its own
loading boundary, so a tab that is still loading shows a spinner under
the tab bar instead of the whole page turning into one.

Nothing changes on its own: no tab is lazy yet. The pages follow in
separate PRs per owner, and with them and the entry PRs in, opening
Settings goes from 11.76 MB to 2.55 MB (3.19 MB to 0.77 MB gzipped).

The jest setup's `getComputedStyle` fallback now returns a width and
height, since tables mounted inside a lazy pane crashed without them.

Part of #10192

#### Screenshots / Screen Recordings

Settings with its pages loading on demand through this change (the
follow-up PR), in Storybook with the network slowed to 1.6 Mbps, main on
the left:


https://github.com/user-attachments/assets/d22bf877-1ff8-4d25-a4eb-85a0a046998c
2026-11-23 17:48:51 +00:00
Vinicius Lourenço
7ea0d57417 fix(roles): keep the editor loading until the role's grants are in local state (#13671)
Some checks failed
build-staging / staging (push) Has been cancelled
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
cacheci / tests (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
#### Description

Opening a role's JSON view from a link or after a reload
(`/settings/roles/:id/edit?viewMode=json`) could show `[]` instead of
the role's grants, and saving then replaced them with whatever was
typed. It happened whenever the permission check answered before the
role fetch.

The editor reads its value only once, when it mounts, so the page now
stays in its loading state until the fetched role is in local state.
2026-11-23 14:26:30 +00:00
Nikhil Soni
1e08a94ab8 fix: application support for clickhouse 26.8 (#13371)
#### Description

Part of SigNoz/platform-pod#3428.

- Run every integration suite against ClickHouse `26.8.34` (SQLite only,
non-blocking) to catch upgrade issues early.
- Bump the collector to `v0.144.17` for
SigNoz/signoz-otel-collector#990: 26.8 rejects the migrator's `CREATE`
of AggregatingMergeTree tables with plain columns outside the sorting
key.
- Pin `use_variant_as_common_type=0`: 26.8 turns mismatched types into
`Variant` instead of the no-common-type error. Handling `Variant`
results instead is tracked in SigNoz/events-pod#271.
- Drop `avg(timestamp)` from the pinned unsupported aggregations: 26.8
averages `DateTime64` into an instant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01X3AdVnw3X4N8Knhw8Yghtv
2026-11-23 13:24:36 +00:00
Vinicius Lourenço
cbfbb103af fix(web): correct the CSS modules guide, forbid component overrides, replace undefined tokens (#13697)
## Description

The CSS modules guide told us to write `:local(@keyframes name)`, and
Greptile now flags plain `@keyframes` in review because of it. That form
doesn't compile (Sass fails with `expected selector`), and it isn't
needed: CSS Modules already scope `@keyframes` in a `.module.scss` file.

While checking the rest of the guide against `@signozhq/ui` and the
design tokens, I fixed two more things that don't exist or don't behave
as written. The `--periscope-font-size-*` and `--font-size-*` tokens
aren't defined anywhere, so the checklist now points at the text style
tokens. And a nested `.icon` inside `.button` compiles to `.button
.icon`, so it is scoped under `.button`, contrary to what the comment
said.

The app had the same problem: the AI assistant, the Top List panel and
the Geo Map tooltip used `--periscope-font-size-*`, `--font-size-*` and
`--font-weight-*` tokens that were never defined, so their text fell
back to whatever size and weight it inherited. They now use the
typography tokens, so small labels render at 11px and medium or semibold
text gets its weight back. Expect those surfaces to look slightly
different.

The guide also taught how to override `@signozhq/ui` components through
their CSS variables and `data-*` attributes, and several of the
variables it listed didn't exist. That section now says not to override
them at all: use the component's props, put layout on a wrapper you own,
and when the component can't do what the design needs, file a UI
suggestion in `SigNoz/uforge-pod` instead of restyling it locally.
`frontend/CLAUDE.md` says the same, so agents stop writing overrides.

## Screenshots

AI assistant thread list: group headers and timestamps drop to 11px,
headers get bolder.
![AI assistant thread list, before and
after](https://github.com/user-attachments/assets/97d85d76-95d1-4793-b968-049ba21b11d1)

AI assistant suggested actions: the label drops to 11px, the action
buttons grow to 13px.
![AI assistant suggested actions, before and
after](https://github.com/user-attachments/assets/bc115d6d-2a95-47c5-8aeb-8d8da62cbd7a)

Geo Map tooltip: the place name goes to 13px medium, the code, label and
value to 11px.
![Geo Map tooltip, before and
after](https://github.com/user-attachments/assets/12b54137-2310-4e0b-976b-ac94e7ad364c)

Top List: the value column goes from regular to medium weight.
![Top List values, before and
after](https://github.com/user-attachments/assets/f90222b0-d256-499d-90b7-03065676886d)
2026-11-23 13:17:32 +00:00
Swapnil Nakade
fbca5e7d80 feat(auditor): add tls to the kafka auditor (#13710)
<!--A few plain bullets saying what changed and why, for a reviewer
skimming it - not a wall of text, not a restatement of the diff, not
generated boilerplate.-->
#### Description
- Adds `auditor::kafka::tls` (`enabled`, `ca_file`, `cert_file`,
`key_file`) so the Kafka auditor can connect to brokers that require TLS
or mTLS, such as Redpanda's internal listener in TLS deployments.

<!--Reference issues using `Closes #issue-number` to enable automatic
closure on merge. -->
#### Issues closed by this PR
closes https://github.com/SigNoz/keystone-pod/issues/225
2026-11-23 10:57:46 +00:00
78 changed files with 1272 additions and 3725 deletions

View File

@@ -94,7 +94,7 @@ jobs:
postgres:15 \
clickhouse/clickhouse-server:25.12.5 \
clickhouse/clickhouse-keeper:25.12.5 \
signoz/signoz-otel-collector:v0.144.16-rc.1 \
signoz/signoz-otel-collector:v0.144.17 \
wiremock/wiremock:2.35.1-1 \
| xargs -P 0 -n 1 docker pull -q
- name: python

26
.github/workflows/flakyci.yaml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: flakyci
on:
schedule:
- cron: "0 4 * * 1"
workflow_dispatch:
permissions:
actions: read
contents: read
jobs:
jest:
runs-on: ubuntu-latest
steps:
- name: self-checkout
uses: actions/checkout@v4
- name: node-install
uses: actions/setup-node@v5
with:
node-version: "22"
- name: report
env:
GH_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_FLAKY_TESTS_WEBHOOK }}
run: node frontend/scripts/flaky-jest-report.mjs >> "$GITHUB_STEP_SUMMARY"

View File

@@ -85,13 +85,18 @@ jobs:
- wal
clickhouse-version:
- 25.12.5
- 26.8.34
signoz-otel-collector-version:
- v0.144.16-rc.1
- v0.144.17
postgres-version:
- 15
exclude:
- sqlstore-provider: postgres
clickhouse-version: 26.8.34
if: |
((github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork && github.event.pull_request.user.login != 'dependabot[bot]' && ! contains(github.event.pull_request.labels.*.name, 'safe-to-test')) ||
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe-to-test'))) && contains(github.event.pull_request.labels.*.name, 'safe-to-integrate')
continue-on-error: ${{ matrix.clickhouse-version == '26.8.34' }}
runs-on: ubuntu-latest
steps:
- name: checkout

View File

@@ -474,6 +474,14 @@ auditor:
compression: lz4
# The maximum time to drain buffered events on shutdown. Undelivered events are dropped after it.
shutdown_timeout: 30s
tls:
# Whether to connect to the brokers over TLS.
enabled: false
# The PEM CA bundle that verifies broker certificates. Empty uses the system roots.
ca_file: ""
# The client certificate and key, for brokers that require client auth. Set both or neither.
cert_file: ""
key_file: ""
##################### Cloud Integration #####################
cloudintegration:

View File

@@ -2,7 +2,10 @@ package kafkaauditor
import (
"context"
"crypto/tls"
"crypto/x509"
"log/slog"
"os"
"github.com/twmb/franz-go/pkg/kgo"
"github.com/twmb/franz-go/plugin/kslog"
@@ -10,6 +13,7 @@ import (
"github.com/SigNoz/signoz/pkg/auditor"
"github.com/SigNoz/signoz/pkg/auditor/auditorserver"
"github.com/SigNoz/signoz/pkg/errors"
"github.com/SigNoz/signoz/pkg/factory"
"github.com/SigNoz/signoz/pkg/licensing"
"github.com/SigNoz/signoz/pkg/types/audittypes"
@@ -39,13 +43,25 @@ func newProvider(_ context.Context, providerSettings factory.ProviderSettings, c
// Acks from all in-sync replicas, idempotent writes and unbounded record retries are franz-go defaults and are kept as is.
// A delivery timeout or retry limit lets franz-go < v1.22.2 ack a record that was never written (twmb/franz-go#1484).
client, err := kgo.NewClient(
opts := []kgo.Opt{
kgo.SeedBrokers(config.Kafka.Brokers...),
kgo.ClientID(config.Kafka.ClientID),
kgo.ProducerBatchCompression(compressionCodec(config.Kafka.Compression)),
kgo.ProducerLinger(0),
kgo.WithLogger(kslog.New(settings.Logger())),
)
}
if config.Kafka.TLS.Enabled {
tlsConfig, err := newTLSConfig(config.Kafka.TLS)
if err != nil {
return nil, err
}
// franz-go sets ServerName per broker from the dialed address.
opts = append(opts, kgo.DialTLSConfig(tlsConfig))
}
client, err := kgo.NewClient(opts...)
if err != nil {
return nil, err
}
@@ -130,3 +146,30 @@ func compressionCodec(name string) kgo.CompressionCodec {
return kgo.NoCompression()
}
}
func newTLSConfig(config auditor.TLSConfig) (*tls.Config, error) {
tlsConfig := &tls.Config{}
if config.CAFile != "" {
caPEM, err := os.ReadFile(config.CAFile)
if err != nil {
return nil, errors.WrapInvalidInputf(err, errors.CodeInvalidInput, "cannot read auditor::kafka::tls::ca_file")
}
tlsConfig.RootCAs = x509.NewCertPool()
if !tlsConfig.RootCAs.AppendCertsFromPEM(caPEM) {
return nil, errors.NewInvalidInputf(errors.CodeInvalidInput, "auditor::kafka::tls::ca_file %q holds no PEM certificate", config.CAFile)
}
}
if config.CertFile != "" {
cert, err := tls.LoadX509KeyPair(config.CertFile, config.KeyFile)
if err != nil {
return nil, errors.WrapInvalidInputf(err, errors.CodeInvalidInput, "cannot load auditor::kafka::tls::cert_file and auditor::kafka::tls::key_file")
}
tlsConfig.Certificates = []tls.Certificate{cert}
}
return tlsConfig, nil
}

View File

@@ -0,0 +1,269 @@
package kafkaauditor
import (
"context"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"math/big"
"net"
"os"
"path/filepath"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/twmb/franz-go/pkg/kfake"
"github.com/twmb/franz-go/pkg/kgo"
"github.com/SigNoz/signoz/pkg/auditor"
"github.com/SigNoz/signoz/pkg/errors"
"github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest"
"github.com/SigNoz/signoz/pkg/types/audittypes"
"github.com/SigNoz/signoz/pkg/types/coretypes"
"github.com/SigNoz/signoz/pkg/version"
)
func TestExport_MutualTLS(t *testing.T) {
certificates := newTestCertificates(t)
cluster, err := kfake.NewCluster(
kfake.NumBrokers(1),
kfake.SeedTopics(1, "tls_audit"),
kfake.TLS(&tls.Config{
Certificates: []tls.Certificate{certificates.server},
ClientCAs: certificates.caPool,
ClientAuth: tls.RequireAndVerifyClientCert,
}),
)
require.NoError(t, err)
t.Cleanup(cluster.Close)
testCases := []struct {
name string
tls auditor.TLSConfig
err bool
}{
{
name: "CAAndClientCertificate_Delivers",
tls: certificates.client,
},
{
name: "TLSDisabled_Fails",
tls: auditor.TLSConfig{},
err: true,
},
{
name: "WithoutClientCertificate_Fails",
tls: auditor.TLSConfig{Enabled: true, CAFile: certificates.client.CAFile},
err: true,
},
{
name: "WithoutCA_Fails",
tls: auditor.TLSConfig{Enabled: true, CertFile: certificates.client.CertFile, KeyFile: certificates.client.KeyFile},
err: true,
},
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
config := auditor.Config{
Provider: "kafka",
BufferSize: 10,
BatchSize: 5,
FlushInterval: 50 * time.Millisecond,
Kafka: auditor.KafkaConfig{
Brokers: cluster.ListenAddrs(),
Topic: "tls_audit",
ClientID: "signoz-tls-test",
Compression: "lz4",
ShutdownTimeout: 30 * time.Second,
TLS: testCase.tls,
},
}
auditor, err := newProvider(context.Background(), instrumentationtest.New().ToProviderSettings(), config, nil, version.Info)
require.NoError(t, err)
provider := auditor.(*provider)
defer provider.client.Close()
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
err = provider.export(ctx, []audittypes.AuditEvent{newTestEvent(coretypes.ResourceUser, coretypes.VerbCreate, testCase.name)})
if testCase.err {
assert.True(t, errors.Is(err, context.DeadlineExceeded))
return
}
require.NoError(t, err)
})
}
consumerTLS, err := newTLSConfig(certificates.client)
require.NoError(t, err)
consumer, err := kgo.NewClient(
kgo.SeedBrokers(cluster.ListenAddrs()...),
kgo.DialTLSConfig(consumerTLS),
kgo.ConsumeTopics("tls_audit"),
kgo.ConsumeResetOffset(kgo.NewOffset().AtStart()),
)
require.NoError(t, err)
defer consumer.Close()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
fetches := consumer.PollFetches(ctx)
require.Empty(t, fetches.Errors())
assert.Len(t, fetches.Records(), 1)
}
func TestNewTLSConfig(t *testing.T) {
certificates := newTestCertificates(t)
notPEMFile := filepath.Join(t.TempDir(), "not-pem.crt")
require.NoError(t, os.WriteFile(notPEMFile, []byte("not a pem"), 0o600))
testCases := []struct {
name string
config auditor.TLSConfig
err bool
wantRootCAs bool
wantCertificates int
}{
{
name: "NoFiles_UsesSystemRoots",
config: auditor.TLSConfig{Enabled: true},
},
{
name: "CAOnly",
config: auditor.TLSConfig{Enabled: true, CAFile: certificates.client.CAFile},
wantRootCAs: true,
},
{
name: "CAAndClientCertificate",
config: certificates.client,
wantRootCAs: true,
wantCertificates: 1,
},
{
name: "CAFileMissing",
config: auditor.TLSConfig{Enabled: true, CAFile: filepath.Join(t.TempDir(), "missing-ca.crt")},
err: true,
},
{
name: "CAFileNotPEM",
config: auditor.TLSConfig{Enabled: true, CAFile: notPEMFile},
err: true,
},
{
name: "KeyFileMissing",
config: auditor.TLSConfig{Enabled: true, CertFile: certificates.client.CertFile, KeyFile: filepath.Join(t.TempDir(), "missing.key")},
err: true,
},
{
name: "CertFileNotPEM",
config: auditor.TLSConfig{Enabled: true, CertFile: notPEMFile, KeyFile: certificates.client.KeyFile},
err: true,
},
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
tlsConfig, err := newTLSConfig(testCase.config)
if testCase.err {
assert.True(t, errors.Ast(err, errors.TypeInvalidInput))
return
}
require.NoError(t, err)
assert.Equal(t, testCase.wantRootCAs, tlsConfig.RootCAs != nil)
assert.Len(t, tlsConfig.Certificates, testCase.wantCertificates)
})
}
}
type testCertificates struct {
caPool *x509.CertPool
server tls.Certificate
client auditor.TLSConfig
}
// Issues a CA, a broker certificate for 127.0.0.1 and a client certificate, writing the client side as ca.crt, tls.crt and tls.key.
func newTestCertificates(t *testing.T) testCertificates {
t.Helper()
caKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
require.NoError(t, err)
caTemplate := &x509.Certificate{
SerialNumber: big.NewInt(1),
Subject: pkix.Name{CommonName: "test-ca"},
NotBefore: time.Now().Add(-time.Hour),
NotAfter: time.Now().Add(time.Hour),
IsCA: true,
BasicConstraintsValid: true,
KeyUsage: x509.KeyUsageCertSign,
}
caDER, err := x509.CreateCertificate(rand.Reader, caTemplate, caTemplate, &caKey.PublicKey, caKey)
require.NoError(t, err)
ca, err := x509.ParseCertificate(caDER)
require.NoError(t, err)
serverCertPEM, serverKeyPEM := issueTestCertificate(t, ca, caKey, &x509.Certificate{
SerialNumber: big.NewInt(2),
Subject: pkix.Name{CommonName: "broker"},
IPAddresses: []net.IP{net.ParseIP("127.0.0.1")},
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
})
server, err := tls.X509KeyPair(serverCertPEM, serverKeyPEM)
require.NoError(t, err)
clientCertPEM, clientKeyPEM := issueTestCertificate(t, ca, caKey, &x509.Certificate{
SerialNumber: big.NewInt(3),
Subject: pkix.Name{CommonName: "signoz"},
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
})
dir := t.TempDir()
client := auditor.TLSConfig{
Enabled: true,
CAFile: filepath.Join(dir, "ca.crt"),
CertFile: filepath.Join(dir, "tls.crt"),
KeyFile: filepath.Join(dir, "tls.key"),
}
require.NoError(t, os.WriteFile(client.CAFile, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: caDER}), 0o600))
require.NoError(t, os.WriteFile(client.CertFile, clientCertPEM, 0o600))
require.NoError(t, os.WriteFile(client.KeyFile, clientKeyPEM, 0o600))
caPool := x509.NewCertPool()
caPool.AddCert(ca)
return testCertificates{caPool: caPool, server: server, client: client}
}
func issueTestCertificate(t *testing.T, ca *x509.Certificate, caKey *ecdsa.PrivateKey, template *x509.Certificate) ([]byte, []byte) {
t.Helper()
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
require.NoError(t, err)
template.NotBefore = time.Now().Add(-time.Hour)
template.NotAfter = time.Now().Add(time.Hour)
template.KeyUsage = x509.KeyUsageDigitalSignature
der, err := x509.CreateCertificate(rand.Reader, template, ca, &key.PublicKey, caKey)
require.NoError(t, err)
keyDER, err := x509.MarshalECPrivateKey(key)
require.NoError(t, err)
return pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der}), pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: keyDER})
}

View File

@@ -28,7 +28,7 @@ You are operating within a constrained context window and strict system prompts.
- UI primitives come from `@signozhq/ui` (subpath imports) and icons from `@signozhq/icons`. No new `antd` component or direct icon library (`lucide-react`) where `@signozhq/ui` has an equivalent; `signoz/no-antd-components` enforces part of this list.
- Exception: a control added beside `antd` siblings of the same kind (a tab in an `antd` tab strip) matches them until that surface migrates. Say so in the PR.
- When `@signozhq/ui` or `@signozhq/icons` lacks what you need, say so in the PR before reaching for another library.
- Before styling a `@signozhq/ui` component, check its props in `node_modules/@signozhq/ui/dist/<component>/*.d.ts` for `className`/`style` support; some omit them. Avoid overriding the component's CSS vars unless explicitly needed.
- Never override a `@signozhq/ui` component's styles: no `--<component>-*` CSS variables, no `:global` class or `data-*` selectors, no restyling through `className`/`style`. Use its props, and put layout on a wrapper you own. When it can't do what the design needs, file a UI suggestion in `SigNoz/uforge-pod` (`ui-suggestion.yml` template) and link it in the PR.
- When writing code that could need authorization checks, read ./src/lib/authz/README.md
- A flow that gains a request also gates on that request's permission: a rename that now reads the view first needs `read` as well as `update`.
- Identity keys (legend groups, color groups, CSV headers, React keys) come from structured values, never from joined display text: `['us, east', 'prod']` and `['us', 'east, prod']` both join to `us, east, prod`.

View File

@@ -9,12 +9,12 @@
- [ ] No deep class nesting (max 3 class levels; pseudo-classes/elements and parent-reference selectors like `&.active`, `&#bar` are not counted)
- [ ] No hardcoded colors - use `--l1/l2/l3-*` semantic tokens (not `--bg-*` primitives)
- [ ] No magic numbers - use `--spacing-*` tokens
- [ ] Typography uses `--periscope-font-size-*` or `--font-size-*` tokens
- [ ] @signozhq/ui overrides use CSS variables, not direct class overrides
- [ ] Global escapes only for third-party overrides
- [ ] Typography uses `--{variant}-{size}-{weight}-*` text style tokens (see Typography)
- [ ] No overrides of `@signozhq/ui` components (see below)
- [ ] Global escapes only for third-party overrides (`@signozhq/ui` is not third-party)
- [ ] No ID selectors
- [ ] No bare element selectors
- [ ] Keyframes use `:local(@keyframes name)` to avoid global collisions
- [ ] Keyframes are declared in the module with plain `@keyframes name` (already local)
## Config (vite.config.ts)
@@ -77,7 +77,7 @@ css: {
// BAD: Nesting creates separate classes you might not expect
.button {
.icon { } // -> styles.icon (separate class, not scoped under .button)
.icon { } // -> styles.icon, but the rule is `.button .icon`: it only matches inside .button
}
// GOOD: Flat structure
@@ -289,88 +289,32 @@ Use L1/L2/L3 semantic tokens - they handle light/dark theme automatically.
- L2 = elevated surfaces (cards, panels)
- L3 = nested/inset elements
## Overriding @signozhq/ui Components
## @signozhq/ui Components
Components expose CSS variables for customization.
Don't override them. That covers setting a component's `--<component>-*` CSS variables, targeting its classes or `data-*` attributes through `:global(...)`, and restyling it with `className` or `style`. An override keeps working until the component changes, then breaks with no type error or lint warning, and the screen drifts from every other one using that component.
You can ensure they exist by looking at ./node_modules/@signozhq/ui/dist.
Never write a override without confirm it exists.
Override via:
### Method 1: CSS Variables (Preferred)
Each component exposes `--<component>-<property>` variables:
- Use the component's props (`variant`, `color`, `size`, ...) for how it looks.
- Put layout (position, margin, width inside a flex or grid parent) on a wrapper element you own.
- If the component can't do what the design needs, file a [UI suggestion](https://github.com/SigNoz/uforge-pod/issues/new?template=ui-suggestion.yml) in `SigNoz/uforge-pod` and ship with the component as it renders until the suggestion is decided. Link the issue in the PR.
```scss
// Override Button
.customButton {
--button-background: var(--success-background);
--button-border-radius: var(--radius-2);
--button-padding: var(--spacing-4) var(--spacing-8);
--button-font-size: var(--label-base-400-font-size);
// BAD: Restyling the component
.saveButton {
--button-primary-background-color: var(--success-background);
}
// Override Input
.customInput {
--input-height: 2.5rem;
--input-border-color: var(--l2-border);
--input-padding: var(--spacing-2) var(--spacing-6);
--input-placeholder-color: var(--l3-foreground);
.toolbar :global([data-variant="outlined"]) {
--button-variant-outlined-border: 1px solid var(--accent-primary);
}
// Override nested parts
.customInput {
--input-prefix-padding: 0 var(--spacing-4) 0 var(--spacing-6);
--input-suffix-color: var(--accent-primary);
// GOOD: Layout on your own wrapper, looks from props
.toolbarActions {
display: flex;
gap: var(--spacing-4);
margin-left: auto;
}
```
### Method 2: Data Attributes
Components use data attributes for variants/states. Target them for state-specific overrides:
```scss
// Target variant
.wrapper :global([data-variant="outlined"]) {
--button-border-color: var(--accent-primary);
}
// Target size
.wrapper :global([data-size="sm"]) {
--button-font-size: var(--label-small-400-font-size);
}
// Target color
.wrapper :global([data-color="destructive"]) {
--button-background: var(--danger-background);
}
// Target state (Radix patterns)
.popover :global([data-state="open"]) {
opacity: 1;
}
.tooltip :global([data-side="top"]) {
margin-bottom: var(--spacing-2);
}
```
### Common Component CSS Variables
**Button:**
- `--button-background`, `--button-border-radius`, `--button-padding`
- `--button-font-size`, `--button-height`, `--button-gap`
- `--button-hover-background`, `--button-disabled-opacity`
**Input:**
- `--input-height`, `--input-border-color`, `--input-background`
- `--input-padding`, `--input-font-size`, `--input-placeholder-color`
- `--input-focus-outline-color`, `--input-hover-border-color`
- `--input-prefix-*`, `--input-suffix-*` for adornments
**General pattern:** `--<component>-<property>` or `--<component>-<state>-<property>`
## Good Patterns
### Structure
@@ -434,24 +378,21 @@ Components use data attributes for variants/states. Target them for state-specif
### Keyframes (Local Scoping)
Without `:local()`, keyframe names are global and can clash across modules:
CSS Modules scope `@keyframes` like classes: the build renames `fadeIn` to `_fadeIn_<hash>` and rewrites every `animation` in the same module that names it. Don't wrap it in `:local(...)`; Sass rejects `:local(@keyframes fadeIn)` with `expected selector`.
```scss
// BAD: Global keyframe - can conflict with other modules
// GOOD: Local to this module
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
// GOOD: Locally scoped keyframe
:local(@keyframes fadeIn) {
from { opacity: 0; }
to { opacity: 1; }
}
.modal {
animation: fadeIn 200ms ease;
}
// BAD: Doesn't compile
:local(@keyframes fadeIn) { }
```
## JS Import Patterns

View File

@@ -6,6 +6,8 @@ const LOG_EVENT_MOCK_PATH = '<rootDir>/src/__tests__/logEventMock.ts';
const config: Config.InitialOptions = {
silent: true,
// CI runners are slow enough that multi-step userEvent tests pass 5s.
testTimeout: 10000,
clearMocks: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'cobertura', 'html', 'json-summary'],
@@ -67,6 +69,9 @@ const config: Config.InitialOptions = {
testPathIgnorePatterns: ['/node_modules/', '/public/'],
moduleDirectories: ['node_modules', 'src'],
testEnvironment: '<rootDir>/jest.environment.cjs',
...(process.env.GITHUB_STEP_SUMMARY
? { reporters: ['default', '<rootDir>/scripts/slow-test-reporter.mjs'] }
: {}),
coverageThreshold: {
global: {
statements: 80,

View File

@@ -137,6 +137,8 @@ window.getComputedStyle = function (
return {
display: '',
visibility: '',
width: '',
height: '',
opacity: '1',
animationName: 'none',
getPropertyValue: () => '',

View File

@@ -56,6 +56,7 @@
"@sentry/vite-plugin": "5.3.0",
"@signozhq/design-tokens": "2.8.0",
"@signozhq/icons": "0.4.0",
"@signozhq/noz-client": "1.13.0",
"@signozhq/ui": "0.4.0-rc.5",
"@tanstack/react-table": "8.21.3",
"@tanstack/react-virtual": "3.13.22",

View File

@@ -82,6 +82,9 @@ importers:
'@signozhq/icons':
specifier: 0.4.0
version: 0.4.0
'@signozhq/noz-client':
specifier: 1.13.0
version: 1.13.0(axios@1.21.1)(react-query@3.39.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0)
'@signozhq/ui':
specifier: 0.4.0-rc.5
version: 0.4.0-rc.5(@date-fns/tz@1.4.1)(@signozhq/design-tokens@2.8.0)(@signozhq/icons@0.4.0)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
@@ -3248,6 +3251,13 @@ packages:
'@signozhq/icons@0.4.0':
resolution: {integrity: sha512-QctNvNPlQlsefFdIVmSy/P/7a1IcQ3IryKP0KPMqtoqew3q89FGUmFa5IfEJ7Z3CHhtG1zaXwBKqP72QkLyA3g==}
'@signozhq/noz-client@1.13.0':
resolution: {integrity: sha512-130L2xomHnQZK8ZtAst34qFz9d2rSF/JYpg9gKvJkZVS9+46CPZeTW8Va9PNS9Oa5owezVHIXZStTEbsHIxnwg==}
peerDependencies:
axios: ^1.20.0
react: ^18.2.0
react-query: ^3.39.3
'@signozhq/ui@0.4.0-rc.5':
resolution: {integrity: sha512-WlJMfeDfvL2hjMpTpHhhND/tuK7X0sfXQlx6E1ZG+6E/DYHpuhYljfvW3E6/BohIlHFlTyCs/ZMl9wnV2k9Zcw==}
peerDependencies:
@@ -12373,6 +12383,12 @@ snapshots:
'@signozhq/icons@0.4.0': {}
'@signozhq/noz-client@1.13.0(axios@1.21.1)(react-query@3.39.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0)':
dependencies:
axios: 1.21.1
react: 18.2.0
react-query: 3.39.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
'@signozhq/ui@0.4.0-rc.5(@date-fns/tz@1.4.1)(@signozhq/design-tokens@2.8.0)(@signozhq/icons@0.4.0)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)':
dependencies:
'@base-ui/react': 1.8.0(@date-fns/tz@1.4.1)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)

View File

@@ -0,0 +1,106 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import {
findFlaky,
parseFailures,
prOf,
slackMessage,
} from '../flaky-jest-report.mjs';
const LOG = [
'2026-11-10T10:00:00.0000000Z \x1b[1mFAIL\x1b[22m src/a/A.test.tsx (12.1 s)',
'2026-11-10T10:00:00.0000001Z \x1b[1m● A › saves the form\x1b[22m',
'2026-11-10T10:00:00.0000002Z ',
'2026-11-10T10:00:00.0000003Z thrown: "Exceeded timeout of 5000 ms for a test.',
'2026-11-10T10:00:00.0000004Z FAIL src/b/B.test.tsx',
'2026-11-10T10:00:00.0000005Z ● B › shows the error',
'2026-11-10T10:00:00.0000006Z expect(received).toBe(expected)',
'2026-11-10T10:00:00.0000007Z ● Test suite failed to run',
'2026-11-10T10:00:00.0000008Z FAIL src/a/A.test.tsx (12.1 s)',
'2026-11-10T10:00:00.0000009Z ● A › saves the form',
].join('\n');
test('parseFailures reads each failing test once with its first error line', () => {
assert.deepEqual(parseFailures(LOG), [
{
file: 'src/a/A.test.tsx',
test: 'A › saves the form',
error: 'thrown: "Exceeded timeout of 5000 ms for a test.',
},
{
file: 'src/b/B.test.tsx',
test: 'B › shows the error',
error: 'expect(received).toBe(expected)',
},
]);
});
test('findFlaky keeps re-run and multi-PR failures only', () => {
const failure = (test, extra) => ({
file: 'src/x.test.tsx',
test,
error: '',
event: 'pull_request',
pr: 1,
passedOnRerun: false,
...extra,
});
const flaky = findFlaky([
failure('one PR only'),
failure('one PR only'),
failure('re-run', { passedOnRerun: true }),
failure('queue once', { event: 'merge_group', pr: 7 }),
failure('spread', { pr: 1 }),
failure('spread', { event: 'merge_group', pr: 2 }),
failure('spread', { pr: 3 }),
]);
assert.deepEqual(
flaky.map((entry) => entry.test),
['spread', 're-run'],
);
});
test('prOf reads the PR number from a merge queue branch', () => {
assert.equal(
prOf({
event: 'merge_group',
head_branch: 'gh-readonly-queue/main/pr-13616-0a1ca00c27f1',
}),
13616,
);
assert.equal(
prOf({ event: 'pull_request', pull_requests: [{ number: 42 }] }),
42,
);
});
test('slackMessage escapes test names and lists the top 10 with a link to the run', () => {
const entry = (index) => ({
file: `src/t${index}.test.tsx`,
test: `T${index} › shows <Empty> & more`,
failures: 20 - index,
passedOnRerun: 1,
mergeQueue: 0,
prs: new Set([1]),
change: { who: 'dev' },
});
const message = slackMessage(
'SigNoz/signoz',
'2026-11-17',
Array.from({ length: 12 }, (_, index) => entry(index)),
'https://github.com/SigNoz/signoz/actions/runs/1',
);
assert.equal(message.text, '12 flaky Jest tests since 2026-11-17');
const sections = message.blocks.filter((block) => block.type === 'section');
assert.equal(sections.length, 10);
assert.equal(
sections[0].text.text,
'*20 failures* <https://github.com/SigNoz/signoz/blob/main/frontend/src/t0.test.tsx|T0 › shows &lt;Empty&gt; &amp; more>\npassed on re-run (1), last changed by dev',
);
assert.equal(
message.blocks.at(-1).elements[0].text,
'<https://github.com/SigNoz/signoz/actions/runs/1|All tests and their first error line>',
);
});

View File

@@ -0,0 +1,43 @@
import assert from 'node:assert/strict';
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { test } from 'node:test';
import SlowTestReporter from '../slow-test-reporter.mjs';
const result = {
testFilePath: path.join(process.cwd(), 'src/a/A.test.tsx'),
testResults: [
{ fullName: 'A › saves', duration: 2500 },
{ fullName: 'A › loads', duration: 100 },
{ fullName: 'A › reads a | b', duration: 4000 },
],
};
test('lists tests over 2 s in the job summary, slowest first', (t) => {
const summary = path.join(
mkdtempSync(path.join(tmpdir(), 'slow-')),
'summary.md',
);
writeFileSync(summary, '');
t.after(() => delete process.env.GITHUB_STEP_SUMMARY);
process.env.GITHUB_STEP_SUMMARY = summary;
const reporter = new SlowTestReporter();
reporter.onTestResult(undefined, result);
reporter.onRunComplete();
assert.equal(
readFileSync(summary, 'utf8'),
[
'### Jest tests over 2 s',
'',
'| Test | File | Time |',
'| --- | --- | --- |',
'| A › reads a \\| b | `src/a/A.test.tsx` | 4.0 s |',
'| A › saves | `src/a/A.test.tsx` | 2.5 s |',
'',
].join('\n'),
);
});

View File

@@ -0,0 +1,299 @@
#!/usr/bin/env node
import { pathToFileURL } from 'node:url';
const API = 'https://api.github.com';
const TEST_JOB = /^test-shard \(\d+\)$|^test \/ js$/;
const MIN_PRS = 3;
const SLACK_LIMIT = 10;
const MAX_ATTEMPTS = 4;
const RETRY_BACKOFF_MS = 2000;
const PARALLEL_RUNS = 8;
const DAY_MS = 24 * 60 * 60 * 1000;
export function parseFailures(log) {
const lines = log.split('\n').map((line) =>
line
// eslint-disable-next-line no-control-regex
.replace(/\x1b\[[0-9;]*m/g, '')
.replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z /, ''),
);
const failures = new Map();
let file = null;
lines.forEach((line, index) => {
const failedFile = line.match(/^\s*FAIL\s+(\S+)/);
if (failedFile) {
[, file] = failedFile;
return;
}
const failedTest = line.match(/^\s*● (.+ › .+)$/);
if (!failedTest || !file) {
return;
}
const test = failedTest[1].trim();
const key = `${file}\0${test}`;
if (!failures.has(key)) {
const error =
lines
.slice(index + 1, index + 8)
.map((next) => next.trim())
.find(Boolean) ?? '';
failures.set(key, { file, test, error });
}
});
return [...failures.values()];
}
export function findFlaky(failures) {
const byTest = new Map();
failures.forEach((failure) => {
const key = `${failure.file}\0${failure.test}`;
const entry = byTest.get(key) ?? {
file: failure.file,
test: failure.test,
error: failure.error,
failures: 0,
prs: new Set(),
passedOnRerun: 0,
mergeQueue: 0,
};
entry.failures += 1;
if (failure.pr) {
entry.prs.add(failure.pr);
}
entry.passedOnRerun += failure.passedOnRerun ? 1 : 0;
entry.mergeQueue += failure.event === 'merge_group' ? 1 : 0;
byTest.set(key, entry);
});
return [...byTest.values()]
.filter((entry) => entry.passedOnRerun > 0 || entry.prs.size >= MIN_PRS)
.sort((a, b) => b.failures - a.failures);
}
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
async function gh(path, init = {}, attempt = 1) {
const retry = !init.method && attempt < MAX_ATTEMPTS;
let response;
try {
response = await fetch(path.startsWith('http') ? path : API + path, {
...init,
headers: {
accept: 'application/vnd.github+json',
authorization: `Bearer ${process.env.GH_TOKEN}`,
...init.headers,
},
});
} catch (error) {
if (!retry) {
throw error;
}
await sleep(attempt * RETRY_BACKOFF_MS);
return gh(path, init, attempt + 1);
}
if (retry && response.status >= 500) {
await sleep(attempt * RETRY_BACKOFF_MS);
return gh(path, init, attempt + 1);
}
if (!response.ok) {
throw new Error(`${response.status} ${init.method ?? 'GET'} ${path}`);
}
return response;
}
async function mapLimit(items, limit, fn) {
const results = [];
let next = 0;
await Promise.all(
Array.from({ length: limit }, async () => {
while (next < items.length) {
const index = next;
next += 1;
results[index] = await fn(items[index]);
}
}),
);
return results;
}
async function paginate(path, key) {
const items = [];
let next = API + path;
while (next) {
const response = await gh(next);
const body = await response.json();
items.push(...(key ? body[key] : body));
next = response.headers.get('link')?.match(/<([^>]+)>; rel="next"/)?.[1];
}
return items;
}
// Merge queue branches are named gh-readonly-queue/<base>/pr-<number>-<sha>.
export function prOf(run) {
if (run.event === 'merge_group') {
return Number(run.head_branch.match(/\/pr-(\d+)-/)?.[1]) || run.head_branch;
}
return run.pull_requests[0]?.number ?? run.head_branch;
}
async function runFailures(repo, run) {
const jobs = (
await paginate(
`/repos/${repo}/actions/runs/${run.id}/jobs?filter=all&per_page=100`,
'jobs',
)
).filter((job) => TEST_JOB.test(job.name));
const failures = [];
for (const job of jobs.filter((failed) => failed.conclusion === 'failure')) {
const passedOnRerun = jobs.some(
(later) =>
later.name === job.name &&
later.run_attempt > job.run_attempt &&
later.conclusion === 'success',
);
let log;
try {
log = await (await gh(`/repos/${repo}/actions/jobs/${job.id}/logs`)).text();
} catch (error) {
process.stderr.write(`skipped job ${job.id}: ${error.message}\n`);
continue;
}
parseFailures(log).forEach((failure) =>
failures.push({
...failure,
event: run.event,
pr: prOf(run),
passedOnRerun,
}),
);
}
return failures;
}
async function collectFailures(repo, since) {
const runs = await paginate(
`/repos/${repo}/actions/workflows/jsci.yaml/runs?created=>=${since}&per_page=100`,
'workflow_runs',
);
const candidates = runs.filter(
(run) => run.run_attempt > 1 || run.conclusion === 'failure',
);
return (
await mapLimit(candidates, PARALLEL_RUNS, (run) => runFailures(repo, run))
).flat();
}
async function lastChange(repo, file) {
const [commit] = await (
await gh(`/repos/${repo}/commits?path=frontend/${file}&per_page=1`)
).json();
if (!commit) {
return null;
}
return {
who: commit.author?.login ?? commit.commit.author.name,
when: commit.commit.author.date.slice(0, 10),
sha: commit.sha.slice(0, 7),
url: commit.html_url,
};
}
function signal(entry) {
return [
entry.passedOnRerun && `passed on re-run (${entry.passedOnRerun})`,
entry.mergeQueue && `merge queue (${entry.mergeQueue})`,
entry.prs.size >= MIN_PRS && `${entry.prs.size} PRs`,
]
.filter(Boolean)
.join(', ');
}
const cell = (text) => text.replace(/\|/g, '\\|');
const changeCell = (change) =>
change
? `${change.who}, ${change.when}, [${change.sha}](${change.url})`
: 'unknown';
function report(since, flaky) {
const header = `## Flaky Jest tests since ${since}`;
if (flaky.length === 0) {
return `${header}\n\nNo flaky tests found.\n`;
}
const rows = flaky.map(
(entry) =>
`| ${cell(entry.test)} | \`${entry.file}\` | ${entry.failures} | ${signal(entry)} | ${cell(entry.error.slice(0, 80))} | ${changeCell(entry.change)} |`,
);
return [
header,
'',
'A test is listed when it failed and then passed on a re-run of the same commit, or failed on 3 or more PRs. A merge queue run counts for the PR it was merging.',
'',
'| Test | File | Failures | Signal | First error line | Last change |',
'| --- | --- | --- | --- | --- | --- |',
...rows,
'',
].join('\n');
}
// Slack mrkdwn treats these three as control characters.
const slackEscape = (text) =>
text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
export function slackMessage(repo, since, flaky, runUrl) {
const title = `${flaky.length} flaky Jest tests since ${since}`;
return {
text: title,
blocks: [
{ type: 'header', text: { type: 'plain_text', text: title } },
...flaky.slice(0, SLACK_LIMIT).map((entry) => ({
type: 'section',
text: {
type: 'mrkdwn',
text: `*${entry.failures} failures* <https://github.com/${repo}/blob/main/frontend/${entry.file}|${slackEscape(entry.test)}>\n${signal(entry)}, last changed by ${slackEscape(entry.change?.who ?? 'unknown')}`,
},
})),
{
type: 'context',
elements: [
{
type: 'mrkdwn',
text: `<${runUrl}|All tests and their first error line>`,
},
],
},
],
};
}
async function postToSlack(webhook, message) {
const response = await fetch(webhook, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(message),
});
if (!response.ok) {
throw new Error(`${response.status} POST Slack webhook`);
}
}
async function main() {
const repo = process.env.GITHUB_REPOSITORY;
const days = Number(process.env.DAYS ?? 7);
const since = new Date(Date.now() - days * DAY_MS).toISOString().slice(0, 10);
const flaky = await Promise.all(
findFlaky(await collectFailures(repo, since)).map(async (entry) => ({
...entry,
change: await lastChange(repo, entry.file),
})),
);
process.stdout.write(report(since, flaky));
const webhook = process.env.SLACK_WEBHOOK_URL;
if (webhook && flaky.length > 0) {
const runUrl = `${process.env.GITHUB_SERVER_URL}/${repo}/actions/runs/${process.env.GITHUB_RUN_ID}`;
await postToSlack(webhook, slackMessage(repo, since, flaky, runUrl));
}
}
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
await main();
}

View File

@@ -0,0 +1,45 @@
import fs from 'node:fs';
import path from 'node:path';
const budgetMs = Number(process.env.SLOW_TEST_MS ?? 2000);
class SlowTestReporter {
constructor() {
this.slow = [];
}
onTestResult(_test, result) {
const file = path.relative(process.cwd(), result.testFilePath);
result.testResults.forEach((test) => {
if ((test.duration ?? 0) > budgetMs) {
this.slow.push({ file, name: test.fullName, ms: test.duration });
}
});
}
onRunComplete() {
const summaryFile = process.env.GITHUB_STEP_SUMMARY;
if (!summaryFile || this.slow.length === 0) {
return;
}
const rows = this.slow
.sort((a, b) => b.ms - a.ms)
.map(
(test) =>
`| ${test.name.replace(/\|/g, '\\|')} | \`${test.file}\` | ${(test.ms / 1000).toFixed(1)} s |`,
);
fs.appendFileSync(
summaryFile,
[
`### Jest tests over ${budgetMs / 1000} s`,
'',
'| Test | File | Time |',
'| --- | --- | --- |',
...rows,
'',
].join('\n'),
);
}
}
export default SlowTestReporter;

View File

@@ -11,7 +11,7 @@
* to resume, which each return a new executionId to open a fresh SSE stream.
*
* Types in this file re-use the OpenAPI-generated DTOs in
* `src/api/ai-assistant/sigNozAIAssistantAPI.schemas.ts`.
* `@signozhq/noz-client`.
* Local types are defined only when the UI needs a different shape — for
* example, the SSE event union adds a literal `type` discriminator that the
* generated event DTOs leave loose.
@@ -60,7 +60,7 @@ import type {
PageTypeDTO,
ToolCallEventDTO,
ToolResultEventDTO,
} from './sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import { LOCALSTORAGE } from 'constants/localStorage';
import {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -12,4 +12,5 @@
import '@signozhq/design-tokens';
import '@signozhq/icons';
import '@signozhq/noz-client';
import '@signozhq/ui';

View File

@@ -1,3 +1,4 @@
import { lazy } from 'react';
import { navigate } from 'lib/router/navigation';
import { fireEvent, render, screen } from 'tests/test-utils';
@@ -98,4 +99,30 @@ describe('RouteTab component', () => {
fireEvent.click(screen.getByRole('tab', { name: 'Tab2' }));
expect(onChangeHandler).toHaveBeenCalled();
});
it('keeps the tab bar while a lazy tab loads', async () => {
let resolveTab: (module: { default: () => JSX.Element }) => void = () => {};
const LazyTab = lazy(
() =>
new Promise<{ default: () => JSX.Element }>((resolve) => {
resolveTab = resolve;
}),
);
render(
<RouteTab
routes={[{ ...testRoutes[0], Component: LazyTab }, testRoutes[1]]}
activeKey="Tab1"
/>,
);
expect(screen.getByRole('tab', { name: 'Tab1' })).toBeInTheDocument();
expect(
screen.getByLabelText('loading').closest('.ant-spin')?.parentElement,
).toHaveStyle({ height: '100%' });
resolveTab({ default: DummyComponent1 });
await expect(
screen.findByText('Dummy Component 1'),
).resolves.toBeInTheDocument();
});
});

View File

@@ -1,7 +1,9 @@
import { Suspense } from 'react';
import { Tabs, TabsProps } from 'antd';
import cx from 'classnames';
import HeaderRightSection from 'components/HeaderRightSection/HeaderRightSection';
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
import Spinner from 'components/Spinner';
import { buildRoutePath } from 'lib/router/buildRoutePath';
import { matchRoute } from 'lib/router/matchRoute';
import { navigate } from 'lib/router/navigation';
@@ -58,7 +60,11 @@ function RouteTab({
tabKey: route,
children: (
<OverlayScrollbar>
<Component />
<Suspense
fallback={<Spinner size="large" tip="Loading..." height="100%" />}
>
<Component />
</Suspense>
</OverlayScrollbar>
),
}));

View File

@@ -1,4 +1,4 @@
import { PageTypeDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { PageTypeDTO } from '@signozhq/noz-client';
import { QueryParams } from 'constants/query';
import ROUTES from 'constants/routes';

View File

@@ -8,7 +8,7 @@
--input-focus-background: transparent;
--input-focus-outline-width: 0;
--input-box-shadow: none;
--input-font-size: var(--periscope-font-size-base);
--input-font-size: var(--label-base-400-font-size);
--input-line-height: 20px;
--input-placeholder-color: color-mix(
in srgb,

View File

@@ -12,8 +12,8 @@
}
.heading {
font-size: var(--periscope-font-size-small);
font-weight: var(--font-weight-medium);
font-size: var(--label-small-500-font-size);
font-weight: var(--label-small-500-font-weight);
line-height: 1;
letter-spacing: 0.04em;
text-transform: uppercase;
@@ -34,9 +34,9 @@
--button-height: auto;
--button-padding: var(--spacing-4) var(--spacing-6);
--button-border-radius: var(--radius-3);
--button-font-size: var(--periscope-font-size-base);
--button-font-size: var(--label-base-400-font-size);
--button-size-line-height: var(--line-height-20);
--button-font-weight: var(--font-weight-normal);
--button-font-weight: var(--label-base-400-font-weight);
--button-variant-outlined-background-color: var(--l3-background-60);
--button-variant-outlined-border: none;
--button-variant-outlined-color: var(--l2-foreground);

View File

@@ -16,11 +16,11 @@ import {
import { v4 as uuidv4 } from 'uuid';
import { Button } from '@signozhq/ui/button';
import { Tooltip } from '@signozhq/ui/tooltip';
import type { MessageActionDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import type { MessageActionDTO } from '@signozhq/noz-client';
import {
ApplyFilterSignalDTO,
MessageActionKindDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import {
restoreExecution,
revertExecution,

View File

@@ -1,7 +1,4 @@
import {
MessageActionDTO,
MessageActionKindDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { MessageActionDTO, MessageActionKindDTO } from '@signozhq/noz-client';
import logEvent from 'api/common/logEvent';
import { getCurrentLocation, navigate } from 'lib/router/navigation';
import { act, render, screen, userEvent, waitFor } from 'tests/test-utils';

View File

@@ -1,9 +1,9 @@
import { undoExecution } from 'api/ai-assistant/chat';
import type { MessageActionDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import type { MessageActionDTO } from '@signozhq/noz-client';
import {
ApplyFilterSignalDTO,
MessageActionKindDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import { Querybuildertypesv5RequestTypeDTO } from 'api/generated/services/sigNoz.schemas';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';

View File

@@ -1,4 +1,4 @@
import { ApplyFilterSignalDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { ApplyFilterSignalDTO } from '@signozhq/noz-client';
import { Querybuildertypesv5RequestTypeDTO } from 'api/generated/services/sigNoz.schemas';
import { PANEL_TYPES } from 'constants/queryBuilder';

View File

@@ -2,7 +2,7 @@ import {
ApplyFilterSignalDTO,
MessageActionKindDTO,
SavedViewEntityDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import {
getSavedView,
listSavedViews,

View File

@@ -1,7 +1,7 @@
import {
type MessageActionDTO,
MessageActionKindDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import {
isSavedViewOpenAction,

View File

@@ -1,7 +1,7 @@
import {
ApplyFilterSignalDTO,
type MessageActionDTOQuery,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import { Querybuildertypesv5RequestTypeDTO } from 'api/generated/services/sigNoz.schemas';
import { PANEL_TYPES } from 'constants/queryBuilder';

View File

@@ -1,4 +1,4 @@
import type { MessageActionDTOQuery } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import type { MessageActionDTOQuery } from '@signozhq/noz-client';
import { normalizeTimeToMs } from 'utils/timeUtils';
export interface ActionTimeRange {

View File

@@ -1,8 +1,5 @@
import type { MessageActionDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import {
ApplyFilterSignalDTO,
SavedViewEntityDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import type { MessageActionDTO } from '@signozhq/noz-client';
import { ApplyFilterSignalDTO, SavedViewEntityDTO } from '@signozhq/noz-client';
import { DataSource } from 'types/common/queryBuilder';
import { ResourceType } from './resourceRoute';

View File

@@ -31,8 +31,8 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: var(--periscope-font-size-small);
font-weight: var(--font-weight-medium);
font-size: var(--label-small-500-font-size);
font-weight: var(--label-small-500-font-weight);
line-height: 18px;
letter-spacing: -0.005em;
}
@@ -54,7 +54,7 @@
.soloThought {
margin: 0;
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
line-height: var(--line-height-20);
letter-spacing: -0.005em;
color: var(--l2-foreground);
@@ -64,8 +64,8 @@
// While Noz works, the row names the step it's on.
.live .activitySummary {
font-size: var(--periscope-font-size-base);
font-weight: var(--font-weight-normal);
font-size: var(--paragraph-base-400-font-size);
font-weight: var(--paragraph-base-400-font-weight);
line-height: var(--line-height-20);
@include shimmer-text(var(--l3-foreground), var(--l1-foreground));
}

View File

@@ -59,7 +59,7 @@
border: none;
background: none;
font: inherit;
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
line-height: var(--line-height-20);
letter-spacing: -0.005em;
color: var(--l1-foreground);
@@ -90,7 +90,7 @@ button.title {
}
.detail {
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
line-height: var(--line-height-20);
letter-spacing: -0.005em;
color: var(--l2-foreground);

View File

@@ -42,7 +42,7 @@
}
.headerLabel {
font-size: var(--font-size-sm);
font-size: var(--paragraph-base-400-font-size);
line-height: var(--line-height-20);
letter-spacing: -0.005em;
color: var(--l1-foreground);
@@ -61,7 +61,7 @@
.summary {
margin: 0;
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
line-height: var(--line-height-20);
color: var(--l2-foreground);
}

View File

@@ -8,7 +8,7 @@ import { Tooltip } from '@signozhq/ui/tooltip';
import type {
ApprovalEventDTO,
ApprovalEventDTODiff,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import {
Check,
Columns2,

View File

@@ -134,8 +134,8 @@
--button-padding: 7px #{$padding-inline};
--button-border-radius: 0;
--button-justify-content: flex-start;
--button-font-size: var(--periscope-font-size-base);
--button-font-weight: var(--font-weight-normal);
--button-font-size: var(--label-base-400-font-size);
--button-font-weight: var(--label-base-400-font-weight);
--button-variant-ghost-color: var(--l2-foreground);
--button-variant-ghost-hover-color: var(--l1-foreground);
--button-variant-ghost-hover-background-color: var(--l3-background);
@@ -180,8 +180,8 @@
height: 44px;
padding: 0 var(--spacing-7);
border-bottom: 1px solid var(--l2-border);
font-size: var(--periscope-font-size-small);
font-weight: var(--font-weight-semibold);
font-size: var(--label-small-600-font-size);
font-weight: var(--label-small-600-font-weight);
line-height: 1;
letter-spacing: 0.04em;
text-transform: uppercase;

View File

@@ -8,8 +8,8 @@
border-radius: var(--radius-2);
background: var(--l3-background-60);
color: var(--l2-foreground);
font-size: var(--font-size-xs);
font-weight: var(--font-weight-medium);
font-size: var(--label-small-500-font-size);
font-weight: var(--label-small-500-font-weight);
line-height: 15px;
transition:
background-color 0.12s,

View File

@@ -40,7 +40,7 @@
}
.headerLabel {
font-size: var(--font-size-sm);
font-size: var(--paragraph-base-400-font-size);
line-height: var(--line-height-20);
letter-spacing: -0.005em;
color: var(--l1-foreground);
@@ -48,7 +48,7 @@
.message {
margin: 0;
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
line-height: var(--line-height-20);
color: var(--l2-foreground);
}

View File

@@ -6,11 +6,11 @@ import { Input } from '@signozhq/ui/input';
import { Select } from '@signozhq/ui/select';
import type { SelectItemType } from '@signozhq/ui/select';
import logEvent from 'api/common/logEvent';
import { ClarificationFieldTypeDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { ClarificationFieldTypeDTO } from '@signozhq/noz-client';
import type {
ClarificationEventDTO,
ClarificationFieldEventDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import { CircleHelp, Send, X } from '@signozhq/icons';
import { AIAssistantEvents } from '../../events';

View File

@@ -53,7 +53,7 @@
}
.title {
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
line-height: 20px;
letter-spacing: -0.005em;
color: var(--text-vanilla-400);
@@ -73,7 +73,7 @@
// Wide enough to hold the action buttons that replace it.
min-width: 16px;
text-align: right;
font-size: var(--periscope-font-size-small);
font-size: var(--paragraph-small-400-font-size);
line-height: 18px;
color: var(--l3-foreground);
opacity: calc(1 - var(--actions-opacity, 0));
@@ -87,7 +87,7 @@
width: 100%;
border-bottom: 1px solid var(--accent-primary);
--input-padding: 1px 0;
--input-font-size: var(--periscope-font-size-base);
--input-font-size: var(--label-base-400-font-size);
--input-hover-border-color: transparent;
}

View File

@@ -56,7 +56,7 @@
--button-border-radius: 3px;
--button-justify-content: flex-start;
--button-gap: var(--spacing-4);
--button-font-weight: var(--font-weight-normal);
--button-font-weight: var(--label-base-400-font-weight);
--button-variant-outlined-background-color: var(--l2-background);
--button-variant-outlined-border: 1px solid var(--l1-border);
--button-variant-outlined-color: var(--l2-foreground);
@@ -144,8 +144,8 @@
.groupLabel {
display: block;
padding: 0 0 7px;
font-size: var(--periscope-font-size-small);
font-weight: var(--font-weight-semibold);
font-size: var(--label-small-600-font-size);
font-weight: var(--label-small-600-font-weight);
line-height: 1;
text-transform: uppercase;
letter-spacing: 0.04em;

View File

@@ -14,8 +14,8 @@
}
.note {
font-size: var(--periscope-font-size-small);
font-weight: var(--font-weight-medium);
font-size: var(--label-small-500-font-size);
font-weight: var(--label-small-500-font-weight);
line-height: 1;
font-feature-settings:
'tnum' on,

View File

@@ -71,7 +71,7 @@
align-items: flex-start;
background: var(--l2-background);
color: var(--l1-foreground);
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
border-bottom-left-radius: var(--radius-2);
}
@@ -274,7 +274,7 @@
width: max-content;
min-width: 100%;
border-collapse: collapse;
font-size: var(--periscope-font-size-base);
font-size: var(--paragraph-base-400-font-size);
font-variant-numeric: tabular-nums;
word-break: normal;
@@ -286,8 +286,8 @@
th {
padding-block: 13px;
font-size: var(--periscope-font-size-small);
font-weight: var(--font-weight-medium);
font-size: var(--label-small-500-font-size);
font-weight: var(--label-small-500-font-weight);
line-height: 1;
letter-spacing: 0.04em;
text-transform: uppercase;

View File

@@ -5,7 +5,7 @@ import remarkGfm from 'remark-gfm';
import { Button } from '@signozhq/ui/button';
import { RotateCw, TriangleAlert } from '@signozhq/icons';
import { RetryActionDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { RetryActionDTO } from '@signozhq/noz-client';
// Side-effect: registers all built-in block types into the BlockRegistry
import '../blocks';

View File

@@ -1,9 +1,6 @@
import React from 'react';
import { render, screen, userEvent } from 'tests/test-utils';
import {
ErrorCodeDTO,
RetryActionDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { ErrorCodeDTO, RetryActionDTO } from '@signozhq/noz-client';
import { Message } from '../../../types';

View File

@@ -10,7 +10,7 @@ import { useTimezone } from 'providers/Timezone';
import logEvent from 'api/common/logEvent';
import { FeedbackRatingDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { FeedbackRatingDTO } from '@signozhq/noz-client';
import { AIAssistantEvents } from '../../events';
import { useAIAssistantAnalyticsContext } from '../../hooks/useAIAssistantAnalyticsContext';
import { useAIAssistantStore } from '../../store/useAIAssistantStore';

View File

@@ -6,7 +6,7 @@ import remarkGfm from 'remark-gfm';
import type {
ApprovalEventDTO,
ClarificationEventDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import { useVariant } from '../../VariantContext';
import { StreamingEventItem } from '../../types';

View File

@@ -44,8 +44,8 @@
--button-height: 32px;
--button-padding: 0 var(--spacing-6);
--button-border-radius: var(--radius-round);
--button-font-size: var(--periscope-font-size-base);
--button-font-weight: var(--font-weight-normal);
--button-font-size: var(--label-base-400-font-size);
--button-font-weight: var(--label-base-400-font-weight);
--button-secondary-background-color: var(--l3-background);
--button-secondary-hover-background-color: var(--l3-background-hover);
--button-secondary-solid-foreground: var(--l1-foreground);

View File

@@ -7,7 +7,7 @@ import { ArrowDown } from '@signozhq/icons';
import type {
ApprovalEventDTO,
ClarificationEventDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import logEvent from 'api/common/logEvent';
import { AIAssistantEvents } from '../../events';

View File

@@ -1,4 +1,4 @@
import type { ChipDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import type { ChipDTO } from '@signozhq/noz-client';
/** Static empty-state chips used when the contextual chips API is unavailable. */
export const EMPTY_STATE_CHIPS_FALLBACK: ChipDTO[] = [

View File

@@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { useQuery } from 'react-query';
import { getEmptyStateChips } from 'api/ai-assistant/chat';
import type { ChipDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import type { ChipDTO } from '@signozhq/noz-client';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { useResolvePageType } from 'hooks/aiAssistant/useResolvePageType';

View File

@@ -1,4 +1,4 @@
import { PageTypeDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { PageTypeDTO } from '@signozhq/noz-client';
import { QueryParams } from 'constants/query';
import ROUTES from 'constants/routes';
import { matchRoute } from 'lib/router/matchRoute';

View File

@@ -4,7 +4,7 @@ import {
MessageContextDTOType,
MessageRoleDTO,
RetryActionDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import type {
MessageContext,
SSEEvent,

View File

@@ -7,8 +7,8 @@ import { immer } from 'zustand/middleware/immer';
import type {
MessageActionDTO,
MessageSummaryDTOBlocksAnyOfItem,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { RetryActionDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import { RetryActionDTO } from '@signozhq/noz-client';
import {
approveExecution,

View File

@@ -1,8 +1,7 @@
/**
* UI types for the AI Assistant.
*
* Wherever the OpenAPI-generated DTOs in
* `src/api/ai-assistant/sigNozAIAssistantAPI.schemas.ts`
* Wherever the OpenAPI-generated DTOs in `@signozhq/noz-client`
* already capture the right shape, this module re-exports them.
*
* A type is defined locally only when the UI needs a different shape than
@@ -20,7 +19,7 @@ import type {
MessageActionDTO,
MessageActionKindDTO,
RetryActionDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import type { MessageContext } from 'api/ai-assistant/chat';
/** Client-only file attachment — no API equivalent (uploads happen via data URLs). */

View File

@@ -1,8 +1,5 @@
import { AxiosError } from 'axios';
import {
ErrorCodeDTO,
RetryActionDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { ErrorCodeDTO, RetryActionDTO } from '@signozhq/noz-client';
import { resolveAssistantError } from '../resolveAssistantError';

View File

@@ -4,7 +4,7 @@ import {
RetryActionDTO,
type ErrorBodyDTO,
type ErrorResponseDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
export interface AssistantErrorResolution {
/** User-facing copy: code-specific FE copy → backend message → caller fallback. */

View File

@@ -83,6 +83,7 @@ import { MeterAggregateOperator } from 'types/common/queryBuilder';
import { USER_ROLES } from 'types/roles';
import { getDaysUntilExpiry } from 'utils/timeUtils';
import 'components/LearnMore/LearnMore.styles.scss';
import './IngestionSettings.styles.scss';
const { Option } = Select;

View File

@@ -1,13 +1,42 @@
import { QueryClient, QueryClientProvider } from 'react-query';
import ROUTES from 'constants/routes';
import { customRoleResponse } from 'mocks-server/__mockdata__/roles';
import { server } from 'mocks-server/server';
import { rest } from 'msw';
import { render, screen, userEvent, waitFor, within } from 'tests/test-utils';
import { setupAuthzAdmin } from 'lib/authz/utils/authz-test-utils';
import {
act,
render,
screen,
userEvent,
waitFor,
within,
} from 'tests/test-utils';
import {
AUTHZ_CHECK_URL,
authzMockResponse,
setupAuthzAdmin,
} from 'lib/authz/utils/authz-test-utils';
import { getCurrentLocation } from 'lib/router/navigation';
import CreateEditRolePage from '../CreateEditRolePage';
jest.mock('@monaco-editor/react', () => ({
__esModule: true,
default: ({
value,
onChange,
}: {
value: string;
onChange: (next?: string) => void;
}): JSX.Element => (
<textarea
data-testid="monaco-editor"
value={value}
onChange={(e): void => onChange(e.target.value)}
/>
),
}));
const CUSTOM_ROLE_ID = '019c24aa-3333-0001-aaaa-111111111111';
const rolesApiBase = '*/api/v1/roles';
const VIEW_ROLE_URL = `${ROUTES.ROLE_DETAILS.replace(
@@ -408,4 +437,125 @@ describe('EditRolePage', () => {
);
});
});
describe('JSON view opened from the URL', () => {
const roleGrants = roleWithTransactionGroups.data.transactionGroups;
function renderJsonView(client?: QueryClient): ReturnType<typeof render> {
const page = <CreateEditRolePage />;
return render(
client ? (
<QueryClientProvider client={client}>{page}</QueryClientProvider>
) : (
page
),
undefined,
{
initialRoute: `/settings/roles/${CUSTOM_ROLE_ID}/edit?name=Custom%20Role&viewMode=json`,
},
);
}
function readBuffer(editor: HTMLElement): unknown {
return JSON.parse((editor as HTMLTextAreaElement).value);
}
it('shows the role grants when the role loads after the authz check', async () => {
server.use(
rest.get(`${rolesApiBase}/:id`, (_req, res, ctx) =>
res(ctx.delay(300), ctx.status(200), ctx.json(roleWithTransactionGroups)),
),
);
renderJsonView();
const editor = await screen.findByTestId('monaco-editor');
expect(readBuffer(editor)).toStrictEqual(roleGrants);
});
it('shows the role grants when the role loads before the authz check', async () => {
server.use(
rest.post(AUTHZ_CHECK_URL, async (req, res, ctx) => {
const payload = await req.json();
return res(
ctx.delay(300),
ctx.status(200),
ctx.json(
authzMockResponse(
payload,
payload.map(() => true),
),
),
);
}),
);
renderJsonView();
const editor = await screen.findByTestId('monaco-editor');
expect(readBuffer(editor)).toStrictEqual(roleGrants);
});
it('saves what was typed in the buffer even when the role refetches afterwards', async () => {
const updatedBodies: unknown[] = [];
let roleReads = 0;
server.use(
rest.get(`${rolesApiBase}/:id`, (_req, res, ctx) => {
roleReads += 1;
return res(
ctx.status(200),
ctx.json(
roleReads === 1
? roleWithTransactionGroups
: {
...roleWithTransactionGroups,
data: {
...roleWithTransactionGroups.data,
transactionGroups: [
{
objectGroup: {
resource: { kind: 'role', type: 'role' },
selectors: ['*'],
},
relation: 'update',
},
],
},
},
),
);
}),
rest.put(`${rolesApiBase}/:id`, async (req, res, ctx) => {
updatedBodies.push(await req.json());
return res(ctx.status(200), ctx.json({ status: 'success' }));
}),
);
const user = userEvent.setup();
const client = new QueryClient({
defaultOptions: { queries: { retry: false } },
});
renderJsonView(client);
const editor = await screen.findByTestId('monaco-editor');
await user.type(editor, '[[]', {
initialSelectionStart: 0,
initialSelectionEnd: (editor as HTMLTextAreaElement).value.length,
});
await act(async () => {
await client.invalidateQueries();
});
await waitFor(() => {
expect(roleReads).toBeGreaterThan(1);
});
await user.click(screen.getByTestId('save-button'));
await waitFor(() => {
expect(updatedBodies).toHaveLength(1);
});
expect(updatedBodies[0]).toMatchObject({ transactionGroups: [] });
});
});
});

View File

@@ -86,6 +86,9 @@ export function useCreateEditRolePageActions(
const { mutateAsync: updateRole, isLoading: isUpdating } =
useUpdateRolePermissions();
const isSaving = isCreating || isUpdating;
// Editors read their initial value once, so stay loading until the fetched
// role has been copied into local state.
const isSeedingFromRole = !!rolePermissionsData && !isInitialized;
useEffect(() => {
if (rolePermissionsData && !isInitialized) {
@@ -229,7 +232,7 @@ export function useCreateEditRolePageActions(
setEditorMode: handleModeChange,
resources: localResources,
setResources: handleResourcesChange,
isLoading: isLoadingPermissions,
isLoading: isLoadingPermissions || isSeedingFromRole,
isSaving,
hasUnsavedChanges,
handleSave,

View File

@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react';
import { PageTypeDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { PageTypeDTO } from '@signozhq/noz-client';
import type { AIAssistantVariant } from 'container/AIAssistant/VariantContext';
import ROUTES from 'constants/routes';
import { mockAppLocation } from 'tests/router-mocks';

View File

@@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { useAppLocation } from 'lib/router/useAppLocation';
import { PageTypeDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import { PageTypeDTO } from '@signozhq/noz-client';
import { resolvePageType } from 'container/AIAssistant/resolvePageType';
import { useVariant } from 'container/AIAssistant/VariantContext';

View File

@@ -29,7 +29,7 @@
align-items: center;
justify-content: space-between;
gap: var(--spacing-6);
font-size: var(--font-size-sm);
font-size: var(--label-base-500-font-size);
font-weight: 500;
}
@@ -37,7 +37,7 @@
.subtitle {
padding-left: calc(12px + var(--spacing-3));
font-family: var(--font-mono);
font-size: var(--font-size-xs);
font-size: var(--paragraph-small-400-font-size);
color: var(--muted-foreground);
}
@@ -58,7 +58,7 @@
.code {
flex-shrink: 0;
font-family: var(--font-mono);
font-size: var(--font-size-xs);
font-size: var(--paragraph-small-400-font-size);
color: var(--muted-foreground);
}
@@ -100,7 +100,7 @@
align-items: center;
gap: var(--spacing-2);
font-family: var(--font-mono);
font-size: var(--font-size-xs);
font-size: var(--paragraph-small-400-font-size);
letter-spacing: -0.01em;
font-variant-numeric: tabular-nums;
}

View File

@@ -11,7 +11,7 @@ import type {
MessageSummaryDTO,
ThreadDetailResponseDTO,
ThreadListResponseDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import {
ApplyFilterSignalDTO,
ApprovalActionTypeDTO,
@@ -22,7 +22,7 @@ import {
MessageActionKindDTO,
MessageContentTypeDTO,
MessageRoleDTO,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import type {
Conversation,
ConversationStreamState,

View File

@@ -3,11 +3,11 @@
* Do not hand-edit: regenerate instead.
*/
import type { MessageSummaryDTO } from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
import type { MessageSummaryDTO } from '@signozhq/noz-client';
import {
MessageContextDTOSource,
MessageContextDTOType,
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
} from '@signozhq/noz-client';
import type { MessageBlock } from 'container/AIAssistant/types';
/** The opening question's contexts: the thread shows the @-picked ones, not the page it was asked from. */

View File

@@ -1,14 +1,16 @@
import Loadable from 'components/Loadable';
import { TabRoutes } from 'components/RouteTab/types';
import { QueryParams } from 'constants/query';
import ROUTES from 'constants/routes';
import AlertHistory from 'container/AlertHistory';
import { AlertDetailsTab } from 'container/AlertHistory/types';
import useUrlQuery from 'hooks/useUrlQuery';
import { buildRoutePath } from 'lib/router/buildRoutePath';
import { History, Table } from '@signozhq/icons';
import EditRules from 'pages/EditRules';
import BetaTag from 'periscope/components/BetaTag/BetaTag';
const EditRules = Loadable(() => import('pages/EditRules'));
const AlertHistory = Loadable(() => import('container/AlertHistory'));
export const useRouteTabUtils = (): { routes: TabRoutes[] } => {
const urlQuery = useUrlQuery();

View File

@@ -36,7 +36,7 @@
.sizerValue {
font-size: 12px;
font-weight: var(--font-weight-medium);
font-weight: var(--label-base-500-font-weight);
font-variant-numeric: tabular-nums;
}

View File

@@ -46,7 +46,7 @@
}
.tooltipName {
font-weight: var(--font-weight-medium);
font-weight: var(--label-base-500-font-weight);
word-break: break-word;
}

View File

@@ -37,7 +37,7 @@
.value {
font-size: 12px;
line-height: 16px;
font-weight: var(--font-weight-medium);
font-weight: var(--label-base-500-font-weight);
color: var(--l1-foreground);
text-align: right;
white-space: nowrap;

View File

@@ -0,0 +1,35 @@
import ROUTES from 'constants/routes';
import { render, screen } from 'tests/test-utils';
import { USER_ROLES } from 'types/roles';
const mockBillingModuleLoaded = jest.fn();
jest.mock('pages/MembersSettings', () => ({
__esModule: true,
default: (): JSX.Element => <div data-testid="members-settings-tab" />,
}));
jest.mock('container/BillingContainer/BillingContainer', () => {
mockBillingModuleLoaded();
return {
__esModule: true,
default: (): JSX.Element => <div data-testid="billing-settings-tab" />,
};
});
describe('SettingsPage tabs', () => {
it('loads only the tab of the current route', async () => {
const { default: SettingsPage } = await import('pages/Settings/Settings');
render(<SettingsPage />, undefined, {
role: USER_ROLES.ADMIN,
initialRoute: ROUTES.MEMBERS_SETTINGS,
});
await expect(
screen.findByTestId('members-settings-tab'),
).resolves.toBeInTheDocument();
expect(screen.queryByTestId('billing-settings-tab')).not.toBeInTheDocument();
expect(mockBillingModuleLoaded).not.toHaveBeenCalled();
});
});

View File

@@ -1,16 +1,7 @@
import { lazy } from 'react';
import Loadable from 'components/Loadable';
import { RouteTabProps } from 'components/RouteTab/types';
import ROUTES from 'constants/routes';
import BillingContainer from 'container/BillingContainer/BillingContainer';
import GeneralSettings from 'container/GeneralSettings';
import GeneralSettingsCloud from 'container/GeneralSettingsCloud';
import IngestionSettings from 'container/IngestionSettings/IngestionSettings';
import MultiIngestionSettings from 'container/IngestionSettings/MultiIngestionSettings';
import MCPServerSettings from 'container/MCPServerSettings/MCPServerSettings';
import MySettings from 'container/MySettings';
import OrganizationSettings from 'container/OrganizationSettings';
import RolesSettings from 'container/RolesSettings';
import CreateEditRolePage from 'container/RolesSettings/CreateEditRolePage';
import ViewRolePage from 'container/RolesSettings/ViewRolePage';
import { TFunction } from 'i18next';
import {
Backpack,
@@ -24,9 +15,41 @@ import {
User,
Users,
} from '@signozhq/icons';
import MembersSettings from 'pages/MembersSettings';
import ServiceAccountsSettings from 'pages/ServiceAccountsSettings';
import Shortcuts from 'pages/Shortcuts';
import { lazyRetry } from 'utils/lazyWithRetries';
const BillingContainer = Loadable(
() => import('container/BillingContainer/BillingContainer'),
);
const GeneralSettings = Loadable(() => import('container/GeneralSettings'));
const GeneralSettingsCloud = Loadable(
() => import('container/GeneralSettingsCloud'),
);
const IngestionSettings = Loadable(
() => import('container/IngestionSettings/IngestionSettings'),
);
const MultiIngestionSettings = Loadable(
() => import('container/IngestionSettings/MultiIngestionSettings'),
);
const MCPServerSettings = Loadable(
() => import('container/MCPServerSettings/MCPServerSettings'),
);
const MySettings = Loadable(() => import('container/MySettings'));
const OrganizationSettings = Loadable(
() => import('container/OrganizationSettings'),
);
const RolesSettings = Loadable(() => import('container/RolesSettings'));
// Loadable's prop type rejects the authz HOC's ComponentType<object>.
const CreateEditRolePage = lazy(() =>
lazyRetry(() => import('container/RolesSettings/CreateEditRolePage')),
);
const ViewRolePage = Loadable(
() => import('container/RolesSettings/ViewRolePage'),
);
const MembersSettings = Loadable(() => import('pages/MembersSettings'));
const ServiceAccountsSettings = Loadable(
() => import('pages/ServiceAccountsSettings'),
);
const Shortcuts = Loadable(() => import('pages/Shortcuts'));
export const organizationSettings = (t: TFunction): RouteTabProps['routes'] => [
{

View File

@@ -71,6 +71,20 @@ type KafkaConfig struct {
// ShutdownTimeout bounds draining buffered events on stop; events still undelivered when it expires are dropped.
ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout"`
TLS TLSConfig `mapstructure:"tls"`
}
type TLSConfig struct {
Enabled bool `mapstructure:"enabled"`
// CAFile is the PEM bundle that verifies the server certificate. Empty uses the system roots.
CAFile string `mapstructure:"ca_file"`
// CertFile and KeyFile are the client certificate, presented when the server requires client auth.
CertFile string `mapstructure:"cert_file"`
KeyFile string `mapstructure:"key_file"`
}
// RetryConfig configures exponential backoff for the OTLP HTTP exporter.
@@ -168,6 +182,10 @@ func (c Config) Validate() error {
if c.Kafka.ShutdownTimeout <= 0 {
return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "auditor::kafka::shutdown_timeout must be greater than 0")
}
if c.Kafka.TLS.Enabled && (c.Kafka.TLS.CertFile == "") != (c.Kafka.TLS.KeyFile == "") {
return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "auditor::kafka::tls::cert_file and auditor::kafka::tls::key_file must be set together")
}
}
return nil

View File

@@ -30,6 +30,10 @@ func (h *provider) BeforeQuery(ctx context.Context, _ *telemetrystore.QueryEvent
settings["log_comment"] = ctxtypes.CommentFromContext(ctx).String()
// The result model has no Variant type: mismatched types must fail with the
// no-common-type error rather than become a Variant (the 26.8 default).
settings["use_variant_as_common_type"] = 0
if ctx.Value("enforce_max_result_rows") != nil {
settings["max_result_rows"] = h.settings.MaxResultRows
}

View File

@@ -116,6 +116,6 @@ def pytest_addoption(parser: pytest.Parser):
parser.addoption(
"--signoz-otel-collector-version",
action="store",
default="v0.144.16-rc.1",
default="v0.144.17",
help="signoz-otel-collector version, used to run clickhouse migrations",
)

View File

@@ -144,14 +144,13 @@ def test_timestamp_counting_aggregations_are_numeric(
assert raw > 0, f"{expression} returned {raw!r}, expected a positive rate"
# KNOWN GAP, pinned deliberately: ClickHouse rejects sum/avg over DateTime64, and rate_*
# KNOWN GAP, pinned deliberately: ClickHouse rejects sum over DateTime64, and rate_*
# additionally divides a time by an interval; both surface as the generic 500. They returned
# a meaningless seconds number before #5824. Flip to BAD_REQUEST once validated up front.
@pytest.mark.parametrize(
"expression",
[
"sum(timestamp)",
"avg(timestamp)",
"rate_sum(timestamp)",
"rate_avg(timestamp)",
"rate_min(timestamp)",