Skip to content

Refactor/unify projects collections - #73

Closed
s-adamantine wants to merge 7 commits into
developfrom
refactor/unify-projects-collections
Closed

Refactor/unify projects collections#73
s-adamantine wants to merge 7 commits into
developfrom
refactor/unify-projects-collections

Conversation

@s-adamantine

@s-adamantine s-adamantine commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR unifies the org.hypercerts.claim.project and org.hypercerts.claim.collection lexicons into a single org.hypercerts.claim.collection schema.

Changes

Schema Changes

  • Unified lexicon: Merged project.json and collection.json into a single collection.json schema
  • Added type field: Required field to distinguish between project, collection, or custom types
  • Added ext field: Optional metadata extension field (type: unknown) for custom properties
  • Removed project.json: No longer needed after unification
  • Updated activity.json: Removed the project field (back-reference) since activities can now belong to multiple collections/projects

Breaking Changes

⚠️ This is a breaking change. Code referencing org.hypercerts.claim.project must be updated to use org.hypercerts.claim.collection with the appropriate type value.

Summary by CodeRabbit

  • Refactor

    • Removed project concept and moved to a collection-centric model; activities now link via location instead of project.
  • New Features

    • Collections now require a type, include description and location references, and support richer title/summary and image formats.
    • Rights schema replaced with explicit name, type, description, optional attachment and createdAt.
  • Documentation

    • README updated to reflect the unified collection model.
  • Chores

    • Changeset added for lexicon unification.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot

changeset-bot Bot commented Jan 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 98f0d3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hypercerts-org/lexicon Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jan 20, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@s-adamantine has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c53f8db and 98f0d3c.

📒 Files selected for processing (23)
  • .changeset/unify-projects-collections.md
  • ERD.puml
  • README.md
  • lexicons/org/hypercerts/claim/collection.json
  • lexicons/org/hypercerts/claim/project.json
  • types/index.ts
  • types/lexicons.ts
  • types/types/app/certified/badge/award.ts
  • types/types/app/certified/badge/definition.ts
  • types/types/app/certified/badge/response.ts
  • types/types/app/certified/defs.ts
  • types/types/app/certified/location.ts
  • types/types/com/atproto/repo/strongRef.ts
  • types/types/org/hypercerts/claim/activity.ts
  • types/types/org/hypercerts/claim/collection.ts
  • types/types/org/hypercerts/claim/contribution.ts
  • types/types/org/hypercerts/claim/evaluation.ts
  • types/types/org/hypercerts/claim/evidence.ts
  • types/types/org/hypercerts/claim/measurement.ts
  • types/types/org/hypercerts/claim/rights.ts
  • types/types/org/hypercerts/defs.ts
  • types/types/org/hypercerts/funding/receipt.ts
  • types/util.ts
📝 Walkthrough

Walkthrough

This PR removes the project lexicon and consolidates project functionality into an expanded collection lexicon. activity no longer references project (project field removed), collection gains type and description (and other public property changes), ERD and README updated to reflect collection-centric relationships.

Changes

Cohort / File(s) Summary
Schema: Collection & Project
lexicons/org/hypercerts/claim/collection.json, lexicons/org/hypercerts/claim/project.json
Deleted project lexicon (.../project.json) entirely. Expanded collection (.../collection.json): added required type, added shortDescription and description (ref), tightened title constraints, updated media accept arrays; activities no longer required.
Schema: Activity
lexicons/org/hypercerts/claim/activity.json
Removed public project field (AT-URI) from activity defs; activityWeight.required formatting changed only.
Schema: Rights & README
lexicons/org/hypercerts/claim/rights.json, README.md
Rights schema replaced/rewritten with new properties (rightsName, rightsType, rightsDescription, attachment, createdAt); README updated to reflect collection-centric model and schema changes.
Diagrams / ERD
ERD.puml
Removed project dataclass and project→activity / project→location edges; replaced edges and references to use collection→activity and collection→location. Badge/diagram references updated to collection.
Metadata / Changeset
.changeset/unify-projects-collections.md
Added changeset entry describing unification of projects into collections (minor version bump; metadata only).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • aspiers
  • holkexyz

