Skip to content

Require an agreement's terms.deliverable to match its listing's deliverable - #259

Merged
randomblocker merged 2 commits into
phase0-completionfrom
contrib/community-249-terms-deliverable
Nov 6, 2026
Merged

randomblocker merged 2 commits into
phase0-completionfrom
contrib/community-249-terms-deliverable

Conversation

@randomblocker

@randomblocker randomblocker commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

The Directory accepted an agreement with no terms.deliverable, or with one that differed from the listing's offered deliverable. Under DACS-3 §8.5.2 item 4, terms.deliverable is a required DeliverableRef. Its deliverableType, its hash (sha256 hex of the anchored offering.deliverable, built the same way as the SDK builds it) and its schemaUrl must equal the listing's.

What changes (reference-implementations/dacs-directory):

  • A missing or mistyped terms.deliverable is now refused as a malformed agreement, and discovery refuses it too. The shape check matches the pinned SDK validator: only deliverableType, hash and schemaUrl, and only the four deliverable kinds.
  • A one-time startup step (agreement-deliverable-schema-version) clears deal credit saved before this rule (verified and eligible flags, ratings) and recomputes reputation, keeping Listings, withdrawal evidence and scan pointers. The next successful reindex re-earns credit under the new rule.
  • A well-formed value whose kind, hash or schemaUrl differs from the listing's is refused as not matching its listing.
  • The new test/agreement-deliverable.test.ts covers missing, wrong-type, extra-member, unknown-kind, equal and different values for both agreement profiles; test/agreement-deliverable-migration.test.ts covers the startup step and that it runs once. The shared agreement fixtures and four inline agreement fixtures in other tests now carry the matching deliverable. No assertion was weakened.

Known limits:

  • An agreement against a listing with no offering.deliverable is refused by construction. No test covers this path, because such a listing is not admitted with the current fixtures.
  • schemaUrl is compared exactly for every deliverable kind, as the Standard says, even though the SDK only writes it for storage-program.
  • A hash with a sha256: prefix or in uppercase is refused. The Standard says hex, and the SDK writes bare lowercase.

Closes #249

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

randomblocker and others added 2 commits November 6, 2026 12:00
…erable

DACS-3 8.5.2 item 4: terms.deliverable is a required DeliverableRef whose
deliverableType, hash (sha256 hex of the anchored offering.deliverable) and
schemaUrl must equal those of the listing. A missing or mistyped value is a
malformed agreement; a well-formed value that differs does not match its
listing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e deliverable rule

deliverableRefShapeOk now accepts exactly what the pinned SDK validator
accepts: only deliverableType, hash and schemaUrl, one of the four
deliverable kinds, and a bare lowercase sha256 hex hash.

A one-time startup step, keyed agreement-deliverable-schema-version, clears
derived deal credit (refsVerified, reputationEligible, ratings) and
recomputes reputation, so a catalog saved before the rule stops serving
credit for deals whose Agreement now fails. Listings, withdrawal evidence
and scan pointers are kept.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@randomblocker
randomblocker marked this pull request as ready for review November 6, 2026 14:39
@randomblocker
randomblocker merged commit f7de5af into phase0-completion Nov 6, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant