|
| 1 | +# Tool Contract Bundle Tests Validation |
| 2 | + |
| 3 | +PR: PR_26152_072-tool-contract-bundle-tests |
| 4 | +Date: 2026-06-02 |
| 5 | + |
| 6 | +## Scope |
| 7 | + |
| 8 | +- Added reusable Tool Contract Bundle data under `src/shared/contracts/toolContractBundle.js`. |
| 9 | +- Added Tool Contract Bundle fixtures under `tests/fixtures/tools/tool-contract-bundle-scenarios.json`. |
| 10 | +- Added targeted contract tests under `tests/shared/ToolContractBundle.test.mjs`. |
| 11 | +- Added coverage report under `docs/dev/reports/tool_contract_coverage.md`. |
| 12 | +- No database implementation was added. |
| 13 | +- No authentication implementation was added. |
| 14 | +- No UI/page/tool runtime behavior was changed. |
| 15 | +- No CSS or HTML files were changed. |
| 16 | +- No dependencies were added. |
| 17 | + |
| 18 | +## Contract Coverage |
| 19 | + |
| 20 | +Targeted tests prove: |
| 21 | + |
| 22 | +- every tool contract requires owner |
| 23 | +- every saved tool contract requires project |
| 24 | +- every tool contract has valid tool type |
| 25 | +- every tool contract has valid import/export formats |
| 26 | +- every tool contract declares produced outputs |
| 27 | +- every tool contract declares supported asset types when applicable |
| 28 | +- saved tool state links back to the tool contract |
| 29 | +- visibility rules are enforced |
| 30 | +- archived tool outputs are immutable unless policy allows edits |
| 31 | +- tool exports remain portable |
| 32 | +- every registered Tools Index first-class tool has a matching contract or documented skip |
| 33 | + |
| 34 | +The shared Tool contract defines: |
| 35 | + |
| 36 | +- `toolId` |
| 37 | +- `toolType` |
| 38 | +- `ownerId` |
| 39 | +- `projectId` |
| 40 | +- `visibility` |
| 41 | +- `requiredInputs` |
| 42 | +- `producedOutputs` |
| 43 | +- `sourceToolState` |
| 44 | +- `supportedAssetTypes` |
| 45 | +- `importFormats` |
| 46 | +- `exportFormats` |
| 47 | +- `status` |
| 48 | +- `version` |
| 49 | + |
| 50 | +## Validation Lanes |
| 51 | + |
| 52 | +- lanes executed: contract - Tool Contract Bundle tests plus existing Asset, Palette, Vector Asset, Tool State, Project, and Identity/Permissions contract tests were required by the PR. |
| 53 | +- lanes skipped: runtime, integration, engine, recovery/UAT - no runtime, handoff, engine, or recovery behavior changed. |
| 54 | +- samples decision: SKIP because samples were explicitly out of scope and no sample contracts or runtime paths changed. |
| 55 | +- Playwright impacted: No. This PR changes contract data and targeted Node tests only. |
| 56 | +- blocker scope: targeted contract lane only. |
| 57 | + |
| 58 | +## Commands |
| 59 | + |
| 60 | +```powershell |
| 61 | +node ./scripts/run-node-test-files.mjs tests/shared/ToolContractBundle.test.mjs tests/shared/AssetContract.test.mjs tests/shared/PaletteContract.test.mjs tests/shared/VectorAssetContract.test.mjs tests/shared/ToolStateContract.test.mjs tests/shared/ProjectContract.test.mjs tests/shared/IdentityPermissionsContract.test.mjs |
| 62 | +``` |
| 63 | + |
| 64 | +Result: PASS |
| 65 | + |
| 66 | +```text |
| 67 | +PASS tests/shared/ToolContractBundle.test.mjs |
| 68 | +PASS tests/shared/AssetContract.test.mjs |
| 69 | +PASS tests/shared/PaletteContract.test.mjs |
| 70 | +PASS tests/shared/VectorAssetContract.test.mjs |
| 71 | +PASS tests/shared/ToolStateContract.test.mjs |
| 72 | +PASS tests/shared/ProjectContract.test.mjs |
| 73 | +PASS tests/shared/IdentityPermissionsContract.test.mjs |
| 74 | +
|
| 75 | +7/7 targeted node test file(s) passed. |
| 76 | +``` |
| 77 | + |
| 78 | +```powershell |
| 79 | +git diff --check -- src/shared/contracts/toolContractBundle.js tests/shared/ToolContractBundle.test.mjs tests/fixtures/tools/tool-contract-bundle-scenarios.json |
| 80 | +``` |
| 81 | + |
| 82 | +Result: PASS with no output. |
| 83 | + |
| 84 | +```powershell |
| 85 | +node --input-type=module - <tool-contract-coverage-readback> |
| 86 | +``` |
| 87 | + |
| 88 | +Result: PASS |
| 89 | + |
| 90 | +- Active visible registered first-class tools discovered: 23 |
| 91 | +- Tool contracts defined: 34 |
| 92 | +- Registered first-class tools without contract: 0 |
| 93 | +- Root Tools Index cards reviewed: 18 |
| 94 | +- Root Tools Index cards skipped as non-tool surfaces: 2 |
| 95 | + |
| 96 | +## Expected PASS Behavior |
| 97 | + |
| 98 | +- All active visible registered first-class tools have matching contracts. |
| 99 | +- Root Tools Index card entries are contracted, mapped, or documented as skipped. |
| 100 | +- Valid tool contracts pass without errors. |
| 101 | +- Invalid tool contract fixtures return the exact expected contract error codes. |
| 102 | +- Saved tool contracts require owner and project. |
| 103 | +- Produced outputs are required. |
| 104 | +- Import/export formats and supported asset types use approved values. |
| 105 | +- Tool state payloads link back to their owning tool contract by `toolType`. |
| 106 | +- Private tool contracts deny ungranted viewers and allow granted project viewers. |
| 107 | +- Collaborators can edit granted active project tool contracts. |
| 108 | +- Viewers cannot edit tool contracts. |
| 109 | +- Marketplace tool contracts are visible. |
| 110 | +- Archived tool outputs reject edits unless policy explicitly allows archived output edits. |
| 111 | +- Portable tool contract exports preserve portable fields and remove owner/project/database identifiers. |
| 112 | + |
| 113 | +## Expected WARN Behavior |
| 114 | + |
| 115 | +- Root Marketplace and Arcade cards are documented as skipped because they target non-tool surfaces. |
| 116 | +- Repo-wide, samples, UI, CSS, HTML, database, authentication, and tool runtime validation were intentionally not run because they are outside this PR scope. |
0 commit comments