Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

simplify comments

Thiago Araujo da Silva52b6ace4fa00
diff --git a/backend/e2e-test/event-outbox.spec.ts b/backend/e2e-test/event-outbox.spec.ts
index 96cef06161..a928d4132d 100644
--- a/backend/e2e-test/event-outbox.spec.ts
+++ b/backend/e2e-test/event-outbox.spec.ts
@@ -55,7 +55,7 @@ describe("event outbox (postgres)", () => {
expect(await rowsFor(`${CONSUMER}-other`)).toHaveLength(1);
});
- // A pod on the previous release inserts without an eventId during a rolling deploy.
+ // Old pods still insert without an eventId during a rolling deploy.
test("claimBatch gives a row written without an eventId one of its own", async () => {
const { eventId, ...withoutEventId } = makeRow();
await testDb(TableName.EventOutbox).insert([
@@ -72,7 +72,7 @@ describe("event outbox (postgres)", () => {
rows.forEach((row) => expect(row.eventId).toMatch(/^[0-9a-f-]{36}$/));
});
- // A bulk write emits one row per secret, past the 1000-row chunk insertEvents splits on.
+ // A bulk secret write can go past the 1000-row chunk insertEvents splits on.
test("insertEvents writes a batch larger than one chunk in the caller's transaction", async () => {
await insert(Array.from({ length: 1001 }, () => makeRow()));
diff --git a/backend/e2e-test/fakes/event-outbox-registry.ts b/backend/e2e-test/fakes/event-outbox-registry.ts
index 79e1fdc2be..bfb1662499 100644
--- a/backend/e2e-test/fakes/event-outbox-registry.ts
+++ b/backend/e2e-test/fakes/event-outbox-registry.ts
@@ -4,22 +4,20 @@ import { FolderModifiedEventV1 } from "@app/services/secret-folder/secret-folder
import { SecretImportModifiedEventV1 } from "@app/services/secret-import/secret-import-events";
import { SecretModifiedEventV1 } from "@app/services/secret-v2-bridge/secret-events";
-// Reached through a path the alias does not match, so these resolve to the real modules.
+// Relative on purpose: the vitest alias would point back at this file.
import * as RealEventOutboxRegistry from "../../src/services/event-outbox/event-outbox-registry";
import { EventResultStatus, IEventConsumer } from "../../src/services/event-outbox/event-outbox-types";
-// Nothing in src/ subscribes to the secret events yet, and emit writes no row for an event nobody
-// subscribes to, so without a consumer a spec could not see what a write emitted. This one records
-// every secret event and accepts it, so the row stays in event_outbox for a spec to read. Wired up by
-// test.alias in vitest.e2e.config.mts; nothing under src/ references this file.
+// Nothing in src/ subscribes to the secret events yet, and emit skips events nobody subscribes to, so
+// specs would never see them. This consumer accepts every secret event so the row stays in event_outbox
+// for specs to read. Wired in through test.alias in vitest.e2e.config.mts.
export const SECRET_EVENTS_RECORDER = "e2e-secret-events";
const RECORDED_EVENTS = [SecretModifiedEventV1, FolderModifiedEventV1, SecretImportModifiedEventV1] as const;
const secretEventsRecorder: IEventConsumer = {
name: SECRET_EVENTS_RECORDER,
- // The definitions' own schemas, so an emit site that builds a bad payload is dropped here exactly as
- // it would be for a real consumer, and the spec waiting for its row fails.
+ // The real schemas, so a bad payload fails the spec the same way it would fail a real consumer.
dataSchema: z.union([RECORDED_EVENTS[0].data, RECORDED_EVENTS[1].data, RECORDED_EVENTS[2].data]),
subscribesTo: (eventType) => RECORDED_EVENTS.some((definition) => definition.type === eventType),
handle: async (events) => events.map((event) => ({ id: event.id, status: EventResultStatus.Delivered }))
diff --git a/backend/e2e-test/routes/v4/secret-events.spec.ts b/backend/e2e-test/routes/v4/secret-events.spec.ts
index f9229f28ba..546e0f86b3 100644
--- a/backend/e2e-test/routes/v4/secret-events.spec.ts
+++ b/backend/e2e-test/routes/v4/secret-events.spec.ts
@@ -17,8 +17,8 @@ type TRecordedEvent = {
>;
};
-// No API shows outbox rows, so the events a write emitted are read from the table. The recorder
-// consumer (e2e-test/fakes/event-outbox-registry.ts) is what makes emit write them at all.
+// No API exposes outbox rows, so read them straight from the table. The recorder consumer in
+// fakes/event-outbox-registry.ts is what makes emit write them at all.
const recordedEvents = async (projectId: string, eventType?: string): Promise<TRecordedEvent[]> => {
const query = testDb(TableName.EventOutbox)
.where({ consumer: SECRET_EVENTS_RECORDER })
diff --git a/backend/e2e-test/secret-folder-dal.spec.ts b/backend/e2e-test/secret-folder-dal.spec.ts
index 00c8879286..d17ff1a0b6 100644
--- a/backend/e2e-test/secret-folder-dal.spec.ts
+++ b/backend/e2e-test/secret-folder-dal.spec.ts
@@ -11,8 +11,7 @@ declare const testDb: Knex;
const folderDAL = secretFolderDALFactory(testDb as never);
describe("secret folder dal (postgres)", () => {
- // No API puts an environment into its deletion grace period and still reads its folders, so the
- // environment is soft-deleted directly.
+ // No API can put an environment into its grace period and still read its folders, so soft-delete it directly.
test("findSecretPathByFolderIds hides an environment pending deletion unless asked to include it", async () => {
const { projectId, authToken, cleanup } = await createIsolatedOrgAndProject("folder-dal");
try {
diff --git a/backend/src/db/migrations/20261019120000_event-outbox-event-id.ts b/backend/src/db/migrations/20261019120000_event-outbox-event-id.ts
index fbaa19ebdc..0d80a6a261 100644
--- a/backend/src/db/migrations/20261019120000_event-outbox-event-id.ts
+++ b/backend/src/db/migrations/20261019120000_event-outbox-event-id.ts
@@ -4,11 +4,10 @@ import { TableName } from "../schemas";
const EVENT_ID_INDEX = `${TableName.EventOutbox}_event_id_idx`;
-// The CloudEvents `id`, shared by every consumer's row for one event. It replaces `idempotencyKey`. Both
-// stay for one release, because a pod still on the previous release inserts into `idempotencyKey` and names its
-// unique index in ON CONFLICT during a rolling deploy; dropping either would fail that insert along with
-// the write it belongs to. For the same reason `eventId` is nullable with no default: `claimBatch` gives
-// those rows one.
+// The CloudEvents id, shared by every consumer's row for one event. It replaces `idempotencyKey`, but both
+// stay for one release: during a rolling deploy old pods still insert into `idempotencyKey` and name its
+// index in ON CONFLICT, so dropping either would fail those inserts along with the writes they belong to.
+// Same reason `eventId` is nullable with no default; `claimBatch` fills it in.
export async function up(knex: Knex): Promise<void> {
if (!(await knex.schema.hasColumn(TableName.EventOutbox, "eventId"))) {
await knex.schema.alterTable(TableName.EventOutbox, (t) => {
diff --git a/backend/src/ee/services/honey-token/honey-token-service.ts b/backend/src/ee/services/honey-token/honey-token-service.ts
index 161ddf2ffd..f5a0162b6f 100644
--- a/backend/src/ee/services/honey-token/honey-token-service.ts
+++ b/backend/src/ee/services/honey-token/honey-token-service.ts
@@ -443,8 +443,8 @@ export const honeyTokenServiceFactory = ({
}
const { projectId } = honeyToken;
- // From the primary and including an environment pending deletion: update and revoke must still work
- // during the grace period, and the permission check needs the token's real environment and path.
+ // Includes environments pending deletion so update and revoke keep working during the grace period,
+ // and the permission check gets the real environment and path.
const [folderWithEnv] = await folderDAL.findSecretPathByFolderIds(projectId, [honeyToken.folderId], undefined, {
readFromPrimary: true,
includePendingDeletion: true
@@ -647,8 +647,8 @@ export const honeyTokenServiceFactory = ({
}
const { projectId } = honeyToken;
- // From the primary and including an environment pending deletion: update and revoke must still work
- // during the grace period, and the permission check needs the token's real environment and path.
+ // Includes environments pending deletion so update and revoke keep working during the grace period,
+ // and the permission check gets the real environment and path.
const [folderWithEnv] = await folderDAL.findSecretPathByFolderIds(projectId, [honeyToken.folderId], undefined, {
readFromPrimary: true,
includePendingDeletion: true
diff --git a/backend/src/ee/services/secret-replication/secret-replication-service.ts b/backend/src/ee/services/secret-replication/secret-replication-service.ts
index 1fb1ddc15c..907a55aba9 100644
--- a/backend/src/ee/services/secret-replication/secret-replication-service.ts
+++ b/backend/src/ee/services/secret-replication/secret-replication-service.ts
@@ -381,8 +381,7 @@ export const secretReplicationServiceFactory = ({
isReserved: true
});
if (!destinationReplicationFolder) {
- // One transaction, so a folder never exists without its event: a retry finds the folder and
- // would not emit again.
+ // Same transaction, otherwise a retry finds the folder already there and never emits.
destinationReplicationFolder = await folderDAL.transaction(async (tx) => {
const createdFolder = await folderDAL.create(
{
diff --git a/backend/src/services/event-outbox/event-definition.ts b/backend/src/services/event-outbox/event-definition.ts
index 3d26af8acd..5f63b07e7b 100644
--- a/backend/src/services/event-outbox/event-definition.ts
+++ b/backend/src/services/event-outbox/event-definition.ts
@@ -6,22 +6,19 @@ import { z } from "zod";
import { TEventEmitter, TEventInput } from "./event-outbox-types";
-// The naming and envelope rules from the Event Standards and Versioning ADR, which adopts CloudEvents
-// 1.0: an event is named com.infisical.<domain>.<entity>.<action>.v<version>, every segment
-// lower-kebab, the entity singular and the action past tense. The version moves only on a breaking
-// change to `data`, so adding an optional field is not a new version.
+// Naming rules from the Event Standards and Versioning ADR (CloudEvents 1.0):
+// com.infisical.<domain>.<entity>.<action>.v<version>, every segment lower-kebab, entity singular, action
+// past tense. Bump the version only on a breaking change to `data`; a new optional field is not one.
const SEGMENT_PATTERN = new RE2("^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$");
-// The ADR groups every state change to an entity into one `modified` event, so its data says which kind
-// of change it was.
+// Create, update and delete share one `modified` event, so the data says which one it was.
export enum EventModificationType {
Created = "created",
Updated = "updated",
Deleted = "deleted"
}
-// Throws at module load, so a name that breaks the convention fails the process on boot rather than
-// reaching a request.
+// Throws at module load so a bad name fails on boot, not on a request.
export const defineEvent = <TData extends z.AnyZodObject>({
domain,
entity,
@@ -58,8 +55,8 @@ export const defineEvent = <TData extends z.AnyZodObject>({
export type TEventDefinition<TData extends z.AnyZodObject> = ReturnType<typeof defineEvent<TData>>;
-// `urn:infisical:<domain>`. Events named before the ADR (eg `identity.authentication.auth-method-changed`)
-// have no domain segment, so their first segment stands in for it.
+// Pre-ADR names like `identity.authentication.auth-method-changed` have no domain segment, so the first
+// segment stands in.
export const eventSource = (type: string): string => {
const segments = type.split(".");
const domain = type.startsWith("com.infisical.") ? segments[2] : segments[0];
diff --git a/backend/src/services/event-outbox/event-outbox-dal.ts b/backend/src/services/event-outbox/event-outbox-dal.ts
index f3c49c09d5..a096d6055d 100644
--- a/backend/src/services/event-outbox/event-outbox-dal.ts
+++ b/backend/src/services/event-outbox/event-outbox-dal.ts
@@ -27,8 +27,8 @@ export type TOutboxInsertRow = {
occurredAt: Date;
};
-// Postgres caps a statement at 65535 bind parameters, and a row takes five, so a bulk secret write
-// emitting one event per secret would otherwise fail the whole write past ~13k secrets.
+// Postgres caps a statement at 65535 bind parameters and a row takes five, so a bulk write of ~13k+
+// secrets would otherwise fail.
const INSERT_BATCH_SIZE = 1000;
export const eventOutboxDALFactory = (db: TDbClient) => {
@@ -70,9 +70,9 @@ export const eventOutboxDALFactory = (db: TDbClient) => {
};
// One statement on purpose so the row locks only live as long as the UPDATE. The fresh lockToken is
- // how extendClaims and commitResults tell this claim apart from a later one on the same rows. A pod on
- // the previous release writes rows without an eventId during a rolling deploy, so the claim gives
- // them one; consumers rely on every event having an id.
+ // how extendClaims and commitResults tell this claim apart from a later one on the same rows. Old pods
+ // write rows without an eventId during a rolling deploy, so the claim fills it in; consumers rely on
+ // every event having one.
const claimBatch = async (key: TOutboxFlushKey, limit: number): Promise<TOutboxClaim> => {
const lockToken = crypto.randomUUID();
try {
diff --git a/backend/src/services/event-outbox/event-outbox-service.test.ts b/backend/src/services/event-outbox/event-outbox-service.test.ts
index 6bfed7c8f1..a5707cffa4 100644
--- a/backend/src/services/event-outbox/event-outbox-service.test.ts
+++ b/backend/src/services/event-outbox/event-outbox-service.test.ts
@@ -118,8 +118,8 @@ describe("event outbox emit", () => {
expect(inserted[0].tx).toBe(TX);
});
- // Committing the business write without its event would break the guarantee that consumers hear
- // about every change, so a bad event fails the caller's transaction.
+ // A bad event fails the caller's transaction: a write that commits without its event is a change
+ // consumers never hear about.
describe("rejects a malformed event, failing the write it belongs to", () => {
beforeEach(() => {
rejectedMetrics.length = 0;
diff --git a/backend/src/services/event-outbox/event-outbox-service.ts b/backend/src/services/event-outbox/event-outbox-service.ts
index c3090ac7f4..2de604482e 100644
--- a/backend/src/services/event-outbox/event-outbox-service.ts
+++ b/backend/src/services/event-outbox/event-outbox-service.ts
@@ -112,9 +112,9 @@ export type TEventOutboxServiceFactoryDep = {
export type TEventOutboxServiceFactory = ReturnType<typeof eventOutboxServiceFactory>;
export const eventOutboxServiceFactory = ({ eventOutboxDAL, eventOutboxRegistry }: TEventOutboxServiceFactoryDep) => {
- // A malformed event is a bug at the emit site. Throwing fails the caller's transaction, and the
- // business write with it, because committing the write without its event would break the guarantee
- // that consumers hear about every change. Every check runs before any DB access.
+ // A malformed event is a bug at the emit site. Throwing fails the caller's transaction on purpose: a
+ // write that commits without its event is a change consumers never hear about. All checks run before
+ // any DB access.
const $reject = (type: string, reason: EventOutboxRejectReason, detail: string, consumer?: string): never => {
logger.error(
`event-outbox: rejected event [type=${type}] [reason=${reason}]${consumer ? ` [consumer=${consumer}]` : ""}: ${detail}`
@@ -165,9 +165,8 @@ export const eventOutboxServiceFactory = ({ eventOutboxDAL, eventOutboxRegistry
});
};
- // Pass the caller's `tx` so the rows commit with the business write; omit it only when there is no
- // business write to be atomic with. A failed insert is not caught: swallowing it would leave the
- // caller with a poisoned transaction.
+ // Pass the caller's `tx` so the rows commit with the business write. A failed insert is not caught:
+ // swallowing it would hand the caller a poisoned transaction.
const emit = async (events: TEventInput[], tx?: Knex): Promise<void> => {
const rows = events.flatMap($buildRows);
if (rows.length === 0) return;
diff --git a/backend/src/services/event-outbox/event-outbox-types.ts b/backend/src/services/event-outbox/event-outbox-types.ts
index 877c64e2d6..e3a3902305 100644
--- a/backend/src/services/event-outbox/event-outbox-types.ts
+++ b/backend/src/services/event-outbox/event-outbox-types.ts
@@ -46,8 +46,7 @@ const keySchema = z
"Must be lowercase and dot-namespaced, e.g. 'pki.certificate.issued'"
);
-// `id` is the CloudEvents id. It is set when the event is built, so every consumer's row for the event
-// carries the same one.
+// `id` is set when the event is built, so every consumer's row for it shares the same one.
export const EventInputSchema = z.object({
id: z.string().uuid(),
type: keySchema,
@@ -61,8 +60,7 @@ export type TEventEmitter = {
emit: (events: TEventInput[], tx?: Knex) => Promise<void>;
};
-// What a consumer sees: the CloudEvents 1.0 envelope from the Event Standards and Versioning ADR. Lock,
-// attempt and status columns are the outbox's business.
+// What a consumer sees: the CloudEvents 1.0 envelope. Lock, attempt and status columns stay inside the outbox.
export type TEvent<TData = unknown> = {
specversion: "1.0";
id: string;
@@ -78,7 +76,7 @@ export enum EventResultStatus {
Failed = "failed"
}
-// `id` is the event's id, which is unique within one consumer's events.
+// `id` is the event id, not the outbox row id.
export type TEventConsumerResult = {
id: string;
status: EventResultStatus;
diff --git a/backend/src/services/folder-commit/folder-commit-service.ts b/backend/src/services/folder-commit/folder-commit-service.ts
index 55cceae679..d81f860bcb 100644
--- a/backend/src/services/folder-commit/folder-commit-service.ts
+++ b/backend/src/services/folder-commit/folder-commit-service.ts
@@ -1350,7 +1350,7 @@ export const folderCommitServiceFactory = ({
(change): change is ResourceChange & FolderChange => change.type === ResourceType.FOLDER
);
- // An update can rename and re-parent, so the old paths are read before any write rather than derived.
+ // An update can rename and re-parent, so read the old paths before any write instead of deriving them.
const existingFolderIds = folderChanges.filter(({ changeType }) => changeType !== "create").map(({ id }) => id);
const [parentLocation, ...existingLocations] = folderChanges.length
? await folderDAL.findSecretPathByFolderIds(projectId, [folderId, ...existingFolderIds], tx)
diff --git a/backend/src/services/reminder/reminder-events.ts b/backend/src/services/reminder/reminder-events.ts
index e9980d2c2c..753fae3450 100644
--- a/backend/src/services/reminder/reminder-events.ts
+++ b/backend/src/services/reminder/reminder-events.ts
@@ -33,9 +33,9 @@ export const emitSecretReminderDue = (
eventEmitter.emit(
[
{
- // Random, not derived from the reminder and date. The dispatch transaction already stops one run from
- // firing an occurrence twice, and a derived id would make the outbox drop a reminder the user moved
- // back onto a date it already fired on.
+ // Random on purpose. The dispatch transaction already stops an occurrence firing twice, and an id
+ // derived from reminder + date would make the outbox drop a reminder moved back onto a date it
+ // already fired on.
id: crypto.randomUUID(),
type: SECRET_REMINDER_DUE_EVENT,
data: {
diff --git a/backend/src/services/reminder/reminder-service.test.ts b/backend/src/services/reminder/reminder-service.test.ts
index 8ff2a1786a..f3918974c0 100644
--- a/backend/src/services/reminder/reminder-service.test.ts
+++ b/backend/src/services/reminder/reminder-service.test.ts
@@ -120,9 +120,8 @@ describe("reminder dispatch", () => {
]);
});
- // A cron retry after a partial run must be the same event, so the outbox drops it.
- // The outbox drops an event id a consumer already has, so a reminder moved back onto a date it already
- // fired on would never send again if its id were derived from the reminder and the date.
+ // An id derived from reminder + date would make the outbox drop a reminder moved back onto a date it
+ // already fired on.
test("gives every firing its own event id, even for a date the reminder already fired on", async () => {
const first = buildService({ due: [reminder()] });
const movedBack = buildService({ due: [reminder()] });
diff --git a/backend/src/services/secret-folder/secret-folder-dal.ts b/backend/src/services/secret-folder/secret-folder-dal.ts
index 47d6ff5b37..94a9384a7d 100644
--- a/backend/src/services/secret-folder/secret-folder-dal.ts
+++ b/backend/src/services/secret-folder/secret-folder-dal.ts
@@ -223,8 +223,8 @@ export const secretFolderDALFactory = (db: TDbClient) => {
}: { readFromPrimary?: boolean; includePendingDeletion?: boolean } = {}
) => {
const conn = tx || (readFromPrimary ? db : db.replicaNode());
- // An environment pending deletion is hidden from every read, but a caller still acting on a resource
- // inside it (eg revoking a honey token during the grace period) needs its real location.
+ // Environments pending deletion are hidden from reads, but a caller still acting inside one (eg revoking
+ // a honey token during the grace period) needs the real location.
const excludePendingDeletion = (qb: Knex.QueryBuilder) => {
if (!includePendingDeletion) void qb.whereNull(`${TableName.Environment}.deleteAfter`);
};
diff --git a/backend/src/services/secret-folder/secret-folder-events.ts b/backend/src/services/secret-folder/secret-folder-events.ts
index 30bc08b96f..ab3e28a28c 100644
--- a/backend/src/services/secret-folder/secret-folder-events.ts
+++ b/backend/src/services/secret-folder/secret-folder-events.ts
@@ -12,7 +12,7 @@ export type TPreviousSecretLocation = z.infer<typeof PreviousSecretLocationSchem
type TSecretLocation = { environment: string; secretPath: string };
-// Undefined when the update left the location alone, so `previous` only appears on an update that moved.
+// Undefined when nothing changed, so `previous` only shows up on a move.
export const previousSecretLocation = (
before: TSecretLocation,
after: TSecretLocation
@@ -24,11 +24,10 @@ export const previousSecretLocation = (
return Object.keys(previous).length ? previous : undefined;
};
-// `secretPath` is the folder's own path, after the change for `created` and `updated` and before it for
-// `deleted`. A rename is one `updated` event whose `previous` holds the old path, so a consumer covering
-// either path hears about it. A move to another parent recreates the folder and its subfolders under new
-// ids, so it is `created` at the destination and `deleted` at the source. A deleted folder takes its
-// subfolders with it, and those are not emitted separately: the event covers everything beneath its path.
+// `secretPath` is the folder's own path: the new one for `created` and `updated`, the old one for `deleted`.
+// A rename is one `updated` event with the old path in `previous`. A move to another parent recreates the
+// folder and its subfolders under new ids, so it's `created` at the destination and `deleted` at the source.
+// Deleting a folder emits one event that covers everything beneath it; subfolders are not emitted separately.
export const FolderModifiedEventV1 = defineEvent({
domain: "secrets",
entity: "folder",
diff --git a/backend/src/services/secret-import/secret-import-events.ts b/backend/src/services/secret-import/secret-import-events.ts
index ab3713603d..7536621c14 100644
--- a/backend/src/services/secret-import/secret-import-events.ts
+++ b/backend/src/services/secret-import/secret-import-events.ts
@@ -2,9 +2,8 @@ import { z } from "zod";
import { defineEvent, EventModificationType } from "@app/services/event-outbox/event-definition";
-// Covers create, update and delete of an import. `environment` and `secretPath` locate the folder the
-// import lives in, which is the folder whose effective secrets change, not the folder it imports from.
-// An import never moves to another folder, so unlike secrets and folders it has no `previous`.
+// `environment` and `secretPath` are the folder the import lives in (whose effective secrets change), not
+// the folder it imports from. Imports never move, so there's no `previous`.
export const SecretImportModifiedEventV1 = defineEvent({
domain: "secrets",
entity: "secret-import",
diff --git a/backend/src/services/secret-v2-bridge/secret-events.ts b/backend/src/services/secret-v2-bridge/secret-events.ts
index 4c1f4a8029..7a4161b84f 100644
--- a/backend/src/services/secret-v2-bridge/secret-events.ts
+++ b/backend/src/services/secret-v2-bridge/secret-events.ts
@@ -9,11 +9,11 @@ import {
TPreviousSecretLocation
} from "@app/services/secret-folder/secret-folder-events";
-// One event per shared secret per write. A consumer re-reads the secret's current state (or finds it
-// gone) to learn what changed. Moving a secret between folders recreates it under a new id, so it is
-// `deleted` at the source and `created` at the destination; a write that moves it in place (eg a
-// rotation moving its generated secrets) is one `updated` event whose `previous` holds the old location.
-// Personal overrides belong to one user, not the project's shared state, so nothing is emitted for them.
+// One event per shared secret per write; consumers re-read the secret to see what changed. A move between
+// folders recreates the secret under a new id, so it's `deleted` at the source and `created` at the
+// destination. A write that moves it in place (eg rotation moving its generated secrets) is one `updated`
+// event with the old location in `previous`. Personal overrides belong to one user, so nothing is emitted
+// for them.
export const SecretModifiedEventV1 = defineEvent({
domain: "secrets",
entity: "secret",
@@ -29,8 +29,7 @@ export const SecretModifiedEventV1 = defineEvent({
})
});
-// Where the written secrets live. Every low-level secret write takes one, so a caller cannot write
-// secrets without saying where, and the emit cannot be skipped.
+// Required on every low-level secret write so the emit can't be skipped.
export type TSecretEventScope = {
projectId: string;
environment: string;
diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
index b26ec0b3be..5452a4bab1 100644
--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
@@ -2343,7 +2343,7 @@ export const secretV2BridgeServiceFactory = ({
inputSecrets: inputSecretsWithBlindIndex,
folderId,
eventEmitter,
- // A caller-supplied folder carries no path, so this is the path the folder was resolved from.
+ // The caller's folder carries no path, so use the one it was resolved from.
eventScope: { projectId, environment, secretPath },
commitChanges,
orgId: actorOrgId,
diff --git a/backend/vitest.e2e.config.mts b/backend/vitest.e2e.config.mts
index ab8a8d258e..f8cfe86d06 100644
--- a/backend/vitest.e2e.config.mts
+++ b/backend/vitest.e2e.config.mts
@@ -99,8 +99,7 @@ export default defineConfig({
find: /^@app\/services\/event-outbox\/event-outbox-queue$/,
replacement: path.resolve(__dirname, "./e2e-test/fakes/event-outbox-queue")
},
- // Adds a consumer that records the secret events. server/routes/index.ts and
- // audit-log-stream-outbox.integration.spec.ts import this specifier; the latter emits none of them.
+ // Adds a consumer that records the secret events so specs can read them.
{
find: /^@app\/services\/event-outbox\/event-outbox-registry$/,
replacement: path.resolve(__dirname, "./e2e-test/fakes/event-outbox-registry")