Skip to content

Commit 2c23fc9

Browse files
committed
Address PR review comments
- SKILL.md: Instruct agents to check validation results before importing and prompt the user if validation fails (promeris feedback) - Fix "500 on import" to "Errors on import (400 / 500)" in skill and guide (promeris feedback) - Add module-level tests for asset-registry handlers to improve coverage Includes-AI-Code: true Made-with: Cursor
1 parent ac5546a commit 2c23fc9

3 files changed

Lines changed: 68 additions & 3 deletions

File tree

.cursor/skills/asset-registry-endpoints/SKILL.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ importing:
232232
$CLI config import -d <export_dir> --validate --overwrite -p <profile>
233233
```
234234

235+
**Important**: If validation returns errors, do **not** proceed with the import.
236+
Instead, fix the schema violations in the node JSON and re-run the command. If
237+
you cannot resolve the errors automatically, present the validation results to
238+
the user and ask whether they want to continue importing with invalid
239+
configuration or stop to fix it manually.
240+
235241
## Troubleshooting
236242

237243
**404 on examples / methodology** — Not all asset services have deployed these
@@ -242,8 +248,8 @@ are optional.
242248
service. A 500 typically means the downstream service is unavailable or returned
243249
an unexpected response.
244250

245-
**500 on import** — Ensure `spaceId` is set on every node and `schemaVersion`
246-
matches the descriptor's `assetSchema.version`.
251+
**Errors on import (400 / 500)** — Ensure `spaceId` is set on every node and
252+
`schemaVersion` matches the descriptor's `assetSchema.version`.
247253

248254
## Full worked example
249255

docs/user-guide/agentic-development-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ content-cli config export --keysByVersion <packageKey>_<version> --unzip
9595

9696
**500 on proxy endpoints** — The platform proxies requests to the owning asset service. A 500 typically means the downstream service is unavailable or returned an unexpected response.
9797

98-
**500 on import** — Ensure `spaceId` is set on every node and `schemaVersion` matches the descriptor's `assetSchema.version`.
98+
**Errors on import (400 / 500)** — Ensure `spaceId` is set on every node and `schemaVersion` matches the descriptor's `assetSchema.version`.
9999

100100
## Further reading
101101

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import Module = require("../../../src/commands/asset-registry/module");
2+
import { Command, OptionValues } from "commander";
3+
import { AssetRegistryService } from "../../../src/commands/asset-registry/asset-registry.service";
4+
import { testContext } from "../../utls/test-context";
5+
6+
jest.mock("../../../src/commands/asset-registry/asset-registry.service");
7+
8+
describe("Asset Registry Module", () => {
9+
let module: Module;
10+
let mockCommand: Command;
11+
let mockService: jest.Mocked<AssetRegistryService>;
12+
13+
beforeEach(() => {
14+
jest.clearAllMocks();
15+
module = new Module();
16+
mockCommand = {} as Command;
17+
18+
mockService = {
19+
listTypes: jest.fn().mockResolvedValue(undefined),
20+
getType: jest.fn().mockResolvedValue(undefined),
21+
getSchema: jest.fn().mockResolvedValue(undefined),
22+
getExamples: jest.fn().mockResolvedValue(undefined),
23+
getMethodology: jest.fn().mockResolvedValue(undefined),
24+
} as any;
25+
26+
(AssetRegistryService as jest.MockedClass<typeof AssetRegistryService>)
27+
.mockImplementation(() => mockService);
28+
});
29+
30+
it("should call getSchema with correct parameters", async () => {
31+
const options: OptionValues = { assetType: "BOARD_V2", json: true };
32+
await (module as any).getSchema(testContext, mockCommand, options);
33+
expect(mockService.getSchema).toHaveBeenCalledWith("BOARD_V2", true);
34+
});
35+
36+
it("should call getExamples with correct parameters", async () => {
37+
const options: OptionValues = { assetType: "BOARD_V2", json: "" };
38+
await (module as any).getExamples(testContext, mockCommand, options);
39+
expect(mockService.getExamples).toHaveBeenCalledWith("BOARD_V2", false);
40+
});
41+
42+
it("should call getMethodology with correct parameters", async () => {
43+
const options: OptionValues = { assetType: "SEMANTIC_MODEL" };
44+
await (module as any).getMethodology(testContext, mockCommand, options);
45+
expect(mockService.getMethodology).toHaveBeenCalledWith("SEMANTIC_MODEL", false);
46+
});
47+
48+
it("should call listTypes", async () => {
49+
const options: OptionValues = { json: true };
50+
await (module as any).listTypes(testContext, mockCommand, options);
51+
expect(mockService.listTypes).toHaveBeenCalledWith(true);
52+
});
53+
54+
it("should call getType", async () => {
55+
const options: OptionValues = { assetType: "BOARD_V2", json: "" };
56+
await (module as any).getType(testContext, mockCommand, options);
57+
expect(mockService.getType).toHaveBeenCalledWith("BOARD_V2", false);
58+
});
59+
});

0 commit comments

Comments
 (0)