Skip to content

Feat/restrict metadata - #23

Open
alvinsw wants to merge 4 commits into
mainfrom
feat/restrict-metadata
Open

Feat/restrict metadata#23
alvinsw wants to merge 4 commits into
mainfrom
feat/restrict-metadata

Conversation

@alvinsw

@alvinsw alvinsw commented Aug 24, 2026

Copy link
Copy Markdown
Member

Added access restriction functionality based on the:

  1. For endpoints /crate, /entity, /file: responds with 403 when access.metadata returned by accessTransformer function is false.
  2. For endpoints /search, /entities, /files: Use the resolveValidLicenses helper function (if it is specified in the options) to retrieve a list of valid licenses granted to the logged-in user and use the list to filter the search query.

@alvinsw
alvinsw requested review from johnf and moisbo August 24, 2026 01:27
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔴 Lines 98.81% (🎯 100%) 334 / 338
🔴 Statements 98.86% (🎯 100%) 347 / 351
🟢 Functions 100% (🎯 100%) 50 / 50
🔴 Branches 88.51% (🎯 100%) 185 / 209
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/app.ts 100% 100% 100% 100%
src/routes/crate.ts 100% 92.85% 100% 100%
src/routes/entities.ts 100% 95.23% 100% 100%
src/routes/entity.ts 100% 100% 100% 100%
src/routes/file.ts 100% 70% 100% 100%
src/routes/files.ts 100% 83.33% 100% 100%
src/routes/search.ts 93.54% 88.09% 100% 93.22% 68-71
src/transformers/default.ts 100% 100% 100% 100%
src/utils/errors.ts 100% 80% 100% 100%
Generated in workflow #78 for commit 628773d by the Vitest Coverage Report Action

@alvinsw

alvinsw commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

@johnf How do we fix this error?

ERROR: Coverage for lines (98.81%) does not meet global threshold (100%)
ERROR: Coverage for statements (98.86%) does not meet global threshold (100%)
ERROR: Coverage for branches (88.51%) does not meet global threshold (100%)
 ELIFECYCLE  Test failed. See above for more details.

@johnf

johnf commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

@johnf How do we fix this error?

ERROR: Coverage for lines (98.81%) does not meet global threshold (100%)
ERROR: Coverage for statements (98.86%) does not meet global threshold (100%)
ERROR: Coverage for branches (88.51%) does not meet global threshold (100%)
 ELIFECYCLE  Test failed. See above for more details.

You need to add more tests to cover any extra code you added.

You can check the coverage report in the web version pnpm test:ui from memory to see what needs to be covered.

Also, AI is excellent at doing this for you.

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