Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/add-post-lexicon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hypercerts-org/lexicon": minor
---

Add org.hypercerts.claim.post lexicon for updates, reports, and comments on hypercerts records
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure about the .claim. domain because this can point to many things, including evidence, that aren't directly the claim

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, I feel like the whole folder structure isn't super ideal yet, but don't have a very clear alternative.

regarding evidence, that is claim.attachment, so claim.post would for that. I agree with you in general though... will think about the folder structure more

16 changes: 16 additions & 0 deletions ERD.puml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,19 @@ dataclass collection {
!endif
}

' org.hypercerts.claim.post
dataclass post {
!if (SHOW_FIELDS == "true")
text
replies[]?
embed?
labels?
tags[]?
attachments[]?
createdAt
!endif
}

' org.hypercerts.context.acknowledgement
dataclass acknowledgement {
!if (SHOW_FIELDS == "true")
Expand Down Expand Up @@ -384,6 +397,9 @@ fundingReceipt::to --> contributorEntity

fundingReceipt::for --> activity : funds

post::replies --> activity : "replies to"
post::replies --> collection : "replies to"

badgeAward::badge --> badgeDefinition
badgeResponse::badgeAward --> badgeAward
badgeAward::subject --> contributorInformation
Expand Down
30 changes: 30 additions & 0 deletions SCHEMAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,36 @@ Hypercerts-specific lexicons for tracking impact work and claims.

---

### `org.hypercerts.claim.post`

**Description:** Record containing a hypercerts post, e.g. an update, a report, a comment.

**Key:** `tid`

#### Properties

| Property | Type | Required | Description | Comments |
| ------------- | ---------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| `text` | `string` | ❌ | The primary post content. May be an empty string, if there are embeds. | maxLength: 50000, maxGraphemes: 5000 |
| `facets` | `ref[]` | ❌ | Annotations of text (mentions, URLs, hashtags, etc.) | |
| `replies` | `ref[]` | ❌ | The subjects that this post is in reply to. Each entry identifies a thread root and the direct parent being replied to. | maxLength: 10 |
| `embed` | `union` | ❌ | The primary featured media for this post (images, video, external link, or quoted record). | |
| `labels` | `union` | ❌ | Self-label values for this post. Effectively content warnings. | |
| `tags` | `string[]` | ❌ | Additional hashtags, in addition to any included in post text and facets. | maxLength: 8 |
| `attachments` | `union[]` | ❌ | The files, documents, or external references attached to this post. | maxLength: 100 |
| `createdAt` | `string` | ✅ | Client-declared timestamp when this post was originally created. | |

#### Defs

##### `org.hypercerts.claim.post#replyRef`

| Property | Type | Required | Description |
| -------- | ----- | -------- | ------------------------------------------------------------------------------------------ |
| `root` | `ref` | ✅ | The root record of the thread being replied to. |
| `parent` | `ref` | ✅ | The direct parent record being replied to (may be the same as root for top-level replies). |

---

### `org.hypercerts.claim.rights`

**Description:** Describes the rights that a contributor and/or an owner has, such as whether the hypercert can be sold, transferred, and under what conditions.
Expand Down
90 changes: 90 additions & 0 deletions lexicons/org/hypercerts/claim/post.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"lexicon": 1,
"id": "org.hypercerts.claim.post",
"defs": {
"main": {
"type": "record",
"description": "Record containing a hypercerts post, e.g. an update, a report, a comment.",
"key": "tid",
"record": {
"type": "object",
"required": ["createdAt"],
"properties": {
"text": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The description is in opposition with required. Requiring an empty string doesn't make much sense

"type": "string",
"maxLength": 50000,
"maxGraphemes": 5000,
"description": "The primary post content. May be an empty string, if there are embeds."
},
"facets": {
"type": "array",
"description": "Annotations of text (mentions, URLs, hashtags, etc.)",
"items": { "type": "ref", "ref": "app.bsky.richtext.facet" }
},
"replies": {
"type": "array",
"description": "The subjects that this post is in reply to. Each entry identifies a thread root and the direct parent being replied to.",
"items": { "type": "ref", "ref": "#replyRef" },
"maxLength": 10
},
"embed": {
"type": "union",
"description": "The primary featured media for this post (images, video, external link, or quoted record).",
"refs": [
"app.bsky.embed.images",
"app.bsky.embed.video",
"app.bsky.embed.external",
"app.bsky.embed.record",
"app.bsky.embed.recordWithMedia"
]
},
"labels": {
"type": "union",
"description": "Self-label values for this post. Effectively content warnings.",
"refs": ["com.atproto.label.defs#selfLabels"]
},
"tags": {
"type": "array",
"description": "Additional hashtags, in addition to any included in post text and facets.",
"maxLength": 8,
"items": { "type": "string", "maxLength": 640, "maxGraphemes": 64 }
},
"attachments": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and this is functionally different from embeds?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, there is just one main embed, but if you want to add just more files, you can with the attachment.

"type": "array",
"description": "The files, documents, or external references attached to this post.",
"items": {
"type": "union",
"refs": [
"org.hypercerts.defs#uri",
"org.hypercerts.defs#smallBlob"
]
},
"maxLength": 100
},
"createdAt": {
"type": "string",
"format": "datetime",
"description": "Client-declared timestamp when this post was originally created."
}
}
}
},
"replyRef": {
"type": "object",
"description": "Identifies the thread root and direct parent that this post is replying to.",
"required": ["root", "parent"],
"properties": {
"root": {
"type": "ref",
"ref": "com.atproto.repo.strongRef",
"description": "The root record of the thread being replied to."
},
"parent": {
"type": "ref",
"ref": "com.atproto.repo.strongRef",
"description": "The direct parent record being replied to (may be the same as root for top-level replies)."
}
}
}
}
}
Comment on lines +1 to +90
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:

