mirror of
https://github.com/SigNoz/signoz.git
synced 2026-11-24 17:21:06 +00:00
Compare commits
21 Commits
refactor/s
...
ci/e2e-sha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ef70575e5 | ||
|
|
7601d8d976 | ||
|
|
3959c23f83 | ||
|
|
fc8c53eeb4 | ||
|
|
4aeb9c2d15 | ||
|
|
2a7c5df62a | ||
|
|
f28e7e4be3 | ||
|
|
2945f3c62a | ||
|
|
768b1b3fff | ||
|
|
35b2605435 | ||
|
|
4e8971ec85 | ||
|
|
7e3cfce33b | ||
|
|
0bda515783 | ||
|
|
1e8e832918 | ||
|
|
9fd35b5110 | ||
|
|
cb0adcc618 | ||
|
|
b14b634bce | ||
|
|
7ea0d57417 | ||
|
|
1e08a94ab8 | ||
|
|
cbfbb103af | ||
|
|
fbca5e7d80 |
28
.github/workflows/e2eci.yaml
vendored
28
.github/workflows/e2eci.yaml
vendored
@@ -67,6 +67,30 @@ jobs:
|
||||
- name: lint
|
||||
run: |
|
||||
cd tests/e2e && pnpm lint
|
||||
# A package both manifests declare must have the same version in both.
|
||||
# tests/e2e type-checks frontend files against its own installs.
|
||||
shared-deps:
|
||||
needs: changes
|
||||
if: github.event_name != 'merge_group' && needs.changes.outputs.e2e == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: compare
|
||||
run: |
|
||||
MISMATCHES=$(jq -rn \
|
||||
--slurpfile frontend frontend/package.json \
|
||||
--slurpfile e2e tests/e2e/package.json '
|
||||
($frontend[0] | (.dependencies // {}) + (.devDependencies // {})) as $f
|
||||
| $e2e[0] | (.dependencies // {}) + (.devDependencies // {})
|
||||
| to_entries[]
|
||||
| select($f[.key] != null and $f[.key] != .value)
|
||||
| "::error file=tests/e2e/package.json::\(.key) is \(.value) here and \($f[.key]) in frontend/package.json. Set both to the same version."
|
||||
')
|
||||
if [ -n "$MISMATCHES" ]; then
|
||||
echo "$MISMATCHES"
|
||||
exit 1
|
||||
fi
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -94,7 +118,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
|
||||
@@ -189,7 +213,7 @@ jobs:
|
||||
# Runs for other labels must not report as e2e, or their pass would hide the real result.
|
||||
name: ${{ github.event.action == 'labeled' && github.event.label.name != 'safe-to-e2e' && 'ignored-label' || 'e2e' }}
|
||||
if: always()
|
||||
needs: [changes, fmtlint, test]
|
||||
needs: [changes, fmtlint, shared-deps, test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: verdict
|
||||
|
||||
7
.github/workflows/integrationci.yaml
vendored
7
.github/workflows/integrationci.yaml
vendored
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
269
ee/auditor/kafkaauditor/tls_test.go
Normal file
269
ee/auditor/kafkaauditor/tls_test.go
Normal 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})
|
||||
}
|
||||
@@ -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`.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -137,6 +137,8 @@ window.getComputedStyle = function (
|
||||
return {
|
||||
display: '',
|
||||
visibility: '',
|
||||
width: '',
|
||||
height: '',
|
||||
opacity: '1',
|
||||
animationName: 'none',
|
||||
getPropertyValue: () => '',
|
||||
|
||||
@@ -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",
|
||||
|
||||
16
frontend/pnpm-lock.yaml
generated
16
frontend/pnpm-lock.yaml
generated
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
@@ -30,16 +30,11 @@ import rotateSession from 'api/v2/sessions/rotate/post';
|
||||
import afterLogin from 'AppRoutes/utils';
|
||||
import type {
|
||||
ActionResultResponseDTO,
|
||||
ApprovalEventDTO,
|
||||
ApproveResponseDTO,
|
||||
CancelResponseDTO,
|
||||
ClarificationEventDTO,
|
||||
ClarifyResponseDTO,
|
||||
ConversationEventDTO,
|
||||
CreateMessageResponseDTO,
|
||||
CreateThreadResponseDTO,
|
||||
DoneEventDTO,
|
||||
ErrorEventDTO,
|
||||
ExecutionStateDTO,
|
||||
FeedbackRatingDTO,
|
||||
ListThreadsApiV1AssistantThreadsGetArchived,
|
||||
@@ -47,20 +42,15 @@ import type {
|
||||
MessageContextDTO,
|
||||
MessageContextDTOSource,
|
||||
MessageContextDTOType,
|
||||
MessageEventDTO,
|
||||
MessageSummaryDTO,
|
||||
RegenerateResponseDTO,
|
||||
StatusEventDTO,
|
||||
ThinkingEventDTO,
|
||||
ThreadDetailResponseDTO,
|
||||
ThreadListResponseDTO,
|
||||
ThreadSummaryDTO,
|
||||
ChipDTO,
|
||||
ChipsResponseDTO,
|
||||
PageTypeDTO,
|
||||
ToolCallEventDTO,
|
||||
ToolResultEventDTO,
|
||||
} from './sigNozAIAssistantAPI.schemas';
|
||||
} from '@signozhq/noz-client';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
|
||||
import {
|
||||
@@ -70,6 +60,10 @@ import {
|
||||
} from '../AIAPIInstance';
|
||||
import { getSigNozInstanceUrl } from 'utils/signozInstanceUrl';
|
||||
|
||||
import type { SSEEvent } from './sseEvent';
|
||||
|
||||
export type { SSEEvent };
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SSE-only auth wrapper.
|
||||
//
|
||||
@@ -183,26 +177,6 @@ async function fetchSSEWithAuth(
|
||||
return res;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SSE event types
|
||||
//
|
||||
// The generated event DTOs each declare `type?: string` (loose). The UI needs
|
||||
// a discriminated union, so we intersect each variant with a string-literal
|
||||
// `type` to enable narrowing via `event.type === 'status'`.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type SSEEvent =
|
||||
| (StatusEventDTO & { type: 'status' })
|
||||
| (MessageEventDTO & { type: 'message' })
|
||||
| (ThinkingEventDTO & { type: 'thinking' })
|
||||
| (ToolCallEventDTO & { type: 'tool_call' })
|
||||
| (ToolResultEventDTO & { type: 'tool_result' })
|
||||
| (ApprovalEventDTO & { type: 'approval' })
|
||||
| (ClarificationEventDTO & { type: 'clarification' })
|
||||
| (ErrorEventDTO & { type: 'error' })
|
||||
| (ConversationEventDTO & { type: 'conversation' })
|
||||
| (DoneEventDTO & { type: 'done' });
|
||||
|
||||
/** String-literal view of `ExecutionStateDTO` for ergonomic comparisons. */
|
||||
export type ExecutionState = `${ExecutionStateDTO}`;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
32
frontend/src/api/ai-assistant/sseEvent.ts
Normal file
32
frontend/src/api/ai-assistant/sseEvent.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type {
|
||||
ApprovalEventDTO,
|
||||
ClarificationEventDTO,
|
||||
ConversationEventDTO,
|
||||
DoneEventDTO,
|
||||
ErrorEventDTO,
|
||||
MessageEventDTO,
|
||||
StatusEventDTO,
|
||||
ThinkingEventDTO,
|
||||
ToolCallEventDTO,
|
||||
ToolResultEventDTO,
|
||||
} from '@signozhq/noz-client';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SSE event types
|
||||
//
|
||||
// The generated event DTOs each declare `type?: string` (loose). The UI needs
|
||||
// a discriminated union, so we intersect each variant with a string-literal
|
||||
// `type` to enable narrowing via `event.type === 'status'`.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type SSEEvent =
|
||||
| (StatusEventDTO & { type: 'status' })
|
||||
| (MessageEventDTO & { type: 'message' })
|
||||
| (ThinkingEventDTO & { type: 'thinking' })
|
||||
| (ToolCallEventDTO & { type: 'tool_call' })
|
||||
| (ToolResultEventDTO & { type: 'tool_result' })
|
||||
| (ApprovalEventDTO & { type: 'approval' })
|
||||
| (ClarificationEventDTO & { type: 'clarification' })
|
||||
| (ErrorEventDTO & { type: 'error' })
|
||||
| (ConversationEventDTO & { type: 'conversation' })
|
||||
| (DoneEventDTO & { type: 'done' });
|
||||
1
frontend/src/auto-import-registry.d.ts
vendored
1
frontend/src/auto-import-registry.d.ts
vendored
@@ -12,4 +12,5 @@
|
||||
|
||||
import '@signozhq/design-tokens';
|
||||
import '@signozhq/icons';
|
||||
import '@signozhq/noz-client';
|
||||
import '@signozhq/ui';
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
),
|
||||
}));
|
||||
|
||||
@@ -194,7 +194,7 @@ export default function ConversationView({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={conversationClass}>
|
||||
<div className={conversationClass} data-testid="ai-conversation-view">
|
||||
<VirtualizedMessages
|
||||
key={conversationId}
|
||||
conversationId={conversationId}
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
ApplyFilterSignalDTO,
|
||||
MessageActionKindDTO,
|
||||
SavedViewEntityDTO,
|
||||
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
|
||||
} from '@signozhq/noz-client';
|
||||
import {
|
||||
getSavedView,
|
||||
listSavedViews,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type MessageActionDTO,
|
||||
MessageActionKindDTO,
|
||||
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
|
||||
} from '@signozhq/noz-client';
|
||||
|
||||
import {
|
||||
isSavedViewOpenAction,
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ export default function ConversationItem({
|
||||
return (
|
||||
<div
|
||||
className={itemClass}
|
||||
data-testid={`ai-conversation-item-${conversation.id}`}
|
||||
onClick={(): void => onSelect(conversation.id)}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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[] = [
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
MessageContextDTOType,
|
||||
MessageRoleDTO,
|
||||
RetryActionDTO,
|
||||
} from 'api/ai-assistant/sigNozAIAssistantAPI.schemas';
|
||||
} from '@signozhq/noz-client';
|
||||
import type {
|
||||
MessageContext,
|
||||
SSEEvent,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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). */
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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: [] });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
}
|
||||
|
||||
.tooltipName {
|
||||
font-weight: var(--font-weight-medium);
|
||||
font-weight: var(--label-base-500-font-weight);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
|
||||
@@ -120,7 +120,10 @@ export const test = withThing(withTanstack(kit));
|
||||
|
||||
Worker-scoped seeds use `seeded()`, which runs on a throwaway admin page and
|
||||
tears down after. Drivers reuse each other by calling the factory directly,
|
||||
never by reaching for another fixture.
|
||||
never by reaching for another fixture. Before adding a `goto` or a locator,
|
||||
grep `drivers/` for one: `shellDriver` owns the side nav and home page, and a
|
||||
feature driver's `goto` also waits for its page to load, which a raw
|
||||
`page.goto` skips.
|
||||
|
||||
- A method is navigation or a locator, never a scenario. A method that exists
|
||||
for one spec belongs in that spec; a flag that switches behaviour is two
|
||||
@@ -141,6 +144,17 @@ never by reaching for another fixture.
|
||||
- Never `test.slow()` in a driver: it triples the remaining budget on every
|
||||
call and compounds in loops. Use `allowFor(floor)`. Budgets and their
|
||||
measurements are in [`docs/flake-notes.md`](docs/flake-notes.md).
|
||||
- A fake stands in for a service the stack does not run (`drivers/noz/fake.ts`).
|
||||
Install it with `page.route` before the first `goto`, type it from the
|
||||
service's contract (S5), and answer only the methods and paths the real
|
||||
service serves. Anything else gets a 404, so a client change the real API
|
||||
would reject fails the spec.
|
||||
- Import from `frontend/` by relative path and only types
|
||||
(`export type * from '../../../frontend/src/…'`), as `drivers/schemas.ts`
|
||||
does. CI installs only `tests/e2e`, so a package the frontend file imports
|
||||
needs an e2e devDependency and a `paths` entry in `tsconfig.json`. A package
|
||||
both `package.json` files declare has the same version in both; the
|
||||
`shared-deps` job in `e2eci.yaml` fails otherwise.
|
||||
|
||||
## Moving a test down a layer
|
||||
|
||||
|
||||
62
tests/e2e/drivers/noz/driver.ts
generated
Normal file
62
tests/e2e/drivers/noz/driver.ts
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
import type { Locator, Page } from '@playwright/test';
|
||||
|
||||
import { logsExplorerDriver } from '../logs/explorer';
|
||||
import { shellDriver } from '../shell';
|
||||
|
||||
import { installFakeAssistant, type FakeAssistant } from './fake';
|
||||
|
||||
export const NOZ_NEW_PATH = '/ai-assistant/new';
|
||||
|
||||
const THREAD_PATH = /^\/ai-assistant\/([^/]+)$/;
|
||||
|
||||
export interface Noz {
|
||||
/** Turns Noz on for this page against a fake AI service; call before the first navigation. */
|
||||
enable(): Promise<FakeAssistant>;
|
||||
gotoHome(): Promise<void>;
|
||||
gotoNew(): Promise<void>;
|
||||
gotoLogsExplorer(): Promise<void>;
|
||||
reload(): Promise<void>;
|
||||
navItem(): Locator;
|
||||
/** "Ask Noz" in the bottom strip; opens the Noz drawer over the current page. */
|
||||
askNozButton(): Locator;
|
||||
newChatButton(): Locator;
|
||||
/** A thread's row in the history list. */
|
||||
historyItem(threadId: string): Locator;
|
||||
input(): Locator;
|
||||
/** Text in the open conversation, from either side. */
|
||||
message(text: string): Locator;
|
||||
/** Types `text` and presses Enter, as a user sends. */
|
||||
send(text: string): Promise<void>;
|
||||
/** The id in `/ai-assistant/:id`, `null` off the page. */
|
||||
conversationId(): string | null;
|
||||
}
|
||||
|
||||
export function nozDriver(page: Page): Noz {
|
||||
const conversation = (): Locator => page.getByTestId('ai-conversation-view');
|
||||
const input = (): Locator => page.getByTestId('ai-chat-input-textarea');
|
||||
|
||||
return {
|
||||
enable: () => installFakeAssistant(page),
|
||||
gotoHome: () => shellDriver(page).home.goto(),
|
||||
gotoNew: async () => {
|
||||
await page.goto(NOZ_NEW_PATH);
|
||||
},
|
||||
gotoLogsExplorer: () => logsExplorerDriver(page).goto(),
|
||||
reload: async () => {
|
||||
await page.reload();
|
||||
},
|
||||
navItem: () => shellDriver(page).nav.item('ai-assistant'),
|
||||
askNozButton: () => page.getByTestId('bottom-strip-ask-noz-button'),
|
||||
newChatButton: () => page.getByTestId('ai-assistant-new-conversation'),
|
||||
historyItem: (threadId) =>
|
||||
page.getByTestId(`ai-conversation-item-${threadId}`),
|
||||
input,
|
||||
message: (text) => conversation().getByText(text, { exact: true }),
|
||||
send: async (text) => {
|
||||
await input().fill(text);
|
||||
await input().press('Enter');
|
||||
},
|
||||
conversationId: () =>
|
||||
new URL(page.url()).pathname.match(THREAD_PATH)?.[1] ?? null,
|
||||
};
|
||||
}
|
||||
204
tests/e2e/drivers/noz/fake.ts
generated
Normal file
204
tests/e2e/drivers/noz/fake.ts
generated
Normal file
@@ -0,0 +1,204 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
|
||||
import type { Page, Route } from '@playwright/test';
|
||||
|
||||
import type { GetGlobalConfig200 } from '../schemas';
|
||||
import type {
|
||||
ChipsResponseDTO,
|
||||
CreateMessageRequestDTO,
|
||||
CreateMessageResponseDTO,
|
||||
CreateThreadResponseDTO,
|
||||
ExecutionStateDTO,
|
||||
MessageRoleDTO,
|
||||
MessageSummaryDTO,
|
||||
SSEEvent,
|
||||
ThreadDetailResponseDTO,
|
||||
ThreadListResponseDTO,
|
||||
} from './schemas';
|
||||
|
||||
export interface SentMessage {
|
||||
threadId: string;
|
||||
body: CreateMessageRequestDTO;
|
||||
}
|
||||
|
||||
export interface FakeAssistant {
|
||||
/** Queue the text of the next reply; a send with nothing queued gets a 500. */
|
||||
replyWith(text: string): void;
|
||||
/** Bodies the app POSTed to `/threads/:id/messages`, oldest first. */
|
||||
sentMessages(): SentMessage[];
|
||||
}
|
||||
|
||||
const ASSISTANT_PATH = '/api/v1/assistant';
|
||||
|
||||
/** The path under the assistant API, or `null` for any other request. */
|
||||
function assistantPath(url: URL): string | null {
|
||||
const at = url.pathname.indexOf(`${ASSISTANT_PATH}/`);
|
||||
return at >= 0 ? url.pathname.slice(at + ASSISTANT_PATH.length) : null;
|
||||
}
|
||||
|
||||
const json = (route: Route, body: unknown, status = 200): Promise<void> =>
|
||||
route.fulfill({ status, json: body });
|
||||
|
||||
// The generated enums are TS enums; a literal typed by their values can't drift.
|
||||
const role = (value: `${MessageRoleDTO}`): MessageRoleDTO =>
|
||||
value as MessageRoleDTO;
|
||||
const state = (value: `${ExecutionStateDTO}`): ExecutionStateDTO =>
|
||||
value as ExecutionStateDTO;
|
||||
|
||||
function replyEvents(
|
||||
executionId: string,
|
||||
messageId: string,
|
||||
text: string,
|
||||
): SSEEvent[] {
|
||||
return [
|
||||
{ type: 'status', executionId, state: state('running') },
|
||||
{ type: 'message', executionId, messageId, delta: text, done: false },
|
||||
{ type: 'message', executionId, messageId, delta: '', done: true },
|
||||
{ type: 'done', executionId, tokenInput: 0, tokenOutput: 0, latencyMs: 0 },
|
||||
];
|
||||
}
|
||||
|
||||
const sse = (events: SSEEvent[]): string =>
|
||||
events.map((event) => `data: ${JSON.stringify(event)}\n\n`).join('');
|
||||
|
||||
/** Fakes the AI service the stack doesn't run, and enables Noz for this page only. */
|
||||
export async function installFakeAssistant(page: Page): Promise<FakeAssistant> {
|
||||
const threads = new Map<string, ThreadDetailResponseDTO>();
|
||||
const executions = new Map<string, SSEEvent[]>();
|
||||
const replies: string[] = [];
|
||||
const sent: SentMessage[] = [];
|
||||
|
||||
const now = (): string => new Date().toISOString();
|
||||
|
||||
const message = (
|
||||
messageRole: `${MessageRoleDTO}`,
|
||||
content: string,
|
||||
extra: Partial<MessageSummaryDTO> = {},
|
||||
): MessageSummaryDTO => ({
|
||||
messageId: randomUUID(),
|
||||
role: role(messageRole),
|
||||
content,
|
||||
complete: true,
|
||||
createdAt: now(),
|
||||
updatedAt: now(),
|
||||
...extra,
|
||||
});
|
||||
|
||||
const createThread = (): CreateThreadResponseDTO => {
|
||||
const threadId = randomUUID();
|
||||
threads.set(threadId, {
|
||||
threadId,
|
||||
title: null,
|
||||
state: null,
|
||||
activeExecutionId: null,
|
||||
archived: false,
|
||||
createdAt: now(),
|
||||
updatedAt: now(),
|
||||
messages: [],
|
||||
});
|
||||
return { threadId };
|
||||
};
|
||||
|
||||
const listThreads = (url: URL): ThreadListResponseDTO => {
|
||||
const archived = url.searchParams.get('archived') === 'true';
|
||||
return {
|
||||
threads: [...threads.values()]
|
||||
.filter((thread) => Boolean(thread.archived) === archived)
|
||||
.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))
|
||||
.map((thread) => ({
|
||||
threadId: thread.threadId,
|
||||
title: thread.title,
|
||||
state: thread.state,
|
||||
archived: thread.archived,
|
||||
createdAt: thread.createdAt,
|
||||
updatedAt: thread.updatedAt,
|
||||
})),
|
||||
hasMore: false,
|
||||
nextCursor: null,
|
||||
};
|
||||
};
|
||||
|
||||
const postMessage = async (
|
||||
route: Route,
|
||||
thread: ThreadDetailResponseDTO,
|
||||
): Promise<void> => {
|
||||
const body = route.request().postDataJSON() as CreateMessageRequestDTO;
|
||||
sent.push({ threadId: thread.threadId, body });
|
||||
const text = replies.shift();
|
||||
if (text === undefined) {
|
||||
await json(route, { error: 'no scripted reply' }, 500);
|
||||
return;
|
||||
}
|
||||
const executionId = randomUUID();
|
||||
const reply = message('assistant', text, { executionId });
|
||||
executions.set(executionId, replyEvents(executionId, reply.messageId, text));
|
||||
thread.messages?.push(
|
||||
message('user', body.content, { contexts: body.contexts }),
|
||||
reply,
|
||||
);
|
||||
thread.title ??= body.content;
|
||||
thread.state = state('completed');
|
||||
thread.updatedAt = now();
|
||||
const response: CreateMessageResponseDTO = { executionId };
|
||||
await json(route, response);
|
||||
};
|
||||
|
||||
const handle = async (route: Route): Promise<void> => {
|
||||
const url = new URL(route.request().url());
|
||||
const method = route.request().method();
|
||||
const path = assistantPath(url) ?? '';
|
||||
const [, resource, id, sub, ...extra] = path.split('/');
|
||||
const thread = id ? threads.get(id) : undefined;
|
||||
const is = (verb: string, segment?: string): boolean =>
|
||||
method === verb && sub === segment && extra.length === 0;
|
||||
|
||||
if (resource === 'threads' && !id && is('POST')) {
|
||||
return json(route, createThread());
|
||||
}
|
||||
if (resource === 'threads' && !id && is('GET')) {
|
||||
return json(route, listThreads(url));
|
||||
}
|
||||
if (resource === 'threads' && thread && is('GET')) {
|
||||
return json(route, thread);
|
||||
}
|
||||
if (resource === 'threads' && thread && is('POST', 'messages')) {
|
||||
return postMessage(route, thread);
|
||||
}
|
||||
if (
|
||||
resource === 'executions' &&
|
||||
id &&
|
||||
executions.has(id) &&
|
||||
is('GET', 'events')
|
||||
) {
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'text/event-stream',
|
||||
body: sse(executions.get(id) ?? []),
|
||||
});
|
||||
}
|
||||
if (resource === 'empty-state' && id === 'chips' && is('GET')) {
|
||||
const chips: ChipsResponseDTO = { chips: [] };
|
||||
return json(route, chips);
|
||||
}
|
||||
return json(route, { error: `fake assistant: ${method} ${path}` }, 404);
|
||||
};
|
||||
|
||||
await page.route((url) => assistantPath(url) !== null, handle);
|
||||
|
||||
await page.route(
|
||||
(url) => url.pathname.endsWith('/api/v1/global/config'),
|
||||
async (route) => {
|
||||
const response = await route.fetch();
|
||||
const body = (await response.json()) as GetGlobalConfig200;
|
||||
body.data.ai_assistant_url = new URL(route.request().url()).origin;
|
||||
await route.fulfill({ response, json: body });
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
replyWith: (text) => {
|
||||
replies.push(text);
|
||||
},
|
||||
sentMessages: () => [...sent],
|
||||
};
|
||||
}
|
||||
12
tests/e2e/drivers/noz/index.ts
generated
Normal file
12
tests/e2e/drivers/noz/index.ts
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
import { driver, kit, type Layer } from '../kit';
|
||||
|
||||
import { nozDriver, type Noz } from './driver';
|
||||
|
||||
export type { FakeAssistant, SentMessage } from './fake';
|
||||
|
||||
export const withNoz: Layer<{ noz: Noz }> = driver('noz', ({ page }) =>
|
||||
nozDriver(page),
|
||||
);
|
||||
|
||||
export const test = withNoz(kit);
|
||||
export { expect } from '../kit';
|
||||
3
tests/e2e/drivers/noz/schemas.ts
generated
Normal file
3
tests/e2e/drivers/noz/schemas.ts
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
/** The AI service contract; `SSEEvent` adds the `type` discriminator the package's event DTOs leave loose. */
|
||||
export type * from '@signozhq/noz-client';
|
||||
export type { SSEEvent } from '../../../../frontend/src/api/ai-assistant/sseEvent';
|
||||
@@ -39,13 +39,14 @@
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@playwright/test": "1.57.0",
|
||||
"@types/node": "^20.0.0",
|
||||
"@signozhq/noz-client": "1.13.0",
|
||||
"@types/node": "^22.20.5",
|
||||
"dotenv": "^16.0.0",
|
||||
"eslint-plugin-playwright": "^2.10.2",
|
||||
"oxfmt": "0.73.0",
|
||||
"oxlint": "1.88.0",
|
||||
"oxlint-tsgolint": "7.0.2004",
|
||||
"typescript": "^5.0.0"
|
||||
"typescript": "5.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0",
|
||||
|
||||
437
tests/e2e/pnpm-lock.yaml
generated
437
tests/e2e/pnpm-lock.yaml
generated
@@ -14,9 +14,12 @@ importers:
|
||||
'@playwright/test':
|
||||
specifier: 1.57.0
|
||||
version: 1.57.0
|
||||
'@signozhq/noz-client':
|
||||
specifier: 1.13.0
|
||||
version: 1.13.0(axios@1.21.1)(react-query@3.39.3(react@18.3.1))(react@18.3.1)
|
||||
'@types/node':
|
||||
specifier: ^20.0.0
|
||||
version: 20.19.20
|
||||
specifier: ^22.20.5
|
||||
version: 22.20.5
|
||||
dotenv:
|
||||
specifier: ^16.0.0
|
||||
version: 16.6.1
|
||||
@@ -33,11 +36,15 @@ importers:
|
||||
specifier: 7.0.2004
|
||||
version: 7.0.2004
|
||||
typescript:
|
||||
specifier: ^5.0.0
|
||||
specifier: 5.9.3
|
||||
version: 5.9.3
|
||||
|
||||
packages:
|
||||
|
||||
'@babel/runtime@7.29.7':
|
||||
resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@eslint-community/eslint-utils@4.9.1':
|
||||
resolution: {integrity: sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@@ -367,6 +374,13 @@ packages:
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
'@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
|
||||
|
||||
'@types/esrecurse@4.3.1':
|
||||
resolution: {integrity: sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==}
|
||||
|
||||
@@ -376,8 +390,8 @@ packages:
|
||||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
|
||||
'@types/node@20.19.20':
|
||||
resolution: {integrity: sha512-2Q7WS25j4pS1cS8yw3d6buNCVJukOTeQ39bAnwR6sOJbaxvyCGebzTMypDFN82CxBLnl+lSWVdCCWbRY6y9yZQ==}
|
||||
'@types/node@22.20.5':
|
||||
resolution: {integrity: sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==}
|
||||
|
||||
acorn-jsx@5.3.2:
|
||||
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
|
||||
@@ -389,17 +403,51 @@ packages:
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
agent-base@6.0.2:
|
||||
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
||||
engines: {node: '>= 6.0.0'}
|
||||
|
||||
ajv@6.15.0:
|
||||
resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==}
|
||||
|
||||
asynckit@0.4.0:
|
||||
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
||||
|
||||
axios@1.21.1:
|
||||
resolution: {integrity: sha512-6eI5Q/Y4u/Um9dDlsRoq5pY2rxnUTv+L4PpLitnbk/i4jb3MxLZ5CsN5Ih3IysbeRYK4pR+P7qfMsOQl9fwwFQ==}
|
||||
|
||||
balanced-match@1.0.2:
|
||||
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
||||
|
||||
balanced-match@4.0.4:
|
||||
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
big-integer@1.6.52:
|
||||
resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==}
|
||||
engines: {node: '>=0.6'}
|
||||
|
||||
brace-expansion@1.1.22:
|
||||
resolution: {integrity: sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==}
|
||||
|
||||
brace-expansion@5.0.12:
|
||||
resolution: {integrity: sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==}
|
||||
engines: {node: 20 || >=22}
|
||||
|
||||
broadcast-channel@3.7.0:
|
||||
resolution: {integrity: sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==}
|
||||
|
||||
call-bind-apply-helpers@1.0.2:
|
||||
resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
combined-stream@1.0.8:
|
||||
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
concat-map@0.0.1:
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||
engines: {node: '>= 8'}
|
||||
@@ -416,10 +464,37 @@ packages:
|
||||
deep-is@0.1.4:
|
||||
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
|
||||
|
||||
delayed-stream@1.0.0:
|
||||
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
|
||||
detect-node@2.1.0:
|
||||
resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==}
|
||||
|
||||
dotenv@16.6.1:
|
||||
resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
dunder-proto@1.0.1:
|
||||
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
es-define-property@1.0.1:
|
||||
resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
es-errors@1.3.0:
|
||||
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
es-object-atoms@1.1.2:
|
||||
resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
es-set-tostringtag@2.1.0:
|
||||
resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
escape-string-regexp@4.0.0:
|
||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -496,19 +571,70 @@ packages:
|
||||
flatted@3.4.2:
|
||||
resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==}
|
||||
|
||||
follow-redirects@1.16.3:
|
||||
resolution: {integrity: sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A==}
|
||||
engines: {node: '>=4.0'}
|
||||
peerDependencies:
|
||||
debug: '*'
|
||||
peerDependenciesMeta:
|
||||
debug:
|
||||
optional: true
|
||||
|
||||
form-data@4.0.6:
|
||||
resolution: {integrity: sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
fs.realpath@1.0.0:
|
||||
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
|
||||
|
||||
fsevents@2.3.2:
|
||||
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
|
||||
function-bind@1.1.2:
|
||||
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
||||
|
||||
get-intrinsic@1.3.0:
|
||||
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
get-proto@1.0.1:
|
||||
resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
glob-parent@6.0.2:
|
||||
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
glob@7.2.3:
|
||||
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
|
||||
deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
|
||||
|
||||
globals@17.5.0:
|
||||
resolution: {integrity: sha512-qoV+HK2yFl/366t2/Cb3+xxPUo5BuMynomoDmiaZBIdbs+0pYbjfZU+twLhGKp4uCZ/+NbtpVepH5bGCxRyy2g==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
gopd@1.2.0:
|
||||
resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
has-symbols@1.1.0:
|
||||
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
has-tostringtag@1.0.2:
|
||||
resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
hasown@2.0.4:
|
||||
resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
https-proxy-agent@5.0.1:
|
||||
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
ignore@5.3.2:
|
||||
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
|
||||
engines: {node: '>= 4'}
|
||||
@@ -517,6 +643,13 @@ packages:
|
||||
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
|
||||
engines: {node: '>=0.8.19'}
|
||||
|
||||
inflight@1.0.6:
|
||||
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
|
||||
deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
|
||||
|
||||
inherits@2.0.4:
|
||||
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
||||
|
||||
is-extglob@2.1.1:
|
||||
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -528,6 +661,12 @@ packages:
|
||||
isexe@2.0.0:
|
||||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||
|
||||
js-sha3@0.8.0:
|
||||
resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==}
|
||||
|
||||
js-tokens@4.0.0:
|
||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||
|
||||
json-buffer@3.0.1:
|
||||
resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
|
||||
|
||||
@@ -548,16 +687,50 @@ packages:
|
||||
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
loose-envify@1.4.0:
|
||||
resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
|
||||
hasBin: true
|
||||
|
||||
match-sorter@6.3.4:
|
||||
resolution: {integrity: sha512-jfZW7cWS5y/1xswZo8VBOdudUiSd9nifYRWphc9M5D/ee4w4AoXLgBEdRbgVaxbMuagBPeUC5y2Hi8DO6o9aDg==}
|
||||
|
||||
math-intrinsics@1.1.0:
|
||||
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
microseconds@0.2.0:
|
||||
resolution: {integrity: sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==}
|
||||
|
||||
mime-db@1.52.0:
|
||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-types@2.1.35:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
minimatch@10.2.5:
|
||||
resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
minimatch@3.1.5:
|
||||
resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==}
|
||||
|
||||
ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
|
||||
nano-time@1.0.0:
|
||||
resolution: {integrity: sha512-flnngywOoQ0lLQOTRNexn2gGSNuM9bKj9RZAWSzhQ+UJYaAFG9bac4DW9VHjUAzrOaIcajHybCTHe/bkvozQqA==}
|
||||
|
||||
natural-compare@1.4.0:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
|
||||
oblivious-set@1.0.0:
|
||||
resolution: {integrity: sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw==}
|
||||
|
||||
once@1.4.0:
|
||||
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||
|
||||
optionator@0.9.4:
|
||||
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@@ -607,6 +780,10 @@ packages:
|
||||
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
path-is-absolute@1.0.1:
|
||||
resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
path-key@3.1.1:
|
||||
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -625,10 +802,38 @@ packages:
|
||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
proxy-from-env@2.1.0:
|
||||
resolution: {integrity: sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
punycode@2.3.1:
|
||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
react-query@3.39.3:
|
||||
resolution: {integrity: sha512-nLfLz7GiohKTJDuT4us4X3h/8unOh+00MLb2yJoGTPjxKs2bc1iDhkNx2bd5MKklXnOD3NrVZ+J2UXujA5In4g==}
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
react-dom: '*'
|
||||
react-native: '*'
|
||||
peerDependenciesMeta:
|
||||
react-dom:
|
||||
optional: true
|
||||
react-native:
|
||||
optional: true
|
||||
|
||||
react@18.3.1:
|
||||
resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
remove-accents@0.5.0:
|
||||
resolution: {integrity: sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==}
|
||||
|
||||
rimraf@3.0.2:
|
||||
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
|
||||
deprecated: Rimraf versions prior to v4 are no longer supported
|
||||
hasBin: true
|
||||
|
||||
shebang-command@2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -653,6 +858,9 @@ packages:
|
||||
undici-types@6.21.0:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
|
||||
unload@2.2.0:
|
||||
resolution: {integrity: sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==}
|
||||
|
||||
uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
|
||||
@@ -665,12 +873,17 @@ packages:
|
||||
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
wrappy@1.0.2:
|
||||
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||
|
||||
yocto-queue@0.1.0:
|
||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
snapshots:
|
||||
|
||||
'@babel/runtime@7.29.7': {}
|
||||
|
||||
'@eslint-community/eslint-utils@4.9.1(eslint@10.2.1)':
|
||||
dependencies:
|
||||
eslint: 10.2.1
|
||||
@@ -853,13 +1066,19 @@ snapshots:
|
||||
dependencies:
|
||||
playwright: 1.57.0
|
||||
|
||||
'@signozhq/noz-client@1.13.0(axios@1.21.1)(react-query@3.39.3(react@18.3.1))(react@18.3.1)':
|
||||
dependencies:
|
||||
axios: 1.21.1
|
||||
react: 18.3.1
|
||||
react-query: 3.39.3(react@18.3.1)
|
||||
|
||||
'@types/esrecurse@4.3.1': {}
|
||||
|
||||
'@types/estree@1.0.8': {}
|
||||
|
||||
'@types/json-schema@7.0.15': {}
|
||||
|
||||
'@types/node@20.19.20':
|
||||
'@types/node@22.20.5':
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
@@ -869,6 +1088,12 @@ snapshots:
|
||||
|
||||
acorn@8.16.0: {}
|
||||
|
||||
agent-base@6.0.2:
|
||||
dependencies:
|
||||
debug: 4.4.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
ajv@6.15.0:
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
@@ -876,12 +1101,55 @@ snapshots:
|
||||
json-schema-traverse: 0.4.1
|
||||
uri-js: 4.4.1
|
||||
|
||||
asynckit@0.4.0: {}
|
||||
|
||||
axios@1.21.1:
|
||||
dependencies:
|
||||
follow-redirects: 1.16.3
|
||||
form-data: 4.0.6
|
||||
https-proxy-agent: 5.0.1
|
||||
proxy-from-env: 2.1.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
- supports-color
|
||||
|
||||
balanced-match@1.0.2: {}
|
||||
|
||||
balanced-match@4.0.4: {}
|
||||
|
||||
big-integer@1.6.52: {}
|
||||
|
||||
brace-expansion@1.1.22:
|
||||
dependencies:
|
||||
balanced-match: 1.0.2
|
||||
concat-map: 0.0.1
|
||||
|
||||
brace-expansion@5.0.12:
|
||||
dependencies:
|
||||
balanced-match: 4.0.4
|
||||
|
||||
broadcast-channel@3.7.0:
|
||||
dependencies:
|
||||
'@babel/runtime': 7.29.7
|
||||
detect-node: 2.1.0
|
||||
js-sha3: 0.8.0
|
||||
microseconds: 0.2.0
|
||||
nano-time: 1.0.0
|
||||
oblivious-set: 1.0.0
|
||||
rimraf: 3.0.2
|
||||
unload: 2.2.0
|
||||
|
||||
call-bind-apply-helpers@1.0.2:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
function-bind: 1.1.2
|
||||
|
||||
combined-stream@1.0.8:
|
||||
dependencies:
|
||||
delayed-stream: 1.0.0
|
||||
|
||||
concat-map@0.0.1: {}
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
dependencies:
|
||||
path-key: 3.1.1
|
||||
@@ -894,8 +1162,33 @@ snapshots:
|
||||
|
||||
deep-is@0.1.4: {}
|
||||
|
||||
delayed-stream@1.0.0: {}
|
||||
|
||||
detect-node@2.1.0: {}
|
||||
|
||||
dotenv@16.6.1: {}
|
||||
|
||||
dunder-proto@1.0.1:
|
||||
dependencies:
|
||||
call-bind-apply-helpers: 1.0.2
|
||||
es-errors: 1.3.0
|
||||
gopd: 1.2.0
|
||||
|
||||
es-define-property@1.0.1: {}
|
||||
|
||||
es-errors@1.3.0: {}
|
||||
|
||||
es-object-atoms@1.1.2:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
|
||||
es-set-tostringtag@2.1.0:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
get-intrinsic: 1.3.0
|
||||
has-tostringtag: 1.0.2
|
||||
hasown: 2.0.4
|
||||
|
||||
escape-string-regexp@4.0.0: {}
|
||||
|
||||
eslint-plugin-playwright@2.10.2(eslint@10.2.1):
|
||||
@@ -989,19 +1282,86 @@ snapshots:
|
||||
|
||||
flatted@3.4.2: {}
|
||||
|
||||
follow-redirects@1.16.3: {}
|
||||
|
||||
form-data@4.0.6:
|
||||
dependencies:
|
||||
asynckit: 0.4.0
|
||||
combined-stream: 1.0.8
|
||||
es-set-tostringtag: 2.1.0
|
||||
hasown: 2.0.4
|
||||
mime-types: 2.1.35
|
||||
|
||||
fs.realpath@1.0.0: {}
|
||||
|
||||
fsevents@2.3.2:
|
||||
optional: true
|
||||
|
||||
function-bind@1.1.2: {}
|
||||
|
||||
get-intrinsic@1.3.0:
|
||||
dependencies:
|
||||
call-bind-apply-helpers: 1.0.2
|
||||
es-define-property: 1.0.1
|
||||
es-errors: 1.3.0
|
||||
es-object-atoms: 1.1.2
|
||||
function-bind: 1.1.2
|
||||
get-proto: 1.0.1
|
||||
gopd: 1.2.0
|
||||
has-symbols: 1.1.0
|
||||
hasown: 2.0.4
|
||||
math-intrinsics: 1.1.0
|
||||
|
||||
get-proto@1.0.1:
|
||||
dependencies:
|
||||
dunder-proto: 1.0.1
|
||||
es-object-atoms: 1.1.2
|
||||
|
||||
glob-parent@6.0.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
||||
glob@7.2.3:
|
||||
dependencies:
|
||||
fs.realpath: 1.0.0
|
||||
inflight: 1.0.6
|
||||
inherits: 2.0.4
|
||||
minimatch: 3.1.5
|
||||
once: 1.4.0
|
||||
path-is-absolute: 1.0.1
|
||||
|
||||
globals@17.5.0: {}
|
||||
|
||||
gopd@1.2.0: {}
|
||||
|
||||
has-symbols@1.1.0: {}
|
||||
|
||||
has-tostringtag@1.0.2:
|
||||
dependencies:
|
||||
has-symbols: 1.1.0
|
||||
|
||||
hasown@2.0.4:
|
||||
dependencies:
|
||||
function-bind: 1.1.2
|
||||
|
||||
https-proxy-agent@5.0.1:
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.4.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
ignore@5.3.2: {}
|
||||
|
||||
imurmurhash@0.1.4: {}
|
||||
|
||||
inflight@1.0.6:
|
||||
dependencies:
|
||||
once: 1.4.0
|
||||
wrappy: 1.0.2
|
||||
|
||||
inherits@2.0.4: {}
|
||||
|
||||
is-extglob@2.1.1: {}
|
||||
|
||||
is-glob@4.0.3:
|
||||
@@ -1010,6 +1370,10 @@ snapshots:
|
||||
|
||||
isexe@2.0.0: {}
|
||||
|
||||
js-sha3@0.8.0: {}
|
||||
|
||||
js-tokens@4.0.0: {}
|
||||
|
||||
json-buffer@3.0.1: {}
|
||||
|
||||
json-schema-traverse@0.4.1: {}
|
||||
@@ -1029,14 +1393,47 @@ snapshots:
|
||||
dependencies:
|
||||
p-locate: 5.0.0
|
||||
|
||||
loose-envify@1.4.0:
|
||||
dependencies:
|
||||
js-tokens: 4.0.0
|
||||
|
||||
match-sorter@6.3.4:
|
||||
dependencies:
|
||||
'@babel/runtime': 7.29.7
|
||||
remove-accents: 0.5.0
|
||||
|
||||
math-intrinsics@1.1.0: {}
|
||||
|
||||
microseconds@0.2.0: {}
|
||||
|
||||
mime-db@1.52.0: {}
|
||||
|
||||
mime-types@2.1.35:
|
||||
dependencies:
|
||||
mime-db: 1.52.0
|
||||
|
||||
minimatch@10.2.5:
|
||||
dependencies:
|
||||
brace-expansion: 5.0.12
|
||||
|
||||
minimatch@3.1.5:
|
||||
dependencies:
|
||||
brace-expansion: 1.1.22
|
||||
|
||||
ms@2.1.3: {}
|
||||
|
||||
nano-time@1.0.0:
|
||||
dependencies:
|
||||
big-integer: 1.6.52
|
||||
|
||||
natural-compare@1.4.0: {}
|
||||
|
||||
oblivious-set@1.0.0: {}
|
||||
|
||||
once@1.4.0:
|
||||
dependencies:
|
||||
wrappy: 1.0.2
|
||||
|
||||
optionator@0.9.4:
|
||||
dependencies:
|
||||
deep-is: 0.1.4
|
||||
@@ -1112,6 +1509,8 @@ snapshots:
|
||||
|
||||
path-exists@4.0.0: {}
|
||||
|
||||
path-is-absolute@1.0.1: {}
|
||||
|
||||
path-key@3.1.1: {}
|
||||
|
||||
playwright-core@1.57.0: {}
|
||||
@@ -1124,8 +1523,27 @@ snapshots:
|
||||
|
||||
prelude-ls@1.2.1: {}
|
||||
|
||||
proxy-from-env@2.1.0: {}
|
||||
|
||||
punycode@2.3.1: {}
|
||||
|
||||
react-query@3.39.3(react@18.3.1):
|
||||
dependencies:
|
||||
'@babel/runtime': 7.29.7
|
||||
broadcast-channel: 3.7.0
|
||||
match-sorter: 6.3.4
|
||||
react: 18.3.1
|
||||
|
||||
react@18.3.1:
|
||||
dependencies:
|
||||
loose-envify: 1.4.0
|
||||
|
||||
remove-accents@0.5.0: {}
|
||||
|
||||
rimraf@3.0.2:
|
||||
dependencies:
|
||||
glob: 7.2.3
|
||||
|
||||
shebang-command@2.0.0:
|
||||
dependencies:
|
||||
shebang-regex: 3.0.0
|
||||
@@ -1142,6 +1560,11 @@ snapshots:
|
||||
|
||||
undici-types@6.21.0: {}
|
||||
|
||||
unload@2.2.0:
|
||||
dependencies:
|
||||
'@babel/runtime': 7.29.7
|
||||
detect-node: 2.1.0
|
||||
|
||||
uri-js@4.4.1:
|
||||
dependencies:
|
||||
punycode: 2.3.1
|
||||
@@ -1152,4 +1575,6 @@ snapshots:
|
||||
|
||||
word-wrap@1.2.5: {}
|
||||
|
||||
wrappy@1.0.2: {}
|
||||
|
||||
yocto-queue@0.1.0: {}
|
||||
|
||||
108
tests/e2e/tests/noz/chat.spec.ts
Normal file
108
tests/e2e/tests/noz/chat.spec.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import { expect, test } from '../../drivers/noz';
|
||||
|
||||
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||
|
||||
const QUESTION = 'Why is checkout slow?';
|
||||
const REPLY = 'Checkout waits on the payment quota.';
|
||||
const FOLLOW_UP = 'Since when?';
|
||||
const FOLLOW_UP_REPLY = 'Since the 14:05 deploy.';
|
||||
|
||||
test.describe('Noz — chat', () => {
|
||||
test('TC-01 with an assistant URL the side nav opens a new chat', async ({
|
||||
noz,
|
||||
}) => {
|
||||
await noz.enable();
|
||||
await noz.gotoHome();
|
||||
await noz.navItem().click();
|
||||
|
||||
await expect.poll(() => noz.conversationId()).toMatch(UUID);
|
||||
await expect(noz.input()).toBeVisible();
|
||||
});
|
||||
|
||||
test('TC-02 a sent message reaches the assistant and its reply renders', async ({
|
||||
noz,
|
||||
}) => {
|
||||
const assistant = await noz.enable();
|
||||
assistant.replyWith(REPLY);
|
||||
await noz.gotoNew();
|
||||
await noz.send(QUESTION);
|
||||
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
await expect(noz.message(QUESTION)).toBeVisible();
|
||||
const [sent] = assistant.sentMessages();
|
||||
expect(sent.body.content).toBe(QUESTION);
|
||||
await expect.poll(() => noz.conversationId()).toBe(sent.threadId);
|
||||
});
|
||||
|
||||
test('TC-03 a reload reopens the thread from the assistant', async ({
|
||||
noz,
|
||||
}) => {
|
||||
const assistant = await noz.enable();
|
||||
assistant.replyWith(REPLY);
|
||||
await noz.gotoNew();
|
||||
await noz.send(QUESTION);
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
|
||||
await noz.reload();
|
||||
|
||||
await expect(noz.message(QUESTION)).toBeVisible();
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
});
|
||||
|
||||
test('TC-04 a follow-up stays in the same thread', async ({ noz }) => {
|
||||
const assistant = await noz.enable();
|
||||
assistant.replyWith(REPLY);
|
||||
assistant.replyWith(FOLLOW_UP_REPLY);
|
||||
await noz.gotoNew();
|
||||
await noz.send(QUESTION);
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
|
||||
await noz.send(FOLLOW_UP);
|
||||
|
||||
await expect(noz.message(FOLLOW_UP_REPLY)).toBeVisible();
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
const [first, second] = assistant.sentMessages();
|
||||
expect(second.body.content).toBe(FOLLOW_UP);
|
||||
expect(second.threadId).toBe(first.threadId);
|
||||
expect(noz.conversationId()).toBe(first.threadId);
|
||||
});
|
||||
|
||||
test('TC-05 a new chat starts empty and the history list reopens the last one', async ({
|
||||
noz,
|
||||
}) => {
|
||||
const assistant = await noz.enable();
|
||||
assistant.replyWith(REPLY);
|
||||
await noz.gotoNew();
|
||||
await noz.send(QUESTION);
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
const [{ threadId }] = assistant.sentMessages();
|
||||
|
||||
await noz.newChatButton().click();
|
||||
|
||||
await expect.poll(() => noz.conversationId()).not.toBe(threadId);
|
||||
await expect(noz.message(QUESTION)).toHaveCount(0);
|
||||
|
||||
await noz.historyItem(threadId).click();
|
||||
|
||||
await expect.poll(() => noz.conversationId()).toBe(threadId);
|
||||
await expect(noz.message(QUESTION)).toBeVisible();
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
});
|
||||
|
||||
test('TC-06 asking from the Logs Explorer sends that page as context', async ({
|
||||
noz,
|
||||
}) => {
|
||||
const assistant = await noz.enable();
|
||||
assistant.replyWith(REPLY);
|
||||
await noz.gotoLogsExplorer();
|
||||
|
||||
await noz.askNozButton().click();
|
||||
await noz.send(QUESTION);
|
||||
|
||||
await expect(noz.message(REPLY)).toBeVisible();
|
||||
const [sent] = assistant.sentMessages();
|
||||
expect(sent.body.contexts).toContainEqual(
|
||||
expect.objectContaining({ source: 'auto', type: 'logs_explorer' }),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -16,7 +16,10 @@
|
||||
"types": ["node", "@playwright/test"],
|
||||
"paths": {
|
||||
"@tests/*": ["./tests/*"],
|
||||
"@specs/*": ["./specs/*"]
|
||||
"@specs/*": ["./specs/*"],
|
||||
// The frontend's `sseEvent.ts`, imported by `drivers/noz/schemas.ts`, imports this package.
|
||||
// e2e CI installs only `tests/e2e`, so resolve it here instead of `frontend/node_modules`.
|
||||
"@signozhq/noz-client": ["./node_modules/@signozhq/noz-client"]
|
||||
}
|
||||
},
|
||||
"include": ["tests/**/*.ts", "drivers/**/*.ts", "bootstrap/**/*.ts", "playwright.config.ts"],
|
||||
|
||||
@@ -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)",
|
||||
|
||||
Reference in New Issue
Block a user