Skip to content

breaking: split history schemas out of main schema pkg#1729

Merged
golanglemonade merged 6 commits intomainfrom
breaking-move-history
Dec 18, 2025
Merged

breaking: split history schemas out of main schema pkg#1729
golanglemonade merged 6 commits intomainfrom
breaking-move-history

Conversation

@golanglemonade
Copy link
Member

@golanglemonade golanglemonade commented Dec 16, 2025

Breaking Change - Part 1

  • Restructures the history schemas to be moved to it's own package, allowing for simplier client + dramatically decreases the size of the main generated package
  • moves accessmap to it's own authzgenerated package. The other authz generated files cannot be moved due to the pointer receiver variable being from generated
  • entc now only runs the history generate once, instead of two times, and it happens after the main schema generation, reducing the overall time (and memory + cpu consumption)
  • history resolvers are now under a seperate endpoint http://localhost:17608/history/query
  • changes requirements to view history data to just view access of the object

When looking at the PR you should see mostly removals from internal/ent/generated/* files for history schemas; and net-new files in internal/ent/historygenerated/

There is a new common package in internal/graphapi/common/ that contains the common functions used by both the main resolvers and history resolvers.

Note:

  • This currently means we get two migration files for every schema change; one for history and one for the main schemas. Theres not an easy way to merge this without using atlas pro features and might be useful if we wanted history to be stored in a different db?

Other changes:

  • Removes the query simple for released client generation, this will be updated and ensure its up-to-date in https://github.com/theopenlane/go-client next
  • removes go-generate-fast and just uses the checksum generation for consistency
  • removes all history functions from the cli; this is inline with feat: cli refactor  #1563 which will be done as a follow-up as well
  • Auditing and history_query is currently disabled; this requires some rework due to needing to be the historygenerated package but the templates need to be in generated because they are hooks. Neither of these are currently in use so should not affect production while this is reworked.

Follow-ups:

  • Move cli to the client repo
  • remove extra uneeded packages
  • other changes for origianl draft PR; move packages that are used by core and other repos that depend on core to it's own shared package to prevent cyclical deps
  • rework auditing + history_query templates

Still some more imporvements we can do but better than before:

actiongraph -f actiongraph-new11.json top                                                          
 35.439s  10.22%  link	github.com/theopenlane/core
 24.546s  17.30%  build	github.com/theopenlane/core/internal/ent/generated
 20.843s  23.31%  build	github.com/theopenlane/core/internal/graphapi/generated
 12.125s  26.81%  build	github.com/theopenlane/core/internal/ent/historygenerated
  7.782s  29.06%  build	github.com/theopenlane/core/internal/graphapi/historygenerated
  6.277s  30.87%  build	github.com/cloudflare/cloudflare-go/v6/radar
  6.245s  32.67%  build	github.com/stripe/stripe-go/v84
  5.843s  34.35%  build	github.com/redis/go-redis/v9
  4.826s  35.75%  build	github.com/cloudflare/cloudflare-go/v6/zero_trust
  3.525s  36.76%  build	github.com/go-redis/redis/v8
  2.992s  37.63%  build	github.com/jackc/pgx/v5/pgtype
  2.870s  38.45%  build	github.com/theopenlane/core/pkg/openlaneclient
  2.638s  39.21%  build	github.com/cloudflare/cloudflare-go/v6/magic_cloud_networking
  2.388s  39.90%  build	github.com/AfterShip/email-verifier
  2.376s  40.59%  build	net/http
  2.312s  41.26%  build	github.com/cloudflare/cloudflare-go/v6/workers
  2.098s  41.86%  build	github.com/google/go-github/v79/github
  2.066s  42.46%  build	github.com/cloudflare/cloudflare-go/v6
  2.028s  43.04%  build	github.com/theopenlane/core/pkg/corejobs/internal/cloudflare
  2.027s  43.63%  build	github.com/openfga/api/proto/openfga/v1

before:

actiongraph -f actiongraph-og.json top   
240.839s  26.31%  link	github.com/theopenlane/core
236.278s  52.12%  build	github.com/theopenlane/core/internal/ent/generated
141.957s  67.63%  build	github.com/theopenlane/core/internal/graphapi/generated
6.637s  68.36%  build	github.com/windmill-labs/windmill-go-client/api
6.596s  69.08%  build	github.com/theopenlane/core/pkg/openlaneclient
6.160s  69.75%  build	github.com/stripe/stripe-go/v84
6.116s  70.42%  build	github.com/cloudflare/cloudflare-go/v6/radar
6.075s  71.08%  build	github.com/redis/go-redis/v9
4.726s  71.60%  build	github.com/cloudflare/cloudflare-go/v6/zero_trust
4.609s  72.10%  build	github.com/theopenlane/core/internal/httpserve/handlers
4.167s  72.56%  build	github.com/theopenlane/core/internal/ent/hooks
3.905s  72.98%  build	github.com/theopenlane/core/internal/graphapi
3.208s  73.34%  build	github.com/theopenlane/core/internal/httpserve/route
3.164s  73.68%  build	github.com/theopenlane/core/internal/ent/generated/intercept
3.134s  74.02%  build	github.com/go-redis/redis/v8
2.955s  74.35%  build	github.com/AfterShip/email-verifier
2.854s  74.66%  build	github.com/jackc/pgx/v5/pgtype
2.775s  74.96%  build	github.com/cloudflare/cloudflare-go/v6/magic_cloud_networking
2.697s  75.26%  build	github.com/theopenlane/core/internal/httpserve/config
2.665s  75.55%  build	github.com/theopenlane/core/internal/ent/generated/runtime

@golanglemonade golanglemonade changed the title Breaking move history breaking: split history schemas out of main schema pkg Dec 17, 2025
@github-actions github-actions bot added the ci label Dec 17, 2025
@golanglemonade golanglemonade force-pushed the breaking-move-history branch 2 times, most recently from eeee6bd to f8a166c Compare December 17, 2025 07:11
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@golanglemonade golanglemonade marked this pull request as ready for review December 17, 2025 08:44
@golanglemonade golanglemonade requested a review from a team as a code owner December 17, 2025 08:44
@golanglemonade golanglemonade marked this pull request as draft December 17, 2025 08:46
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@golanglemonade golanglemonade marked this pull request as ready for review December 17, 2025 23:58
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@theopenlane-bender
Copy link

🔧 Configuration Changes Detected

This PR contains changes that will affect the Helm chart configuration. A draft infrastructure PR has been automatically created to preview these changes:

📋 Draft PR: https://github.com/theopenlane/openlane-infra/pull/540

Changes Preview:

✅ Updated ConfigMap template

- 🔄 Merged Helm values.yaml
- 🔐 External secrets configuration updated
- ✅ Updated ConfigMap template

The infrastructure PR will automatically convert from draft to ready for review once this core PR is merged.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.1% Coverage on New Code (required ≥ 20%)

See analysis details on SonarQube Cloud

@golanglemonade golanglemonade merged commit c3ee469 into main Dec 18, 2025
20 of 21 checks passed
@golanglemonade golanglemonade deleted the breaking-move-history branch December 18, 2025 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants