Skip to content

lua: replace allowlisted helper copies with shared helpers - #107

Open
Kzoeps wants to merge 8 commits into
lint/shared-helpersfrom
lua/consolidate-shared-helpers
Open

Kzoeps wants to merge 8 commits into
lint/shared-helpersfrom
lua/consolidate-shared-helpers

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The lint in #105 left 109 allowlisted copies of shared Lua helpers (record URIs, query params, cursors, record and actor views). Each copy can drift from the shared one.

Fix

  • Replace the copies with shared helpers: valid_bounded_record_uri, scalar_or_boolean, decode_record_cursor (with decode_hex_cursor_token and cursor_encode, all in listCursor.lua), record_view, record_view_omitting_indexed_at, and an optional view builder in hydrate_actor_views.
  • No behavior change. First commit adds list-golden cases (array shapes, null indexed_at); the list golden is byte-identical in every later commit.
  • Allowlist 109 → 66; deletes the shared files this emptied. New helpers live in the existing recordIdentifier.lua, listCursor.lua, query.lua and recordView.lua.

@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api-endpoints Ready Ready Preview Nov 27, 2026 10:26am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 152 files, which is 52 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.

Check out review usage here.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b3eea1c3-d33f-4fde-8b44-e3e266601a6b
Commits

Reviewing files that changed from the base of the PR and between d611356 and 3683aad.

Files selected for processing: 152

  • happyview-modules/lua/endpoints/getAcknowledgement.lua
  • happyview-modules/lua/endpoints/getActivity.lua
  • happyview-modules/lua/endpoints/getActor.lua
  • happyview-modules/lua/endpoints/getActorLikes.lua
  • happyview-modules/lua/endpoints/getActorReactions.lua
  • happyview-modules/lua/endpoints/getActorReposts.lua
  • happyview-modules/lua/endpoints/getActors.lua
  • happyview-modules/lua/endpoints/getAttachment.lua
  • happyview-modules/lua/endpoints/getBadgeAward.lua
  • happyview-modules/lua/endpoints/getBadgeDefinition.lua
  • happyview-modules/lua/endpoints/getBadgeResponse.lua
  • happyview-modules/lua/endpoints/getCollection.lua
  • happyview-modules/lua/endpoints/getCommentCounts.lua
  • happyview-modules/lua/endpoints/getContribution.lua
  • happyview-modules/lua/endpoints/getContributorInformation.lua
  • happyview-modules/lua/endpoints/getEntityFollow.lua
  • happyview-modules/lua/endpoints/getEntityFollows.lua
  • happyview-modules/lua/endpoints/getEvaluation.lua
  • happyview-modules/lua/endpoints/getEvmLink.lua
  • happyview-modules/lua/endpoints/getFeature.lua
  • happyview-modules/lua/endpoints/getFollow.lua
  • happyview-modules/lua/endpoints/getFollowerCounts.lua
  • happyview-modules/lua/endpoints/getFollows.lua
  • happyview-modules/lua/endpoints/getLikes.lua
  • happyview-modules/lua/endpoints/getLocation.lua
  • happyview-modules/lua/endpoints/getMeasurement.lua
  • happyview-modules/lua/endpoints/getOrganization.lua
  • happyview-modules/lua/endpoints/getOrganizations.lua
  • happyview-modules/lua/endpoints/getProfile.lua
  • happyview-modules/lua/endpoints/getProfiles.lua
  • happyview-modules/lua/endpoints/getReactionCounts.lua
  • happyview-modules/lua/endpoints/getReceipt.lua
  • happyview-modules/lua/endpoints/getReposts.lua
  • happyview-modules/lua/endpoints/getRights.lua
  • happyview-modules/lua/endpoints/getVocabTag.lua
  • happyview-modules/lua/endpoints/getWorkscopeTag.lua
  • happyview-modules/lua/endpoints/listAcknowledgements.lua
  • happyview-modules/lua/endpoints/listActivities.lua
  • happyview-modules/lua/endpoints/listActorFollowers.lua
  • happyview-modules/lua/endpoints/listActorFollowing.lua
  • happyview-modules/lua/endpoints/listAttachments.lua
  • happyview-modules/lua/endpoints/listBadgeAwards.lua
  • happyview-modules/lua/endpoints/listBadgeDefinitions.lua
  • happyview-modules/lua/endpoints/listBadgeResponses.lua
  • happyview-modules/lua/endpoints/listCollectionItems.lua
  • happyview-modules/lua/endpoints/listCollections.lua
  • happyview-modules/lua/endpoints/listContributions.lua
  • happyview-modules/lua/endpoints/listContributorInformation.lua
  • happyview-modules/lua/endpoints/listEntityFollowers.lua
  • happyview-modules/lua/endpoints/listEntityFollowing.lua
  • happyview-modules/lua/endpoints/listEvaluations.lua
  • happyview-modules/lua/endpoints/listEvmLinks.lua
  • happyview-modules/lua/endpoints/listFeatures.lua
  • happyview-modules/lua/endpoints/listLocations.lua
  • happyview-modules/lua/endpoints/listMeasurements.lua
  • happyview-modules/lua/endpoints/listOrganizations.lua
  • happyview-modules/lua/endpoints/listProfiles.lua
  • happyview-modules/lua/endpoints/listReceipts.lua
  • happyview-modules/lua/endpoints/listRecentFollows.lua
  • happyview-modules/lua/endpoints/listRights.lua
  • happyview-modules/lua/endpoints/listVocabTags.lua
  • happyview-modules/lua/endpoints/listWorkscopeTags.lua
  • happyview-modules/lua/endpoints/searchActivities.lua
  • happyview-modules/lua/endpoints/searchBadgeDefinitions.lua
  • happyview-modules/lua/endpoints/searchCollections.lua
  • happyview-modules/lua/endpoints/searchOrganizations.lua
  • happyview-modules/lua/endpoints/searchProfiles.lua
  • happyview-modules/lua/shared/acknowledgement.lua
  • happyview-modules/lua/shared/acknowledgementList.lua
  • happyview-modules/lua/shared/activityList.lua
  • happyview-modules/lua/shared/actorView.lua
  • happyview-modules/lua/shared/attachmentList.lua
  • happyview-modules/lua/shared/collection.lua
  • happyview-modules/lua/shared/collectionItems.lua
  • happyview-modules/lua/shared/collectionList.lua
  • happyview-modules/lua/shared/collectionProjection.lua
  • happyview-modules/lua/shared/entityFollow.lua
  • happyview-modules/lua/shared/entityFollowEntities.lua
  • happyview-modules/lua/shared/entityFollowFollowers.lua
  • happyview-modules/lua/shared/entityFollowLookup.lua
  • happyview-modules/lua/shared/entityFollowPagination.lua
  • happyview-modules/lua/shared/evaluationList.lua
  • happyview-modules/lua/shared/evmLinkIdentifier.lua
  • happyview-modules/lua/shared/featureProjection.lua
  • happyview-modules/lua/shared/feedReaction.lua
  • happyview-modules/lua/shared/fundingReceipt.lua
  • happyview-modules/lua/shared/fundingReceiptList.lua
  • happyview-modules/lua/shared/listCursor.lua
  • happyview-modules/lua/shared/listQuery.lua
  • happyview-modules/lua/shared/measurementQuery.lua
  • happyview-modules/lua/shared/organizationList.lua
  • happyview-modules/lua/shared/profileList.lua
  • happyview-modules/lua/shared/query.lua
  • happyview-modules/lua/shared/recentFollows.lua
  • happyview-modules/lua/shared/recordIdentifier.lua
  • happyview-modules/lua/shared/recordView.lua
  • happyview-modules/lua/shared/rightsIdentifier.lua
  • happyview-modules/lua/shared/rightsView.lua
  • happyview-modules/lua/shared/vocabTagValidation.lua
  • happyview-modules/lua/shared/workscopeRecordView.lua
  • happyview-modules/lua/shared/workscopeTag.lua
  • happyview-modules/lua/shared/workscopeTagList.lua
  • happyview-modules/lua/src/getAcknowledgement.lua
  • happyview-modules/lua/src/getCollection.lua
  • happyview-modules/lua/src/getEntityFollows.lua
  • happyview-modules/lua/src/getEvmLink.lua
  • happyview-modules/lua/src/getMeasurement.lua
  • happyview-modules/lua/src/getRights.lua
  • happyview-modules/lua/src/getVocabTag.lua
  • happyview-modules/lua/src/getWorkscopeTag.lua
  • happyview-modules/lua/src/listBadgeAwards.lua
  • happyview-modules/lua/src/listContributions.lua
  • happyview-modules/lua/src/listContributorInformation.lua
  • happyview-modules/lua/src/listEntityFollowers.lua
  • happyview-modules/lua/src/listEntityFollowing.lua
  • happyview-modules/lua/src/listEvmLinks.lua
  • happyview-modules/lua/src/listMeasurements.lua
  • happyview-modules/lua/src/listRights.lua
  • happyview-modules/lua/src/listVocabTags.lua
  • happyview-modules/modules/acknowledgements/manifest.json
  • happyview-modules/modules/activity/manifest.json
  • happyview-modules/modules/actor-follow/manifest.json
  • happyview-modules/modules/badge-definitions/manifest.json
  • happyview-modules/modules/badge-queries/manifest.json
  • happyview-modules/modules/collection/manifest.json
  • happyview-modules/modules/context-attachments/manifest.json
  • happyview-modules/modules/context-evaluation/manifest.json
  • happyview-modules/modules/context-measurements/manifest.json
  • happyview-modules/modules/contribution/manifest.json
  • happyview-modules/modules/contributor-information/manifest.json
  • happyview-modules/modules/entity-follow/manifest.json
  • happyview-modules/modules/evm-links/manifest.json
  • happyview-modules/modules/features/manifest.json
  • happyview-modules/modules/feed-reactions/manifest.json
  • happyview-modules/modules/funding/manifest.json
  • happyview-modules/modules/location/manifest.json
  • happyview-modules/modules/organization/manifest.json
  • happyview-modules/modules/profile/manifest.json
  • happyview-modules/modules/recent-follows/manifest.json
  • happyview-modules/modules/rights/manifest.json
  • happyview-modules/modules/vocab/manifest.json
  • happyview-modules/modules/workscope-tags/manifest.json
  • happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js
  • happyview-modules/tests/unit/endpoints/rights-lua.test.js
  • happyview-modules/tests/unit/feature.test.js
  • happyview-modules/tests/unit/list-golden/fixtures.js
  • happyview-modules/tests/unit/list-golden/harness.js
  • happyview-modules/tests/unit/list-golden/list-endpoints.golden.jsonl
  • happyview-modules/tests/unit/lua/recentFollows.test.lua
  • happyview-modules/tests/unit/tooling/listContributorInformation.test.js
  • happyview-modules/tests/unit/tooling/vocab-tags.test.js
  • happyview-modules/tooling/shared-helpers.registry.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3683aad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@Kzoeps