Poem

🐰 A hop and a nibble, the schemas rearrange,

Projects fold into collections — tidy and strange.
Activities point to places, diagrams redraw,
Fields shift like carrots in neat little rows.
Hooray — a rabbit’s cheer for the unified flow 🥕

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Refactor/unify projects collections' directly and clearly describes the main change: unifying the project and collection lexicons into a single schema.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Lexicon Documentation Sync ✅ Passed JSON lexicons, README.md, and ERD.puml are properly synchronized with project.json successfully deleted and no orphaned references.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@ERD.puml`:
- Around line 183-191: The ERD currently lists the collection field as required
with "activities[]"; update that field to be optional to match the lexicon by
changing "activities[]" to "activities[]?" (i.e., mark the activities array as
optional) in the entity definition that contains type, title, description,
avatar, coverPhoto, etc., so the ERD aligns with the schema.

In `@lexicons/org/hypercerts/claim/collection.json`:
- Around line 7-16: Update the version bump in the changeset file
beige-clowns-relax.md from "major" to "minor" to follow the project's 0.x
versioning policy; locate the beige-clowns-relax.md changeset and replace the
bump type value so it matches the expected "minor" (note that
unify-projects-collections.md already exists and should remain unchanged).

In `@README.md`:
- Around line 187-188: Remove the duplicate "location" row from the activity
table in README.md so only a single entry for the `location` property remains;
locate the two identical rows showing `| 'location' | 'ref' | ❌ | ... |
References must conform to 'app.certified.location' |` and delete one of them,
ensuring the activity table mirrors the lexicon definitions exactly.
🧹 Nitpick comments (1)
ERD.puml (1)

243-299: Remove duplicated edges/comments to avoid double arrows.

There are duplicate hidden/commented edges and duplicate relationships (collection→activity and activity→location) which can render twice and clutter the diagram.

🧹 Suggested cleanup
-'collection -d[hidden]-> activity
 'collection -d[hidden]-> activity
@@
-collection::activities --> activity
 collection::activities --> activity
 collection::location --> location
@@
-activity::location --> location
 activity::location --> location

Comment thread ERD.puml Outdated
Comment on lines +183 to +191
type
title
shortDescription
description?
avatar?
coverPhoto?
activities[]?
activities[]
location?
ext?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Mark activities optional to mirror the lexicon.

Line 189 shows activities[] as required, but the collection lexicon no longer requires it. The ERD should reflect optionality to avoid misleading consumers.

🩹 Proposed update
-    activities[]
+    activities[]?
As per coding guidelines, keep ERD entities aligned with lexicon schemas.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type
title
shortDescription
description?
avatar?
coverPhoto?
activities[]?
activities[]
location?
ext?
type
title
shortDescription
description?
avatar?
coverPhoto?
activities[]?
location?
ext?
🤖 Prompt for AI Agents
In `@ERD.puml` around lines 183 - 191, The ERD currently lists the collection
field as required with "activities[]"; update that field to be optional to match
the lexicon by changing "activities[]" to "activities[]?" (i.e., mark the
activities array as optional) in the entity definition that contains type,
title, description, avatar, coverPhoto, etc., so the ERD aligns with the schema.

