Commit Graph

82 Commits

Author SHA1 Message Date
Sacha Al Himdani
b603d04d8d Assets as document: replace snapshot with publish workflow
Remove assets from the snapshot system and replace with a publish-based
document workflow that generates versioned ProseMirror documents.

- Remove snapshot_id/source_id from asset and asset_vendor models
- Delete AssetFilter (no longer needed without snapshot filtering)
- Add PublishAssetList service, GraphQL mutation, MCP tool, CLI command,
  and n8n operation
- Add asset_list_document_id column to generated_documents table
- Generate ProseMirror documents with asset inventory tables
  (name, type, amount, data types stored, owner, vendors)
- Add AssetListDocument resolver on Organization type
- Update frontend to remove snapshot routes/params and add publish dialog
- Add e2e tests for asset publish (immediate, with approvers, reuse, RBAC)
- Add migration script for converting legacy asset snapshots to documents
- Exclude ASSETS from snapshot type lists and e2e snapshot tests
- Move generated_documents SQL to coredata methods on Datum and Asset
- Clear generated document and SOA references on soft delete and archive

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-21 19:36:17 +02:00
Bryan Frimin
fbc10a8591 Move dev env file to repo root
Use the conventional .env / .env.example location at the repo
root instead of cfg/dev.env / cfg/dev.env.example. .env is what
contributors expect, keeps cfg/ a pure generated-config directory,
and shares the same file if we ever add another dev target that
needs the same overrides.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-21 18:51:34 +02:00
Bryan Frimin
ab0e59ad71 Generate cfg/dev.yaml via a Make target
Committing a fully-materialised cfg/dev.yaml hid the dev
configuration surface and blocked the OAuth2 signing-key inlining
change: the new config requires a per-dev private key that must
not be committed. Replace the checked-in file with a dev-config
Make target that shells out to probod-bootstrap with dev-safe
defaults and a stable RSA signing key stashed under
cfg/.dev-oauth2-signing-key.pem on first run.

The recipe sources cfg/dev.env when present so devs can override
any setting without editing the Makefile; cfg/dev.env.example
ships the full list of overridable knobs. cfg/dev.yaml,
cfg/dev.env, and the signing key are all gitignored.

Update README, CONTRIBUTING, and contrib/claude/config.md to
describe the new workflow.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-21 18:20:07 +02:00
Bryan Frimin
c4e81ed092 Inline OAuth2 signing key in config
The OAuth2/OIDC server accepted its signing key via a file path
(key-file), while every other PEM key in the probod config (SAML
private key, ACME account key) is embedded inline. Switch the
field to a private-key string so the convention is uniform.

The signing key is operator-supplied material that must outlive
any process restart, so the bootstrap builder now treats
OAUTH2_SERVER_SIGNING_KEY as required and refuses to start
without one; silently minting a fresh key per boot would break
token validation across rollouts. The OAUTH2_SERVER_* env vars
otherwise flow through builder.Build like the existing SAML
block so the new OAuth2Server section is populated end-to-end.

Rework the e2e harness to render its config via bootstrap at
test setup, which removes the static
e2e/console/testdata/config.yaml and the previously generated
test-only PEM file. A per-run RSA key is minted via
bootstrap.GenerateOAuth2SigningKey (kept public for test
tooling) and injected through the builder env map. CI now
passes ACME_ROOT_CA inline instead of mutating a YAML on disk.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-21 17:56:00 +02:00
Émile Ré
82748f870f Fix missing RowsAffected checks in cookie update methods
Address PR review comments: capture Exec result and check
RowsAffected() == 0 to return ErrResourceNotFound in
Cookie.Update, CookieCategory.Update, and CookieCategory.UpdateRank.
Also update coredata and relay contributor docs accordingly.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-21 15:24:54 +04:00
Émile Ré
8dfed9fff2 Fix move-cookie connection lookup with filters: []
ConnectionHandler.getConnection could not find the cookies
connection because orderBy was implicitly treated as a filter.
Add filters: [] to the @connection directive and document the
filters rule in contrib/claude/relay.md.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-21 14:18:33 +04:00
Émile Ré
8e420da5bc Fix cookie mutations to update Relay store
The create, delete, and move cookie mutations were not updating
the Relay store connections, so the UI only reflected changes
after a page reload. Add @connection and @appendEdge/@deleteEdge
directives, and a store updater for the move mutation.

Also document mutation store update rules in contrib/claude/relay.md.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-21 14:18:33 +04:00
Émile Ré
29c0d55e75 Create a db table for cookies for easiest management
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-21 14:18:32 +04:00
Émile Ré
d3333fd137 Remove unused destructured variable and document the convention
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-21 11:40:22 +04:00
Émile Ré
2147cded9f Add configuration propagation rules
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-21 11:38:52 +04:00
Émile Ré
6dc234bbe9 Fix review issues: clipboard error handling, merge conflicts, mutation error checks, and category ranking
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-20 17:47:07 +04:00
Émile Ré
de73199ff2 Rename useMutation destructured vars to match graphql tagged node
Replace generic names (commitMutation, commitCreate, isInFlight, etc.)
with names derived from the graphql tagged-template variable minus the
Mutation suffix. Add naming convention rule to contrib/claude/relay.md.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-20 17:47:06 +04:00
Émile Ré
619cdd0e6c Update contrib guides
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-20 17:47:04 +04:00
Bryan Frimin
472ca703b5 Mitiate SSRF attack
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-20 12:11:17 +02:00
Bryan Frimin
e84094e62c Add logging and encryption rules
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-19 11:59:22 +02:00
Bryan Frimin
5efe9e5b0f Update agent rules
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-19 11:49:55 +02:00
Bryan Frimin
29818714a8 Style
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-19 11:44:05 +02:00
Bryan Frimin
ab52dc0a34 Clean agent rules
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-19 11:42:50 +02:00
Bryan Frimin
53edc5ba26 Fix compose config
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-15 16:42:56 +02:00
Émile Ré
713623c7c0 Document enum parameter rule and fix call style
Add coredata guide section on using Go enum constants as named
SQL parameters instead of hardcoded string literals. Fix mixed
inline/multiline RenderJSON call in cookie banner handler.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-15 10:21:01 +04:00
Émile Ré
85061884e7 Update contrib/claude/coredata.md
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Signed-off-by: Émile Ré <nemile.re@gmail.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-15 10:21:00 +04:00
Émile Ré
01ca89de4a Rename migration
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-15 10:21:00 +04:00
Émile Ré
fe1b5dae4e Review fixes
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-15 09:24:48 +04:00
Émile Ré
31abc31454 Replace npm run relay with make relay everywhere
The make relay target merges split graphql files into a single
schema.graphql before running the Relay compiler. All CI workflows,
the generate target, and documentation now use make relay.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-15 09:19:41 +04:00
Émile Ré
00b233aa03 Fix Relay generating null query text for mutations
Relay v20 treats extend type in server schema as client extensions,
causing all mutation fields to have "text": null in generated artifacts.

Replace the cat-based schema concatenation with a merge script that
collects all extend type Mutation blocks and produces a single
type Mutation definition. The split graphql/ files remain the source
of truth for gqlgen; the merged schema.graphql is generated for Relay.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-15 09:19:41 +04:00
Émile Ré
31cca05ca4 Split GraphQL schemas into per-entity files
Split each API's monolithic schema.graphql into per-coredata-model
files under graphql/ subdirectories. gqlgen's follow-schema layout
with {name}.resolvers.go template generates one resolver file per
schema file. Relay uses schema + schemaExtensions to load the split
files.

Connect API: 8 files (base, session, organization, profile,
personal_api_key, saml, scim, audit_log)

Trust API: 5 files (base, trust_center, auth, nda, mailing_list)

Console API: 25 files covering all domain entities

Types extended across files (Organization, Mutation, Viewer,
TrustCenter, Identity) are defined in base.graphql as required by
Relay's schemaExtensions.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-15 09:19:38 +04:00
Émile Ré
74d7d3ff25 Upgrade Relay to v20.1.1 and unify compiler config
Consolidate the two per-app relay configs (console and trust)
into a single multi-project relay.config.json at the repo root
with three projects: core, iam, and trust. Bump all relay
packages from v19 to v20.1.1 and move relay-compiler to the
root devDependencies. Replace per-workspace relay scripts with
a single root-level npm run relay command and update the
GNUmakefile, CI workflows, and docs accordingly.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-14 16:04:11 +04:00
Émile Ré
61cd3244df Denormalize organization_id onto cookie entities
Add organization_id to cookie_banner_versions, cookie_categories,
and cookie_consent_records so AuthorizationAttributes can return
it directly without JOINing back to cookie_banners. Document the
pattern in contrib/claude/coredata.md.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-13 14:52:21 +04:00
Bryan Frimin
43336078f4 Migrate workers to kit/worker
Replace hand-rolled polling loops, semaphores, and WaitGroups
in all 7 background workers with go.gearno.de/kit/worker. Each
worker now implements Handler[T] (Claim/Process) and optionally
StaleRecoverer, gaining automatic Prometheus metrics and
OpenTelemetry tracing. Bumps kit from v0.3.0 to v0.5.0.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-13 12:25:42 +02:00
Émile Ré
722d4d2c45 Remove unused prop
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 12:17:16 +04:00
Émile Ré
ebd3a27c70 Update ui rules
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:58 +04:00
Émile Ré
7ea33ab68e Change naming rule
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:58 +04:00
Émile Ré
3df4e22da3 Fix page example
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:58 +04:00
Émile Ré
97afaed3ec Fix relay.md
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:58 +04:00
Émile Ré
6d537e8896 Add rules for app arborescence
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:58 +04:00
Émile Ré
be03883d80 Add rule for UI component props
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:57 +04:00
Émile Ré
d58d838f04 Add general react components rules
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:57 +04:00
Émile Ré
6e836d42f8 Add UI rules
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-07 11:38:57 +04:00
Émile Ré
a5d7630b9c Update release promp
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-03 18:18:10 +04:00
Émile Ré
ed826eb605 Add go style rules in contrib/claude
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-01 18:03:25 +04:00
Sacha Al Himdani
6e9cee9d34 Document migration rules for indexes and defaults
Clarify that indexes should not be added speculatively and
should only be introduced when justified by production query
latency. Also document that columns should avoid DEFAULT
clauses, with guidance on backfilling non-nullable columns.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-20 10:52:31 +01:00
Bryan Frimin
a69b6da377 Document fix categorization rule in release guide 2026-03-20 10:32:51 +01:00
Bryan Frimin
baf8cf0837 Support developer-specific env vars in sandbox provisioning
Source a gitignored .sandbox.env file (if present) before running
probod-bootstrap so each developer can inject their own secrets
(SSO, API keys, etc.) without committing them to the repo.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-19 22:04:08 +01:00
Bryan Frimin
fc2c3eab61 Isolate sandbox node_modules with VM-local bind mount
Avoid platform conflicts between macOS host and Linux VM by
bind-mounting a VM-local directory over /workspace/node_modules.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-19 22:04:06 +01:00
Bryan Frimin
2be7337344 Disable Lima automatic port forwarding for sandbox
Lima auto-forwards ports from the VM to localhost, which blocks local
development on the same ports (e.g. localhost:8080). Services are
already accessible via the VM IP shown by `sandbox.sh status`.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-18 20:03:36 +01:00
Bryan Frimin
f3aa0dea36 Fix sandbox provisioning failure due to missing LIMA_CIDATA_USER
The provision script relied on LIMA_CIDATA_USER being set in the
environment, but during cloud-init this variable is not exported — it
only exists in /mnt/lima-cidata/lima.env. The file cannot be sourced
directly because values like LIMA_CIDATA_COMMENT contain unquoted
spaces, so we extract LIMA_CIDATA_USER with sed instead.

Also ensure HOME is set for root's go install commands and explicitly
set PATH when running make as the Lima user via su, since profile.d
scripts may not be loaded during cloud-init provisioning.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-18 19:51:53 +01:00
Bryan Frimin
9fd3473147 Fix sandbox Docker root issue and replace make dev with systemd services
Fixes docker permissions by enabling Docker daemon during provisioning. Replaces make dev with three managed systemd services: probo-stack (auto-starting Docker Compose infra), probod (API server with gow for hot-reload), and probo-console (frontend dev server). The stack now starts automatically on VM boot; probod and console are started manually after build.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-18 19:51:53 +01:00
Bryan Frimin
7895dd32b0 Fix logging format string bugs and add missing contributor guides
Replace three instances of leftover %T format verbs in logger.ErrorCtx() calls with proper structured logging fields. Add alphabetically-sorted reference documentation for six new contrib/claude/ guides and reorder the existing list.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-18 15:09:31 +01:00
Bryan Frimin
312e30d9e4 Add sandbox-specific probod config generation
Add a make target for probod-bootstrap and integrate it into the sandbox provisioning workflow. During VM provisioning, generate /etc/probod/config.yml with the Lima VM IP as the cookie domain, secure=false for HTTP access, and correct CORS origins. Also generate .env files for console and trust apps pointing to the VM IP. Update sandbox documentation to explain the auto-generated configuration.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-18 15:06:37 +01:00
Sacha Al Himdani
6c9b338ad5 Deprecate useMutationWithToasts and promisifyMutation
Update relay agent rules to mark both helpers as deprecated.
Replace examples with the preferred pattern: useMutation with
onCompleted/onError callbacks and useToast.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-17 17:51:55 +01:00