Skip to content

Add vocabulary relating to proposals, intentions and measures. #579

Open
scammo wants to merge 10 commits intofedify-dev:mainfrom
54GradSoftware:main
Open

Add vocabulary relating to proposals, intentions and measures. #579
scammo wants to merge 10 commits intofedify-dev:mainfrom
54GradSoftware:main

Conversation

@scammo
Copy link

@scammo scammo commented Feb 21, 2026

Summary

Add vocabulary relating to proposals, intentions and measures according to the docs.

Related issue

Reference the related issue(s) by number, e.g.:

Changes

  • Add vocabulary: "proposals", "intentions" and "measures".

Benefits

Users can now build a federated system based on the first part of FEP-0837: Federated Marketplace (https://codeberg.org/fediverse/fep/src/branch/main/fep/0837/fep-0837.md). This is really interesting for making offered goods or services available for discovery in the Fediverse.

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you run mise test on your machine?

Additional notes

Please note that this is both my first pull request and my first enhancement issue for this project. While I have extensive Mastodon/event experience, I have no prior experience of enhancing federation tooling directly. I am happy to make any necessary changes or additions. Thank you for your work!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @scammo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the @fedify/vocab package by introducing new vocabulary types crucial for building federated marketplace functionalities. These additions enable users to define and exchange information about proposals, economic intentions, and measurable quantities, laying the groundwork for implementing the first part of the Federated Marketplace FEP-0837. This expands the system's capability to describe and discover offered goods or services across the Fediverse.

Highlights

  • New Vocabulary Classes: Introduced Proposal, Intent, and Measure classes to support economic resource coordination in federated networks.
  • Proposal Class: Added the Proposal class for publishing offers or requests, including properties for purpose, primary intent (publishes), reciprocal intent (reciprocal), and whether it is unit-based.
  • Intent Class: Defined the Intent class to describe economic transactions within a proposal, with properties such as action, resourceConformsTo, resourceQuantity, availableQuantity, and minimumQuantity.
  • Measure Class: Implemented the Measure class for representing quantities with units, featuring hasUnit and hasNumericalValue properties.
  • Changelog Update: Updated the CHANGES.md file to document the addition of these new vocabulary types under @fedify/vocab.
Changelog
  • CHANGES.md
    • Added new entries under @fedify/vocab for the Proposal, Intent, and Measure classes.
    • Included details about the properties of each new class.
  • packages/vocab/src/snapshots/vocab.test.ts.snap
    • Updated snapshots to include Measure objects.
    • Updated snapshots to include Intent objects.
    • Updated snapshots to include Proposal objects.
  • packages/vocab/src/intent.yaml
    • Added the YAML definition for the Intent vocabulary type.
    • Defined properties like action, resourceConformsTo, resourceQuantity, availableQuantity, and minimumQuantity for Intent.
  • packages/vocab/src/measure.yaml
    • Added the YAML definition for the Measure vocabulary type.
    • Defined hasUnit and hasNumericalValue properties for Measure.
  • packages/vocab/src/proposal.yaml
    • Added the YAML definition for the Proposal vocabulary type.
    • Defined properties like purpose, publishes, reciprocal, and unitBased for Proposal.
Activity
  • The author, scammo, has submitted their first pull request and enhancement issue for this project.
  • The author has extensive Mastodon/event experience but is new to federation tooling directly.
  • The author is open to making any necessary changes or additions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@issues-auto-labeler issues-auto-labeler bot added activitypub/interop Interoperability issues component/collections Collections related component/federation Federation object related labels Feb 21, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new vocabulary types for economic resource coordination, specifically Proposal, Intent, and Measure, based on FEP-0837. This is a great addition that will enable building federated marketplace applications with Fedify.

The implementation is well-done, with new YAML definitions for the vocabulary generator and corresponding test snapshot updates. I have a few minor suggestions to improve the changes:

  • In CHANGES.md, please add your name to the changelog entry as per the contribution guidelines and remove an unused reference link.
  • In packages/vocab/src/measure.yaml, the hasNumericalValue property should use a numeric type (xsd:float) instead of xsd:string for better type safety and interoperability.

Thank you for your contribution, especially as a first-time contributor! These changes are valuable to the project.

@dahlia dahlia added the component/vocab Activity Vocabulary related label Feb 21, 2026
scammo and others added 4 commits February 24, 2026 15:15
# Conflicts:
#	CHANGES.md
#	packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap
#	packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap
#	packages/vocab-tools/src/__snapshots__/class.test.ts.snap
@scammo
Copy link
Author

scammo commented Feb 26, 2026

FYI: I updated the comments, CHANGES.md and the snapshots to the current version :)

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@scammo
Copy link
Author

scammo commented Mar 12, 2026

FYI: I resolved the conversation and I created a new enhencement issue #617

Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @scammo! This is a solid first step toward FEP-0837 support. I have a few design questions and some formatting issues to address before merging.