#!/bin/bash
# First, check if ERD.puml exists and its current state
if [ -f "ERD.puml" ]; then
  echo "=== ERD.puml exists ==="
  wc -l ERD.puml
  echo ""
  echo "=== Checking for post-related references in ERD.puml ==="
  grep -n "post\|Post" ERD.puml || echo "(no 'post' references found)"
else
  echo "ERD.puml does not exist"
fi

echo ""
echo "=== Checking if ERD.puml was modified in this PR ==="
git diff --name-only 2>/dev/null | head -20

echo ""
echo "=== Repository structure (checking for diagram files) ==="
find . -maxdepth 2 -name "*.puml" -o -name "*ERD*" -o -name "*erd*" 2>/dev/null | head -20

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 411


🏁 Script executed:

#!/bin/bash
# Check the git log to see recent changes to ERD.puml
echo "=== Recent git history for ERD.puml ==="
git log --oneline --all -- ERD.puml 2>/dev/null | head -10 || echo "No git history available"

echo ""
echo "=== Files in the repository root ==="
ls -la | head -30

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 2522


🏁 Script executed:

#!/bin/bash
# Read the ERD.puml file to see its current structure
echo "=== ERD.puml content ==="
cat -n ERD.puml

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 9787


🏁 Script executed:

#!/bin/bash
# Check the git diff for the commit that added post.json to see if ERD.puml was modified
echo "=== Git diff for d597c87 (post.json commit) ==="
git show d597c87 --stat

echo ""
echo "=== Did post.json commit touch ERD.puml? ==="
git show d597c87 --name-only | grep -i "erd\|post"

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 7447


Add post entity to ERD.puml.