Kzoeps commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

SonarCloud annotation harness.js:23 (nested template literals): valid, fixed in 5afb449. CodeRabbit skipped this PR (file-count limit). No other open threads, reviews or annotations.

@Kzoeps
Kzoeps force-pushed the lua/consolidate-shared-helpers branch from 5afb449 to 6c62cfa Compare November 27, 2026 04:22
Adds per-array-filter cases (100 and 101 values, invalid, non-string, oversize
and nested items, keyed and sparse tables) and a null indexed_at row for every
list endpoint with a record view. Tests and regenerated golden only; no Lua
change. This golden is the baseline for the helper consolidation commits.
Collection and collection-projection filters use one bounded shared helper;
measurement, rights and work-scope wrappers, the organization/profile cursor
URI parsers and the redundant EVM-link authority check call valid_record_uri.
recent_valid_record_uri becomes is_recent_follow_uri, a follow-collection
predicate. No behavior change: list golden is byte-identical.

rightsIdentifier.lua is now empty and no bundle includes it.
The activity and collection hasOrganizationRecord twins become one shared
scalar_or_boolean. listBadgeAwards uses the shared parse_include_total, and
listCollectionItems calls invalid and keys_only directly. No behavior change:
list golden is byte-identical.
Adds decode_record_cursor (collection or URI predicate, optional timestamp
check) and splits the hex prologue into cursorToken.lua and cursor_encode into
cursorEncode.lua so bundles that only need one do not carry unused helpers.
The per-endpoint decode wrappers and the collection-items and recent-follows
encoders are deleted. Hand-rolled decoders are untouched. No behavior change:
list golden is byte-identical.
Acknowledgement, collection, feature, entity-follow, EVM-link, rights and
funding views build on record_view. hydrate_actor_views takes an optional view
builder; the omit-missing-indexedAt builder (record_view_omitting_indexed_at,
formerly workscopeRecordView's record_view) replaces the vocab hydrate wrapper
and the work-scope global-name override. entity_follow_record_view becomes
entity_follow_typed_view. No behavior change: list golden is byte-identical.

rightsView.lua is now empty and no bundle includes it.
Both lost their last function in the record-URI and record-view commits and no
bundle includes them. Drops their entries from the two rights unit tests that
assembled bundles by path. Generated bundles and list golden unchanged.
recordViewOmittingIndexedAt -> recordView.lua, cursorToken and cursorEncode ->
listCursor.lua, scalarOrBoolean -> query.lua, boundedRecordIdentifier ->
recordIdentifier.lua. Helpers that only some bundles use sit inside luacheck
'ignore 211' regions so bundles that skip them still lint clean. listVocabTags'
local decode_cursor is renamed decode_vocab_tag_cursor because its bundle now
carries the shared decode_cursor. Golden byte-identical.
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

This branch was successfully deployed

1 active deployment
Preview — 3683aad7 Deployed Nov 27, 2026 by vercel[bot]
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.

1 participant