name: Proposal
compactName: Proposal
uri: "https://w3id.org/valueflows/ont/vf#Proposal"
extends: "https://www.w3.org/ns/activitystreams#Object"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to FEP-0837, Proposal is a pure ValueFlows type, not an ActivityStreams Object. However, I see you've set extends: "https://www.w3.org/ns/activitystreams#Object" here.

This does have a practical benefit: inheriting properties like name, content, attributedTo, published, to, and location that the spec recommends for Proposal. So it may be an intentional design choice. Could you clarify the reasoning?

If the intent is to reuse AS properties for interoperability, that's reasonable, but it should be documented (e.g., in the description) so future maintainers understand this is a deliberate deviation from the spec rather than an oversight.

$schema: ../../vocab-tools/schema.yaml
name: Intent
compactName: Intent
uri: "https://w3id.org/valueflows/ont/vf#Intent"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intent is marked as entity: true, which means it can be independently fetched by URI. In FEP-0837, Intents are typically embedded within a Proposal and use fragment URIs (e.g., #primary, #reciprocal), which suggests they function more as embedded value objects.

Is there a use case where an Intent would be fetched independently outside of its parent Proposal? If not, entity: false might be more appropriate, similar to how Measure is defined.

Also, unlike Proposal, Intent has no extends field. If Proposal extends Object for practical reasons (reusing name, content, etc.), should Intent also extend Object for consistency, or is the asymmetry intentional?

Comment on lines +18 to +32
Proposal: "vf:Proposal"
Intent: "vf:Intent"
purpose: "vf:purpose"
unitBased: "vf:unitBased"
publishes: "vf:publishes"
reciprocal: "vf:reciprocal"
action: "vf:action"
resourceConformsTo:
"@id": "vf:resourceConformsTo"
"@type": "@id"
resourceQuantity: "vf:resourceQuantity"
availableQuantity: "vf:availableQuantity"
minimumQuantity: "vf:minimumQuantity"
hasUnit: "om2:hasUnit"
hasNumericalValue: "om2:hasNumericalValue"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defaultContext here includes mappings for Intent, action, resourceConformsTo, hasUnit, hasNumericalValue, etc. These are properties that belong to Intent and Measure, not to Proposal itself.

I understand this is likely to ensure correct JSON-LD serialization when Intent/Measure objects are embedded. However, each of those types already defines its own defaultContext. Could you verify that the code generator handles nested contexts correctly without this duplication? If the duplication is necessary, a comment explaining why would be helpful.

The amount of the resource. If not specified, arbitrary amounts can be
used when responding to the proposal.
range:
- "http://www.w3.org/2001/XMLSchema#string"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this was already discussed and xsd:string was agreed upon as a pragmatic stopgap until xsd:decimal support is added (#617). That's fine for now.

One small suggestion: it would be helpful to add a note in the description field mentioning that xsd:string is a temporary choice and that the value should represent a decimal number. This helps consumers of the API understand the expected format. For example:

description: |
  The amount of the resource, represented as a decimal string.  If not
  specified, arbitrary amounts can be used when responding to the proposal.

  NOTE: This property uses `xsd:string` as a temporary measure until
  `xsd:decimal` is supported.  See #617.

Comment on lines 622 to +636

### @fedify/vocab

- Added vocabulary types for economic resource coordination
in federated networks. [[#578]]

- Added `Proposal` class for publishing offers or requests.
- Added `Intent` class for describing economic transactions within
a proposal, with `action`, `resourceConformsTo`, `resourceQuantity`,
`availableQuantity`, and `minimumQuantity` properties.
- Added `Measure` class for representing quantities with units of
measure, with `hasUnit` and `hasNumericalValue` properties.

[#578]: https://github.com/fedify-dev/fedify/issues/578
[ValueFlows]: https://www.valueflo.ws/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These entries appear under the Version 1.5.0 section, which has already been released. Since this PR hasn't been merged yet, the changelog entry should only appear in the unreleased section at the top. Please remove this duplicate block.

Also, the [#578] reference link is defined twice (once in each section), and the [ValueFlows] reference link is defined but never used. Please clean these up.

Comment on lines +84 to +89
- Added vocabulary types for economic resource coordination
in federated networks. [[#578] by scammo]
- Added `Proposal` class for publishing offers or requests.
- Added `Intent` class for describing economic transactions within
a proposal, with `action`, `resourceConformsTo`, `resourceQuantity`,
`availableQuantity`, and `minimumQuantity` properties.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sub-items (Proposal, Intent, Measure) should be nested under the summary line rather than being flat siblings. Also, please run mise run fmt to fix Hongdown formatting issues.

Suggested structure:

 -  Added vocabulary types for economic resource coordination
    in federated networks.  [[#578] by Samuel Brinkmann]

     -  Added `Proposal` class for publishing offers or requests.
     -  Added `Intent` class for describing economic transactions within
        a proposal, with `action`, `resourceConformsTo`, `resourceQuantity`,
        `availableQuantity`, and `minimumQuantity` properties.
     -  Added `Measure` class for representing quantities with units of
        measure, with `hasUnit` and `hasNumericalValue` properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

activitypub/interop Interoperability issues component/collections Collections related component/federation Federation object related component/vocab Activity Vocabulary related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants