Skip to content

Commit 1e43c82

Browse files
committed
Add Library Item contract tests and owned catalog boundaries - PR_26152_087-library-item-contract-tests
1 parent 3294633 commit 1e43c82

5 files changed

Lines changed: 2001 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Library Item Contract Tests Validation
2+
3+
PR: `PR_26152_087-library-item-contract-tests`
4+
5+
## Scope
6+
7+
- Added Library Item contract definition under `src/shared/contracts`.
8+
- Added Library Item fixture scenarios.
9+
- Added Library Item targeted contract test suite.
10+
- Added Library Item contract specification document.
11+
- No database, authentication, payment, CDN, install, file delivery, UI, HTML, CSS, or runtime implementation changes.
12+
13+
## Commands
14+
15+
| Command | Result |
16+
| --- | --- |
17+
| `node --check src/shared/contracts/libraryItemContract.js` | PASS |
18+
| `node --check tests/shared/LibraryItemContract.test.mjs` | PASS |
19+
| `node tests/shared/LibraryItemContract.test.mjs` | PASS |
20+
| `node tests/shared/DownloadGrantContract.test.mjs` | PASS |
21+
| `node tests/shared/EntitlementContract.test.mjs` | PASS |
22+
| `node tests/shared/MarketplaceListingContract.test.mjs` | PASS |
23+
| `node tests/shared/PublishContract.test.mjs` | PASS |
24+
| `node tests/shared/ReleaseContract.test.mjs` | PASS |
25+
| `node tests/shared/ProjectContract.test.mjs` | PASS |
26+
| `node tests/shared/IdentityPermissionsContract.test.mjs` | PASS |
27+
| `git diff --name-only -- '*.css' '*.html'` | PASS - no CSS or HTML changes |
28+
| `git diff --check` | PASS |
29+
30+
## Contract Coverage
31+
32+
Validated Library Item rules:
33+
34+
- Library Item requires owner.
35+
- Library Item requires project.
36+
- Library Item requires Entitlement linkage.
37+
- Library Item requires Marketplace Listing linkage.
38+
- Library Item requires source Release linkage.
39+
- Library Item requires source Publish linkage.
40+
- `entitlement.ownerId` must match `ownerId`.
41+
- `entitlement.projectId` must match `projectId`.
42+
- `entitlement.listingId` must match `marketplaceListing.listingId`.
43+
- `entitlement.releaseId` must match `sourceRelease.releaseId`.
44+
- `entitlement.publishId` must match `sourcePublish.publishId`.
45+
- `marketplaceListing.projectId` must match `projectId`.
46+
- `marketplaceListing.releaseId` must match `sourceRelease.releaseId`.
47+
- `marketplaceListing.publishId` must match `sourcePublish.publishId`.
48+
- `sourcePublish.releaseId` must match `sourceRelease.releaseId`.
49+
- Library status is limited to `available`, `hidden`, `revoked`, and `archived`.
50+
- All Library Items require `addedAt`.
51+
- Hidden Library Items require `hiddenAt`.
52+
- Revoked Library Items require `revokedAt`.
53+
- Archived Library Items require `archivedAt`.
54+
- Library Item access remains owner-private unless platform administration permission applies.
55+
56+
Validated forbidden leakage:
57+
58+
- Payment state rejected.
59+
- Auth session state rejected.
60+
- Runtime state rejected.
61+
- ToolState data rejected.
62+
- File bytes rejected.
63+
- CDN details rejected.
64+
- Install state rejected.
65+
66+
## Samples Decision
67+
68+
SKIP. This PR only changes shared contract definitions, contract fixtures, contract tests, docs/specs, and reports. Samples are not in scope.
69+
70+
## Playwright
71+
72+
Playwright impacted: No. This PR has no UI, runtime, tool behavior, rendering, or page changes.
73+
74+
## Manual Validation
75+
76+
1. Review `docs/dev/specs/LIBRARY_ITEM_CONTRACT.md`.
77+
2. Review `src/shared/contracts/libraryItemContract.js`.
78+
3. Confirm Library Item links to Entitlement, Marketplace Listing, Project, Release, Publish, and owner records.
79+
4. Confirm Library Item does not carry payment, auth session, runtime, toolState, file bytes, CDN details, or install state.
80+
5. Confirm `docs/dev/reports/codex_review.diff` and `docs/dev/reports/codex_changed_files.txt` exist for review.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Library Item Contract
2+
3+
## Purpose
4+
5+
The Library Item contract defines a user's persisted catalog entry for marketplace content.
6+
7+
Library Item links an owner to an Entitlement, Marketplace Listing, Project, Release, and Publish record. It does not store payment state, auth session state, runtime state, toolState data, file bytes, CDN details, or install state.
8+
9+
## Ownership
10+
11+
- Every Library Item requires `ownerId`.
12+
- `ownerId` is the user whose library contains the item.
13+
- Library Item access is owner-private unless platform administration permission applies.
14+
- Library Item does not replace Entitlement, Marketplace Listing, Project, Release, or Publish ownership.
15+
16+
## Required Linkage
17+
18+
Library Item requires:
19+
20+
- `projectId`
21+
- `entitlement`
22+
- `marketplaceListing`
23+
- `sourceRelease`
24+
- `sourcePublish`
25+
26+
Required consistency:
27+
28+
- `entitlement.ownerId` must match `ownerId`.
29+
- `entitlement.projectId` must match `projectId`.
30+
- `entitlement.listingId` must match `marketplaceListing.listingId`.
31+
- `entitlement.releaseId` must match `sourceRelease.releaseId`.
32+
- `entitlement.publishId` must match `sourcePublish.publishId`.
33+
- `marketplaceListing.projectId` must match `projectId`.
34+
- `marketplaceListing.releaseId` must match `sourceRelease.releaseId`.
35+
- `marketplaceListing.publishId` must match `sourcePublish.publishId`.
36+
- `sourcePublish.releaseId` must match `sourceRelease.releaseId`.
37+
38+
## Library Status
39+
40+
Allowed library item statuses:
41+
42+
- `available`
43+
- `hidden`
44+
- `revoked`
45+
- `archived`
46+
47+
All Library Items require `addedAt`.
48+
49+
Hidden Library Items require `hiddenAt`.
50+
51+
Revoked Library Items require `revokedAt`.
52+
53+
Archived Library Items require `archivedAt`.
54+
55+
## Fields
56+
57+
- `libraryItemId`
58+
- `ownerId`
59+
- `projectId`
60+
- `entitlement`
61+
- `marketplaceListing`
62+
- `sourceRelease`
63+
- `sourcePublish`
64+
- `libraryStatus`
65+
- `addedAt`
66+
- `hiddenAt`
67+
- `revokedAt`
68+
- `archivedAt`
69+
- `libraryNotes`
70+
71+
## Forbidden State
72+
73+
Library Item records must not contain:
74+
75+
- payment state
76+
- auth session state
77+
- runtime state
78+
- toolState data
79+
- file bytes
80+
- CDN details
81+
- install state
82+
83+
Installation systems may use a Library Item later, but install paths, installed files, launcher state, CDN URLs, file bytes, and runtime state do not live inside the Library Item contract.
84+
85+
## Non-Goals
86+
87+
- No database implementation.
88+
- No authentication implementation.
89+
- No payment implementation.
90+
- No CDN implementation.
91+
- No install implementation.
92+
- No file delivery implementation.
93+
- No UI or runtime behavior changes.

0 commit comments

Comments
 (0)