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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 0 additions & 128 deletions services/actions/src/rpc/__tests__/enrichmentEntitlement.test.js

This file was deleted.

40 changes: 5 additions & 35 deletions services/actions/src/rpc/reconcileDefaultModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import {
captureDriftSnapshot,
diffDriftSnapshots,
} from "../utils/defaultModels/drift.js";
import {
ENRICHMENT_TEMPLATE_NAMES,
reconcileEnrichmentEntitlement,
templatesForEntitlement,
} from "../utils/defaultModels/enrichmentEntitlement.js";

const TEAM_CONCURRENCY = 4;

Expand All @@ -49,7 +44,6 @@ export default async (session, input, headers, deps = {}) => {
listTeams = listAllTeams,
reconcileOneTeam = reconcileOneTeamImpl,
captureDrift = captureDriftSnapshot,
reconcileEntitlement = reconcileEnrichmentEntitlement,
isAdmin,
} = deps;

Expand Down Expand Up @@ -159,25 +153,11 @@ export default async (session, input, headers, deps = {}) => {
for (;;) {
const team = queue.shift();
if (!team) return;
let entitlement;
try {
entitlement = await reconcileEntitlement(team, config, { dryRun });
} catch (err) {
await record({
team_id: team.id,
result: "failed",
reason: `enrichment_entitlement: ${err?.message || String(err)}`,
});
continue;
}
const effectiveTeam = entitlement.team;
const unchanged =
changedPartitions !== null &&
!changedPartitions.has(effectiveTeam.settings?.partition);
!changedPartitions.has(team.settings?.partition);
// unchanged team on a schedule tick: skip before any per-team probe
// unless an entitlement revocation still needs to remove managed
// artifacts. A revoke-only pass sends no ordinary templates.
if (unchanged && !entitlement.enrichmentRevokeRequired) {
if (unchanged) {
await record({
team_id: team.id,
result: "skipped_no_change",
Expand All @@ -187,20 +167,10 @@ export default async (session, input, headers, deps = {}) => {
}
try {
const teamOutcomes = await reconcileOneTeam(
effectiveTeam,
unchanged
? []
: templatesForEntitlement(
templates,
entitlement.enrichmentEnabled
),
team,
templates,
config,
{
dryRun,
revokeTemplates: entitlement.enrichmentRevokeRequired
? ENRICHMENT_TEMPLATE_NAMES
: [],
}
{ dryRun }
);
for (const outcome of teamOutcomes) {
const row = { team_id: team.id, ...outcome };
Expand Down
18 changes: 1 addition & 17 deletions services/actions/src/rpc/reconcileTeamDefaultModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import {
getTeam as getTeamImpl,
reconcileOneTeam as reconcileOneTeamImpl,
} from "../utils/defaultModels/shared.js";
import {
ENRICHMENT_TEMPLATE_NAMES,
reconcileEnrichmentEntitlement,
templatesForEntitlement,
} from "../utils/defaultModels/enrichmentEntitlement.js";

export default async (session, input, headers, deps = {}) => {
const {
Expand All @@ -26,7 +21,6 @@ export default async (session, input, headers, deps = {}) => {
fetchTemplates = fetchPublishedTemplates,
getTeam = getTeamImpl,
reconcileOneTeam = reconcileOneTeamImpl,
reconcileEntitlement = reconcileEnrichmentEntitlement,
isAdmin,
} = deps;

Expand Down Expand Up @@ -74,17 +68,7 @@ export default async (session, input, headers, deps = {}) => {

let outcomes;
try {
const entitlement = await reconcileEntitlement(team, config);
outcomes = await reconcileOneTeam(
entitlement.team,
templatesForEntitlement(templates, entitlement.enrichmentEnabled),
config,
{
revokeTemplates: entitlement.enrichmentRevokeRequired
? ENRICHMENT_TEMPLATE_NAMES
: [],
}
);
outcomes = await reconcileOneTeam(team, templates, config);
} catch (err) {
outcomes = [
{
Expand Down
11 changes: 0 additions & 11 deletions services/actions/src/utils/defaultModels/__tests__/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ test("applies defaults for the optional keys", () => {
assert.deepEqual(config.canaryTeamIds, []);
// empty drift probes = treat all teams as changed
assert.deepEqual(config.driftProbes, []);
assert.equal(config.enrichmentEntitlementUrl, null);
assert.equal(config.enrichmentServiceKey, null);
assert.equal(config.enrichmentSigningKey, null);
assert.equal(config.enrichmentTimeoutMs, 5000);
});

test("parses optional keys into typed values", () => {
Expand All @@ -64,12 +60,6 @@ test("parses optional keys into typed values", () => {
DEFAULT_MODELS_COHORTS: "6",
DEFAULT_MODELS_DRIFT_PROBES:
'[{"table":"cst.semantic_events","timeColumn":"timestamp"}]',
CXS2_ENRICHMENT_ENTITLEMENT_URL:
"http://cxs2.cxs2.svc/api/internal/semantic-layer/enrichment-entitlements",
INTERNAL_SERVICE_API_KEY: "service-key",
ENRICHMENT_ENTITLEMENT_SIGNING_KEY:
"test-only-entitlement-key-with-at-least-32-bytes",
ENRICHMENT_ENTITLEMENT_TIMEOUT_MS: "1234",
});

assert.deepEqual(config.canaryTeamIds, [UUID_A, UUID_B]);
Expand All @@ -78,7 +68,6 @@ test("parses optional keys into typed values", () => {
assert.deepEqual(config.driftProbes, [
{ table: "cst.semantic_events", timeColumn: "timestamp" },
]);
assert.equal(config.enrichmentTimeoutMs, 1234);
});

test("rejects malformed DEFAULT_MODELS_DRIFT_PROBES", () => {
Expand Down
12 changes: 0 additions & 12 deletions services/actions/src/utils/defaultModels/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ export const loadDefaultModelsConfig = (env = process.env) => {
.map((id) => id.trim())
.filter(Boolean);

const enrichmentTimeoutMs = env.ENRICHMENT_ENTITLEMENT_TIMEOUT_MS
? Number(env.ENRICHMENT_ENTITLEMENT_TIMEOUT_MS)
: 5_000;
if (!Number.isInteger(enrichmentTimeoutMs) || enrichmentTimeoutMs <= 0) {
fail("ENRICHMENT_ENTITLEMENT_TIMEOUT_MS must be a positive integer");
}

return {
templateDatasourceId,
systemUserId,
Expand All @@ -99,11 +92,6 @@ export const loadDefaultModelsConfig = (env = process.env) => {
cohorts,
driftProbes: parseDriftProbes(env.DEFAULT_MODELS_DRIFT_PROBES),
cronSecret: env.ACTIONS_CRON_SECRET || null,
enrichmentEntitlementUrl:
env.CXS2_ENRICHMENT_ENTITLEMENT_URL?.trim() || null,
enrichmentServiceKey: env.INTERNAL_SERVICE_API_KEY || null,
enrichmentSigningKey: env.ENRICHMENT_ENTITLEMENT_SIGNING_KEY || null,
enrichmentTimeoutMs,
};
};

Expand Down
Loading
Loading