Skip to content

Commit d28e0e6

Browse files
os-zhuangclaude
andcommitted
fix(spec): repair 25 dead PROTOCOL_MAP links + gate them in CI
PROTOCOL_MAP.md is hand-written and nothing regenerates it, so renames orphan rows silently. 25 of its 132 `src/…` links pointed at files that no longer exist. The reported row was misdiagnosed, and the git history says why. The prose "Virtual capabilities for analytics datasets" was NOT a half-finished rewrite left by #1620 — it has been there verbatim since the map was created (ced379b), when `data/dataset.zod.ts` held the *seed* schema (object/externalId/mode/records). It never described that file. So this is one wrong row plus one absent row, not one half-updated row: - `data/dataset.zod.ts` -> `data/seed.zod.ts`, described as seed fixtures (renamed by #1620 to free `dataset` for analytics, ADR-0021). - the analytics dataset the old prose was reaching for is a real, unlisted schema: added as `ui/dataset.zod.ts` (ADR-0021 semantic layer). The sweep found the same rot everywhere, all from deliberate refactors that left the map behind: - `src/hub/**` (9 rows) — the directory no longer exists (142703d). Survivors rehomed: license/registry-config/tenant -> src/system, plugin-registry/plugin-security -> src/kernel; composer, marketplace, space, hub-federation and api/hub were deleted outright. Section 9 is therefore gone and Kernel renumbered 10 -> 9. - `src/ai` (10 rows) — narrowed by 629a716. Repointed where a successor exists (agent-action -> tool, cost -> usage, rag-pipeline -> knowledge-source); dropped nlq/orchestration/predictive/devops-agent/ feedback-loop/plugin-development/runtime-ops. - `identity/role` -> `identity/position` (ADR-0090 D3 renamed sys_role). - `security/policy` (#2387), `system/compliance` + `system/masking` (ADR-0056 D8) — removed as dead, rows dropped. Gate: scripts/protocol-map.test.ts asserts every link resolves. Proven to go red first — it listed exactly the 25 dead links before the fix. It rides Test Core (required); `core: packages/**` covers the file and turbo's $TURBO_DEFAULT$ inputs include it, so a map-only edit still re-runs the test rather than cache-hitting to a false green. A new workflow job would not have blocked merges (main requires only 4 checks), and check-links.yml is dormant (workflow_dispatch only) and does not cover packages/spec. Deliberately asserts links only, not completeness: the map is a curated digest, not a generated index. Sibling of #3138, which fixed the identical stale `data/dataset.zod.ts` pointer in build-skill-references.ts's SKILL_MAP. That one guards generated artifacts that ship to third parties; PROTOCOL_MAP.md is hand-written and repo-internal (not in the package's npm `files`), so it needs its own check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 09b18f5 commit d28e0e6

2 files changed

Lines changed: 78 additions & 34 deletions

File tree

packages/spec/PROTOCOL_MAP.md

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
77
> * **Support Protocols** provide internal structures or auxiliary types.
88
> * Always check the file content for specific Zod schema definitions.
99
10+
> **Maintaining this file.** It is hand-written and not generated. Every `src/…`
11+
> link is asserted to resolve by `scripts/protocol-map.test.ts`, so a rename that
12+
> orphans a row fails CI — repoint the row at the schema that replaced it, or drop
13+
> the row if the concept is gone. The listing is a *curated digest*, not an
14+
> exhaustive index: not every schema in `src/` appears here, and that is by design.
15+
1016
---
1117

