Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

  • Update activityWeight weight description in lexicons/org/hypercerts/claim/activity.json to remove the "should add up to 100" constraint
  • Update corresponding documentation in README.md to reflect the relaxed constraint
  • Regenerate TypeScript types using npm run gen-api
  • Validate changes with linting and formatting checks
  • Request code review
  • Run security checks
  • Rebase onto main and resolve merge conflicts

This PR addresses issue #18 by removing the hard requirement that collection weights must sum to 100, allowing more flexibility in weight assignment while maintaining backward compatibility.

Changes Made

Lexicon Update

Updated the weight field description in activityWeight definition to:

  • Remove the constraint that "total activity weights should add up to 100"
  • Clarify that weights can be any positive numeric values
  • Specify that normalization can be performed by consuming applications as needed

Documentation Update

Updated the README.md table to reflect the new, more flexible weight description (without the Comments column, per PR #46)

Rebase

Successfully rebased onto main branch (commit 52d640b) and resolved merge conflicts with README.md

Benefits

  • Flexibility: No need to recalculate all weights when adding/removing items from collections
  • Simplicity: Avoids floating-point precision issues in weight calculations
  • Backward Compatible: Existing collections with weights summing to 100 remain valid
  • User Experience: Frontends can display weights as percentages through normalization without data constraints

Testing

  • ✅ Lexicon validation passed (npm run gen-api)
  • ✅ Linting/formatting checks passed (npm run lint)
  • ✅ Code review completed with no issues
  • ✅ Security checks passed

Notes

The generated TypeScript types in the types/ directory have been updated but are not committed (as they are in .gitignore and are generated during build).

Original prompt

The issue at hand involves relaxing the requirement for collection weights to add up to 100 in the 'hypercerts-lexicon' repository. Currently, this constraint may create unnecessary complications and limitations, such as requiring recalculating weights when modifying collections, handling floating-point precision issues, and restricting flexibility in use cases.

For example, if we initially have weights 1, 2, 3 assigned to items and add new items to the collection, manually adjusting all existing weights can be cumbersome. Additionally, the user-facing frontend can easily normalize or represent weights as percentages without the data needing to inherently add up to 100.

The aim of this PR is to implement changes to remove this hard constraint while ensuring the system remains backward-compatible and robust. Instead, platforms or record creators can decide whether they want to enforce the percentage rule based on their specific needs. The frontend will be adapted (either through documentation/spec changes or by making sure the systems using the data allow for normalization) to maintain user understandability, and thorough tests/documentation of these changes will be ensured.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Summary by CodeRabbit

  • Documentation

    • Updated activityWeight definition and description formatting.
  • Updates

    • Modified activityWeight.weight specification to accept flexible positive numeric values instead of fixed 0-100 percentages.
    • Removed requirement that weights must sum to 100; normalization is now delegated to consuming applications.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

Documentation and schema definition updates to the activityWeight property in the Hypercerts Defs lexicon. The README layout was reformatted with a dedicated "Required" column, and the activity.json schema description was updated to reflect that weights are flexible positive numeric values without requiring summation to a specific total.

Changes

Cohort / File(s) Summary
Documentation & Schema Updates
README.md, lexicons/org/hypercerts/claim/activity.json
Updated activityWeight property definition: reformatted README table layout with dedicated "Required" column header; modified schema description to allow flexible positive numeric weights stored as strings, removed "sum to 100" requirement, and clarified that normalization is handled by consuming applications

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Documentation and specification updates only; no functional code changes or logic modifications
  • Schema type remains unchanged (string); only descriptive text updated

Possibly related PRs

Poem

🐰 Weights can be free, no bound to a sum,
Normalize at leisure, the work's never done!
From rigid to nimble, the spec takes its flight,
Let each app decide what feels just right! ✨

Pre-merge checks and finishing touches

✅ Passed checks (4 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: removing the constraint that collection activity weights must sum to 100.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Lexicon Documentation Sync ✅ Passed The PR maintains full synchronization between lexicon JSON schema and README.md documentation with identical weight property descriptions and correct required indicators.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/remove-weight-constraint

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

Copilot AI changed the title [WIP] Remove hard constraint for collection weights in hypercerts-lexicon Remove collection weight sum constraint Dec 17, 2025
Copilot AI requested a review from aspiers December 17, 2025 09:51
@aspiers aspiers marked this pull request as ready for review December 17, 2025 09:52
Copy link
Contributor

@aspiers aspiers left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Copilot I guess I'm no longer useful in society except as an AI's pet

@aspiers
Copy link
Contributor

aspiers commented Dec 17, 2025

@copilot rebase this and resolve the conflict.

Copy link
Contributor Author

Copilot AI commented Dec 17, 2025

@copilot rebase this and resolve the conflict.

Rebase completed and merge conflicts resolved in commit 52d640b. The README.md conflict has been resolved to keep the updated weight description without the Comments column.

However, I'm unable to force push the rebased branch due to authentication limitations. The local branch has been successfully rebased onto main and is ready. You may need to manually force push or grant push permissions:

git push --force-with-lease origin copilot/remove-weight-constraint

Changes:

  • Rebased onto main (abb166a)
  • Resolved conflict in README.md (removed Comments column while keeping updated weight description)
  • All tests and linting pass

Updated activityWeight description to allow flexible weight values
that don't need to sum to 100. This removes unnecessary complexity
around weight recalculation when modifying collections while
maintaining backward compatibility. Frontends can normalize weights as
needed for display.

Closes #18

Co-authored-by: aspiers <[email protected]>
@aspiers aspiers force-pushed the copilot/remove-weight-constraint branch from 7ee9ffc to 47cb722 Compare December 17, 2025 10:32
Copilot AI requested a review from aspiers December 17, 2025 10:32
@aspiers
Copy link
Contributor

aspiers commented Dec 17, 2025

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

✅ Actions performed

Full review triggered.

@aspiers aspiers requested a review from holkexyz December 17, 2025 10:33
@aspiers aspiers linked an issue Dec 17, 2025 that may be closed by this pull request
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abb166a and 811a807.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • lexicons/org/hypercerts/claim/activity.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
README.md

📄 CodeRabbit inference engine (Custom checks)

README.md: Ensure that all lexicons documented in README.md exist as JSON files in the lexicons/ directory
Ensure all properties documented in README.md match the actual JSON schema definitions in lexicons/**/*.json

Files:

  • README.md
!(types)/**/*.{js,ts,tsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Run npm run format with Prettier before committing to ensure consistent code formatting

Files:

  • README.md
  • lexicons/org/hypercerts/claim/activity.json
lexicons/**/*.json

📄 CodeRabbit inference engine (Custom checks)

lexicons/**/*.json: When adding, modifying, or deleting files in lexicons//*.json, update README.md to reflect changes (document new lexicons, update modified properties, remove deleted lexicons from documentation)
When adding, modifying, or deleting files in lexicons/
/*.json, update ERD.puml if entity relationships changed (add new entities, modify relationships, remove deleted entities)
Verify that lexicon IDs in JSON files match what's documented in README.md

lexicons/**/*.json: After modifying lexicon JSON files, regenerate TypeScript types by running npm run gen-api
Lexicon JSON files should follow the ATProto lexicon schema v1 specification
Run npm run check before committing to validate lexicon syntax and ensure valid lexicon definitions
Update ERD.puml when modifying lexicon structures to reflect entity relationship changes
Update README.md documentation when adding or modifying lexicon definitions
Organize lexicon files by namespace following the directory structure pattern (e.g., org/hypercerts/claim/*.json)

Files:

  • lexicons/org/hypercerts/claim/activity.json
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: hypercerts-org/hypercerts-lexicon PR: 0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-12-11T15:44:24.397Z
Learning: Applies to README.md : Ensure all properties documented in README.md match the actual JSON schema definitions in lexicons/**/*.json
Learnt from: CR
Repo: hypercerts-org/hypercerts-lexicon PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-15T17:53:11.862Z
Learning: Applies to lexicons/**/*.json : Update `README.md` documentation when adding or modifying lexicon definitions
Learnt from: CR
Repo: hypercerts-org/hypercerts-lexicon PR: 0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-12-11T15:44:24.397Z
Learning: Applies to lexicons/**/*.json : When adding, modifying, or deleting files in lexicons/**/*.json, update README.md to reflect changes (document new lexicons, update modified properties, remove deleted lexicons from documentation)
📚 Learning: 2025-12-15T17:53:11.862Z
Learnt from: CR
Repo: hypercerts-org/hypercerts-lexicon PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-15T17:53:11.862Z
Learning: Applies to lexicons/**/*.json : Update `README.md` documentation when adding or modifying lexicon definitions

Applied to files:

  • README.md
📚 Learning: 2025-12-11T15:44:24.397Z
Learnt from: CR
Repo: hypercerts-org/hypercerts-lexicon PR: 0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-12-11T15:44:24.397Z
Learning: Applies to lexicons/**/*.json : When adding, modifying, or deleting files in lexicons/**/*.json, update README.md to reflect changes (document new lexicons, update modified properties, remove deleted lexicons from documentation)

Applied to files:

  • README.md
📚 Learning: 2025-12-11T15:44:24.397Z
Learnt from: CR
Repo: hypercerts-org/hypercerts-lexicon PR: 0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2025-12-11T15:44:24.397Z
Learning: Applies to README.md : Ensure all properties documented in README.md match the actual JSON schema definitions in lexicons/**/*.json

Applied to files:

  • README.md
📚 Learning: 2025-12-15T16:39:23.964Z
Learnt from: aspiers
Repo: hypercerts-org/hypercerts-lexicon PR: 39
File: README.md:17-17
Timestamp: 2025-12-15T16:39:23.964Z
Learning: In the hypercerts-lexicon repository, standardize on the hyphenless spelling 'onchain' across Markdown documentation (e.g., README.md and other md files) to match the industry standard. Update any occurrences of 'on-chain' to 'onchain' and ensure consistency throughout all documentation.

Applied to files:

  • README.md
📚 Learning: 2025-12-15T10:13:17.689Z
Learnt from: aspiers
Repo: hypercerts-org/hypercerts-lexicon PR: 34
File: lexicons/org/hypercerts/claim/evaluation.json:45-63
Timestamp: 2025-12-15T10:13:17.689Z
Learning: In the hypercerts-lexicon repository, CI automatically runs npm run gen-api and npm run check to regenerate TypeScript types and validate lexicon definitions. Do not include manual reminders to run these commands in code reviews, as CI handles consistency and validation for all lexicon JSON definitions under lexicons/.

Applied to files:

  • lexicons/org/hypercerts/claim/activity.json
📚 Learning: 2025-12-15T15:33:19.949Z
Learnt from: aspiers
Repo: hypercerts-org/hypercerts-lexicon PR: 37
File: lexicons/org/hypercerts/funding/receipt.json:1-71
Timestamp: 2025-12-15T15:33:19.949Z
Learning: In the hypercerts-lexicon repository, do not comment on Prettier/formatting issues in code reviews since they are reported by the lint workflow. Do not duplicate the lint output in reviews to reduce noise; focus review comments on functional/semantic issues and other non-formatting concerns.

Applied to files:

  • lexicons/org/hypercerts/claim/activity.json
🔇 Additional comments (1)
README.md (1)

195-198: Documentation correctly reflects the lexicon changes.

The activityWeight table has been properly updated to match the modified schema definition in activity.json. The description accurately reflects the new flexible weight policy, and the three-column layout with a dedicated "Required" column improves clarity.

Based on coding guidelines, the documentation properly maintains consistency with the JSON schema definitions.

@aspiers aspiers requested a review from s-adamantine December 17, 2025 10:51
@aspiers aspiers merged commit d28e27b into main Dec 17, 2025
4 checks passed
@aspiers aspiers deleted the copilot/remove-weight-constraint branch December 17, 2025 13:27
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.

decide whether collection weights should be percentages

2 participants