Skip to content

Commit 60ca35a

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/issue-15788-flow-end-refused-outcome
2 parents 958a68c + 3aaea38 commit 60ca35a

34 files changed

Lines changed: 1056 additions & 79 deletions

‎.github/workflows/lint.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3846,6 +3846,19 @@ jobs:
38463846
- name: Declared REST fault-log level
38473847
run: node scripts/check-rest-log-declared.mjs --self-test && node scripts/check-rest-log-declared.mjs
38483848

3849+
# The pairing half of the one above (#17865, ruling batch #128 item 4).
3850+
# The `packages/rest` harness now runs at `OS_REST_LOG: 'silent'`, which
3851+
# takes those 2,095 frame lines to ZERO — and that is safe only while
3852+
# every test file that OBSERVES the fault log declares its own loud level.
3853+
# Half of that population announces itself when it breaks: 15 files / 28
3854+
# test cases go RED the moment the suite is silenced. The other half does
3855+
# not. Eight files assert that an expected 4xx logs NOTHING, and a
3856+
# silenced shim makes those pass with every 4xx logged loudly — a phantom
3857+
# check reached by a legitimate-looking config line. This gate names an
3858+
# undeclared observer instead. Self-test first.
3859+
- name: Declared REST fault-log level — observers
3860+
run: node scripts/check-rest-log-spy-declared.mjs --self-test && node scripts/check-rest-log-spy-declared.mjs
3861+
38493862
# Live-server database isolation (#10382). CI provisions ONE Postgres and
38503863
# ONE MySQL for the whole temporal-conformance job and points every live
38513864
# leg at them, and every live suite in the repo issues a `drop` when it

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"check:test-source-alias": "node scripts/check-test-source-alias.mjs --self-test && node scripts/check-test-source-alias.mjs",
162162
"check:registry-log-declared": "node scripts/check-registry-log-declared.mjs --self-test && node scripts/check-registry-log-declared.mjs",
163163
"check:rest-log-declared": "node scripts/check-rest-log-declared.mjs --self-test && node scripts/check-rest-log-declared.mjs",
164+
"check:rest-log-spy-declared": "node scripts/check-rest-log-spy-declared.mjs --self-test && node scripts/check-rest-log-spy-declared.mjs",
164165
"check:refd-timer-probe": "node scripts/check-refd-timer-probe.mjs --self-test && node scripts/check-refd-timer-probe.mjs",
165166
"check:type-source-resolution": "node scripts/check-type-source-resolution.mjs --self-test && node scripts/check-type-source-resolution.mjs",
166167
"check:undeclared-dep-imports": "node scripts/check-undeclared-dep-imports.mjs --self-test && node scripts/check-undeclared-dep-imports.mjs",

‎packages/rest/src/analytics-16019-driver-declared-fault.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,21 @@
5959
* case stays GREEN, which is precisely why it could not stand in for this one.
6060
*/
6161

