Skip to content

Commit 3294633

Browse files
committed
Add Download Grant contract tests and access delivery boundaries - PR_26152_086-download-grant-contract-tests
1 parent b7e2a1f commit 3294633

5 files changed

Lines changed: 2158 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Download Grant Contract Tests Validation
2+
3+
PR: `PR_26152_086-download-grant-contract-tests`
4+
5+
## Scope
6+
7+
- Added Download Grant contract definition under `src/shared/contracts`.
8+
- Added Download Grant fixture scenarios.
9+
- Added Download Grant targeted contract test suite.
10+
- Added Download Grant contract specification document.
11+
- No database, authentication, payment, CDN, storage, file delivery, UI, HTML, CSS, or runtime implementation changes.
12+
13+
## Commands
14+
15+
| Command | Result |
16+
| --- | --- |
17+
| `node --check src/shared/contracts/downloadGrantContract.js` | PASS |
18+
| `node --check tests/shared/DownloadGrantContract.test.mjs` | PASS |
19+
| `node tests/shared/DownloadGrantContract.test.mjs` | PASS |
20+
| `node tests/shared/EntitlementContract.test.mjs` | PASS |
21+
| `node tests/shared/MarketplaceListingContract.test.mjs` | PASS |
22+
| `node tests/shared/PublishContract.test.mjs` | PASS |
23+
| `node tests/shared/ReleaseContract.test.mjs` | PASS |
24+
| `node tests/shared/ProjectContract.test.mjs` | PASS |
25+
| `node tests/shared/IdentityPermissionsContract.test.mjs` | PASS |
26+
| `git diff --name-only -- '*.css' '*.html'` | PASS - no CSS or HTML changes |
27+
| `git diff --check` | PASS |
28+
29+
## Contract Coverage
30+
31+
Validated Download Grant rules:
32+
33+
- Download Grant requires owner.
34+
- Download Grant requires project.
35+
- Download Grant requires Entitlement linkage.
36+
- Download Grant requires Marketplace Listing linkage.
37+
- Download Grant requires source Release linkage.
38+
- Download Grant requires source Publish linkage.
39+
- `entitlement.ownerId` must match `ownerId`.
40+
- `entitlement.projectId` must match `projectId`.
41+
- `entitlement.listingId` must match `marketplaceListing.listingId`.
42+
- `entitlement.releaseId` must match `sourceRelease.releaseId`.
43+
- `entitlement.publishId` must match `sourcePublish.publishId`.
44+
- `marketplaceListing.projectId` must match `projectId`.
45+
- `marketplaceListing.releaseId` must match `sourceRelease.releaseId`.
46+
- `marketplaceListing.publishId` must match `sourcePublish.publishId`.
47+
- `sourcePublish.releaseId` must match `sourceRelease.releaseId`.
48+
- Grant status is limited to `active`, `expired`, `revoked`, and `consumed`.
49+
- Active grants require future `expiresAt`.
50+
- Expired grants require expired `expiresAt`.
51+
- Revoked grants require `revokedAt`.
52+
- Consumed grants require `consumedAt`.
53+
- Download Grant access remains owner-private unless platform administration permission applies.
54+
55+
Validated forbidden leakage:
56+
57+
- Payment state rejected.
58+
- Auth session state rejected.
59+
- Runtime state rejected.
60+
- ToolState data rejected.
61+
- File bytes rejected.
62+
- CDN implementation details rejected.
63+
- Storage implementation details rejected.
64+
65+
## Samples Decision
66+
67+
SKIP. This PR only changes shared contract definitions, contract fixtures, contract tests, docs/specs, and reports. Samples are not in scope.
68+
69+
## Playwright
70+
71+
Playwright impacted: No. This PR has no UI, runtime, tool behavior, rendering, or page changes.
72+
73+
## Manual Validation
74+
75+
1. Review `docs/dev/specs/DOWNLOAD_GRANT_CONTRACT.md`.
76+
2. Review `src/shared/contracts/downloadGrantContract.js`.
77+
3. Confirm Download Grant links to Entitlement, Marketplace Listing, owner, Project, Release, and Publish records.
78+
4. Confirm Download Grant does not carry payment, auth session, runtime, toolState, file bytes, CDN implementation, or storage implementation state.
79+
5. Confirm `docs/dev/reports/codex_review.diff` and `docs/dev/reports/codex_changed_files.txt` exist for review.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Download Grant Contract
2+
3+
## Purpose
4+
5+
The Download Grant contract defines a metadata-only authorization record for downloading marketplace content.
6+
7+
Download Grant links an owner to an Entitlement, Marketplace Listing, Project, Release, and Publish record. It does not store payment, auth session, runtime, toolState, file bytes, CDN implementation details, or storage implementation details.
8+
9+
## Ownership
10+
11+
- Every Download Grant requires `ownerId`.
12+
- `ownerId` is the user allowed to use the grant.
13+
- Download Grant access is owner-private unless platform administration permission applies.
14+
- Download Grant does not replace Entitlement, Marketplace Listing, Project, Release, or Publish ownership.
15+
16+
## Required Linkage
17+
18+
Download Grant 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+
## Grant Status
39+
40+
Allowed grant statuses:
41+
42+
- `active`
43+
- `expired`
44+
- `revoked`
45+
- `consumed`
46+
47+
Active and expired grants require `expiresAt`. Active grants must not be expired at validation time. Expired grants must have an expired `expiresAt` timestamp at validation time.
48+
49+
Revoked grants require `revokedAt`.
50+
51+
Consumed grants require `consumedAt`.
52+
53+
## Fields
54+
55+
- `downloadGrantId`
56+
- `ownerId`
57+
- `projectId`
58+
- `entitlement`
59+
- `marketplaceListing`
60+
- `sourceRelease`
61+
- `sourcePublish`
62+
- `grantStatus`
63+
- `grantedAt`
64+
- `expiresAt`
65+
- `revokedAt`
66+
- `consumedAt`
67+
- `grantNotes`
68+
69+
## Forbidden State
70+
71+
Download Grant records must not contain:
72+
73+
- payment state
74+
- auth session state
75+
- runtime state
76+
- toolState data
77+
- file bytes
78+
- CDN implementation details
79+
- storage implementation details
80+
81+
Delivery systems may use a Download Grant later, but CDN URLs, storage keys, file bytes, and download implementation details do not live inside the Download Grant contract.
82+
83+
## Non-Goals
84+
85+
- No database implementation.
86+
- No authentication implementation.
87+
- No payment implementation.
88+
- No CDN implementation.
89+
- No storage implementation.
90+
- No file delivery implementation.
91+
- No UI or runtime behavior changes.

0 commit comments

Comments
 (0)