Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/api-types/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Complete the update only when `pnpm api:verify-types` passes after the productio

## Pull requests

The `Verify production API types` CI job runs when `packages/api-types/types/**` changes and performs the same production comparison. It is currently observational, not a required merge check. The `api-deploy-required` label is informational only. Still run the local verifier before requesting review and treat a failed CI verification as production drift that must be resolved.
The `Verify production API types` CI job runs when `packages/api-types/types/**` changes and performs the same production comparison. It is a required merge check. Run the local verifier before requesting review and treat a failed CI verification as production drift that must be resolved.
5 changes: 0 additions & 5 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ documentation:
self-hosted:
- changed-files:
- any-glob-to-any-file: 'apps/docs/content/guides/self-hosting/**/*'

# Add 'api-deploy-required' to any change in packages/api-types/types
api-deploy-required:
- changed-files:
- any-glob-to-any-file: 'packages/api-types/types/**'
17 changes: 3 additions & 14 deletions .github/workflows/label_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: 'Pull Request Labeler'

on:
pull_request_target:
paths:
- 'apps/docs/**/*'

jobs:
labeler:
Expand All @@ -10,17 +12,4 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- id: label
uses: actions/labeler@b8dd2d9be0f68b860e7dae5dae7d772984eacd6d # v6.2.0

- name: Comment when api-deploy-required is auto-applied
if: contains(steps.label.outputs.new-labels, 'api-deploy-required')
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'The `api-deploy-required` label was auto-applied to this PR because it updates the API types. The `Verify production API types` check reports whether the committed types match production; it is currently observational and does not block merging.',
})
- uses: actions/labeler@b8dd2d9be0f68b860e7dae5dae7d772984eacd6d # v6.2.0
13 changes: 6 additions & 7 deletions apps/docs/content/guides/platform/privatelink.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,15 @@ In your AWS account, you have two options to establish connectivity:
- The resource configuration name will be in the format `[organisation]-[project-ref]-rc`
- If you have multiple connections, match the **Resource configuration ID** shown for that connection in **View connection** to confirm you select the configuration for the correct database
7. Select your VPC from the dropdown. This should match the VPC you selected for your security group in Step 3
8. Enable the **Enable DNS name** option if you want to use a DNS record instead of the endpoints IP address(es)
9. Choose the appropriate subnets for your network
8. Choose the appropriate subnets for your network
- AWS will provision a private ENI for you in each selected subnet
- IP address type should be set to IPv4
10. Choose the security group you created in Step 3.
11. Click **Create endpoint**
12. After creation, you will see the endpoint in the [Endpoints](https://console.aws.amazon.com/vpcconsole/home#Endpoints:) section with a status of "Available"
13. For connectivity:
9. Choose the security group you created in Step 3.
10. Click **Create endpoint**
11. After creation, you will see the endpoint in the [Endpoints](https://console.aws.amazon.com/vpcconsole/home#Endpoints:) section with a status of "Available"
12. For connectivity:
- The IP addresses of the endpoint will be listed in the **Subnets** section of the endpoint details
- The DNS record will be in the **Associations** section of the endpoint details in the **DNS Name** field if you enabled it in step 8
- The DNS record will be in the **Associations** section of the endpoint details in the **DNS Name** field

#### Option B: Attach resource configuration to an existing VPC lattice service network

Expand Down
2 changes: 2 additions & 0 deletions apps/docs/public/humans.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Brent Schroeter
Bruno Kilian
Burhan A
Carel de Waal
Carson Adam
Cameron Blackwood
Cameron Michie
Cemal Kılıç
Expand Down Expand Up @@ -221,6 +222,7 @@ Mats Kindahl
Mert Yerekapan
Michal Kleczek
Michelle Jubrey
Mike Podobnik
Miranda Limonczenko
Mo Khan
Monica Khoury
Expand Down
5 changes: 5 additions & 0 deletions apps/studio/components/grid/components/grid/GridError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { InlineLink } from '@/components/ui/InlineLink'
import { ENTITY_TYPE } from '@/data/entity-types/entity-type-constants'
import { COST_THRESHOLD_ERROR } from '@/data/sql/execute-sql-mutation'
import { tableRowKeys } from '@/data/table-rows/keys'
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
import { useTableEditorStateSnapshot } from '@/state/table-editor'
import { useTableEditorTableStateSnapshot } from '@/state/table-editor-table'
Expand Down Expand Up @@ -196,10 +197,14 @@ const IcebergUnauthorizedError = ({ error }: { error: ResponseError }) => {

const GeneralError = ({ error }: { error: ResponseError }) => {
const { filters } = useTableFilter()
const { data: project } = useSelectedProjectQuery()
const { data: org } = useSelectedOrganizationQuery()

return (
<AlertError
error={error}
projectRef={project?.ref}
orgSlug={org?.slug}
className="pointer-events-auto"
subject="Failed to retrieve rows from table"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ export const FGA_SCOPE_MINIMUM_ROLE: Record<string, TokenRoleLevel> = {
infra_disk_config_write: 'administrator',
infra_read_replicas_read: 'readonly',
infra_read_replicas_write: 'administrator',
project_notebooks_read: 'readonly',
project_notebooks_write: 'developer',
project_snippets_read: 'readonly',
project_snippets_write: 'readonly',
realtime_config_read: 'readonly',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,16 @@ import { safeSql, type SafeLogSqlFragment } from '@/data/logs/safe-analytics-sql
import { reportKeys } from '@/data/reports/keys'
import { IS_PLATFORM } from '@/lib/constants'

const SOURCE_TABLE: Record<string, SafeLogSqlFragment> = {
edge_logs: safeSql`edge_logs`,
function_edge_logs: safeSql`function_edge_logs`,
}

/** Returns a branded source table fragment, falling back to `edge_logs`. */
function sourceTable(src: string): SafeLogSqlFragment {
return SOURCE_TABLE[src] ?? SOURCE_TABLE.edge_logs
}

export const SHARED_API_REPORT_SQL = {
totalRequests: {
queryType: 'logs',
safeSql: (filters: ReportFilterItem[], src = 'edge_logs'): SafeLogSqlFragment =>
safeSql: (filters: ReportFilterItem[]): SafeLogSqlFragment =>
safeSql`
--reports-api-total-requests
select
cast(timestamp_trunc(t.timestamp, hour) as datetime) as timestamp,
count(t.id) as count
FROM ${sourceTable(src)} t
FROM edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
Expand All @@ -45,7 +35,7 @@ export const SHARED_API_REPORT_SQL = {
},
topRoutes: {
queryType: 'logs',
safeSql: (filters: ReportFilterItem[], src = 'edge_logs'): SafeLogSqlFragment =>
safeSql: (filters: ReportFilterItem[]): SafeLogSqlFragment =>
safeSql`
-- reports-api-top-routes
select
Expand All @@ -54,7 +44,7 @@ export const SHARED_API_REPORT_SQL = {
request.search as search,
response.status_code as status_code,
count(t.id) as count
from ${sourceTable(src)} t
from edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
Expand All @@ -69,13 +59,13 @@ export const SHARED_API_REPORT_SQL = {
},
errorCounts: {
queryType: 'logs',
safeSql: (filters: ReportFilterItem[], src = 'edge_logs'): SafeLogSqlFragment =>
safeSql: (filters: ReportFilterItem[]): SafeLogSqlFragment =>
safeSql`
-- reports-api-error-counts
select
cast(timestamp_trunc(t.timestamp, hour) as datetime) as timestamp,
count(t.id) as count
FROM ${sourceTable(src)} t
FROM edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
Expand All @@ -91,7 +81,7 @@ export const SHARED_API_REPORT_SQL = {
},
topErrorRoutes: {
queryType: 'logs',
safeSql: (filters: ReportFilterItem[], src = 'edge_logs'): SafeLogSqlFragment =>
safeSql: (filters: ReportFilterItem[]): SafeLogSqlFragment =>
safeSql`
-- reports-api-top-error-routes
select
Expand All @@ -100,7 +90,7 @@ export const SHARED_API_REPORT_SQL = {
request.search as search,
response.status_code as status_code,
count(t.id) as count
from ${sourceTable(src)} t
from edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
Expand All @@ -117,14 +107,14 @@ export const SHARED_API_REPORT_SQL = {
},
responseSpeed: {
queryType: 'logs',
safeSql: (filters: ReportFilterItem[], src = 'edge_logs'): SafeLogSqlFragment =>
safeSql: (filters: ReportFilterItem[]): SafeLogSqlFragment =>
safeSql`
-- reports-api-response-speed
select
cast(timestamp_trunc(t.timestamp, hour) as datetime) as timestamp,
avg(response.origin_time) as avg
FROM
${sourceTable(src)} t
edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
Expand All @@ -138,7 +128,7 @@ export const SHARED_API_REPORT_SQL = {
},
topSlowRoutes: {
queryType: 'logs',
safeSql: (filters: ReportFilterItem[], src = 'edge_logs'): SafeLogSqlFragment =>
safeSql: (filters: ReportFilterItem[]): SafeLogSqlFragment =>
safeSql`
-- reports-api-top-slow-routes
select
Expand All @@ -148,7 +138,7 @@ export const SHARED_API_REPORT_SQL = {
response.status_code as status_code,
count(t.id) as count,
avg(response.origin_time) as avg
from ${sourceTable(src)} t
from edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
Expand All @@ -163,7 +153,7 @@ export const SHARED_API_REPORT_SQL = {
},
networkTraffic: {
queryType: 'logs',
safeSql: (filters: ReportFilterItem[], src = 'edge_logs'): SafeLogSqlFragment =>
safeSql: (filters: ReportFilterItem[]): SafeLogSqlFragment =>
safeSql`
-- reports-api-network-traffic
select
Expand All @@ -187,7 +177,7 @@ export const SHARED_API_REPORT_SQL = {
0
) as egress_mb,
FROM
${sourceTable(src)} t
edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
Expand All @@ -204,13 +194,7 @@ export const SHARED_API_REPORT_SQL = {

export type SharedAPIReportKey = keyof typeof SHARED_API_REPORT_SQL

export type SharedAPIReportFilterBy =
| 'auth'
| 'realtime'
| 'storage'
| 'graphql'
| 'functions'
| 'postgrest'
export type SharedAPIReportFilterBy = 'auth' | 'realtime' | 'postgrest'

type SharedAPIReportParams = {
filterBy: SharedAPIReportFilterBy
Expand All @@ -230,20 +214,8 @@ export const useSharedAPIReport = ({
const queryClient = useQueryClient()
const flagUseOtel = useFlag('otelReports')
const { hasLoaded: hasLoadedFlags } = useContext(FeatureFlagContext)
const filterByMapSource = {
functions: 'function_edge_logs',
realtime: 'edge_logs',
storage: 'edge_logs',
graphql: 'edge_logs',
postgrest: 'edge_logs',
auth: 'edge_logs',
}

const filterByMapValue = {
functions: '/functions',
const filterByMapValue: Record<SharedAPIReportFilterBy, string> = {
realtime: '/realtime',
storage: '/storage',
graphql: '/graphql',
postgrest: '/rest',
auth: '/auth',
}
Expand All @@ -255,15 +227,14 @@ export const useSharedAPIReport = ({
}

const allFilters = [baseFilter, ...filters]
const source = filterByMapSource[filterBy]
const isDataApiReport = filterBy === 'postgrest'
const useOtel = IS_PLATFORM && isDataApiReport && Boolean(flagUseOtel)
const isQueryModeReady = !IS_PLATFORM || !isDataApiReport || hasLoadedFlags === true
const source = 'edge_logs'
const useOtel = IS_PLATFORM && Boolean(flagUseOtel)
const isQueryModeReady = !IS_PLATFORM || hasLoadedFlags === true
const keys = Object.keys(SHARED_API_REPORT_SQL) as SharedAPIReportKey[]
const getQuerySql = (queryName: SharedAPIReportKey) =>
useOtel
? getLogsSql(PRESET_CONFIG.api.queries[queryName], allFilters, true)
: SHARED_API_REPORT_SQL[queryName].safeSql(allFilters, source)
: SHARED_API_REPORT_SQL[queryName].safeSql(allFilters)
const SQLMap: Record<SharedAPIReportKey, SafeLogSqlFragment> = {
totalRequests: getQuerySql('totalRequests'),
topRoutes: getQuerySql('topRoutes'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import { StripeAtlasApplicationScreen } from './StripeAtlasApplication'
import { customRender } from '@/tests/lib/custom-render'
import { addAPIMock, type APIErrorBody } from '@/tests/lib/msw'

vi.mock('@/lib/constants', async (importOriginal) => ({
...(await importOriginal<typeof import('@/lib/constants')>()),
IS_PLATFORM: true,
}))

type PerkApplication = platformComponents['schemas']['PerkApplicationDataResponse_Output']

vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }))
Expand Down
Loading
Loading