Skip to content

Commit 8506516

Browse files
committed
fix(#14646): re-measure the moved census control, and drop the runtime test's cross-package source dep
The dogfood census pins per-file control counts exactly; the comment added to realtime-service-plugin.ts moved `RealtimeService` 10 -> 11 because the pattern matches inside `IRealtimeService`. Re-measured in the ledger rather than reworded in the file. The runtime pin's import of the real InMemoryRealtimeAdapter made @objectstack/runtime type-resolve @objectstack/service-realtime through dist. Measured against origin/main: this package's typecheck script already named tsconfig.test.json, so the program was already counted and the registry's re-baseline limb does not apply; the mandated `paths` remedy then billed 13 TS6059 from another package's file graph into this package's ledger, against a rootDir tsconfig.test.json states it will not widen. Edge removed instead. The claim about the shipped occupant stays pinned against the real class in service-realtime's own suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
1 parent 04b60ff commit 8506516

5 files changed

Lines changed: 49 additions & 28 deletions

File tree

packages/qa/dogfood/test/authz-probe-blind-spot.census.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,18 @@ export const PROBE_FILE_CENSUS: readonly ProbeFileReading[] = [
450450
reachable: 0,
451451
blindSpot: 0,
452452
populationRule: 'HTTP route mounts in this file',
453-
controls: { RealtimeService: 10, 'async init(': 1 },
453+
// ⚠️ `RealtimeService` read 10 until #14646 added a comment to that file
454+
// recording why its occupant names no discovery channel route. The pattern
455+
// is a bare `/RealtimeService/g`, so it matches inside `IRealtimeService`
456+
// and PROSE about the symbol moves the symbol's count exactly as code
457+
// does — the mirror image of a retirement whose count goes UP because the
458+
// codebase started documenting an absence. Re-measured here rather than
459+
// reworded there: this control's job is to prove the file is still present
460+
// and readable (the non-zero assertion), and shrinking a comment to hold a
461+
// counter still is how the documentation gets worse to keep a number.
462+
// Nothing else in the row moves — the file still mounts no HTTP route, so
463+
// population / reachable / blindSpot / keys stay 0.
464+
controls: { RealtimeService: 11, 'async init(': 1 },
454465
// The designed-silence decision is the #2992 realtime-transport tripwire record.
455466
note: 'Tripwire only. Zero keys is the designed reading: no end-user realtime transport is wired.',
456467
},

packages/runtime/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"@objectstack/service-job": "workspace:*",
6969
"@objectstack/service-messaging": "workspace:*",
7070
"@objectstack/service-package": "workspace:*",
71-
"@objectstack/service-realtime": "workspace:*",
7271
"typescript": "^6.0.3",
7372
"vitest": "^4.1.10"
7473
},

packages/runtime/src/discovery-realtime-channel.pin.test.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,40 @@ import { describe, it, expect } from 'vitest';
2727
import { HttpDispatcher } from './http-dispatcher.js';
2828
import { isSubscribableChannel } from '@objectstack/spec/api';
2929
import type { IRealtimeService } from '@objectstack/spec/contracts';
30-
// The occupant a stock boot really registers (`RealtimeServicePlugin.init`).
31-
// Imported rather than re-described: the fact under test is that the SHIPPED
32-
// implementation names no channel route, and a hand-written stand-in could
33-
// only re-state this file's own assumption about it.
34-
import { InMemoryRealtimeAdapter } from '@objectstack/service-realtime';
3530

3631
const PREFIX = '/api/v1';
3732

33+
/**
34+
* The shape a stock boot registers: an in-process pub/sub bus that names no
35+
* channel route.
36+
*
37+
* ⭐ Deliberately a stand-in rather than an import of the real
38+
* `InMemoryRealtimeAdapter`, and the reason is structural rather than
39+
* stylistic. Reaching for the real class made `@objectstack/runtime`
40+
* type-resolve `@objectstack/service-realtime` through its `dist/*.d.ts`, and
41+
* three of this repo's own ratchets refuse that from three directions:
42+
* `check:type-source-resolution` reds on the dist-resolved type import; its
43+
* registry is SHRINK-ONLY and its re-baseline limb is open only to a change
44+
* that ONBOARDED the program (this package's `typecheck` script already named
45+
* `tsconfig.test.json`, so it did not); and the mandated `paths` remedy pulls
46+
* that package's file graph into a program whose `rootDir` is `./src`, which
47+
* `tsconfig.test.json` states it will not widen — 13 `TS6059` billed to a
48+
* ledger `service-realtime` cannot see, the same shape PR #12570 measured.
49+
*
50+
* Nothing is lost by declaring it here, because the claim about the SHIPPED
51+
* occupant is not this file's to make: it is pinned against the real class, in
52+
* the package that owns it, by
53+
* `packages/services/service-realtime/src/no-channel-route.pin.test.ts`. That
54+
* pin plus these compose to the stock-boot reading — this file pins that the
55+
* PRODUCER derives its answer from whatever the occupant names, and that one
56+
* pins what the shipped occupant names.
57+
*/
58+
const inProcessBus: IRealtimeService = {
59+
publish: async () => {},
60+
subscribe: async () => 'sub_1',
61+
unsubscribe: async () => {},
62+
};
63+
3864
/** A dispatcher whose kernel resolves exactly the one slot under test. */
3965
function dispatcherWithRealtime(realtime: unknown): HttpDispatcher {
4066
const kernel = {
@@ -52,16 +78,13 @@ function dispatcherWithRealtime(realtime: unknown): HttpDispatcher {
5278
* case has to be composed here.
5379
*/
5480
const mountedChannel: IRealtimeService = {
55-
publish: async () => {},
56-
subscribe: async () => 'sub_1',
57-
unsubscribe: async () => {},
81+
...inProcessBus,
5882
getChannelRoute: () => `${PREFIX}/realtime`,
5983
};
6084

6185
describe('[#14646] discovery and the one definition of a subscribable channel (dispatcher producer)', () => {
62-
it('does NOT advertise the shipped in-process bus as a channel', async () => {
63-
const info = await dispatcherWithRealtime(new InMemoryRealtimeAdapter())
64-
.getDiscoveryInfo(PREFIX);
86+
it('does NOT advertise an in-process realtime bus as a channel', async () => {
87+
const info = await dispatcherWithRealtime(inProcessBus).getDiscoveryInfo(PREFIX);
6588
const realtime = info.services.realtime;
6689

6790
// The retraction the ruling asks for: `enabled` no longer says "the
@@ -108,7 +131,7 @@ describe('[#14646] discovery and the one definition of a subscribable channel (d
108131
// to be two constants that happened to agree; now both are
109132
// `isSubscribableChannel` over the same entry, so no composition can
110133
// make them disagree — including one this file did not think of.
111-
for (const occupant of [new InMemoryRealtimeAdapter(), mountedChannel, null]) {
134+
for (const occupant of [inProcessBus, mountedChannel, null]) {
112135
const info = await dispatcherWithRealtime(occupant).getDiscoveryInfo(PREFIX);
113136
const verdict = isSubscribableChannel(info.services.realtime);
114137
expect(info.services.realtime.enabled, 'services.realtime.enabled').toBe(verdict);

packages/runtime/vitest.config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,6 @@ export default defineConfig({
143143
find: '@objectstack/service-package',
144144
replacement: path.resolve(__dirname, '../services/service-package/src/index.ts'),
145145
},
146-
// Dev-only: discovery-realtime-channel.pin.test.ts drives the REAL
147-
// occupant `RealtimeServicePlugin` registers, so "the shipped realtime
148-
// service names no channel route" (#14646) is proven against the actual
149-
// adapter rather than against a stand-in written from this file's own
150-
// assumption about it.
151-
{
152-
find: '@objectstack/service-realtime',
153-
replacement: path.resolve(__dirname, '../services/service-realtime/src/index.ts'),
154-
},
155146
],
156147
},
157148
test: {

pnpm-lock.yaml

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)