@fjall/components-infrastructure 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { type GovernancePreset } from "@fjall/generator";
1
+ import { type GovernancePreset, type MachineTrustMode } from "@fjall/generator";
2
2
  import { type AccountTier } from "@fjall/util";
3
3
  import { Construct } from "constructs";
4
4
  export interface OidcConnectorProps {
@@ -32,6 +32,15 @@ export interface OidcConnectorProps {
32
32
  * ("account") or absent ⇒ generic-only scalar (unchanged, fail-safe).
33
33
  */
34
34
  accountTier?: AccountTier;
35
+ /**
36
+ * §4.4a Step-3 contract knob, forwarded verbatim to
37
+ * `buildNarrowedDeployTrustStatements`. Absent ⇒ `"expanded"` (the safe
38
+ * shared default). `"account-scoped"` renders the machine statement with the
39
+ * account-scoped literal ONLY and throws at synth unless `accountTier` is
40
+ * governance — opt in solely where per-account issuance is known-flipped
41
+ * (see `MachineTrustMode` in `@fjall/generator`).
42
+ */
43
+ machineTrustMode?: MachineTrustMode;
35
44
  }
36
45
  export declare class OidcConnector extends Construct {
37
46
  readonly deployRoleArn: string;
@@ -123,7 +123,12 @@ export class OidcConnector extends Construct {
123
123
  providerArn,
124
124
  issuerDomain,
125
125
  accountId,
126
- ...(props.accountTier !== undefined && { accountTier: props.accountTier })
126
+ ...(props.accountTier !== undefined && {
127
+ accountTier: props.accountTier
128
+ }),
129
+ ...(props.machineTrustMode !== undefined && {
130
+ machineTrustMode: props.machineTrustMode
131
+ })
127
132
  };
128
133
  const deployRole = new Role(this, "DeployRole", {
129
134
  roleName: `FjallDeploy${props.fjallOrgId}`,
@@ -12,7 +12,7 @@ import type { SecurityHubHubProps } from "../../config/aws/securityHubHub.js";
12
12
  import type { ConfigRecorderProps } from "../../config/aws/configRecorder.js";
13
13
  import type { ConfigRulePresetProps } from "../../config/aws/configRulePreset.js";
14
14
  import type { OrganisationType } from "./interfaces/organisation.js";
15
- import { type GovernancePreset } from "@fjall/generator";
15
+ import { type GovernancePreset, type MachineTrustMode } from "@fjall/generator";
16
16
  import { type AccountTier } from "@fjall/util";
17
17
  export interface AccountProps extends StackProps {
18
18
  accountId?: string;
@@ -34,6 +34,18 @@ export interface AccountProps extends StackProps {
34
34
  * `securityTier`.
35
35
  */
36
36
  alarmSubscriptions?: SharedAlarmTopicProps["subscriptions"];
37
+ /**
38
+ * §4.4a Step-3 contract knob, forwarded to this account's `OidcConnector`.
39
+ * Absent ⇒ `"expanded"` (the safe shared default — governance trust accepts
40
+ * both the generic and account-scoped machine subjects).
41
+ * `"account-scoped"` contracts the FjallDeploy machine trust to the
42
+ * account-scoped literal only; it throws at synth on a non-governance tier.
43
+ * Set it ONLY in a deployment whose per-account deploy-token issuance is
44
+ * known-flipped (Fjall's own governance accounts) — for any other org it
45
+ * would lock governance CI out at STS. Sourced from the generated
46
+ * `infrastructure.ts`, same as `securityTier`.
47
+ */
48
+ machineTrustMode?: MachineTrustMode;
37
49
  }
38
50
  export declare class Account extends Stack {
39
51
  readonly organisationType: OrganisationType;
@@ -84,6 +84,9 @@ export class Account extends Stack {
84
84
  accountTier: this.deployRoleAccountTier(),
85
85
  ...(props.securityTier !== undefined && {
86
86
  securityTier: props.securityTier
87
+ }),
88
+ ...(props.machineTrustMode !== undefined && {
89
+ machineTrustMode: props.machineTrustMode
87
90
  })
88
91
  });
89
92
  }
@@ -11,7 +11,7 @@ export declare const CLICKHOUSE_DATABASE_NAME = "analytics";
11
11
  * columnar scans than Graviton2.
12
12
  *
13
13
  * Settings are tuned for 1 vCPU sustained (max_threads=1 across all profiles,
14
- * max_concurrent_queries=4) — see clickhouseUserData.ts. Bumping to a larger
14
+ * max_concurrent_queries=8) — see clickhouseUserData.ts. Bumping to a larger
15
15
  * instance MUST be paired with raising those thread/concurrency caps.
16
16
  *
17
17
  * Next size up: `m7g.large` (2 vCPU, 8 GiB) for sustained workloads, or
@@ -11,7 +11,7 @@ export const CLICKHOUSE_DATABASE_NAME = "analytics";
11
11
  * columnar scans than Graviton2.
12
12
  *
13
13
  * Settings are tuned for 1 vCPU sustained (max_threads=1 across all profiles,
14
- * max_concurrent_queries=4) — see clickhouseUserData.ts. Bumping to a larger
14
+ * max_concurrent_queries=8) — see clickhouseUserData.ts. Bumping to a larger
15
15
  * instance MUST be paired with raising those thread/concurrency caps.
16
16
  *
17
17
  * Next size up: `m7g.large` (2 vCPU, 8 GiB) for sustained workloads, or
@@ -90,7 +90,14 @@ export const PROFILE_NAME_PATTERN = NAME_PATTERN;
90
90
  * from the pre-Phase-4b inline `<app_writer>` / `<audit_writer>` /
91
91
  * `<backup_reader>` / `<schema_admin>` blocks at
92
92
  * `clickhouseUserData.ts:296-382` — zero behavioural drift from the
93
- * pre-4b prod resource caps.
93
+ * pre-4b prod resource caps, EXCEPT high_throughput_ingest's
94
+ * `maxConcurrentQueriesForUser`, deliberately raised 2→6 (2026-07-28):
95
+ * the webapp overview fires 6–10 queries per page load and the cap of 2
96
+ * threw TOO_MANY_SIMULTANEOUS_QUERIES instead of queueing (CH does not
97
+ * queue past this cap — `queue_max_wait_ms` empirically does not apply).
98
+ * Consumers pair it with a client-side FIFO gate
99
+ * (`webapp/app/.server/lib/clickhouse/appQuerySlots.ts`) whose limit
100
+ * MUST mirror this value — a users.xml parity test enforces the pair.
94
101
  *
95
102
  * Frozen via `Object.freeze` on the outer record AND each sub-object so
96
103
  * a consumer cannot mutate the defaults in place. Pass your own
@@ -101,7 +108,7 @@ const _ClickHouseDefaultProfilesRaw = {
101
108
  high_throughput_ingest: {
102
109
  maxThreads: 1,
103
110
  maxInsertThreads: 1,
104
- maxConcurrentQueriesForUser: 2,
111
+ maxConcurrentQueriesForUser: 6,
105
112
  logQueriesMinQueryDurationMs: 100,
106
113
  optimizeMoveToPrewhere: true,
107
114
  useQueryConditionCache: true,
@@ -119,13 +119,16 @@ export function generateServerConfigXml(options) {
119
119
  <!-- Filesystem page cache handles uncompressed-block warmth on the
120
120
  host side; an in-CH uncompressed cache would just duplicate it. -->
121
121
  <uncompressed_cache_size>0</uncompressed_cache_size>
122
- <!-- Sized for m7g.medium (1 vCPU sustained). 4 concurrent queries is the
123
- sweet spot: enough headroom for the OPTIMIZE FINAL sidecar + a single
124
- dashboard read + one async insert + one ad-hoc, but low enough that
125
- context switching does not dominate at the kernel scheduler level.
126
- Bump in lockstep with instance size if DEFAULT_CLICKHOUSE_INSTANCE_TYPE
127
- moves to a >=2 vCPU host. -->
128
- <max_concurrent_queries>4</max_concurrent_queries>
122
+ <!-- Server-wide cap across ALL users. Raised 4→8 (2026-07-28) alongside
123
+ high_throughput_ingest's per-user cap (2→6): the webapp overview
124
+ fires 6-10 queries per page load and N app tasks share this cap, so
125
+ 4 starved dashboard reads with TOO_MANY_SIMULTANEOUS_QUERIES (CH
126
+ rejects rather than queues past the cap). On the 1 vCPU m7g.medium
127
+ the extra slots time-slice rather than parallelise — acceptable for
128
+ short cache-hot dashboard reads; max_threads=1 per query keeps the
129
+ scheduler sane. Bump further in lockstep with instance size if
130
+ DEFAULT_CLICKHOUSE_INSTANCE_TYPE moves to a >=2 vCPU host. -->
131
+ <max_concurrent_queries>8</max_concurrent_queries>
129
132
  <background_pool_size>2</background_pool_size>
130
133
  <background_schedule_pool_size>2</background_schedule_pool_size>
131
134
  <background_merges_mutations_concurrency_ratio>2</background_merges_mutations_concurrency_ratio>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/components-infrastructure",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "bin": {
@@ -67,8 +67,8 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@aws-sdk/client-organizations": "^3.1038.0",
70
- "@fjall/generator": "^4.3.0",
71
- "@fjall/util": "^4.3.0",
70
+ "@fjall/generator": "^4.4.0",
71
+ "@fjall/util": "^4.4.0",
72
72
  "constructs": "^10.6.0"
73
73
  },
74
74
  "overrides": {
@@ -82,5 +82,5 @@
82
82
  "engines": {
83
83
  "node": ">=18.0.0"
84
84
  },
85
- "gitHead": "8a3ae096f9d15c47dc8c277c9bddfa40e4168c19"
85
+ "gitHead": "c700128600ab453fa63ce28b3effe8965373be43"
86
86
  }