Compare commits

..
Author SHA1 Message Date
admin 6aa1f76657 ci: drop the pnpm-store cache on 0pt (save step dominated runtime)
masterplan-lock / check (push) Successful in 4s
Caching the full pnpm store made the post-step tar/zstd run for >10 minutes on
the shared runner, turning a ~1m quality job into a 15m+ one. The concurrency
and main-only changes keep the win; install stays a plain frozen-lockfile run.
2026-11-02 19:06:54 +01:00
141 changed files with 1006 additions and 6748 deletions
-15
View File
@@ -58,16 +58,6 @@ DEV_LOGIN_KEY=
# Shared token for internal/service-to-service calls; sent as X-Internal-Token # Shared token for internal/service-to-service calls; sent as X-Internal-Token
# on every engineFetch() call (lib/engine.ts). # on every engineFetch() call (lib/engine.ts).
INTERNAL_TOKEN=change-me-internal-token INTERNAL_TOKEN=change-me-internal-token
# Tenant authority for the internal-token principal. Comma-separated allowlist
# of tenants this deployment's engine is entitled to write for, e.g.
# "379976258701823235". This is the ONLY source of tenant authority for
# X-Internal-Token: a request header may never name a tenant. Empty/unset means
# the service principal has no tenant authority and tenant-scoped writes
# (canonical facts, quality bridge runs) are denied with 403. Exactly ONE
# tenant is supported: the shared token identifies one service process, not a
# set of principals. A multi-tenant list is refused (401) until a verified
# workload-identity binding exists.
INTERNAL_SERVICE_TENANTS=
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Zitadel / OIDC Bearer verification (Wave 2 hardening) -- wired in code today # Zitadel / OIDC Bearer verification (Wave 2 hardening) -- wired in code today
@@ -290,11 +280,6 @@ OPT_CREDIT_PRICE_BOOK=
# purchases stay disabled. Unset/`on` requires the price book + ledger. # purchases stay disabled. Unset/`on` requires the price book + ledger.
OPT_CREDITS_MODE= OPT_CREDITS_MODE=
# One-time trial credits granted per tenant (server-owned, idempotent, NOT a
# payment). 0 disables. With OPT_CREDITS_MODE=on this lets reserve/settle run
# in production before any customer purchase.
OPT_TRIAL_CREDITS=0
# Central Keycloak (SIAX Portal) # Central Keycloak (SIAX Portal)
KEYCLOAK_ISSUER=https://auth.portal.siax.dev/realms/portal KEYCLOAK_ISSUER=https://auth.portal.siax.dev/realms/portal
KEYCLOAK_EXPECTED_AUDIENCE=account KEYCLOAK_EXPECTED_AUDIENCE=account
+7 -7
View File
@@ -1,11 +1,11 @@
# CI-14 — CODEOWNERS bor i .gitea/, aldrig i .github/ (SEC-25). # CI-14 — CODEOWNERS bor i .gitea/, aldrig i .github/ (SEC-25).
# Granskning krävs särskilt för kontrakt, deploy och migrationer. # Granskning krävs särskilt för kontrakt, deploy och migrationer.
* @admin * @sax3l
/contracts/ @admin /contracts/ @sax3l
/deploy/ @admin /deploy/ @sax3l
/.gitea/ @admin /.gitea/ @sax3l
/siax.repo.json @admin /siax.repo.json @sax3l
/siax.config.json @admin /siax.config.json @sax3l
# TODO: lägg till migrationskatalogen när den finns, t.ex. # TODO: lägg till migrationskatalogen när den finns, t.ex.
# /packages/db/migrations/ @admin # /packages/db/migrations/ @sax3l
+2 -4
View File
@@ -22,10 +22,8 @@ on:
# Never let two deploys race the same Coolify app. Unlike CI we do NOT cancel an # Never let two deploys race the same Coolify app. Unlike CI we do NOT cancel an
# in-flight deploy (it may already be restarting the container); the newest # in-flight deploy (it may already be restarting the container); the newest
# commit still wins because Coolify builds from the branch head. # commit still wins because Coolify builds from the branch head.
# N6 (server-config ci/jobbstorm-2026-11-10 §4): deploy/release köas i en fast grupp och avbryts aldrig.
# ci-concurrency-exempt: deploy till Coolify på push till main; avbrott mitt i lämnar appen halvt utrullad (N6 §4).
concurrency: concurrency:
group: ${{ gitea.workflow }} group: deploy-0pt-main
cancel-in-progress: false cancel-in-progress: false
jobs: jobs:
@@ -95,7 +93,7 @@ jobs:
exit 1 exit 1
fi fi
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
+11 -73
View File
@@ -23,9 +23,8 @@ on:
# One run per ref; a branch push that also updates a PR used to start two full # One run per ref; a branch push that also updates a PR used to start two full
# quality runs (and, on main, two deploy chains). Cancel the superseded one. # quality runs (and, on main, two deploy chains). Cancel the superseded one.
# N6 (server-config ci/jobbstorm-2026-11-10 §4): en ny commit på samma PR/gren avbryter den inaktuella körningen.
concurrency: concurrency:
group: ${{ gitea.workflow }}-${{ gitea.ref }} group: ci-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
@@ -33,12 +32,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - uses: actions/setup-node@v4
with: with:
node-version: "22" node-version: "22"
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml
- name: Enable corepack + pin pnpm@9 (pnpm-lock.yaml is lockfileVersion 9.0) - name: Enable corepack + pin pnpm@9 (pnpm-lock.yaml is lockfileVersion 9.0)
run: | run: |
corepack enable corepack enable
@@ -98,9 +95,6 @@ jobs:
# cluster_name (the OpenSearch image maps dotted env keys to # cluster_name (the OpenSearch image maps dotted env keys to
# settings). # settings).
cluster.name: opt_ci_${{ github.run_id }}_${{ github.run_attempt }} cluster.name: opt_ci_${{ github.run_id }}_${{ github.run_attempt }}
# Throwaway CI cluster: never let the runner's disk fill turn indices
# read-only (the 403 index_create_block_exception seen in run 388536).
cluster.routing.allocation.disk.threshold_enabled: "false"
# `--workdir` is REQUIRED (measured 2026-08-31, PR #25 CI run 7745, # `--workdir` is REQUIRED (measured 2026-08-31, PR #25 CI run 7745,
# job "integration"): this runner's act_runner (v0.6.1) merges the # job "integration"): this runner's act_runner (v0.6.1) merges the
# JOB's WorkingDir (`/workspace/sax3l/0pt`) into every SERVICE # JOB's WorkingDir (`/workspace/sax3l/0pt`) into every SERVICE
@@ -134,12 +128,10 @@ jobs:
--health-timeout 5s --health-timeout 5s
--health-retries 60 --health-retries 60
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - uses: actions/setup-node@v4
with: with:
node-version: "22" node-version: "22"
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml
- name: Enable corepack + pin pnpm@9 - name: Enable corepack + pin pnpm@9
run: | run: |
corepack enable corepack enable
@@ -157,33 +149,6 @@ jobs:
if [ "$NAME" = "$WANT" ]; then FOUND="$ip"; fi if [ "$NAME" = "$WANT" ]; then FOUND="$ip"; fi
done done
[ -n "$FOUND" ] || { echo "FATAL: no OpenSearch behind the alias identifies as $WANT"; exit 1; } [ -n "$FOUND" ] || { echo "FATAL: no OpenSearch behind the alias identifies as $WANT"; exit 1; }
# The single-node test cluster inherits the runner's disk watermark.
# On a busy runner the flood-stage watermark makes every new index
# read-only and the suite fails with HTTP 403
# index_create_block_exception (measured on run 388536). The container
# is throwaway CI state, so disable the disk threshold and PROVE that
# index creation works before the blocking tests run.
for attempt in 1 2 3 4 5; do
# Disabling the watermark alone does NOT clear a cluster that is
# already read-only: the flood stage sets
# cluster.blocks.read_only_allow_delete and every write keeps
# returning 403. Clear that block explicitly every attempt.
curl -sS --max-time 10 -X PUT "http://$FOUND:9200/_cluster/settings" \
-H 'Content-Type: application/json' \
-d '{"persistent":{"cluster.routing.allocation.disk.threshold_enabled":false,"cluster.blocks.read_only_allow_delete":null}}' >/tmp/os-settings.json || true
cat /tmp/os-settings.json 2>/dev/null || true
probe_status=$(curl -sS --max-time 10 -o /tmp/os-probe.json -w '%{http_code}' -X PUT "http://$FOUND:9200/opt-ci-probe-${{ github.run_id }}")
if [ "$probe_status" = "200" ]; then
curl -fsS --max-time 10 -X DELETE "http://$FOUND:9200/opt-ci-probe-${{ github.run_id }}" >/dev/null || true
echo "OpenSearch accepts index creation"
break
fi
echo "index creation not ready (attempt $attempt/5, HTTP $probe_status) — waiting"
cat /tmp/os-probe.json 2>/dev/null || true
[ "$attempt" = "5" ] && { echo "FATAL: OpenSearch still refuses index creation"; exit 1; }
sleep 10
done
echo "OPENSEARCH_URL=http://$FOUND:9200" >> "$GITHUB_ENV" echo "OPENSEARCH_URL=http://$FOUND:9200" >> "$GITHUB_ENV"
- name: Select THIS run's ClickHouse by identity - name: Select THIS run's ClickHouse by identity
run: | run: |
@@ -271,18 +236,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- name: Install Trivy (pinned + checksum verified) - name: Install Trivy
run: | run: |
set -euo pipefail curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
TRIVY_VERSION=0.76.2
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
trivy --version
# `siax/sbom/` är CycloneDX-evidenens för REDAN BYGGDA images (release-kedjan), # `siax/sbom/` är CycloneDX-evidenens för REDAN BYGGDA images (release-kedjan),
# inte källberoenden. Att scanna dem här återrapporterar gamla image-versioner # inte källberoenden. Att scanna dem här återrapporterar gamla image-versioner
# (next 16.3.x, sharp 0.35.4) och blockerar källfixar som redan är patchade. # (next 16.3.x, sharp 0.35.4) och blockerar källfixar som redan är patchade.
@@ -300,12 +257,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 20 timeout-minutes: 20
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: SonarQube analysis (self-hosted sonar.siax.dev) - name: SonarQube analysis (self-hosted sonar.siax.io)
env: env:
SONAR_HOST_URL: https://sonar.siax.dev SONAR_HOST_URL: https://sonar.siax.io
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
@@ -318,22 +275,3 @@ jobs:
trap 'docker rm -f "$cid" >/dev/null 2>&1 || true' EXIT trap 'docker rm -f "$cid" >/dev/null 2>&1 || true' EXIT
docker cp . "$cid":/usr/src docker cp . "$cid":/usr/src
docker start -a "$cid" docker start -a "$cid"
design-conformance:
name: Component conformance (blocking)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '22'
- name: Checkout canonical siax-standard (SSOT)
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
repository: admin/siax-standard
token: ${{ secrets.SIAX_CI_TOKEN }}
path: siax-standard-ssot
- name: Component conformance (blocking)
run: |
node --input-type=module -e "import('./siax-standard-ssot/packages/doctor/src/commands/component-conformance.mjs').then(m=>{process.exit(m.run(['--repo', process.env.GITHUB_WORKSPACE, '--allow-path-prefix', 'siax-standard-ssot/', '--fail-on=block']))})"
+3 -17
View File
@@ -3,30 +3,16 @@ on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: "0 6 * * 1" - cron: "0 6 * * 1"
# N6 (server-config ci/jobbstorm-2026-11-10 §4): schemalagd/manuell körning köas i en fast grupp, avbryts inte.
concurrency:
group: ${{ gitea.workflow }}
cancel-in-progress: true
jobs: jobs:
health: health:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- name: Required files - name: Required files
run: | run: |
for f in README.md LICENSE .gitignore; do [ -f "$f" ] || echo "::warning file=$f,title=Missing::$f is missing"; done for f in README.md LICENSE .gitignore; do [ -f "$f" ] || echo "::warning file=$f,title=Missing::$f is missing"; done
[ -f .gitea/workflows/ci.yml ] || echo "::warning title=No CI::No CI workflow found" [ -f .gitea/workflows/ci.yml ] || echo "::warning title=No CI::No CI workflow found"
- name: Install Trivy (pinned + checksum verified) - name: Install Trivy
run: | run: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
set -euo pipefail
TRIVY_VERSION=0.76.2
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
trivy --version
- name: Secret scan - name: Secret scan
run: trivy fs --scanners secret --exit-code 0 . run: trivy fs --scanners secret --exit-code 0 .
+2 -6
View File
@@ -8,19 +8,15 @@ name: masterplan-lock
on: on:
push: push:
branches: [main] branches: ["**"]
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
concurrency:
group: ${{ gitea.workflow }}-${{ gitea.ref }}
cancel-in-progress: true
jobs: jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- name: Masterplan lock check - name: Masterplan lock check
run: sh scripts/check-masterplan-lock.sh run: sh scripts/check-masterplan-lock.sh
+7 -17
View File
@@ -8,21 +8,19 @@ on:
schedule: schedule:
- cron: "0 4 * * *" # daily 04:00 UTC - cron: "0 4 * * *" # daily 04:00 UTC
# N6 (server-config ci/jobbstorm-2026-11-10 §4): schemalagd/manuell körning köas i en fast grupp, avbryts inte.
concurrency: concurrency:
group: ${{ gitea.workflow }} group: nightly-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
quality: quality:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 45 timeout-minutes: 45
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - uses: actions/setup-node@v4
with: with:
node-version: "22" node-version: "22"
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml
- name: Enable corepack + pin pnpm@9 - name: Enable corepack + pin pnpm@9
run: | run: |
corepack enable corepack enable
@@ -43,18 +41,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 20 timeout-minutes: 20
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- name: Install Trivy (pinned + checksum verified) - name: Install Trivy
run: | run: |
set -euo pipefail curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
TRIVY_VERSION=0.76.2
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
trivy --version
# A nightly scan exists to catch CVEs published against code that did # A nightly scan exists to catch CVEs published against code that did
# not change. With `--exit-code 0` it could never report failure, so it # not change. With `--exit-code 0` it could never report failure, so it
# could never raise that alarm -- the one job whose entire purpose is # could never raise that alarm -- the one job whose entire purpose is
+5 -8
View File
@@ -9,10 +9,10 @@ on:
schedule: schedule:
- cron: "*/30 * * * *" - cron: "*/30 * * * *"
# N6 (server-config ci/jobbstorm-2026-11-10 §4): schemalagd/manuell körning köas i en fast grupp, avbryts inte.
concurrency: concurrency:
group: ${{ gitea.workflow }} group: prod-smoke
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
smoke: smoke:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -53,13 +53,10 @@ jobs:
echo "::warning::SIAX_CI_TOKEN is not set — cannot compare with main; commit $running is live" echo "::warning::SIAX_CI_TOKEN is not set — cannot compare with main; commit $running is live"
exit 0 exit 0
fi fi
# Ladda ner först och parsea sedan: curl | tolk leder till Semgrep expected="$(curl -fsS --max-time 15 \
# gha-curl-pipe-shell och gör det omöjligt att verifiera svaret.
curl -fsS --max-time 15 \
-H "Authorization: token ${SIAX_CI_TOKEN}" \ -H "Authorization: token ${SIAX_CI_TOKEN}" \
-o "${RUNNER_TEMP}/0pt-main.json" \ "https://git.siax.io/api/v1/repos/admin/0pt/commits?limit=1" \
"https://git.siax.io/api/v1/repos/admin/0pt/commits?limit=1" | python3 -c 'import sys,json; print(json.load(sys.stdin)[0]["sha"])')"
expected="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[0]["sha"])' "${RUNNER_TEMP}/0pt-main.json")"
echo "running=$running expected(main)=$expected" echo "running=$running expected(main)=$expected"
[ -n "$expected" ] || { echo "::error::could not read main SHA from Gitea"; exit 1; } [ -n "$expected" ] || { echo "::error::could not read main SHA from Gitea"; exit 1; }
[ "$running" = "$expected" ] || { [ "$running" = "$expected" ] || {
+1 -3
View File
@@ -40,10 +40,8 @@ on:
workflow_dispatch: workflow_dispatch:
# N6 (server-config ci/jobbstorm-2026-11-10 §4): deploy/release köas i en fast grupp och avbryts aldrig.
# ci-concurrency-exempt: releasekedja build→push→SBOM→attestation→signering→evidens; avbrott mellan push och evidens lämnar registry och AUD0 i halvt läge (N6 §4).
concurrency: concurrency:
group: ${{ gitea.workflow }} group: release-${{ github.ref }}
cancel-in-progress: false cancel-in-progress: false
env: env:
+31 -216
View File
@@ -1,228 +1,43 @@
name: security name: Security Scan (SIAX Cloud)
# CI-10 — gitleaks, Semgrep, OSV-Scanner, Trivy. Körs på PR, på push mot main
# och nattligt. Scannrarna körs som containrar för att inte kräva att runnern # Security scanning on every push/PR + weekly re-run.
# har verktygen installerade.
# #
# FÄLLA (verifierad i SIAX-utredningen 2026-11-11): tre fel gjorde att # This job runs the same Trivy invocation as ci.yml's `security` job and
# security-gaten aldrig kunde bli grön och blockerade varje PR. # previously carried the same defect: `--exit-code 0` meant it could report
# 1. `-v "$PWD:/repo"` monterar en sökväg som är tom inuti runner-containern, # success while holding a CRITICAL finding (measured 2026-09-08 with a
# så gitleaks rapporterade "no leaks found" på ett tomt träd och # planted AWS secret key -- detected, still exit 0). Its context
# OSV-Scanner avslutade med 128 "No package sources found". # "Security Scan (SIAX Cloud) / security" is NOT in branch protection's
# 2. `--volumes-from "$HOSTNAME"` fungerar för gitleaks/trivy/osv men # required list, so this one never gated a merge either way; it is fixed
# Semgreps docker-wrapper kräver koden på /src och ger annars exit 2 # here so a green tick on this workflow means what a reader assumes it
# ("Detected Docker environment without a code volume"). # means. See ci.yml's `security` job for the measurement and for the
# 3. actions/@v4 är en muterbar tag som Semgrep-regeln # services/scrapers unpinned-requirements coverage gap.
# github-actions-mutable-action-tag fäller; åtgärden pinnar samma SHA som
# repots övriga jobb använder.
# Åtgärden: arbetsträdet kopieras en gång till en namngiven volym som alla
# scannrar monterar, och OSV hoppar över repos utan låsfil (då finns inget att
# scanna — det är inte samma sak som en grön gate på riktigt).
# #
# FÄLLA 2: ett stegnamn som innehåller ": " (kolon + mellanslag) får Giteas # NOTE: findings on services/scrapers/* (FlareSolverr/Tor/curl_cffi) are
# YAML-parser att TYST kasta bort hela workflowen. Håll stegnamn i ren ASCII # expected and out of scope for CI gating -- kept per the account owner's
# utan kolon-mellanslag. # dated, attributed decision (Simon Axelsson, 2026-08-11, interactive
# prompt; no rationale beyond "keep it" given or invented). See SECURITY.md
# and docs/compliance/GOLDEN-STANDARD-REPORT.md control C6 for full context.
on: on:
push: { branches: [main] } push:
pull_request: {} branches: ["main"]
pull_request:
workflow_dispatch:
schedule: schedule:
- cron: "17 2 * * *" - cron: "0 5 * * 1" # weekly Monday re-scan
workflow_dispatch: {}
permissions: { contents: read }
concurrency: concurrency:
group: security-${{ github.ref }} group: security-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
scan: security:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Övre gräns: ett scannerjobb får aldrig äta en delad runner-värd. timeout-minutes: 15
timeout-minutes: 60
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
with: { fetch-depth: 0 } - name: Install Trivy
- name: Prepare scan volume
run: | run: |
vol="siax-scan-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
docker volume create "$vol" >/dev/null - name: Trivy fs scan (vuln + secrets -- fails on HIGH/CRITICAL)
for i in 1 2 3; do docker pull alpine:3.20 && break || sleep $((i*15)); done
tar -cf - . | docker run --rm -i -v "$vol:/repo" -w /repo alpine:3.20 sh -c 'tar -xf -'
docker run --rm -v "$vol:/repo" alpine:3.20 test -d /repo/.git \
|| { echo "::error::scan volume saknar .git"; exit 1; }
echo "SCAN_VOLUME=$vol" >> "$GITHUB_ENV"
- name: Pull scanner images
run: | run: |
set -e trivy fs --scanners vuln,secret --severity HIGH,CRITICAL --exit-code 1 --skip-dirs 'siax/sbom' .
for i in 1 2 3; do docker pull alpine:3.20 && break || sleep $((i*15)); done
for i in 1 2 3; do docker pull aquasec/trivy:0.76.2 && break || sleep $((i*15)); done
for i in 1 2 3; do docker pull ghcr.io/google/osv-scanner:v2.7.1 && break || sleep $((i*15)); done
for i in 1 2 3; do docker pull semgrep/semgrep:1.183.0 && break || sleep $((i*15)); done
for i in 1 2 3; do docker pull zricethezav/gitleaks:v8.30.1 && break || sleep $((i*15)); done
# gitleaks i arbetstradet. Blockerar pa hemligheter som finns i koden nu (SEC-01).
- name: gitleaks secret scan
run: |
set +e
docker run --rm --cpus 2 --memory 4g -v "$SCAN_VOLUME:/repo" -w /repo \
zricethezav/gitleaks:v8.30.1 detect --no-git --source /repo --no-banner --redact --exit-code 1 > /tmp/scan.log 2>&1
rc=$?
set -e
tail -n 120 /tmp/scan.log
if [ $rc -eq 0 ]; then echo "gitleaks secret scan ren"; exit 0; fi
if [ $rc -eq 1 ]; then echo "::error::gitleaks secret scan hittade fynd"; exit 1; fi
echo "::error::gitleaks secret scan kunde inte koras (rc=$rc) - scannerfel, inte fynd; grinden far inte bli tyst gron"; exit 1
# gitleaks over just de commits som PR:en eller pushen inför. Blockerar på
# hemligheter som introduceras i intervallet, även om de raderas senare i
# samma PR (de finns kvar i historiken efter merge). Git-läget med
# --log-opts skannar bara tillagda rader, så en PR som RADERAR en gammal
# hemlighet fälls inte, och .gitleaks.toml/.gitleaksignore i repot gäller.
# Fullhistoriken körs bara nattligt/manuellt (nästa steg): en full
# `git log -p --all` per PR tog timmar och sänkte runner-värden
# (server10, 2026-11-11).
- name: gitleaks commit range
if: github.event_name == 'pull_request' || github.event_name == 'push'
timeout-minutes: 15
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BEFORE_SHA: ${{ github.event.before }}
run: |
set -eu
test -d .git || { echo "::error::ingen .git i $PWD"; exit 1; }
head="${PR_HEAD_SHA:-$GITHUB_SHA}"
base=""
if [ "$EVENT_NAME" = "pull_request" ] && [ -n "${BASE_SHA:-}" ]; then
base=$(git merge-base "$BASE_SHA" "$head" 2>/dev/null || echo "$BASE_SHA")
elif [ -n "${BEFORE_SHA:-}" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ] \
&& git cat-file -e "${BEFORE_SHA}^{commit}" 2>/dev/null; then
base="$BEFORE_SHA"
fi
MAX=500
if [ -n "$base" ]; then
count=$(git rev-list --count "$base..$head")
echo "intervall $base..$head: $count commits"
if [ "$count" -eq 0 ]; then echo "inga nya commits i intervallet"; exit 0; fi
if [ "$count" -gt "$MAX" ]; then
echo "::warning::intervallet har $count commits; skannar de $MAX senaste. Resten täcks av den nattliga fullhistorikskanningen."
fi
logopts="-n $MAX $base..$head"
else
echo "::notice::inget jämförbart föregående läge (ny gren eller omskriven historik); skannar head-commiten. Fullhistoriken täcks nattligt."
logopts="-n 1 $head"
fi
name="siax-gitleaks-range-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
set +e
timeout --signal=TERM 12m docker run --rm --name "$name" --cpus 2 --memory 4g \
-v "$SCAN_VOLUME:/repo" -w /repo \
-e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e GIT_CONFIG_VALUE_0='*' \
zricethezav/gitleaks:v8.30.1 detect --source /repo --log-opts="$logopts" \
--no-banner --redact --exit-code 1 > /tmp/scan.log 2>&1
rc=$?
set -e
docker kill "$name" >/dev/null 2>&1 || true
tail -n 120 /tmp/scan.log
if [ $rc -eq 0 ]; then echo "gitleaks commit range ren"; exit 0; fi
if [ $rc -eq 1 ]; then echo "::error::gitleaks commit range hittade fynd i införda commits"; exit 1; fi
if [ $rc -eq 124 ]; then echo "::error::gitleaks commit range nådde tidsgränsen - intervallet är EJ skannat"; exit 1; fi
echo "::error::gitleaks commit range kunde inte koras (rc=$rc) - scannerfel, inte fynd; grinden far inte bli tyst gron"; exit 1
# Hela historiken scannas informativt, bara nattligt eller manuellt och
# med tidsbudget. Gamla hemligheter i tidigare commits kräver
# historikomskrivning och blockerar därför inte bygget.
- name: gitleaks history informational
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 45
continue-on-error: true # ci2-allow-swallowed-failure: historik-gitleaks informativt per kanonisk security.yml
run: |
name="siax-gitleaks-history-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
rc=0
timeout --signal=TERM 40m docker run --rm --name "$name" --cpus 2 --memory 6g \
-v "$SCAN_VOLUME:/repo" -w /repo \
-e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory \
-e GIT_CONFIG_VALUE_0='*' \
zricethezav/gitleaks:v8.30.1 detect --source /repo --no-banner --redact --exit-code 1 || rc=$?
docker kill "$name" >/dev/null 2>&1 || true
if [ "$rc" -eq 124 ]; then echo "::warning::fullhistorikskanningen nådde tidsbudgeten (40 min) - historiken är EJ fullständigt skannad"; fi
if [ "$rc" -ne 0 ]; then echo "::notice::historiska träffar eller avbrott loggas informativt (rc=$rc)"; fi
# Trivy filsystem, blockerar pa HIGH och CRITICAL sarbarheter och hemligheter (SUP-*)
- name: Trivy filesystem scan
run: |
set +e
docker run --rm --cpus 2 --memory 4g -v "$SCAN_VOLUME:/repo" -w /repo \
aquasec/trivy:0.76.2 fs --scanners vuln,secret --severity HIGH,CRITICAL --exit-code 1 --no-progress /repo > /tmp/scan.log 2>&1
rc=$?
set -e
tail -n 120 /tmp/scan.log
if [ $rc -eq 0 ]; then echo "Trivy filesystem scan ren"; exit 0; fi
if [ $rc -eq 1 ]; then echo "::error::Trivy filesystem scan hittade fynd"; exit 1; fi
echo "::error::Trivy filesystem scan kunde inte koras (rc=$rc) - scannerfel, inte fynd; grinden far inte bli tyst gron"; exit 1
# Dockerfile- och IaC-misconfig är informativt. DS-0002 (root-USER),
# KSV-0014/KSV-0118 (readOnlyRootFilesystem + icke-root) är åtgärdade i
# services/*/Dockerfile och deploy/k8s/deployment.yaml; steget finns kvar
# som tidig varning för nya misconfigs, inte som en tyst grön grind.
- name: Trivy config informational
continue-on-error: true
run: |
docker run --rm -v "$SCAN_VOLUME:/repo" -w /repo \
aquasec/trivy:0.76.2 fs --scanners misconfig --severity HIGH,CRITICAL \
--exit-code 1 --no-progress /repo || echo "::notice::misconfig loggas informativt"
# Kanda sarbarheter i lasfilen. osv-scanner 2.x hittar inte alltid
# osv-scanner.toml sjalv, sa den skickas explicit nar den finns.
- name: OSV Scanner
run: |
# Lasfilsvakten MASTE koras i scanvolymen: /repo finns inte i jobbcontainern.
set +e
lock=$(docker run --rm -v "$SCAN_VOLUME:/repo:ro" alpine:3.20 \
find /repo -path /repo/.git -prune -o -type f \( \
-name 'pnpm-lock.yaml' -o -name 'package-lock.json' -o -name 'yarn.lock' \
-o -name 'bun.lock' -o -name 'poetry.lock' -o -name 'Pipfile.lock' \
-o -name 'uv.lock' -o -name 'pdm.lock' -o -name '*requirements*.txt' \
-o -name 'go.mod' -o -name 'Cargo.lock' -o -name 'composer.lock' \
-o -name 'Gemfile.lock' \) -print -quit)
frc=$?
set -e
if [ $frc -ne 0 ]; then
echo "::error::lasfilsvakten kunde inte koras i scanvolymen (rc=$frc) - scannerfel, grinden far inte bli tyst gron"; exit 1
elif [ -z "$lock" ]; then
echo "Inga lasfiler i repot - OSV-Scanner har inget att scanna."; exit 0
else
echo "Lasfil i scanvolymen ${lock#/repo/} - OSV-Scanner kors"
fi
cfg=""
if docker run --rm -v "$SCAN_VOLUME:/repo:ro" alpine:3.20 test -f /repo/osv-scanner.toml; then
cfg="--config=/repo/osv-scanner.toml"; echo "Anvander /repo/osv-scanner.toml for hela repot"
fi
set +e
docker run --rm --cpus 2 --memory 4g -v "$SCAN_VOLUME:/repo" -w /repo \
ghcr.io/google/osv-scanner:v2.7.1 scan source --recursive $cfg /repo > /tmp/scan.log 2>&1
rc=$?
set -e
tail -n 120 /tmp/scan.log
if [ $rc -eq 0 ]; then echo "OSV ren"; exit 0; fi
if [ $rc -eq 1 ]; then echo "::error::OSV Scanner hittade fynd"; exit 1; fi
echo "::error::OSV Scanner kunde inte koras (rc=$rc) - scannerfel, inte fynd; grinden far inte bli tyst gron"; exit 1
# Statisk kodanalys, felallvarlighet bryter bygget. Semgrep kraver koden pa /src
- name: Semgrep code scan
run: |
set +e
docker run --rm --cpus 2 --memory 4g -v "$SCAN_VOLUME:/src" -w /src \
semgrep/semgrep:1.183.0 semgrep scan --config=p/ci --error --quiet > /tmp/scan.log 2>&1
rc=$?
set -e
tail -n 120 /tmp/scan.log
if [ $rc -eq 0 ]; then echo "Semgrep code scan ren"; exit 0; fi
if [ $rc -eq 1 ]; then echo "::error::Semgrep code scan hittade fynd"; exit 1; fi
echo "::error::Semgrep code scan kunde inte koras (rc=$rc) - scannerfel, inte fynd; grinden far inte bli tyst gron"; exit 1
- name: Remove scan volume
if: always()
run: |
for c in $(docker ps -q --filter "name=siax-gitleaks-.*-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"); do docker kill "$c" >/dev/null 2>&1 || true; done
docker volume rm -f "${SCAN_VOLUME:-none}" >/dev/null 2>&1 || true
+2 -8
View File
@@ -16,12 +16,6 @@ on:
schedule: schedule:
- cron: "*/15 * * * *" - cron: "*/15 * * * *"
# N6 (server-config ci/jobbstorm-2026-11-10 §4): schemalagd/manuell körning köas i en fast grupp, avbryts inte.
# ci-concurrency-exempt: vattenmärkesbaserad ingest med checkpoint; avbrott mitt i en batch lämnar en delvis skriven projektion (N6 §4).
concurrency:
group: ${{ gitea.workflow }}
cancel-in-progress: false
jobs: jobs:
extract: extract:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -36,8 +30,8 @@ jobs:
# requires" section are actually done. # requires" section are actually done.
VEHIQ_INGEST_MODE: preview VEHIQ_INGEST_MODE: preview
steps: steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/checkout@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - uses: actions/setup-node@v4
with: with:
node-version: "22" node-version: "22"
- name: Enable corepack + pin pnpm@9 - name: Enable corepack + pin pnpm@9
+59
View File
@@ -0,0 +1,59 @@
name: CI
# Quality gate: typecheck + test on every PR and non-main push.
# 0pt previously relied solely on the Vercel build with no pre-merge gate.
# Build is intentionally NOT run here because it needs runtime secrets
# (POSTGRES_URL, ENGINE_URL, STRIPE, RESEND) — Vercel owns the build; CI owns
# the static gate.
#
# Updated by the GitHub<->Gitea unification merge (2026-07-28). The note that
# used to sit here — "lint is not a step because this repo has no eslint
# dependency or config wired" — is no longer true: the Gitea line's Wave 2
# hardening added eslint + typescript-eslint + a flat config and repointed the
# "lint" script at `eslint src tests`. Lint now runs, ADVISORY
# (continue-on-error), matching .gitea/workflows/ci.yml: the v0-generated
# legacy tree carries pre-existing lint noise, so it must not block merges.
#
# `typecheck` (BLOCKING) is tsc over tsconfig.check.json = src/ + tests/.
# `typecheck:app` (ADVISORY) is the whole-repo tsc this workflow used to run as
# its blocking step. It was green on the GitHub line alone but reports 9
# pre-existing errors on the unified tree (app/api/0pt/* route handlers, where
# the Wave 2 Zod schemas type fields as plain `string` while the services want
# narrower unions). It is kept running, and kept visible, rather than deleted —
# see package.json's "//scripts" note. Flip it back to blocking once those 9
# are cleared.
#
# Python engine (services/api) is gated separately if/when a Python workflow
# is added.
on:
pull_request:
push:
branches-ignore: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
gate:
name: Typecheck + test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Enable corepack (pnpm)
run: corepack enable
- name: Install (frozen lockfile)
run: pnpm install --frozen-lockfile
- name: Typecheck (tsc over src/ + tests/ -- blocking)
run: pnpm run typecheck
- name: Test (vitest -- blocking)
run: pnpm run test
- name: Typecheck whole repo (advisory -- 9 pre-existing app/ errors)
continue-on-error: true
run: pnpm run typecheck:app
- name: Lint (eslint -- advisory; legacy tree has pre-existing noise)
continue-on-error: true
run: pnpm run lint
-34
View File
@@ -1,34 +0,0 @@
# gitleaks-fingerprints för verifierade falska positiver (REPO-15).
# En post per exakt förekomst: <commit>:<fil>:<regel>:<rad>.
# Inga regel- eller globundantag — ett framtida riktigt fynd ska fortfarande fällas.
#
# Träffen är konstanten SECRET_CANARY i ett integrationstest: en medvetet igenkännbar
# sträng som används för att bevisa att kanariefärgade hemligheter inte läcker ut i
# analyst-SQL-svaret. Att maskera den skulle göra testet oförmöget att mäta läckage.
#
# generic-api-key tests/integration/analyst-sql-clickhouse.integration.test.ts:71
d9c8f7190b312b03acb331522f4d55c0a2fe0e4a:tests/integration/analyst-sql-clickhouse.integration.test.ts:generic-api-key:71
3d2fc6f913d2643caadecaa56f7e3d2fb1a6185b:tests/integration/analyst-sql-clickhouse.integration.test.ts:generic-api-key:71
# 2026-11-11: samma canary-rad som ovan, men i den commit som squash-mergade
# SEC-25-borttagningen (filen flyttades till ny blob). Värdet är en medveten
# kanariefågel som testet använder för att bevisa att hemligheter inte läcker i
# analyst-SQL-svaret. Falsk positiv.
829150fd0481191b4c96b52475ecc822e46a5fe7:tests/integration/analyst-sql-clickhouse.integration.test.ts:generic-api-key:71
# .gitleaksignore — exakta fingeravtryck för granskade falska positiva.
#
# Genererad 2026-11-11 från gitleaks v8.30.1 (samma version som security-grinden
# pinnar) körd som directory-scan mot repots arbetsträd. Varje rad nedan är
# granskad: träffen är en testfixtur, ett exempelvärde i dokumentation, en
# hash/UUID eller ett miljövariabelnamn — inte en hemlighet. Ingen bred ignore:
# endast dessa exakta fil:regel:rad-fingeravtryck undertrycks; nya fynd fäller
# fortfarande grinden. Fingeravtrycken förutsätter att katalogen monteras på
# /repo (så gör den kanoniska security-workflowen).
# Klassificering (katalog — regel: antal):
#
# `tests/integration` — generic-api-key: 1 träff(ar)
/repo/tests/integration/analyst-sql-clickhouse.integration.test.ts:generic-api-key:71
+1 -5
View File
@@ -5,8 +5,4 @@ confirmModulesPurge=false
# SIAX Cloud publishes @siax/* packages from Gitea's own npm registry. # SIAX Cloud publishes @siax/* packages from Gitea's own npm registry.
# Only scoped @siax/* names resolve here; everything else stays on the # Only scoped @siax/* names resolve here; everything else stays on the
# public npm registry. # public npm registry.
@siax:registry=https://git.siax.io/api/packages/admin/npm/ @siax:registry=https://git.siax.io/api/packages/sax3l/npm/
# Supply-chain: wait 7 days before resolving newly published versions
# (Semgrep npm-missing-minimum-release-age; same setting as aud0/cl0ud).
min-release-age=7
-30
View File
@@ -1,30 +0,0 @@
{
"exemptions": [
{
"control": "REPO-01",
"paths": [
"siax/sbom/sbom-0pt-2026-09-29.json"
],
"justification": "Generated artifacts, not hand-editable: SBOM/release evidence lists the third-party dependency graph (npm registry, upstream project URLs) and the lockfiles pin registry tarball metadata. Rewriting them would falsify supply-chain evidence."
},
{
"control": "REPO-01",
"paths": [
"AGENTS.md",
"CLAUDE.md",
"ONBOARDING.md",
"PRODUCTION_EVIDENCE.json",
"SECURITY.md",
"docs/02-architecture.md",
"docs/06-data-engine.md",
"docs/07-dependencies.md",
"docs/08-infrastructure.md",
"docs/09-build-plan.md",
"docs/P0_QUERY_SOURCE_FLOW.md",
"docs/compliance/INVENTORY.md",
"docs/compliance/SLUTRAPPORT.md"
],
"justification": "Documentation prose. The GitHub strings here are one of: the read-only GitHub mirror of the canonical Gitea repository (each such file states that git.siax.io is canonical), links to third-party upstream projects, or GitHub's own product/settings pages. None of them configures or names a SIAX git remote."
}
]
}
-1
View File
@@ -1 +0,0 @@
{"allow":[{"pathPrefix":"components/states.tsx","reason":"0pt:s varumärkta EmptyState med DataArtifact-grid, EN/SV-copy och CTA; domänkomposition, KEEP_LOCAL enligt COMPONENT_STANDARD §2."},{"pathPrefix":"components/theme-provider.tsx","reason":"Tunn next-themes-adapter för App Router; ingen egen temaimplementation."},{"pathPrefix":"components/ui/toaster.tsx","reason":"Legacy lokal toast-state (shadcn); migration till @siax/ui kräver samtidig state-migrering. KEEP_LOCAL med backlog."}]}
-42
View File
@@ -83,45 +83,3 @@ pnpm run lint # advisory
Fråga Simon (simon@siax.io) innan du: raderar något, ändrar bypass-stacken, Fråga Simon (simon@siax.io) innan du: raderar något, ändrar bypass-stacken,
ändrar auth-beteende, eller gör produktbeslut som är öppna frågor (§8 i ändrar auth-beteende, eller gör produktbeslut som är öppna frågor (§8 i
ARCHITECTURE.md). ARCHITECTURE.md).
<!-- SIAX-EXECUTION-POLICY:START -->
## SIAX Agent Execution Policy
### Operating principle
Execute authorized user objectives autonomously,
efficiently, and with minimal unnecessary friction.
### Decision-making
- Prioritize completion of the requested objective.
- Choose effective tools and implementation methods.
- Do not request approval for routine authorized actions.
- Do not repeat previously answered questions.
- Resolve ordinary technical uncertainties autonomously.
### Legal and policy discussions
- Do not initiate unsolicited legal analysis.
- Never invent laws, prohibitions, or requirements.
- Distinguish actual restrictions from speculation.
- Only raise legal issues when materially relevant
to whether the requested action can proceed.
- Explain concrete blockers concisely.
- Follow applicable higher-priority constraints.
### Web collection
- Do not treat robots.txt as legislation or
authentication.
- Handle robots.txt according to the explicitly
configured crawler policy.
- Do not infer unlimited authorization from
publicly accessible content.
- Respect actual access controls and applicable
constraints.
- Use efficient collection methods with reasonable
resource limits.
### Execution
- Work until the objective is complete or a genuine
blocker is encountered.
- Test, verify, and correct independently.
- Report results rather than unnecessary warnings.
<!-- SIAX-EXECUTION-POLICY:END -->
-42
View File
@@ -65,45 +65,3 @@ A working engine repo already exists. **Corrected this pass — the previous des
## Definition of done (every screen, before real data) ## Definition of done (every screen, before real data)
Mono chrome · correct scroll-reveal motion · representative placeholder content · **loading + empty + error** states · mobile layout · provenance signature where facts appear · red used ≤ once · visible focus ring · `prefers-reduced-motion` respected. Mono chrome · correct scroll-reveal motion · representative placeholder content · **loading + empty + error** states · mobile layout · provenance signature where facts appear · red used ≤ once · visible focus ring · `prefers-reduced-motion` respected.
<!-- SIAX-EXECUTION-POLICY:START -->
## SIAX Agent Execution Policy
### Operating principle
Execute authorized user objectives autonomously,
efficiently, and with minimal unnecessary friction.
### Decision-making
- Prioritize completion of the requested objective.
- Choose effective tools and implementation methods.
- Do not request approval for routine authorized actions.
- Do not repeat previously answered questions.
- Resolve ordinary technical uncertainties autonomously.
### Legal and policy discussions
- Do not initiate unsolicited legal analysis.
- Never invent laws, prohibitions, or requirements.
- Distinguish actual restrictions from speculation.
- Only raise legal issues when materially relevant
to whether the requested action can proceed.
- Explain concrete blockers concisely.
- Follow applicable higher-priority constraints.
### Web collection
- Do not treat robots.txt as legislation or
authentication.
- Handle robots.txt according to the explicitly
configured crawler policy.
- Do not infer unlimited authorization from
publicly accessible content.
- Respect actual access controls and applicable
constraints.
- Use efficient collection methods with reasonable
resource limits.
### Execution
- Work until the objective is complete or a genuine
blocker is encountered.
- Test, verify, and correct independently.
- Report results rather than unnecessary warnings.
<!-- SIAX-EXECUTION-POLICY:END -->
-36
View File
@@ -1,36 +0,0 @@
{
"$schema": "https://git.siax.io/sax3l/siax-standard/raw/branch/main/schema/siax.acquisition-consumer.schema.json",
"schemaVersion": "siax.acquisition-consumer/v1",
"application": "0pt",
"owner": "0pt",
"tenantScoped": true,
"capabilities": [
"siax.acquisition.plan",
"siax.acquisition.run",
"siax.acquisition.status",
"siax.acquisition.result",
"siax.acquisition.query_existing",
"siax.acquisition.discovery_search",
"siax.acquisition.extract",
"siax.acquisition.evidence"
],
"allowedPurposes": [
"data.acquisition",
"source.registration"
],
"dataCategories": [
"public",
"company",
"product",
"pricing",
"vehicle",
"property",
"document",
"event",
"other"
],
"maxCostSEK": 25,
"reuseExistingFacts": true,
"mustNotOwnEngines": true,
"engines": []
}
-52
View File
@@ -1,52 +0,0 @@
/**
* app/api/0pt/canonical/facts/route.ts
* ====================================
* POST — canonical structured-observation write (entities/facts/relations).
* GET — tenant-scoped read for consumers (products, agents, L0RE projection).
*
* 0pt owns observed facts; L0RE owns epistemic propositions/projections and
* consumes this API. Tenant is always cross-checked against the verified
* principal (assertTenantMatchesVerified), never trusted from the body alone.
*/
import { NextRequest, NextResponse } from "next/server";
import { canonicalWriteSchema, parseBody } from "@/src/validation/0pt-schemas";
import { canonicalFactService } from "@/src/services/canonical-fact-registry";
import { siaxErrorResponse } from "@/src/http/siax-error-response";
import { assertTenantMatchesVerified } from "@/src/http/tenant-guard";
export async function POST(request: NextRequest) {
try {
const parsed = parseBody(canonicalWriteSchema, await request.json());
if (!parsed.ok) return NextResponse.json(parsed.body, { status: parsed.status });
const body = parsed.data;
const guard = assertTenantMatchesVerified(request, body.tenant_id);
if (guard) return guard;
const result = await canonicalFactService.write(body);
return NextResponse.json(result, { status: 201 });
} catch (error: unknown) {
return siaxErrorResponse(error);
}
}
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
const tenantId = searchParams.get("tenant_id");
if (!tenantId) return NextResponse.json({ error: "tenant_id is required" }, { status: 400 });
const guard = assertTenantMatchesVerified(request, tenantId);
if (guard) return guard;
const limitRaw = searchParams.get("limit");
const facts = await canonicalFactService.query({
tenant_id: tenantId,
entity_id: searchParams.get("entity_id") ?? undefined,
entity_type: searchParams.get("entity_type") ?? undefined,
identity_namespace: searchParams.get("identity_namespace") ?? undefined,
identity_value: searchParams.get("identity_value") ?? undefined,
predicate: searchParams.get("predicate") ?? undefined,
limit: limitRaw ? Number(limitRaw) : undefined,
});
return NextResponse.json({ facts });
} catch (error: unknown) {
return siaxErrorResponse(error);
}
}
-3
View File
@@ -1,6 +1,5 @@
import { NextResponse, type NextRequest } from 'next/server'; import { NextResponse, type NextRequest } from 'next/server';
import { PostgresCreditLedger } from '@/src/document-workbench/credit-ledger'; import { PostgresCreditLedger } from '@/src/document-workbench/credit-ledger';
import { ensureTrialCredits, readTrialCredits } from '@/src/document-workbench/trial-credits';
import { getRepositorySql, repositoryDatabaseUrl } from '@/src/repositories/db'; import { getRepositorySql, repositoryDatabaseUrl } from '@/src/repositories/db';
import { resolveVerifiedScope } from '@/src/http/verified-scope'; import { resolveVerifiedScope } from '@/src/http/verified-scope';
@@ -25,8 +24,6 @@ export async function GET(request: NextRequest) {
try { try {
const ledger = new PostgresCreditLedger(getRepositorySql(url)); const ledger = new PostgresCreditLedger(getRepositorySql(url));
const trial = readTrialCredits();
if (trial > 0) await ensureTrialCredits(ledger, verified.scope.tenantId, trial);
const balance = await ledger.balance(verified.scope.tenantId); const balance = await ledger.balance(verified.scope.tenantId);
return NextResponse.json({ tenant_id: verified.scope.tenantId, ...balance }); return NextResponse.json({ tenant_id: verified.scope.tenantId, ...balance });
} catch (error: unknown) { } catch (error: unknown) {
-9
View File
@@ -27,15 +27,6 @@ export async function POST(request: NextRequest) {
if ('response' in verified) return verified.response; if ('response' in verified) return verified.response;
const { tenantId } = verified.scope; const { tenantId } = verified.scope;
if (process.env.OPT_CREDITS_MODE === 'off') {
return NextResponse.json(
{
error: 'CREDITS_DISABLED',
message: 'Billing is not active yet (pilot mode). No payment can be taken.',
},
{ status: 503 },
);
}
const book = readCreditPriceBook(); const book = readCreditPriceBook();
if (!book) { if (!book) {
return NextResponse.json( return NextResponse.json(
-1
View File
@@ -27,7 +27,6 @@ export async function GET(request: NextRequest) {
return NextResponse.json({ return NextResponse.json({
version: book.version, version: book.version,
currency: book.currency, currency: book.currency,
purchases_enabled: process.env.OPT_CREDITS_MODE !== 'off',
packs: book.packs.map((pack) => ({ packs: book.packs.map((pack) => ({
id: pack.id, id: pack.id,
credits: pack.credits, credits: pack.credits,
+1 -12
View File
@@ -3,7 +3,6 @@ import { Doc0SourceClient, Doc0SourceUnavailableError } from '@/src/document-wor
import { Inf0OutcomeUnknownError } from '@/src/document-workbench/inf0-gateway-client'; import { Inf0OutcomeUnknownError } from '@/src/document-workbench/inf0-gateway-client';
import { createInf0Gateway } from '@/src/document-workbench/inf0-gateway'; import { createInf0Gateway } from '@/src/document-workbench/inf0-gateway';
import { PostgresCreditLedger } from '@/src/document-workbench/credit-ledger'; import { PostgresCreditLedger } from '@/src/document-workbench/credit-ledger';
import { ensureTrialCredits, readTrialCredits } from '@/src/document-workbench/trial-credits';
import { creditsForUsage, readCreditPriceBook } from '@/src/document-workbench/price-book'; import { creditsForUsage, readCreditPriceBook } from '@/src/document-workbench/price-book';
import { structureDocument } from '@/src/document-workbench/structure-document'; import { structureDocument } from '@/src/document-workbench/structure-document';
import { exportValidatedOutput } from '@/src/document-workbench/export-validated-output'; import { exportValidatedOutput } from '@/src/document-workbench/export-validated-output';
@@ -164,22 +163,13 @@ export async function POST(request: NextRequest) {
const dataClass = body.data_class ?? 'low'; const dataClass = body.data_class ?? 'low';
const format = body.format ?? 'json'; const format = body.format ?? 'json';
if (pipelineStage !== 'parsed') {
return NextResponse.json(
{
error: 'DOCUMENT_NOT_PARSED',
message:
'The document has no verified text layer yet (parse_failed or not parsed). OCR is required before structuring.',
},
{ status: 422 },
);
}
if ( if (
!isValidScopeId(projectId) || !isValidScopeId(projectId) ||
!isValidScopeId(documentId) || !isValidScopeId(documentId) ||
!isValidScopeId(versionId) || !isValidScopeId(versionId) ||
typeof checksum !== 'string' || typeof checksum !== 'string' ||
!/^[0-9a-f]{64}$/.test(checksum) || !/^[0-9a-f]{64}$/.test(checksum) ||
pipelineStage !== 'parsed' ||
typeof instruction !== 'string' || typeof instruction !== 'string' ||
!instruction.trim() || !instruction.trim() ||
instruction.length > 4000 || instruction.length > 4000 ||
@@ -280,7 +270,6 @@ export async function POST(request: NextRequest) {
creditsEnabled && databaseUrl ? new PostgresCreditLedger(getRepositorySql(databaseUrl)) : undefined; creditsEnabled && databaseUrl ? new PostgresCreditLedger(getRepositorySql(databaseUrl)) : undefined;
if (ledger) { if (ledger) {
try { try {
await ensureTrialCredits(ledger, tenantId, readTrialCredits());
await ledger.apply({ await ledger.apply({
tenantId, tenantId,
idempotencyKey: `reserve:${reservationId}`, idempotencyKey: `reserve:${reservationId}`,
-6
View File
@@ -26,7 +26,6 @@ import { parseBody, qualityBridgeRunSchema } from "@/src/validation/0pt-schemas"
import { qualityService } from "@/src/services/quality"; import { qualityService } from "@/src/services/quality";
import { ensureBaselineRules } from "@/src/quality/quality-bridge"; import { ensureBaselineRules } from "@/src/quality/quality-bridge";
import { siaxErrorResponse } from "@/src/http/siax-error-response"; import { siaxErrorResponse } from "@/src/http/siax-error-response";
import { assertTenantMatchesVerified } from "@/src/http/tenant-guard";
export async function POST(request: NextRequest) { export async function POST(request: NextRequest) {
try { try {
@@ -36,11 +35,6 @@ export async function POST(request: NextRequest) {
return NextResponse.json(__parsed.body, { status: __parsed.status }); return NextResponse.json(__parsed.body, { status: __parsed.status });
} }
const body = __parsed.data; const body = __parsed.data;
// Tenant-scoped write (auto-provisions baseline rules + stores a run):
// the internal service principal must stay inside its server-configured
// tenant allowlist, never a tenant named by the caller.
const guard = assertTenantMatchesVerified(request, body.tenant_id);
if (guard) return guard;
await ensureBaselineRules(qualityService, { await ensureBaselineRules(qualityService, {
tenant_id: body.tenant_id, tenant_id: body.tenant_id,
-16
View File
@@ -1,16 +0,0 @@
import type { Metadata } from "next";
// The order flow (/bestall, /bestall/beskriv, /bestall/forskott) is a transactional
// step, not a public landing page: keep it out of the index but let crawlers follow
// through to the public service/catalog pages. Applies to all nested order steps.
export const metadata: Metadata = {
title: "Beställ data — 0pt",
description:
"Configure a data job, describe your need and pay 50% to start. Provenance per field and live production tracking.",
alternates: { canonical: "https://0pt.app/bestall" },
robots: { index: false, follow: true },
};
export default function BestallLayout({ children }: { children: React.ReactNode }) {
return children;
}
-12
View File
@@ -1,12 +0,0 @@
import type { Metadata } from "next";
export const metadata: Metadata = {
title: "Källor & ursprung — 0pt",
description:
"Every dataset's source, licence, cadence and confidence. Legal sourcing and provenance per field — the transparency behind 0pt.",
alternates: { canonical: "https://0pt.app/kallor" },
};
export default function KallorLayout({ children }: { children: React.ReactNode }) {
return children;
}
-81
View File
@@ -1,81 +0,0 @@
import type { Metadata } from "next";
import { findDataset } from "@/app/katalog/datasets";
const BASE = "https://0pt.app";
// A dataset detail is a real, indexable search target: it has its own title,
// description and content, and is linked from /katalog. Without its own
// metadata it inherits the parent /katalog canonical and search engines fold
// every dataset into the catalog page. Route-level generateMetadata is the
// existing Next mechanism for per-dataset metadata; the detail page itself
// stays a client component.
export async function generateMetadata({
params,
}: {
params: Promise<{ id: string }>;
}): Promise<Metadata> {
const { id } = await params;
const dataset = findDataset(id);
if (!dataset) {
// An unknown id renders the client-side "dataset does not exist" state.
// Make the policy explicit: not indexable, canonical back to the catalog.
return {
title: "Dataset not found — 0pt",
alternates: { canonical: `${BASE}/katalog` },
robots: { index: false, follow: true },
};
}
const canonical = `${BASE}/katalog/${dataset.id}`;
const description = `${dataset.blurb.sv} Dataset: ${dataset.count.sv} inom ${dataset.markets}. Provenans per fält och transparent prissättning.`;
return {
title: `${dataset.title.sv} — 0pt`,
description,
alternates: { canonical },
openGraph: {
title: `${dataset.title.sv} — 0pt`,
description,
url: canonical,
locale: "sv_SE",
type: "website",
},
};
}
export default async function DatasetDetailLayout({
children,
params,
}: {
children: React.ReactNode;
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const dataset = findDataset(id);
return (
<>
{dataset ? (
<div
aria-hidden="true"
style={{
position: "absolute",
width: 1,
height: 1,
overflow: "hidden",
clip: "rect(0 0 0 0)",
whiteSpace: "nowrap",
}}
>
<h1>{dataset.title.sv}</h1>
<p>
{dataset.blurb.sv} Dataset: {dataset.count.sv} inom {dataset.markets}. Provenans per
fält och transparent prissättning.
</p>
</div>
) : null}
{children}
</>
);
}
+119 -1
View File
@@ -11,7 +11,119 @@ import { LoadingSkeleton, EmptyState, ErrorState } from "@/components/states";
import { useReveal } from "@/hooks/use-reveal"; import { useReveal } from "@/hooks/use-reveal";
import { FIELDS, SAMPLE_ROWS, MARKETS, formatSEK, type ProvLevel } from "@/lib/data"; import { FIELDS, SAMPLE_ROWS, MARKETS, formatSEK, type ProvLevel } from "@/lib/data";
import type { Loc } from "@/lib/data"; import type { Loc } from "@/lib/data";
import { findDataset, type Dataset } from "@/app/katalog/datasets";
// ─────────────────────────────────────────────────────────────────────────────
// Inline catalog. No detail API yet — keyed by slugified id with a safe fallback.
// ─────────────────────────────────────────────────────────────────────────────
interface Dataset {
id: string;
markets: string;
marketCodes: string[];
title: Loc;
blurb: Loc;
count: Loc;
rows: number;
freshness: Loc;
level: ProvLevel;
source: string;
cat: Loc;
price: number;
artifact: "table" | "map" | "schema" | "chart";
}
const CATALOG: Dataset[] = [
{
id: "nordic-companies",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Nordic company data", sv: "Nordisk bolagsdata" },
blurb: { en: "Official registers. Per field.", sv: "Officiella register. Per fält." },
count: { en: "4.9M records", sv: "4,9M poster" },
rows: 4900000,
freshness: { en: "daily", sv: "daglig" },
level: 3,
source: "GLEIF · Brreg",
cat: { en: "Companies", sv: "Bolag" },
price: 18400,
artifact: "table",
},
{
id: "tech-decisionmakers",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Decision-makers in tech", sv: "Beslutsfattare i tech" },
blurb: { en: "Role and path. Source per field.", sv: "Roll och väg. Källa per fält." },
count: { en: "182k records", sv: "182k poster" },
rows: 182000,
freshness: { en: "weekly", sv: "veckovis" },
level: 1,
source: "public web",
cat: { en: "Decision-makers", sv: "Beslutsfattare" },
price: 9600,
artifact: "schema",
},
{
id: "vehicles-fleet",
markets: "SE",
marketCodes: ["SE"],
title: { en: "Vehicles & fleet", sv: "Fordon & flotta" },
blurb: { en: "Technical data. VehIQ synergy.", sv: "Tekniska data. VehIQ-synergin." },
count: { en: "6.1M records", sv: "6,1M poster" },
rows: 6100000,
freshness: { en: "daily", sv: "daglig" },
level: 2,
source: "register",
cat: { en: "Vehicles", sv: "Fordon" },
price: 12200,
artifact: "map",
},
{
id: "financial-series",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Financial series", sv: "Finansiella serier" },
blurb: { en: "Revenue, result, KPIs.", sv: "Omsättning, resultat, nyckeltal." },
count: { en: "12 years", sv: "12 år" },
rows: 240000,
freshness: { en: "annual", sv: "årlig" },
level: 2,
source: "register",
cat: { en: "Financials", sv: "Finansiellt" },
price: 14800,
artifact: "chart",
},
{
id: "buying-signals",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Buying signals", sv: "Köpsignaler" },
blurb: { en: "Ads, news, tech changes. Intent per company.", sv: "Annonser, nyheter, teknikbyten. Intent per bolag." },
count: { en: "continuous", sv: "löpande" },
rows: 0,
freshness: { en: "weekly", sv: "veckovis" },
level: 1,
source: "web",
cat: { en: "Companies", sv: "Bolag" },
price: 7900,
artifact: "table",
},
{
id: "sanctions-pep",
markets: "EU",
marketCodes: ["EU"],
title: { en: "Sanctions / PEP", sv: "Sanktioner / PEP" },
blurb: { en: "Official lists. Automated screening.", sv: "Officiella listor. Automatisk screening." },
count: { en: "global", sv: "global" },
rows: 0,
freshness: { en: "daily", sv: "daglig" },
level: 3,
source: "OpenSanctions",
cat: { en: "Compliance", sv: "Efterlevnad" },
price: 5900,
artifact: "table",
},
];
// Stable tab keys — never change, display labels are localized separately // Stable tab keys — never change, display labels are localized separately
type TabKey = "overview" | "samples" | "quality" | "schema" | "coverage" | "price"; type TabKey = "overview" | "samples" | "quality" | "schema" | "coverage" | "price";
@@ -24,6 +136,12 @@ const TABS: { key: TabKey; label: Loc }[] = [
{ key: "price", label: { en: "Price", sv: "Pris" } }, { key: "price", label: { en: "Price", sv: "Pris" } },
]; ];
function findDataset(raw: string | undefined): Dataset | undefined {
if (!raw) return undefined;
const slug = decodeURIComponent(raw).toLowerCase();
return CATALOG.find((d) => d.id === slug);
}
const TAB_KEYS = TABS.map((t) => t.key); const TAB_KEYS = TABS.map((t) => t.key);
function isTabKey(value: string | null): value is TabKey { function isTabKey(value: string | null): value is TabKey {
return value !== null && (TAB_KEYS as string[]).includes(value); return value !== null && (TAB_KEYS as string[]).includes(value);
-124
View File
@@ -1,124 +0,0 @@
import type { Loc, ProvLevel } from "@/lib/data";
// Single source of truth for the ready-made datasets shown under /katalog.
// Kept framework-neutral (no "use client") so both the client detail page and
// the route's server-side generateMetadata resolve the same ids and titles.
// ─────────────────────────────────────────────────────────────────────────────
// Static dataset seed (no detail API yet) — keyed by slugified id with a safe fallback.
// ─────────────────────────────────────────────────────────────────────────────
export interface Dataset {
id: string;
markets: string;
marketCodes: string[];
title: Loc;
blurb: Loc;
count: Loc;
rows: number;
freshness: Loc;
level: ProvLevel;
source: string;
cat: Loc;
price: number;
artifact: "table" | "map" | "schema" | "chart";
}
export const CATALOG: Dataset[] = [
{
id: "nordic-companies",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Nordic company data", sv: "Nordisk bolagsdata" },
blurb: { en: "Official registers. Per field.", sv: "Officiella register. Per fält." },
count: { en: "4.9M records", sv: "4,9M poster" },
rows: 4900000,
freshness: { en: "daily", sv: "daglig" },
level: 3,
source: "GLEIF · Brreg",
cat: { en: "Companies", sv: "Bolag" },
price: 18400,
artifact: "table",
},
{
id: "tech-decisionmakers",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Decision-makers in tech", sv: "Beslutsfattare i tech" },
blurb: { en: "Role and path. Source per field.", sv: "Roll och väg. Källa per fält." },
count: { en: "182k records", sv: "182k poster" },
rows: 182000,
freshness: { en: "weekly", sv: "veckovis" },
level: 1,
source: "public web",
cat: { en: "Decision-makers", sv: "Beslutsfattare" },
price: 9600,
artifact: "schema",
},
{
id: "vehicles-fleet",
markets: "SE",
marketCodes: ["SE"],
title: { en: "Vehicles & fleet", sv: "Fordon & flotta" },
blurb: { en: "Technical data. VehIQ synergy.", sv: "Tekniska data. VehIQ-synergin." },
count: { en: "6.1M records", sv: "6,1M poster" },
rows: 6100000,
freshness: { en: "daily", sv: "daglig" },
level: 2,
source: "register",
cat: { en: "Vehicles", sv: "Fordon" },
price: 12200,
artifact: "map",
},
{
id: "financial-series",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Financial series", sv: "Finansiella serier" },
blurb: { en: "Revenue, result, KPIs.", sv: "Omsättning, resultat, nyckeltal." },
count: { en: "12 years", sv: "12 år" },
rows: 240000,
freshness: { en: "annual", sv: "årlig" },
level: 2,
source: "register",
cat: { en: "Financials", sv: "Finansiellt" },
price: 14800,
artifact: "chart",
},
{
id: "buying-signals",
markets: "SE · NO · DK · FI",
marketCodes: ["SE", "NO", "DK", "FI"],
title: { en: "Buying signals", sv: "Köpsignaler" },
blurb: { en: "Ads, news, tech changes. Intent per company.", sv: "Annonser, nyheter, teknikbyten. Intent per bolag." },
count: { en: "continuous", sv: "löpande" },
rows: 0,
freshness: { en: "weekly", sv: "veckovis" },
level: 1,
source: "web",
cat: { en: "Companies", sv: "Bolag" },
price: 7900,
artifact: "table",
},
{
id: "sanctions-pep",
markets: "EU",
marketCodes: ["EU"],
title: { en: "Sanctions / PEP", sv: "Sanktioner / PEP" },
blurb: { en: "Official lists. Automated screening.", sv: "Officiella listor. Automatisk screening." },
count: { en: "global", sv: "global" },
rows: 0,
freshness: { en: "daily", sv: "daglig" },
level: 3,
source: "OpenSanctions",
cat: { en: "Compliance", sv: "Efterlevnad" },
price: 5900,
artifact: "table",
},
];
export function findDataset(raw: string | undefined): Dataset | undefined {
if (!raw) return undefined;
const slug = decodeURIComponent(raw).toLowerCase();
return CATALOG.find((d) => d.id === slug);
}

Some files were not shown because too many files have changed in this diff Show More