cursedbelt-server 4.60.0 → 4.60.1

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.
@@ -8,6 +8,12 @@ export const DEFAULT_SMOKE_ACCOUNTS = ["smoke@auth.local"];
8
8
  * no production registry, so a point they make is a walk's — `smoke`, never a person.
9
9
  */
10
10
  const STAGE_SEED_ACCOUNT = /^stage-(?:owner|user-\d+-[0-9a-f]+)@cursedalchemy\.com$/;
11
+ /**
12
+ * The User-Agent `cursedops`'s deploy smokes send on every request (`SMOKE_USER_AGENT` there). A
13
+ * production smoke walks the routes signed out, so without this each deploy reads as one more
14
+ * anonymous visitor acting on every route (forge task 4234).
15
+ */
16
+ const SMOKE_USER_AGENT = /^cursedops-smoke\//i;
11
17
  /** Is this actor id a deploy smoke's or a stage walk's? `smokeAccounts` adds an app's own. */
12
18
  export function isSmokeAccount(id, smokeAccounts = DEFAULT_SMOKE_ACCOUNTS) {
13
19
  const lower = id.trim().toLowerCase();
@@ -37,7 +43,7 @@ export function resolveActorKind(input) {
37
43
  const id = actor?.id?.trim().toLowerCase() ?? "";
38
44
  if (isSmokeAccount(id, input.smokeAccounts))
39
45
  return "smoke";
40
- if (facts.serviceToken)
46
+ if (facts.serviceToken || SMOKE_USER_AGENT.test(facts.userAgent))
41
47
  return "smoke";
42
48
  if (isBotUserAgent(facts.userAgent))
43
49
  return "bot";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursedbelt-server",
3
- "version": "4.60.0",
3
+ "version": "4.60.1",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "description": "The app-facing Bun/Hono server tier of the cursedbelt split — storage, sharing, activity, guard, sync. React-free; cursedbelt-core below it.",
@@ -423,7 +423,7 @@
423
423
  "@node-rs/argon2": "^2.0.2",
424
424
  "@types/bun": "^1.3.14",
425
425
  "@types/node": "^24",
426
- "cursedbelt": "^5.105.1",
426
+ "cursedbelt": "^5.106.0",
427
427
  "hono": "4.12.28",
428
428
  "kysely": "^0.28.17",
429
429
  "kysely-bun-sqlite": "^0.4.0",
@@ -30,6 +30,8 @@ function harness(status = 200) {
30
30
  app.use(
31
31
  "/api/*",
32
32
  serverActions(events, RULES, {
33
+ // Its own clock, or `ms` is the real one: 1 instead of 0 on a loaded Mac.
34
+ now: () => 1_000,
33
35
  actorOf: () => ({ id: "curt@example.com", label: "Curt", owner: true }),
34
36
  valueFor: (_c, rule) => (rule.name === "search" ? 12 : undefined),
35
37
  }),
@@ -181,6 +181,8 @@ describe("resolveActorKind — the schema's rule, branch by branch", () => {
181
181
  [{ actor: { id: "Stage-User-12-d2fabd@cursedalchemy.com" }, facts }, "smoke"],
182
182
  [{ actor: { id: "stage-owner@example.com", owner: true }, facts }, "owner"],
183
183
  [{ actor: { id: "a@b.c" }, facts: { ...facts, serviceToken: true } }, "smoke"],
184
+ [{ actor: null, facts: { ...facts, userAgent: "cursedops-smoke/1" } }, "smoke"],
185
+ [{ actor: null, facts: { ...facts, userAgent: "curl/8.7.1" } }, "anon"],
184
186
  [{ actor: { id: "a@b.c" }, facts: { ...facts, userAgent: "bingbot" } }, "bot"],
185
187
  [{ actor: { id: "a@b.c", kind: "agent" as const }, facts }, "agent"],
186
188
  ])("%j → %s", (input, expected) => {
@@ -101,6 +101,13 @@ export const DEFAULT_SMOKE_ACCOUNTS: readonly string[] = ["smoke@auth.local"];
101
101
  */
102
102
  const STAGE_SEED_ACCOUNT = /^stage-(?:owner|user-\d+-[0-9a-f]+)@cursedalchemy\.com$/;
103
103
 
104
+ /**
105
+ * The User-Agent `cursedops`'s deploy smokes send on every request (`SMOKE_USER_AGENT` there). A
106
+ * production smoke walks the routes signed out, so without this each deploy reads as one more
107
+ * anonymous visitor acting on every route (forge task 4234).
108
+ */
109
+ const SMOKE_USER_AGENT = /^cursedops-smoke\//i;
110
+
104
111
  /** Is this actor id a deploy smoke's or a stage walk's? `smokeAccounts` adds an app's own. */
105
112
  export function isSmokeAccount(id: string, smokeAccounts: readonly string[] = DEFAULT_SMOKE_ACCOUNTS): boolean {
106
113
  const lower = id.trim().toLowerCase();
@@ -142,7 +149,7 @@ export function resolveActorKind(input: {
142
149
  if (actor?.kind) return actor.kind;
143
150
  const id = actor?.id?.trim().toLowerCase() ?? "";
144
151
  if (isSmokeAccount(id, input.smokeAccounts)) return "smoke";
145
- if (facts.serviceToken) return "smoke";
152
+ if (facts.serviceToken || SMOKE_USER_AGENT.test(facts.userAgent)) return "smoke";
146
153
  if (isBotUserAgent(facts.userAgent)) return "bot";
147
154
  if (id) return actor?.owner ? "owner" : "user";
148
155
  return "anon";