Comment on lines +7 to +16
"description": "A group of hypercerts. Can be a project or a collection.",
"key": "tid",
"record": {
"type": "object",
"required": ["title", "activities", "createdAt"],
"required": [
"type",
"title",
"shortDescription",
"createdAt"
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check for existing changesets
find .changeset -type f -name "*.md" 2>/dev/null | head -20

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 150


🏁 Script executed:

# List all files in the .changeset directory to see what exists
ls -la .changeset/ 2>/dev/null || echo "No .changeset directory found"

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 399


🏁 Script executed:

# Search for references to hypercerts-org/lexicon in changesets
if [ -d .changeset ]; then
  find .changeset -type f -name "*.md" -exec cat {} + | head -100
else
  echo "No .changeset directory"
fi

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 2301


🏁 Script executed:

# Check git status or recent files to see what was modified in this PR
git diff --name-only HEAD~1 HEAD 2>/dev/null | grep -E "(lexicons|\.changeset|README|ERD)" || echo "Cannot determine via git, will use file inspection"

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 127


🏁 Script executed:

# Look for any changeset files with recent timestamps
find . -path ./.git -prune -o -name "*.md" -path "*/.changeset/*" -type f -print 2>/dev/null

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 154


🏁 Script executed:

# Check package.json for the current version
cat package.json | grep -A 2 '"version"'

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 215


🏁 Script executed:

# Check README.md for collection-related documentation
grep -n "collection" README.md -i | head -20

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 1400


🏁 Script executed:

# Check if ERD.puml exists and was updated
ls -la ERD.puml 2>/dev/null && echo "---" && cat ERD.puml | head -50

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 1061


Correct the version bump type in beige-clowns-relax.md changeset.

Changesets already exist (unify-projects-collections.md and beige-clowns-relax.md), but beige-clowns-relax.md incorrectly uses major for a 0.x version. Per the project's versioning policy, 0.x versions should use minor for breaking changes, not major. Change the version bump in beige-clowns-relax.md from major to minor.

🤖 Prompt for AI Agents
In `@lexicons/org/hypercerts/claim/collection.json` around lines 7 - 16, Update
the version bump in the changeset file beige-clowns-relax.md from "major" to
"minor" to follow the project's 0.x versioning policy; locate the
beige-clowns-relax.md changeset and replace the bump type value so it matches
the expected "minor" (note that unify-projects-collections.md already exists and
should remain unchanged).

Comment thread README.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@ERD.puml`:
- Around line 243-244: The ERD contains a duplicated hidden layout directive
"'collection -d[hidden]-> activity"; remove the redundant line so only a single
"'collection -d[hidden]-> activity" remains, keeping one hidden layout link
between the collection and activity entities.
- Around line 290-293: Remove the redundant duplicate edge between
collection::activities and activity in the ERD: keep a single
"collection::activities --> activity" line and delete the second identical
"collection::activities --> activity" entry so the diagram has only one edge
connecting collection::activities to activity.
- Around line 295-298: The ERD contains a duplicated relationship line
"activity::location --> location"; remove the redundant occurrence so only a
single "activity::location --> location" edge remains (leave the other relations
like "activity::contributions -l--> contribution" and "activity::rights -->
rights" untouched).

In `@README.md`:
- Around line 302-312: Update the README table entry for the collection schema
to mark the activities property as optional: change the Required column for
`activities` from ✅ to ❌ and ensure the description still notes "Array of
activities with their associated weights in this collection" and the reference
to `org.hypercerts.claim.activity#activityWeight` remains accurate so the docs
match the lexicon schema.
♻️ Duplicate comments (2)
ERD.puml (1)

183-191: Mark activities optional in the ERD.

The collection schema no longer requires activities, so the ERD should reflect optionality.

🩹 Proposed update
-    activities[]
+    activities[]?
As per coding guidelines, keep ERD entities aligned with lexicon schemas.
README.md (1)

187-188: Remove the duplicate location row in the activity table.

The location property is listed twice; keep one to avoid confusion.

🧹 Proposed fix
-| `location`         | `ref`    | ❌       | A strong reference to the location where the work for done hypercert was located    | References must conform to `app.certified.location`                       |
As per coding guidelines, README properties should mirror the lexicon definitions.

Comment thread ERD.puml
Comment thread ERD.puml
Comment thread ERD.puml Outdated
Comment thread README.md Outdated
Comment on lines +302 to +312
| Property | Type | Required | Description | Comments |
| ------------------ | -------- | -------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `type` | `string` | ✅ | The type of this group. Can be 'project', 'collection', or custom string| Known values: `project`, `collection` |
| `title` | `string` | ✅ | The title of this collection | |
| `shortDescription` | `string` | ❌ | A short description of this collection | |
| `description` | `ref` | ❌ | Rich-text description, represented as a Leaflet linear document | References must conform to `pub.leaflet.pages.linearDocument#main` |
| `avatar` | `blob` | ❌ | Primary avatar image representing this collection across apps and views | Typically a square image |
| `coverPhoto` | `blob` | ❌ | The cover photo of this collection | |
| `activities` | `array` | ✅ | Array of activities with their associated weights in this collection | Each item references `org.hypercerts.claim.activity#activityWeight` |
| `location` | `ref` | ❌ | A strong reference to a location record describing where the work took place| References must conform to `app.certified.location` |
| `ext` | `unknown`| ❌ | Optional metadata extension field | |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Mark activities optional in the collection table.

activities is no longer required in the collection schema, so the table should show ❌.

🩹 Proposed update
-| `activities`       | `array`  | ✅       | Array of activities with their associated weights in this collection    | Each item references `org.hypercerts.claim.activity#activityWeight` |
+| `activities`       | `array`  | ❌       | Array of activities with their associated weights in this collection    | Each item references `org.hypercerts.claim.activity#activityWeight` |
As per coding guidelines, README properties should mirror the lexicon definitions.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Property | Type | Required | Description | Comments |
| ------------------ | -------- | -------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `type` | `string` || The type of this group. Can be 'project', 'collection', or custom string| Known values: `project`, `collection` |
| `title` | `string` || The title of this collection | |
| `shortDescription` | `string` || A short description of this collection | |
| `description` | `ref` || Rich-text description, represented as a Leaflet linear document | References must conform to `pub.leaflet.pages.linearDocument#main` |
| `avatar` | `blob` || Primary avatar image representing this collection across apps and views | Typically a square image |
| `coverPhoto` | `blob` || The cover photo of this collection | |
| `activities` | `array` | | Array of activities with their associated weights in this collection | Each item references `org.hypercerts.claim.activity#activityWeight` |
| `location` | `ref` || A strong reference to a location record describing where the work took place| References must conform to `app.certified.location` |
| `ext` | `unknown`|| Optional metadata extension field | |
| Property | Type | Required | Description | Comments |
| ------------------ | -------- | -------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `type` | `string` || The type of this group. Can be 'project', 'collection', or custom string| Known values: `project`, `collection` |
| `title` | `string` || The title of this collection | |
| `shortDescription` | `string` || A short description of this collection | |
| `description` | `ref` || Rich-text description, represented as a Leaflet linear document | References must conform to `pub.leaflet.pages.linearDocument#main` |
| `avatar` | `blob` || Primary avatar image representing this collection across apps and views | Typically a square image |
| `coverPhoto` | `blob` || The cover photo of this collection | |
| `activities` | `array` | | Array of activities with their associated weights in this collection | Each item references `org.hypercerts.claim.activity#activityWeight` |
| `location` | `ref` || A strong reference to a location record describing where the work took place| References must conform to `app.certified.location` |
| `ext` | `unknown`|| Optional metadata extension field | |
🧰 Tools
🪛 LanguageTool

[style] ~304-~304: To form a complete sentence, be sure to include a subject.
Context: ...ng` | ✅ | The type of this group. Can be 'project', 'collection', or custom s...

(MISSING_IT_THERE)


[style] ~306-~306: Consider using the synonym “brief” (= concise, using a few words, not lasting long) to strengthen your wording.
Context: ...rtDescription|string` | ❌ | A short description of this collection ...

(QUICK_BRIEF)

🤖 Prompt for AI Agents
In `@README.md` around lines 302 - 312, Update the README table entry for the
collection schema to mark the activities property as optional: change the
Required column for `activities` from ✅ to ❌ and ensure the description still
notes "Array of activities with their associated weights in this collection" and
the reference to `org.hypercerts.claim.activity#activityWeight` remains accurate
so the docs match the lexicon schema.

@s-adamantine
s-adamantine force-pushed the refactor/unify-projects-collections branch from c53f8db to 98f0d3c Compare January 20, 2026 02:15
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.

2 participants