Skip to content

change evidence.json to attachment.json and simplify - #118

Merged
aspiers merged 3 commits into
developfrom
change-evidence-schema-to-attachment-schema
Jan 24, 2026
Merged

change evidence.json to attachment.json and simplify#118
aspiers merged 3 commits into
developfrom
change-evidence-schema-to-attachment-schema

Conversation

@holkexyz

@holkexyz holkexyz commented Jan 21, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Breaking Changes

    • Records renamed from "evidence" to "attachment"; schema reworked (subject → subjects array, content → array and now required); removed relationType, contributors, locations; existing records must be migrated.
  • New Features

    • Optional location on attachments, contentType field, rich-text facet support, and new contributor defs (weightedContributor, contributorIdentity).
  • Documentation

    • Migration guidance, schema examples, and "Creating Attachments" usage docs added.

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

@changeset-bot

changeset-bot Bot commented Jan 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0f3055b

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

@holkexyz holkexyz linked an issue Jan 21, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jan 21, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Renames lexicon org.hypercerts.claim.evidence → org.hypercerts.claim.attachment; converts singular subject/content to arrays, adds contentType, rich-text facets, optional location strongRef, removes relationType/contributors/locations, adds defs (weightedContributor, contributorIdentity), updates docs/ERD, and provides migration guidance.

Changes

Cohort / File(s) Summary
Changesets / Migration notes
\.changeset/rename-evidence-to-attachment.md, \.changeset/add-location-to-attachment.md
Breaking-change changelogs and migration instructions: rename evidence→attachment, map subjectsubjects[], contentcontent[], remove relationType/contributors/locations, and add optional location strongRef.
New lexicon: attachment
lexicons/org/hypercerts/claim/attachment.json
Adds org.hypercerts.claim.attachment record with required title, content[], createdAt; optional subjects[] (strongRef), contentType, shortDescription/description + rich-text facets, location strongRef, and field limits/examples.
Removed lexicon: evidence
lexicons/org/hypercerts/claim/evidence.json
Deletes legacy org.hypercerts.claim.evidence (single subject/content, relationType, contributors, locations).
Defs added/updated & SCHEMAS
lexicons/org/hypercerts/defs.json, SCHEMAS.md
Adds weightedContributor and contributorIdentity defs; updates SCHEMAS.md to include new lexicons/defs and adjust public Defs references.
Docs & diagrams
README.md, ERD.puml, SCHEMAS.md
Documentation and diagram updates: new "Creating Attachments" examples, README duplication noted, ERD updated to replace evidence→attachment and adjust cross-links.
Generator refactor
scripts/generate-schemas.js
Refactors schema-generation to category-driven rendering, modular helpers, deterministic ordering, and deduplication; replaces prior hard-coded rendering flow.

Sequence Diagram(s)

(omitted — changes are schema/lexicon updates without a multi-component sequential runtime flow)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • s-adamantine

Poem

🐇 I hopped through JSON, swapped a name,
Singles stretched to lists — a tidy change!
Facets and places joined the play,
New defs and docs to guide the way,
A little hop — lexicons take flight ✨


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)
Check name Status Explanation Resolution
Lexicon Documentation Sync ❌ Error app.certified.defs section in SCHEMAS.md lacks required #### Defs table documenting the 'did' definition as explicitly requested in review comments. Add #### Defs section after line 335 with ##### app.certified.defs#did subsection and properties table matching org.hypercerts.defs pattern.
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: renaming evidence.json to attachment.json and simplifying the schema structure with associated updates.
Lexicons Styleguide Compliance ✅ Passed The lexicons/org/hypercerts/claim/attachment.json lexicon file is compliant with the atproto lexicon style guide with comprehensive documentation.
✨ Finishing touches
  • 📝 Generate docstrings

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.

@aspiers
aspiers force-pushed the change-evidence-schema-to-attachment-schema branch 2 times, most recently from 1c738b7 to 4bd40b1 Compare January 21, 2026 23:00

@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 @.changeset/rename-evidence-to-attachment.md:
- Around line 23-26: The changeset claims to add `weightedContributor` and
`contributorIdentity` to `org.hypercerts.defs` but `weightedContributor` is not
present anywhere and `contributorIdentity` is only added to `activity.json` (not
`defs.json`); update the changeset text to accurately reflect reality by either
removing the entire "Common definitions (org.hypercerts.defs)" section or
rewriting it to state that `contributorIdentity` was added to the activity
schema and that no `weightedContributor` def was added, and ensure the symbols
`weightedContributor`, `contributorIdentity`, and `org.hypercerts.defs` are
referenced correctly in the updated description.