1218
## 🏗️ 1. Data Protocol (`src/data`)
@@ -24,7 +30,8 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
2430
| [`driver-nosql.zod.ts`](src/data/driver-nosql.zod.ts) | | **NoSQL Driver**. Specific configurations for NoSQL drivers. |
2531
| [`driver/mongo.zod.ts`](src/data/driver/mongo.zod.ts) | | **MongoDB Driver**. MongoDB specific connection options. |
2632
| [`driver/postgres.zod.ts`](src/data/driver/postgres.zod.ts) | | **PostgreSQL Driver**. PostgreSQL specific connection options. |
27-
| [`dataset.zod.ts`](src/data/dataset.zod.ts) | | **Dataset**. Virtual capabilities for analytics datasets. |
33+
| [`seed.zod.ts`](src/data/seed.zod.ts) | | **Seed**. Seed data / fixtures — bootstrap, reference, and demo rows applied on publish. (Was `dataset` until #1620; the `dataset` name now belongs to the analytics semantic layer.) |
34+
| [`seed-loader.zod.ts`](src/data/seed-loader.zod.ts) | | **Seed Loader**. How seed rows are resolved and applied. |
2835
| [`analytics.zod.ts`](src/data/analytics.zod.ts) | | **Data Analytics**. Aggregation and multidimensional analysis types. |
2936
| [`document.zod.ts`](src/data/document.zod.ts) | | **Document**. Unstructured document storage protocol. |
3037
| [`external-lookup.zod.ts`](src/data/external-lookup.zod.ts) | | **External Lookup**. Virtual lookups to external API data. |
@@ -43,6 +50,7 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
4350
| [`app.zod.ts`](src/ui/app.zod.ts) || **App Container**. Defines the application shell, navigation menu, and branding. |
4451
| [`view.zod.ts`](src/ui/view.zod.ts) || **Views**. List views (Grid, Kanban) and Record views (Form layouts). |
4552
| [`page.zod.ts`](src/ui/page.zod.ts) || **Custom Pages**. Drag-and-drop page builder definitions. |
53+
| [`dataset.zod.ts`](src/ui/dataset.zod.ts) || **Analytics Dataset**. The one semantic layer (ADR-0021): a base object plus declared dimensions and measures. `report` / `dashboard` bind to it by reference instead of declaring their own queries. |
4654
| [`dashboard.zod.ts`](src/ui/dashboard.zod.ts) || **Dashboards**. Logic for grid-based analytic dashboards. |
4755
| [`report.zod.ts`](src/ui/report.zod.ts) || **Reports**. Reporting definitions (tabular, summary, matrix). |
4856
| [`action.zod.ts`](src/ui/action.zod.ts) || **Actions**. Buttons, links, and operations available on UI. |
@@ -74,19 +82,16 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
7482
| File | Status | Description |
7583
| :--- | :--- | :--- |
7684
| [`agent.zod.ts`](src/ai/agent.zod.ts) || **AI Agent**. Attributes of an AI assistant (role, personality, model). |
77-
| [`agent-action.zod.ts`](src/ai/agent-action.zod.ts) || **Tools & Actions**. Capabilities exposed to the AI (Function Calling). |
85+
| [`tool.zod.ts`](src/ai/tool.zod.ts) || **Tools**. Capabilities exposed to the AI (function calling). Was `agent-action`. |
86+
| [`skill.zod.ts`](src/ai/skill.zod.ts) || **Skills**. Named bundles of instructions plus tools, activated by trigger phrases or conditions. |
7887
| [`mcp.zod.ts`](src/ai/mcp.zod.ts) || **Model Context Protocol (MCP)**. Standard protocol for connecting AI to tools, resources, and data sources. |
79-
| [`rag-pipeline.zod.ts`](src/ai/rag-pipeline.zod.ts) || **RAG**. Retrieval Augmented Generation configurations. |
8088
| [`model-registry.zod.ts`](src/ai/model-registry.zod.ts) | | **LLM Registry**. Configuration for model providers (OpenAI, Anthropic). |
8189
| [`conversation.zod.ts`](src/ai/conversation.zod.ts) | | **Chat Session**. History and context management for AI chats. |
82-
| [`nlq.zod.ts`](src/ai/nlq.zod.ts) | | **Natural Language Query**. Definitions for text-to-SQL/Query logic. |
83-
| [`orchestration.zod.ts`](src/ai/orchestration.zod.ts) | | **Orchestration**. Multi-agent coordination patterns. |
84-
| [`feedback-loop.zod.ts`](src/ai/feedback-loop.zod.ts) | | **RLHF**. Feedback mechanisms for model improvement. |
85-
| [`cost.zod.ts`](src/ai/cost.zod.ts) | | **Cost Tracking**. Token usage and billing metrics. |
86-
| [`devops-agent.zod.ts`](src/ai/devops-agent.zod.ts) | | **DevOps Agent**. Specialized agent for system operations. |
87-
| [`plugin-development.zod.ts`](src/ai/plugin-development.zod.ts) | | **Plugin Dev**. AI assistance for plugin creation. |
88-
| [`predictive.zod.ts`](src/ai/predictive.zod.ts) | | **Predictive AI**. Machine learning model configurations. |
89-
| [`runtime-ops.zod.ts`](src/ai/runtime-ops.zod.ts) | | **Runtime Ops**. Operational parameters for AI runtime. |
90+
| [`knowledge-source.zod.ts`](src/ai/knowledge-source.zod.ts) | | **Knowledge Source**. What to index and which adapter to use (the RAG retrieval binding). |
91+
| [`knowledge-document.zod.ts`](src/ai/knowledge-document.zod.ts) | | **Knowledge Document**. Document / chunk / hit shapes shared by every knowledge adapter. |
92+
| [`embedding.zod.ts`](src/ai/embedding.zod.ts) | | **Embeddings**. Embedding model and vector store configuration. |
93+
| [`solution-blueprint.zod.ts`](src/ai/solution-blueprint.zod.ts) | | **Solution Blueprint**. Plan-first authoring target for high-level goals (ADR-0033). |
94+
| [`usage.zod.ts`](src/ai/usage.zod.ts) | | **Usage**. Token consumption measurement. Was `cost`. |
9095

9196
---
9297

@@ -98,9 +103,9 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
98103
| [`identity.zod.ts`](src/identity/identity.zod.ts) || **User Identity**. User accounts, authentication attributes. |
99104
| [`organization.zod.ts`](src/identity/organization.zod.ts) || **Organization**. Multi-tenancy structure (spaces, companies). |
100105
| [`permission.zod.ts`](src/security/permission.zod.ts) || **Permissions**. ACLs for Objects, Fields, and Apps. |
101-
| [`role.zod.ts`](src/identity/role.zod.ts) | | **Roles**. Hierarchical role definitions. |
102-
| [`policy.zod.ts`](src/security/policy.zod.ts) | | **Security Policy**. Global security settings and restrictions. |
106+
| [`position.zod.ts`](src/identity/position.zod.ts) | | **Positions**. The assignable bundle of permission sets a user holds. Renamed from `role` by ADR-0090 (`sys_role``sys_position`); `profile` was removed in the same wave. |
103107
| [`sharing.zod.ts`](src/security/sharing.zod.ts) | | **Sharing Rules**. Record-level access rules (sharing calculation). |
108+
| [`explain.zod.ts`](src/security/explain.zod.ts) | | **Access Explain**. Why a principal can or cannot reach a record. |
104109
| [`rls.zod.ts`](src/security/rls.zod.ts) | | **Row Level Security**. Database-level RLS definitions. |
105110
| [`territory.zod.ts`](src/security/territory.zod.ts) | | **Territory Management**. Sales territory models. |
106111
| [`scim.zod.ts`](src/identity/scim.zod.ts) | | **SCIM Protocol**. Identity provisioning standards. |
@@ -141,10 +146,11 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
141146
| [`notification.zod.ts`](src/system/notification.zod.ts) | | **Notifications**. System-wide notification preferences. |
142147
| [`translation.zod.ts`](src/system/translation.zod.ts) | | **i18n**. Internationalization and localization. |
143148
| [`worker.zod.ts`](src/system/worker.zod.ts) | | **Worker Nodes**. Background worker scaling config. |
144-
| [`compliance.zod.ts`](src/system/compliance.zod.ts) | | **Compliance**. GDPR/SOC2 policies. |
145149
| [`encryption.zod.ts`](src/system/encryption.zod.ts) | | **Encryption**. At-rest and in-transit encryption keys. |
146-
| [`masking.zod.ts`](src/system/masking.zod.ts) | | **Data Masking**. PII data masking rules. |
147150
| [`migration.zod.ts`](src/system/migration.zod.ts) | | **Migration**. Database schema migration tracking. |
151+
| [`license.zod.ts`](src/system/license.zod.ts) | | **Licensing**. License keys and entitlements. |
152+
| [`registry-config.zod.ts`](src/system/registry-config.zod.ts) | | **Registry Config**. Configuration for the package registry. |
153+
| [`tenant.zod.ts`](src/system/tenant.zod.ts) | | **Tenant**. Multi-tenant environment isolation. |
148154
| [`change-management.zod.ts`](src/system/change-management.zod.ts) | | **Change Mgmt**. Deployment history and rollbacks. |
149155
| [`collaboration.zod.ts`](src/system/collaboration.zod.ts) | | **Collaboration**. Real-time collaboration settings. |
150156

@@ -174,29 +180,12 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
174180
| [`batch.zod.ts`](src/api/batch.zod.ts) | | **Batch API**. Bulk request processing. |
175181
| [`contract.zod.ts`](src/api/contract.zod.ts) | | **API Contracts**. Versioned API signatures. |
176182
| [`storage.zod.ts`](src/api/storage.zod.ts) | | **Storage API**. File upload/download endpoints. |
177-
| [`hub.zod.ts`](src/api/hub.zod.ts) | | **Hub API**. Main Hub communication protocol. |
178183
| [`registry.zod.ts`](src/api/registry.zod.ts) | | **Registry API**. Package registry interface. |
184+
| [`package-api.zod.ts`](src/api/package-api.zod.ts) | | **Package API**. Package lifecycle endpoints (`/api/v1/packages`). |
179185

180186
---
181187

182-
## 🧩 9. Hub & Ecosystem (`src/hub`)
183-
*The "Marketplace as Code" layer. Defines the package ecosystem.*
184-
185-
| File | Status | Description |
186-
| :--- | :--- | :--- |
187-
| [`registry-config.zod.ts`](src/hub/registry-config.zod.ts) || **Registry Config**. Configuration for the package registry. |
188-
| [`plugin-registry.zod.ts`](src/hub/plugin-registry.zod.ts) | | **Plugin Registry**. Metadata for available plugins. |
189-
| [`marketplace.zod.ts`](src/hub/marketplace.zod.ts) | | **Marketplace**. Listings, pricing, and vendor info. |
190-
| [`tenant.zod.ts`](src/hub/tenant.zod.ts) | | **Tenant**. Multi-tenant environment isolation. |
191-
| [`license.zod.ts`](src/hub/license.zod.ts) | | **Licensing**. License keys and entitlements. |
192-
| [`composer.zod.ts`](src/hub/composer.zod.ts) | | **Composer**. Package dependency resolution. |
193-
| [`space.zod.ts`](src/hub/space.zod.ts) | | **Space**. Collaborative workspaces. |
194-
| [`hub-federation.zod.ts`](src/hub/hub-federation.zod.ts) | | **Federation**. Cross-instance hub communication. |
195-
| [`plugin-security.zod.ts`](src/hub/plugin-security.zod.ts) | | **Plugin Security**. Security verification for plugins. |
196-
197-
---
198-
199-
## ⚙️ 10. Kernel & Runtime (`src/kernel`)
188+
## ⚙️ 9. Kernel & Runtime (`src/kernel`)
200189
*The "OS as Code" layer. Defines low-level plugin lifecycles.*
201190

202191
| File | Status | Description |
@@ -210,6 +199,8 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
210199
| [`metadata-loader.zod.ts`](src/kernel/metadata-loader.zod.ts) | | **Loader**. Logic for loading definitions from disk/DB. |
211200
| [`plugin-loading.zod.ts`](src/kernel/plugin-loading.zod.ts) || **Plugin Loading**. Loading strategies, production-safe hot reload (`environment`, `productionSafety`), full plugin sandboxing (`scope`, `ipc`), code splitting, caching, and performance monitoring. |
212201
| [`plugin-runtime.zod.ts`](src/kernel/plugin-runtime.zod.ts) || **Dynamic Loading**. Runtime load/unload of plugins (`DynamicLoadRequest`, `DynamicUnloadRequest`), activation events, plugin discovery from registries/directories, and source resolution (npm/local/url/registry/git). |
202+
| [`plugin-registry.zod.ts`](src/kernel/plugin-registry.zod.ts) | | **Plugin Registry**. Metadata for available plugins. |
203+
| [`plugin-security.zod.ts`](src/kernel/plugin-security.zod.ts) | | **Plugin Security**. Security verification for plugins. |
213204
| [`plugin-versioning.zod.ts`](src/kernel/plugin-versioning.zod.ts) | | **Versioning**. Semantic versioning rules for plugins. |
214205
| [`plugin-validator.zod.ts`](src/kernel/plugin-validator.zod.ts) | | **Validation**. Integrity checks for plugins. |
215206
| [`plugin-structure.zod.ts`](src/kernel/plugin-structure.zod.ts) | | **Structure**. Zod rules for folder layout and file naming. |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import { existsSync, readFileSync } from 'node:fs';
4+
import { dirname, resolve } from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
import { describe, expect, it } from 'vitest';
7+
8+
/**
9+
* PROTOCOL_MAP.md is hand-written and repo-internal (it is not in the package's
10+
* npm `files` list, so it never ships). Nothing regenerates it, which means a
11+
* rename that moves a `*.zod.ts` leaves its row pointing at a file that no
12+
* longer exists and no build step notices.
13+
*
14+
* That is not hypothetical: the Dataset→Seed rename (#1620, ADR-0021) left
15+
* `src/data/dataset.zod.ts` dangling here, and by the time this gate was added
16+
* 25 of the 132 links were dead — an entire section (`src/hub`) had been
17+
* deleted wholesale. This asserts every link resolves; it deliberately does NOT
18+
* assert the reverse (that every schema is listed), since the map is a curated
19+
* digest, not a generated index.
20+
*
21+
* Sibling gate: #3138 covers the same #1620 fallout on the *generated* side —
22+
* `build-skill-references.ts`'s SKILL_MAP held the identical stale
23+
* `data/dataset.zod.ts` pointer. That one is a regenerate-and-diff check on
24+
* artifacts that ship to third parties, so it runs as `check:skill-refs` in
25+
* lint.yml. This file is hand-written and never generated, so a plain assertion
26+
* is the whole job; it rides Test Core, whose `packages/**` filter has no
27+
* blind spot for spec changes.
28+
*/
29+
30+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
31+
const mapPath = resolve(packageRoot, 'PROTOCOL_MAP.md');
32+
33+
/** Matches the `](src/...)` target of every markdown link in the tables. */
34+
const LINK_RE = /\]\((src\/[^)]+)\)/g;
35+
36+
function protocolMapLinks(): string[] {
37+
const md = readFileSync(mapPath, 'utf8');
38+
return [...md.matchAll(LINK_RE)].map((m) => m[1]);
39+
}
40+
41+
describe('PROTOCOL_MAP.md', () => {
42+
it('links only to files that exist', () => {
43+
const dead = protocolMapLinks().filter((link) => !existsSync(resolve(packageRoot, link)));
44+
45+
expect(dead, `PROTOCOL_MAP.md links to ${dead.length} file(s) that do not exist:\n` +
46+
dead.map((d) => ` - ${d}`).join('\n') +
47+
'\n\nRepoint the row at the schema that replaced it, or drop the row if the concept is gone.').toEqual([]);
48+
});
49+
50+
it('actually finds links to check (guards against the regex silently matching nothing)', () => {
51+
expect(protocolMapLinks().length).toBeGreaterThan(100);
52+
});
53+
});

0 commit comments

Comments
 (0)