62-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
62+
import { describe, it, expect, vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
6363
import type { Logger } from '@objectstack/spec/contracts';
6464
import { AnalyticsService } from '@objectstack/service-analytics';
6565
import { SqlDriver } from '@objectstack/driver-sql';
6666
import { INTERNAL_ERROR_MESSAGE, declaresServerFault, looksLikeInternalErrorLeak } from '@objectstack/types';
6767
import { RestServer } from './rest-server';
6868

69+
// [#17865] This file observes the REST fault log, so it declares the level it
70+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
71+
// SHIPPED default — what a real caller gets. Paired by
72+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
73+
// is a finding by name.
74+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
75+
afterAll(() => { vi.unstubAllEnvs(); });
76+
6977
// ── harness (the shape `analytics-dataset-dimension-gate.test.ts` uses) ──────
7078

7179
function mockServer() {

‎packages/rest/src/analytics-dataset-dimension-gate.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,20 @@
5656
* sources: mutating the service without rebuilding it proves nothing here.
5757
*/
5858

59-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
59+
import { describe, it, expect, vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
6060
import type { Logger } from '@objectstack/spec/contracts';
6161
import { AnalyticsService } from '@objectstack/service-analytics';
6262
import { INTERNAL_ERROR_MESSAGE } from '@objectstack/types';
6363
import { RestServer } from './rest-server';
6464

65+
// [#17865] This file observes the REST fault log, so it declares the level it
66+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
67+
// SHIPPED default — what a real caller gets. Paired by
68+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
69+
// is a finding by name.
70+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
71+
afterAll(() => { vi.unstubAllEnvs(); });
72+
6573
// ── harness (the shape `analytics-filter-refusal-envelope.test.ts` uses) ──────
6674

6775
function mockServer() {

‎packages/rest/src/analytics-dataset-where-gate.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,19 @@
4949
* must be falsifiable on its own.
5050
*/
5151

52-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
52+
import { describe, it, expect, vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
5353
import type { Logger } from '@objectstack/spec/contracts';
5454
import { AnalyticsService } from '@objectstack/service-analytics';
5555
import { RestServer } from './rest-server';
5656

57+
// [#17865] This file observes the REST fault log, so it declares the level it
58+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
59+
// SHIPPED default — what a real caller gets. Paired by
60+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
61+
// is a finding by name.
62+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
63+
afterAll(() => { vi.unstubAllEnvs(); });
64+
5765
// ── harness (the shape the two sibling analytics rest tests use) ─────────────
5866

5967
function mockServer() {

‎packages/rest/src/analytics-fault-user-message.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,19 @@
9999
* or strategy.
100100
*/
101101

102-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
102+
import { describe, it, expect, vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
103103
import { INTERNAL_ERROR_MESSAGE } from '@objectstack/types';
104104
import { RestServer } from './rest-server';
105105
import { handleRouteError } from './error-response.js';
106106

107+
// [#17865] This file observes the REST fault log, so it declares the level it
108+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
109+
// SHIPPED default — what a real caller gets. Paired by
110+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
111+
// is a finding by name.
112+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
113+
afterAll(() => { vi.unstubAllEnvs(); });
114+
107115
// ── harness (the shape the sibling analytics envelope tests use) ──────────────
108116

109117
function mockServer() {

‎packages/rest/src/analytics-filter-refusal-envelope.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,20 @@
4545
* be re-labelled with a code of its own choosing.
4646
*/
4747

48-
import { describe, it, expect, vi } from 'vitest';
48+
import { describe, it, expect, vi, beforeAll, afterAll } from 'vitest';
4949
import type { Logger } from '@objectstack/spec/contracts';
5050
import { AnalyticsService } from '@objectstack/service-analytics';
5151
import { INTERNAL_ERROR_MESSAGE } from '@objectstack/types';
5252
import { RestServer } from './rest-server';
5353

54+
// [#17865] This file observes the REST fault log, so it declares the level it
55+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
56+
// SHIPPED default — what a real caller gets. Paired by
57+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
58+
// is a finding by name.
59+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
60+
afterAll(() => { vi.unstubAllEnvs(); });
61+
5462
// ── harness ──────────────────────────────────────────────────────────────────
5563

5664
function mockServer() {

‎packages/rest/src/analytics-read-scope-refusal-envelope.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,20 @@
7171
* threw.
7272
*/
7373

74-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
74+
import { describe, it, expect, vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
7575
import type { Logger } from '@objectstack/spec/contracts';
7676
import { AnalyticsService } from '@objectstack/service-analytics';
7777
import { INTERNAL_ERROR_MESSAGE } from '@objectstack/types';
7878
import { RestServer } from './rest-server';
7979

80+
// [#17865] This file observes the REST fault log, so it declares the level it
81+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
82+
// SHIPPED default — what a real caller gets. Paired by
83+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
84+
// is a finding by name.
85+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
86+
afterAll(() => { vi.unstubAllEnvs(); });
87+
8088
// ── harness (the shape the sibling analytics envelope tests use) ──────────────
8189

8290
function mockServer() {

‎packages/rest/src/execctx-authz-input-seam-reachability.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
* outside vitest (it needs git history) and is recorded on the card.
8989
*/
9090

91-
import { describe, it, expect, vi } from 'vitest';
91+
import { describe, it, expect, vi, beforeAll, afterAll } from 'vitest';
9292
import { readFileSync } from 'node:fs';
9393
import { fileURLToPath } from 'node:url';
9494
import { dirname, resolve } from 'node:path';
@@ -103,6 +103,14 @@ import type { RouteHandler } from '@objectstack/spec/contracts';
103103
import { registerPackageRoutes } from './package-routes.js';
104104
import { RestServer } from './rest-server.js';
105105

106+
// [#17865] This file observes the REST fault log, so it declares the level it
107+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
108+
// SHIPPED default — what a real caller gets. Paired by
109+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
110+
// is a finding by name.
111+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
112+
afterAll(() => { vi.unstubAllEnvs(); });
113+
106114
const PKGS = '/api/v1/packages';
107115
const HERE = dirname(fileURLToPath(import.meta.url));
108116
const SOURCE = readFileSync(resolve(HERE, 'rest-server.ts'), 'utf8');

‎packages/rest/src/external-write-forbidden-envelope.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,20 @@
6464
// had this test lie about what it measures.
6565
// ---------------------------------------------------------------------------
6666

67-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
67+
import { describe, it, expect, vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
6868
import { INTERNAL_ERROR_MESSAGE } from '@objectstack/types';
6969
import { ObjectQL } from '@objectstack/objectql';
7070
import type { IDataDriver } from '@objectstack/spec/contracts';
7171
import { RestServer } from './rest-server.js';
7272

73+
// [#17865] This file observes the REST fault log, so it declares the level it
74+
// asserts against instead of inheriting the suite's quiet one. 'info' is the
75+
// SHIPPED default — what a real caller gets. Paired by
76+
// scripts/check-rest-log-spy-declared.mjs: an observer that declares nothing
77+
// is a finding by name.
78+
beforeAll(() => { vi.stubEnv('OS_REST_LOG', 'info'); });
79+
afterAll(() => { vi.unstubAllEnvs(); });
80+
7381
const DATA_COLLECTION = '/api/v1/data/:object';
7482
const DATA_ITEM = '/api/v1/data/:object/:id';
7583

0 commit comments

Comments
 (0)