In `@lexicons/org/hypercerts/claim/attachment.json`:
- Around line 1-81: Create a new changeset markdown in .changeset (e.g.,
add-org-hypercerts-claim-attachment.md) documenting the public API change that
adds the new lexicon org.hypercerts.claim.attachment (include a short title,
description that a new lexicon/record was added, and bump type set to
minor/patch per repo conventions), then run npm run gen-api to regenerate
TypeScript types under generated/ and update generated/exports.ts so the new
lexicon types are exported.
- Line 3: ERD.puml still references the old lexicon name
org.hypercerts.claim.evidence; update the comment at the top from
org.hypercerts.claim.evidence to org.hypercerts.claim.attachment, rename the
dataclass declaration dataclass evidence to dataclass attachment, rename any
fields that include the old prefix (e.g., evidenceURI -> attachmentURI and
similar field names), and update entity relationship lines that reference
evidence (lines that currently link entities to evidence) to link to attachment
instead so all references use org.hypercerts.claim.attachment consistently.

Comment thread .changeset/rename-evidence-to-attachment.md
Comment thread lexicons/org/hypercerts/claim/attachment.json
Comment thread lexicons/org/hypercerts/claim/attachment.json
@aspiers
aspiers force-pushed the change-evidence-schema-to-attachment-schema branch 2 times, most recently from b7ced73 to 1b063e6 Compare January 24, 2026 08:47
and update SCHEMAS.md to include previously missing lexicons.
@aspiers
aspiers force-pushed the change-evidence-schema-to-attachment-schema branch from 1b063e6 to cbad7c5 Compare January 24, 2026 09:19

@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 `@README.md`:
- Around line 354-361: Update the "Key fields" list for the attachment schema to
include the required non-facet properties `title` and `createdAt`; locate the
block describing attachments (the list containing `subjects`, `contentType`,
`content`, `location`, `shortDescription`/`description`) and add entries for
`title` (string — required) and `createdAt` (timestamp — required) so the README
documents all non-facet properties of the attachment lexicon.

In `@SCHEMAS.md`:
- Around line 211-224: The schema entry `org.hypercerts.defs` is duplicated
across the Hypercerts and Certified sections; remove the duplicate by keeping
the single authoritative definition under the Certified section and deleting the
copy under the Hypercerts section, then update the generator that produces
SCHEMAS.md so it emits each schema key (e.g., org.hypercerts.defs) only once
(deduplicate by key) and regenerate SCHEMAS.md to reflect the change.

In `@scripts/generate-schemas.js`:
- Around line 329-331: The hypercertsOrder computation currently includes
"org.hypercerts.defs", causing duplicate sections in SCHEMAS.md; update the
hypercertsOrder creation (the categories.hypercerts -> .map(...).sort() step) to
filter out the "org.hypercerts.defs" id (or remove any ids present in
certifiedOrder) so that "org.hypercerts.defs" is not present when you later
iterate to emit Hypercerts sections (refer to hypercertsOrder, certifiedOrder
and the literal id "org.hypercerts.defs").
♻️ Duplicate comments (1)
.changeset/rename-evidence-to-attachment.md (1)

23-25: Verify the changeset claim about new defs in org.hypercerts.defs.

Please confirm that weightedContributor and contributorIdentity were actually added to lexicons/org/hypercerts/defs.json. If not, update this section to reflect the real changes.

#!/bin/bash
set -euo pipefail

echo "=== defs.json presence ==="
if [ -f "lexicons/org/hypercerts/defs.json" ]; then
  echo "defs.json found"
  echo "=== Search in defs.json ==="
  rg -n "weightedContributor|contributorIdentity" lexicons/org/hypercerts/defs.json || echo "Not found in defs.json"
else
  echo "defs.json not found"
fi

echo "=== Search all lexicons ==="
rg -n "weightedContributor|contributorIdentity" lexicons/ || echo "Not found in lexicons/"

Comment thread README.md
Comment thread SCHEMAS.md Outdated
Comment thread scripts/generate-schemas.js Outdated
- Add optional location strongRef property to attachment.json for associating location metadata
- Update ERD.puml with location field and relationship arrow
- Add 'Creating Attachments' section to README.md with usage examples
- Create changeset for patch version bump
- Update SCHEMAS.md

Follows the same pattern as PR #123 for adding location to collections.
@aspiers
aspiers force-pushed the change-evidence-schema-to-attachment-schema branch 2 times, most recently from d8a186d to 9d89755 Compare January 24, 2026 22:44
@aspiers aspiers self-assigned this Jan 24, 2026

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
SCHEMAS.md (1)

