Skip to content

Commit b7e2a1f

Browse files
committed
Add Entitlement contract tests and access ownership boundaries - PR_26152_085-entitlement-contract-tests
1 parent fb9d59c commit b7e2a1f

5 files changed

Lines changed: 1453 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Entitlement Contract Tests Validation
2+
3+
PR: `PR_26152_085-entitlement-contract-tests`
4+
5+
## Scope
6+
7+
- Added Entitlement contract definition under `src/shared/contracts`.
8+
- Added Entitlement fixture scenarios.
9+
- Added Entitlement targeted contract test suite.
10+
- Added Entitlement contract specification document.
11+
- No database, authentication, payment, download, UI, HTML, CSS, or runtime implementation changes.
12+
13+
## Commands
14+
15+
| Command | Result |
16+
| --- | --- |
17+
| `node --check src/shared/contracts/entitlementContract.js` | PASS |
18+
| `node --check tests/shared/EntitlementContract.test.mjs` | PASS |
19+
| `node tests/shared/EntitlementContract.test.mjs` | PASS |
20+
| `node tests/shared/MarketplaceListingContract.test.mjs` | PASS |
21+
| `node tests/shared/PublishContract.test.mjs` | PASS |
22+
| `node tests/shared/ReleaseContract.test.mjs` | PASS |
23+
| `node tests/shared/ProjectContract.test.mjs` | PASS |
24+
| `node tests/shared/IdentityPermissionsContract.test.mjs` | PASS |
25+
| `git diff --name-only -- '*.css' '*.html'` | PASS - no CSS or HTML changes |
26+
| `git diff --check` | PASS |
27+
28+
## Contract Coverage
29+
30+
Validated Entitlement rules:
31+
32+
- Entitlement requires owner.
33+
- Entitlement requires project.
34+
- Entitlement requires marketplace listing linkage.
35+
- Entitlement requires source Release linkage.
36+
- Entitlement requires source Publish linkage.
37+
- `marketplaceListing.projectId` must match `projectId`.
38+
- `marketplaceListing.releaseId` must match `sourceRelease.releaseId`.
39+
- `marketplaceListing.publishId` must match `sourcePublish.publishId`.
40+
- `sourcePublish.releaseId` must match `sourceRelease.releaseId`.
41+
- Entitlement types are limited to `owned`, `licensed`, `granted`, and `revoked`.
42+
- Active entitlement types require `grantedAt`.
43+
- Revoked entitlements require `revokedAt`.
44+
- Entitlement access remains owner-private unless platform administration permission applies.
45+
46+
Validated forbidden leakage:
47+
48+
- Payment state rejected.
49+
- Auth session state rejected.
50+
- Runtime state rejected.
51+
- ToolState data rejected.
52+
- Download state rejected.
53+
54+
## Samples Decision
55+
56+
SKIP. This PR only changes shared contract definitions, contract fixtures, contract tests, docs/specs, and reports. Samples are not in scope.
57+
58+
## Playwright
59+
60+
Playwright impacted: No. This PR has no UI, runtime, tool behavior, rendering, or page changes.
61+
62+
## Manual Validation
63+
64+
1. Review `docs/dev/specs/ENTITLEMENT_CONTRACT.md`.
65+
2. Review `src/shared/contracts/entitlementContract.js`.
66+
3. Confirm Entitlement links to Marketplace Listing, Project, Release, and Publish records without carrying payment, auth session, runtime, toolState, or download state.
67+
4. Confirm `docs/dev/reports/codex_review.diff` and `docs/dev/reports/codex_changed_files.txt` exist for review.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Entitlement Contract
2+
3+
## Purpose
4+
5+
The Entitlement contract defines a user-owned access record for marketplace content.
6+
7+
Entitlement links a user owner to a Marketplace Listing, Project, Release, and Publish record. It does not store payment, auth session, runtime, toolState, or download state.
8+
9+
## Ownership
10+
11+
- Every Entitlement requires `ownerId`.
12+
- `ownerId` is the user who owns the entitlement record.
13+
- Entitlement access is owner-private unless platform policy grants administration.
14+
- Entitlement does not replace Project ownership or Marketplace Listing ownership.
15+
16+
## Required Linkage
17+
18+
Entitlement requires:
19+
20+
- `projectId`
21+
- `marketplaceListing`
22+
- `sourceRelease`
23+
- `sourcePublish`
24+
25+
Required consistency:
26+
27+
- `marketplaceListing.projectId` must match `projectId`.
28+
- `marketplaceListing.releaseId` must match `sourceRelease.releaseId`.
29+
- `marketplaceListing.publishId` must match `sourcePublish.publishId`.
30+
- `sourcePublish.releaseId` must match `sourceRelease.releaseId`.
31+
32+
## Entitlement Types
33+
34+
Allowed entitlement types:
35+
36+
- `owned`
37+
- `licensed`
38+
- `granted`
39+
- `revoked`
40+
41+
Active entitlement types require `grantedAt`. Revoked entitlements require `revokedAt`.
42+
43+
## Fields
44+
45+
- `entitlementId`
46+
- `ownerId`
47+
- `projectId`
48+
- `marketplaceListing`
49+
- `sourceRelease`
50+
- `sourcePublish`
51+
- `entitlementType`
52+
- `grantedAt`
53+
- `revokedAt`
54+
- `entitlementNotes`
55+
56+
## Forbidden State
57+
58+
Entitlement records must not contain:
59+
60+
- payment state
61+
- auth session state
62+
- runtime state
63+
- toolState data
64+
- download state
65+
66+
Payment, authentication, runtime sessions, toolState payloads, and download workflows may link to Entitlement later, but their state does not live inside the Entitlement contract.
67+
68+
## Non-Goals
69+
70+
- No database implementation.
71+
- No authentication implementation.
72+
- No payment implementation.
73+
- No download implementation.
74+
- No UI or runtime behavior changes.

0 commit comments

Comments
 (0)