The new post lexicon introduces a record type with relationships (replyRef → com.atproto.repo.strongRef, attachments → org.hypercerts.defs#{uri,smallBlob}), but ERD.puml was not updated. Add the post entity and its relationships to the diagram, omitting the facets field (which is a cosmetic annotation). Per coding guidelines, ERD.puml must reflect all entity relationships whenever lexicons are added or modified.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lexicons/org/hypercerts/claim/post.json` around lines 1 - 80, ERD.puml is
missing the new post entity for the lexicon org.hypercerts.claim.post; update
ERD.puml to add a "post" entity that models the record (omit the cosmetic facets
field), and add relationships from replyRef → com.atproto.repo.strongRef and
attachments → org.hypercerts.defs#uri and org.hypercerts.defs#smallBlob (use the
replyRef name and attachments array to guide the relationship
cardinality/labels). Ensure the entity name references org.hypercerts.claim.post
(or simply "post") and include links to com.atproto.repo.strongRef and
org.hypercerts.defs entries per project ERD style.

62 changes: 62 additions & 0 deletions scripts/create-shims.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,66 @@ export type Mention = AppBskyRichtextFacet.Mention;
export type Tag = AppBskyRichtextFacet.Tag;
EOF

# app.bsky.embed.* - Bluesky embed types
mkdir -p ./generated/types/app/bsky/embed
cat >./generated/types/app/bsky/embed/images.ts <<'EOF'
// Type shim for app.bsky.embed.images lexicon
import type { AppBskyEmbedImages } from '@atcute/bluesky';
export type { AppBskyEmbedImages };
export type Main = AppBskyEmbedImages.Main;
export type Image = AppBskyEmbedImages.Image;
export type View = AppBskyEmbedImages.View;
export type ViewImage = AppBskyEmbedImages.ViewImage;
EOF

cat >./generated/types/app/bsky/embed/video.ts <<'EOF'
// Type shim for app.bsky.embed.video lexicon
import type { AppBskyEmbedVideo } from '@atcute/bluesky';
export type { AppBskyEmbedVideo };
export type Main = AppBskyEmbedVideo.Main;
export type Caption = AppBskyEmbedVideo.Caption;
export type View = AppBskyEmbedVideo.View;
EOF

cat >./generated/types/app/bsky/embed/external.ts <<'EOF'
// Type shim for app.bsky.embed.external lexicon
import type { AppBskyEmbedExternal } from '@atcute/bluesky';
export type { AppBskyEmbedExternal };
export type Main = AppBskyEmbedExternal.Main;
export type External = AppBskyEmbedExternal.External;
export type View = AppBskyEmbedExternal.View;
export type ViewExternal = AppBskyEmbedExternal.ViewExternal;
EOF

cat >./generated/types/app/bsky/embed/record.ts <<'EOF'
// Type shim for app.bsky.embed.record lexicon
import type { AppBskyEmbedRecord } from '@atcute/bluesky';
export type { AppBskyEmbedRecord };
export type Main = AppBskyEmbedRecord.Main;
export type View = AppBskyEmbedRecord.View;
export type ViewBlocked = AppBskyEmbedRecord.ViewBlocked;
export type ViewDetached = AppBskyEmbedRecord.ViewDetached;
export type ViewNotFound = AppBskyEmbedRecord.ViewNotFound;
export type ViewRecord = AppBskyEmbedRecord.ViewRecord;
EOF

cat >./generated/types/app/bsky/embed/recordWithMedia.ts <<'EOF'
// Type shim for app.bsky.embed.recordWithMedia lexicon
import type { AppBskyEmbedRecordWithMedia } from '@atcute/bluesky';
export type { AppBskyEmbedRecordWithMedia };
export type Main = AppBskyEmbedRecordWithMedia.Main;
export type View = AppBskyEmbedRecordWithMedia.View;
EOF

# com.atproto.label.defs - ATProto label types
mkdir -p ./generated/types/com/atproto/label
cat >./generated/types/com/atproto/label/defs.ts <<'EOF'
// Type shim for com.atproto.label.defs lexicon
import type { ComAtprotoLabelDefs } from '@atcute/atproto';
export type { ComAtprotoLabelDefs };
export type SelfLabels = ComAtprotoLabelDefs.SelfLabels;
export type SelfLabel = ComAtprotoLabelDefs.SelfLabel;
export type Label = ComAtprotoLabelDefs.Label;
EOF

echo "Created type shims for external lexicons"
Loading