1-4: SCHEMAS.md appears out of sync with the generator (CI diff).

The pipeline reports a git diff in SCHEMAS.md after generation. Please re-run npm run gen-schemas-md and commit the updated output so CI passes. As per coding guidelines, keep generated docs in sync with lexicon changes.

🤖 Fix all issues with AI agents
In `@scripts/generate-schemas.js`:
- Around line 310-334: generateAdditionalDefsSection is calling
extractPropertyRows without passing the local defs, so ref descriptions for
`#local` refs are not resolved; change the call to pass lexicon.data.defs (e.g.,
extractPropertyRows(defData, defData.required || [], lexicon.data.defs)) and
ensure the same local defs parameter is threaded through any other calls in this
function (and adjust extractPropertyRows signature if needed) so nested def refs
resolve correctly.
♻️ Duplicate comments (1)
.changeset/rename-evidence-to-attachment.md (1)

23-26: Changeset lists defs that don’t appear in the schema outputs.

SCHEMAS.md shows org.hypercerts.defs containing only uri, smallBlob, largeBlob, smallImage, largeImage. If weightedContributor and contributorIdentity weren’t added to lexicons/org/hypercerts/defs.json, the changeset should be corrected (or the defs added).

#!/bin/bash
# Verify defs in org.hypercerts.defs and search for the symbols.
defs_file=$(fd -a '^defs\.json$' lexicons | head -n1)
if [ -n "$defs_file" ]; then
  echo "defs file: $defs_file"
  jq '.defs | keys' "$defs_file"
else
  echo "defs.json not found under lexicons/"
fi

echo "=== Searching for weightedContributor / contributorIdentity ==="
rg -n "weightedContributor|contributorIdentity" lexicons -g '*.json'

Comment thread scripts/generate-schemas.js Outdated
@aspiers
aspiers force-pushed the change-evidence-schema-to-attachment-schema branch from 9d89755 to 0f3055b Compare January 24, 2026 22:47
@aspiers
aspiers merged commit 5be25f6 into develop Jan 24, 2026
4 checks passed
@aspiers
aspiers deleted the change-evidence-schema-to-attachment-schema branch January 24, 2026 22:48

@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: 1

🤖 Fix all issues with AI agents
In `@SCHEMAS.md`:
- Around line 333-337: Add a "#### Defs" subsection to the SCHEMAS.md under the
existing `app.certified.defs` heading and render a defs table for the `did`
property matching the format used in `org.hypercerts.defs`; specifically create
a table row for `did` including its type, description, and any example or
pattern columns used in `org.hypercerts.defs`, ensuring the heading is exactly
"#### Defs" and the property name `did` is spelled the same as in the lexicon.
♻️ Duplicate comments (1)
scripts/generate-schemas.js (1)

310-336: Pass local defs so ref descriptions resolve in nested defs.

extractPropertyRows can pull descriptions from local defs for ref fields, but generateAdditionalDefsSection doesn't pass them. This can drop descriptions for #local refs in additional defs.

🛠️ Proposed fix
-    const defRows = extractPropertyRows(defData, defData.required || []);
+    const defRows = extractPropertyRows(
+      defData,
+      defData.required || [],
+      lexicon.data.defs,
+    );

Comment thread SCHEMAS.md
Comment on lines +333 to +337
### `app.certified.defs`

**Description:** Common type definitions used across certified protocols.

---

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
# Check if app.certified.defs exists and what it contains
fd -t f "defs.json" lexicons/app/certified --exec cat {} | jq '.'

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 349


🏁 Script executed:

#!/bin/bash
# Check how org.hypercerts.defs is rendered in SCHEMAS.md
grep -A 20 "org.hypercerts.defs" SCHEMAS.md | head -30

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 1061


Add defs table to app.certified.defs section in SCHEMAS.md.

The lexicon contains a did definition that should be rendered following the pattern used in org.hypercerts.defs. Add an #### Defs section with a table for the did property after the description.

🤖 Prompt for AI Agents
In `@SCHEMAS.md` around lines 333 - 337, Add a "#### Defs" subsection to the
SCHEMAS.md under the existing `app.certified.defs` heading and render a defs
table for the `did` property matching the format used in `org.hypercerts.defs`;
specifically create a table row for `did` including its type, description, and
any example or pattern columns used in `org.hypercerts.defs`, ensuring the
heading is exactly "#### Defs" and the property name `did` is spelled the same
as in the lexicon.

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.

change evidence to attachment and simplify

2 participants