Skip to content

WEBDEV-9423: Migrate metadata-service into elements - #174

Open
jbuckner wants to merge 5 commits into
WEBDEV-9419-item-metadatafrom
WEBDEV-9423-metadata-service
Open

jbuckner wants to merge 5 commits into
WEBDEV-9419-item-metadatafrom
WEBDEV-9423-metadata-service

Conversation

@jbuckner

@jbuckner jbuckner commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Moves metadata-service into src/services/metadata-service/, ported from @internetarchive/metadata-service 1.1.1 (tag v1.1.1, same as the published source). All 15 tests came over with the assertions unchanged. It imports the local item-metadata and result-type. MetadataServiceErrorType is a const object with a same-named type and the same values, because the repo forbids enums. The entry point is index.ts, since metadata-service.ts is the class. The open upstream writes PR (metadata-service#20, WEBDEV-9151) is not included.

Stacked on #171 (item-metadata). The branch also carries #156 (result-type) until it merges.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CjuFdHEwY7MowcqkUxxudu

jbuckner and others added 3 commits October 8, 2026 16:40
Ported from @internetarchive/result-type 0.0.1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CjuFdHEwY7MowcqkUxxudu
* origin/WEBDEV-9417-result-type:
  WEBDEV-9417: Migrate result-type into elements
Ported from @internetarchive/metadata-service 1.1.1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CjuFdHEwY7MowcqkUxxudu
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-174/

Built to branch ghpages at 2026-10-09 01:27 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

The identifier and key path went into the request URL as they were, so
`../services/user` or `x?y=1` changed which archive.org URL got fetched.
Each part is encoded now, and `.` and `..` parts are refused.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CjuFdHEwY7MowcqkUxxudu
@jbuckner

jbuckner commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Second commit is a security fix beyond the port. DefaultMetadataBackend.fetchMetadata put the identifier and key path into the URL unencoded, so ../services/user or x?y=1 could change which archive.org URL gets fetched (same in the published 1.1.1). Each part is encoded now and . / .. parts return an itemNotFound error, with tests. Worth fixing upstream too.

@codecov-commenter

codecov-commenter commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.15663% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.67%. Comparing base (db7d0df) to head (8708e82).

Files with missing lines Patch % Lines
...tadata-service/backend/default-metadata-backend.ts 80.48% 4 Missing and 4 partials ⚠️
...es/metadata-service/responses/metadata-response.ts 95.23% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           WEBDEV-9419-item-metadata     #174      +/-   ##
=============================================================
- Coverage                      91.73%   91.67%   -0.06%     
=============================================================
  Files                            126      131       +5     
  Lines                           4075     4158      +83     
  Branches                         858      876      +18     
=============================================================
+ Hits                            3738     3812      +74     
- Misses                           147      152       +5     
- Partials                         190      194       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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