Skip to content

Commit 2b9f40e

Browse files
committed
test: recreate the dropped install-secret table for the backfill replay
The migration test clones live tables into a scratch schema, and changeset -56 removed app_install_secret from the live schema — on an upgrade the backfill under test runs while the table still exists, so the scratch copy is now created by hand with its historical shape. Also regenerates the API schema for the corrected owned-apps secrets description.
1 parent 7ec9fa3 commit 2b9f40e

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

backend/app/src/test/kotlin/io/tolgee/service/apps/AppLayerBackfillMigrationTest.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,21 @@ class AppLayerBackfillMigrationTest : AbstractSpringTest() {
105105
listOf(
106106
"app",
107107
"app_install",
108-
"app_install_secret",
109108
"app_available_for_organization",
110109
"app_enabled_for_project",
111110
"user_account",
112111
).forEach {
113112
execute("CREATE TABLE $SCRATCH_SCHEMA.$it (LIKE public.$it INCLUDING ALL)")
114113
}
114+
// Recreated by hand: changeset -56 dropped this table from the live schema, so there is nothing
115+
// to clone anymore. Its shape is frozen in history — on an upgrade the backfill under test runs
116+
// while the table still exists, and -56 removes it afterwards.
117+
execute(
118+
"CREATE TABLE $SCRATCH_SCHEMA.app_install_secret (" +
119+
"id BIGINT PRIMARY KEY, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, " +
120+
"app_install_id BIGINT NOT NULL, secret_hash VARCHAR(128) NOT NULL, " +
121+
"secret_prefix VARCHAR(16) NOT NULL, last_used_at TIMESTAMP, revoked_at TIMESTAMP)",
122+
)
115123
execute("ALTER TABLE $SCRATCH_SCHEMA.app_install DROP COLUMN registered_app_id")
116124
execute("ALTER TABLE $SCRATCH_SCHEMA.app_install DROP COLUMN principal_id")
117125

webapp/src/service/apiSchema.generated.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ export interface paths {
358358
get: operations["listDeliveries"];
359359
};
360360
"/v2/organizations/{organizationId}/owned-apps/{appId}/secrets": {
361-
/** Returns every app-level secret, revoked ones included, without disclosing any of them. These administer the app across every organization that installed it and grant access to no data — they are not the per-install secrets under `/apps/{installId}/secrets`. */
361+
/** Returns every secret of the app, revoked ones included, without disclosing any of them. They are the app's only long-lived credentials — everything the app does across every organization that installed it starts from them. `lastUsedAt` is what tells you whether the app has moved to a newly issued secret and the old one can be revoked. */
362362
get: operations["listSecrets"];
363363
/** Phase one of an app-level rotation: mints a second secret while every existing one keeps working. The app's installs, their own secrets, their organization availability and their per-project enablements are all untouched. The new secret is both returned here — the only place it is ever disclosed — and pushed to the app over the lifecycle channel. */
364364
post: operations["issueSecret"];
@@ -1727,7 +1727,7 @@ export interface components {
17271727
appId: string;
17281728
/** @description App-level OAuth client id. Present only in the response to registering the app — an organization that merely installed it never sees it. */
17291729
clientId?: string;
1730-
/** @description App-level OAuth client secret in plaintext. Administers the app across every organization that installed it and grants access to no data. Present only in the response to registering the app; Tolgee stores only a hash and cannot show it again. */
1730+
/** @description App-level OAuth client secret in plaintext the app's only long-lived credential; the token endpoint exchanges it for install-scoped access tokens. Present only in the response to registering the app; Tolgee stores only a hash and cannot show it again. */
17311731
clientSecret?: string;
17321732
/** Format: int64 */
17331733
id: number;
@@ -1752,7 +1752,7 @@ export interface components {
17521752
* @description When the secret was revoked, or null while it still authenticates
17531753
*/
17541754
revokedAt?: number;
1755-
/** @description The secret in plaintext. Present only in the response to issuing it — Tolgee stores only a hash and cannot show it again. It administers the app and grants access to no data. */
1755+
/** @description The secret in plaintext. Present only in the response to issuing it — Tolgee stores only a hash and cannot show it again. Everything the app does starts from it — the token endpoint exchanges it for the short-lived tokens that reach translation data. */
17561756
secret?: string;
17571757
};
17581758
AppSecretRotationRequest: {
@@ -13952,7 +13952,7 @@ export interface operations {
1395213952
};
1395313953
};
1395413954
};
13955-
/** Returns every app-level secret, revoked ones included, without disclosing any of them. These administer the app across every organization that installed it and grant access to no data — they are not the per-install secrets under `/apps/{installId}/secrets`. */
13955+
/** Returns every secret of the app, revoked ones included, without disclosing any of them. They are the app's only long-lived credentials — everything the app does across every organization that installed it starts from them. `lastUsedAt` is what tells you whether the app has moved to a newly issued secret and the old one can be revoked. */
1395613956
listSecrets: {
1395713957
parameters: {
1395813958
path: {

0 commit comments

Comments
 (0)