Skip to content

Replace Jest with node:test + c8 and migrate TinyPen executable tests#46

Merged
cubap merged 3 commits into
testing-testingfrom
copilot/sync-tinypen-with-rerum
May 18, 2026
Merged

Replace Jest with node:test + c8 and migrate TinyPen executable tests#46
cubap merged 3 commits into
testing-testingfrom
copilot/sync-tinypen-with-rerum

Conversation

Copilot AI commented May 18, 2026

Copy link
Copy Markdown
Contributor
  • Confirm actionable PR feedback and current PR/base state
  • Check workflow runs for testing-testing (and branch if needed) per CI triage guidance
  • Clean up PR progress checklist/status now that base retarget is complete
  • Reply on the new PR comment with resolution
Original prompt

I'm heading out - you can finish this up on your own. Go all the way through and let me know when there is a PR

The user has attached the following file paths as relevant context:

  • .claude\CLAUDE.md
[Chronological Review: The conversation began with the user requesting to check recent PRs in the repositories `rerum_server_nodejs` and `rerum_openapi` to ensure alignment with changes in the `TinyPen` project. The user emphasized that `TinyPen` is a consumer of `RERUM` and should validate against the OpenAPI files. The discussion evolved to consider importing core components from `TinyNode` to maintain alignment while adding specific connections for `TPEN-services`. The user expressed a desire to mirror external contracts locally and implement a syncing mechanism for changes. The conversation shifted towards creating an issue in a private GitHub repository for reusable prompt files and later transitioned to assessing failing tests in a PR. The user decided to move on and suggested a complete replacement of Jest with `node:test` for testing, indicating a preference for minimal dependencies and coverage with `c8`. The user concluded by stating they would leave and requested a PR to be created once the work was completed.]

[Intent Mapping:

  • "Check in on the recent PRs to rerum_server_nodejs and rerum_openapi..." - User wants to ensure alignment with changes.
  • "Many of these are repeated from TinyNode..." - User seeks to streamline the process by importing existing components.
  • "I don't mind mirroring it locally..." - User wants to maintain local contracts and implement a sync action.
  • "Even better, just create an issue for it in the github-private repo..." - User suggests a method for tracking reusable prompt files.
  • "Can you assess the failing tests on this PR?" - User requests an evaluation of test failures.
  • "Let's make a complete replacement of Jest..." - User wants to overhaul the testing framework and remove redundant tests.]

[Technical Inventory:

  • Technologies: OpenAPI, Jest, node:test, c8
  • Frameworks: TinyNode, TPEN-services
  • Architectural Decisions: Local mirroring of contracts, syncing mechanism for external contracts, replacing Jest with node:test for testing.]

[Code Archaeology:

  • Files discussed:
    • tpen-services-to-tinypen.openapi.yaml: OpenAPI contract for TPEN-services.
    • sync_external_contract_mirrors.yaml: Workflow for syncing external contracts.
    • package.json: Configuration file for dependencies and scripts.
  • Recent changes noted in sync_external_contract_mirrors.yaml and tpen-services-to-tinynode.openapi.yaml. The user indicated that edits were made to package.json as well.]

[Progress Assessment:

  • Completed Tasks: User has outlined the need for syncing external contracts and proposed a testing framework overhaul.
  • Partially Complete Work: The PR for the sender workflow is active, and the user is working on replacing Jest with node:test.]

[Context Validation: All critical information for continuation is captured, including the need for syncing contracts, testing framework changes, and the active PR.]

[Recent Commands Analysis:

  • Last Agent Commands: User requested to assess failing tests on the PR and indicated a switch to a new branch for testing.
  • Tool Results Summary: The active pull request is for adding a sender workflow for shared OpenAPI artifact sync.
  • Pre-Summary State: The agent was preparing to assess failing tests on the PR and implement changes to the testing framework.
  • Operation Context: These commands were executed to align the TinyPen project with external contracts and improve testing reliability.]
1. Conversation Overview: - Primary Objectives: User requested to check PRs for alignment with `rerum_server_nodejs` and `rerum_openapi`, streamline imports from `TinyNode`, and establish a local syncing mechanism for contracts. - Session Context: The conversation flowed from checking PRs to discussing contract management, testing framework changes, and concluding with a request for a PR once work is completed. - User Intent Evolution: The user shifted from validating external contracts to focusing on testing improvements and managing dependencies.
  1. Technical Foundation:
  • OpenAPI: Version 3.0.3, used for defining API contracts.
  • Jest: Current testing framework to be replaced due to issues with EJS modules.
  • node:test: Preferred testing framework moving forward for minimal dependencies.
  • c8: Tool for coverage reporting.
  1. Codebase Status:
  • tpen-services-to-tinypen.openapi.yaml:
    • Purpose: Defines the API contract for TPEN-services.
    • Current State: Version 0.2.0, includes paths for /create and /query.
  • sync_external_contract_mirrors.yaml:
    • Purpose: Workflow for syncing external contracts.
    • Current State: Recent edits made.
  • package.json:
    • Purpose: Configuration for project dependencies.
    • Current State: Recent edits made.
  1. Problem Resolution:
  • Issues Encou...

Created from VS Code.

Copilot AI changed the title [WIP] Sync TinyPen project with RERUM changes Replace Jest with node:test + c8 and migrate TinyPen executable tests May 18, 2026
Copilot AI requested a review from cubap May 18, 2026 15:03
Copilot finished work on behalf of cubap May 18, 2026 15:08

@cubap cubap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I asked - and you acknowledged - that this PR should be into testing-testing branch, not main.

Copilot AI commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

I asked - and you acknowledged - that this PR should be into testing-testing branch, not main.

You’re right. The PR is still targeting main; it should target testing-testing. I can’t retarget the PR base with the available GitHub tools in this environment, but the code is ready on commit 296f058 and can be retargeted by changing the PR base branch in GitHub UI.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/CenterForDigitalHumanities/TinyPen/pulls/46
    • Triggering command: /usr/bin/curl curl -sS -X PATCH -H Authorization: ****** -H Accept: application/vnd.github+json REDACTED -d {"base":"testing-testing"} (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from cubap May 18, 2026 15:19
@cubap cubap changed the base branch from main to testing-testing May 18, 2026 15:19
@cubap

cubap commented May 18, 2026

Copy link
Copy Markdown
Member

I asked - and you acknowledged - that this PR should be into testing-testing branch, not main.

You’re right. The PR is still targeting main; it should target testing-testing. I can’t retarget the PR base with the available GitHub tools in this environment, but the code is ready on commit 296f058 and can be retargeted by changing the PR base branch in GitHub UI.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

@copilot, I manually retargetted. you can cleanup

Copilot AI commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

I asked - and you acknowledged - that this PR should be into testing-testing branch, not main.

You’re right. The PR is still targeting main; it should target testing-testing. I ca...

Cleanup is done: PR #46 is now targeting testing-testing, workflow status was rechecked, and the PR checklist is updated to complete. No code changes were required beyond current head 296f058.

Copilot finished work on behalf of cubap May 18, 2026 15:23
@cubap cubap marked this pull request as ready for review May 18, 2026 22:18
@cubap cubap merged commit c38ad90 into testing-testing May 18, 2026
2 checks passed
@cubap cubap deleted the copilot/sync-tinypen-with-rerum branch May 18, 2026 22:18
thehabes added a commit that referenced this pull request May 21, 2026
* Initial plan

* feat: add sender workflow for TinyPen shared OpenAPI sync

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/d09509aa-356a-4e52-8ae3-f935a2a2ee16

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* chore: harden OpenAPI sync workflow permissions and checks

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/d09509aa-356a-4e52-8ae3-f935a2a2ee16

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* chore: pin sync actions and normalize OpenAPI artifact schema

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/d09509aa-356a-4e52-8ae3-f935a2a2ee16

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* Add contract validation, sync workflows, and tests

Add CI to validate TinyPen/TinyNode contract seams and automate contract syncs. New GitHub Actions: contract-validation.yml (runtime seam validation using rerum_openapi workflows), sync_external_contract_mirrors.yaml (periodic/upstream mirror sync + PR creation), and sync_tinypen_provider_contract.yaml (dispatch provider artifact sync to cubap/rerum_openapi). Update sync_tinypen_shared_openapi.yaml to dispatch the central sync workflow instead of performing checkout/copy inline. Add provider contract and external mirror OpenAPI artifacts under openapi/, and add a Jest test (provider_contract_surface.test.js) to ensure mounted routes are covered and shared path imports reference the local external mirror.

* Replace Jest with node:test + c8 and migrate TinyPen executable tests (#46)

* Initial plan

* test: replace jest with node:test and c8 coverage

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/46f16ba9-b28b-42c0-8913-38d0f2285cd1

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* test: stabilize node:test migration cleanup

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/46f16ba9-b28b-42c0-8913-38d0f2285cd1

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* test: migrate provider contract surface test to node:test asserts

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/bd9788ee-bd69-44d9-9cdb-7ebaf313f548

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* ci: make seam contract validation fixture-based

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/bde20b47-ec8d-4da3-b14e-e48d8f9560e3

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* ci: validate seam against external mirror with warnings

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/bde20b47-ec8d-4da3-b14e-e48d8f9560e3

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* chore: polish seam warning step wording

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/bde20b47-ec8d-4da3-b14e-e48d8f9560e3

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* chore: refine seam drift warning label

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/bde20b47-ec8d-4da3-b14e-e48d8f9560e3

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* chore: align external seam drift warning wording

Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyPen/sessions/bde20b47-ec8d-4da3-b14e-e48d8f9560e3

Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>

* fix: use org OPENAPI secret for sync workflows

Aligns TinyPen's two sync workflows with the convention already in use
by rerum_server_nodejs and (as of today) TinyNode. The previous secret
name RERUM_OPENAPI_SYNC_TOKEN did not exist anywhere; using the org
secret OPENAPI reuses the already-working credential and removes one
of three competing naming conventions across the receiver-sync
ecosystem. TinyPen is already in OPENAPI's selected-repos list.

* test: port tokens, rerum, and sync-artifacts test suites from TinyNode

Adds three new test files modeled after TinyNode's parallel test suite:

- __tests__/tokens.test.js: exercises checkAccessToken middleware —
  missing ACCESS_TOKEN early-return, valid-token pass-through, expired-
  token refresh + .env persistence, refresh fetch failure propagation,
  and missing-access_token-in-response error handling. Skips two
  TinyNode-only defensive tests (malformed token, non-numeric exp)
  that exercise behavior TinyPen's tokens.js does not implement.

- __tests__/rerum.test.js: exercises fetchRerum timeout behavior —
  504 mapping on AbortError, 502 mapping on other fetch failures,
  signal forwarding on success, and fallback to the 30000ms default
  when RERUM_FETCH_TIMEOUT_MS is invalid.

- __tests__/openapi_sync_artifacts.test.js: locks down both sync
  workflows (shared components and provider contract). Asserts
  receiver workflow_id, owner/repo, source path, target path, and
  the secrets.OPENAPI reference for each. Mirrors the same assertion
  pattern just added to TinyNode and rerum_server_nodejs to catch the
  same regression class.

- __tests__/helpers/env.js: small shared env bootstrap (mirrors
  TinyNode's test/helpers/env.js).

Coverage impact: function coverage 18% -> 82%, statement 43% -> 54%.
rerum.js and tokens.js both go from 0% function coverage to 100%.
Route handler bodies remain uncovered (deliberately out of scope here).

* fix: harden tokens.js — REFRESH_TOKEN guard + defensive isTokenExpired

Two fixes upstreamed from TinyNode that were surfaced during the test
port:

1. Guard checkAccessToken's early return on both ACCESS_TOKEN and
   REFRESH_TOKEN. Previously only ACCESS_TOKEN was checked, so a
   request with ACCESS_TOKEN set but no REFRESH_TOKEN would fall
   through to isTokenExpired and (if ACCESS_TOKEN is a non-JWT
   string) throw. The refresh path is meaningless without a refresh
   token anyway.

2. Replace the one-liner isTokenExpired with a defensive
   implementation. The old version threw on:
   - malformed tokens with no '.' segments
   - missing/empty middle segment
   - non-base64 payloads
   - non-numeric exp values
   These are now treated as non-expired (return false), so middleware
   does not block requests on a malformed credential. The surrounding
   try/catch absorbed throws before, but the request was failed with
   an unhelpful error rather than letting RERUM judge the token.

Restores three tests previously skipped during the port because they
exercised behavior TinyPen did not implement:
- 'Calls next when REFRESH_TOKEN is missing'
- 'Treats malformed token as non-expired and calls next'
- 'Treats non-numeric exp payload as non-expired and skips refresh'

Full suite: 30/30 pass.

* touchup and cleanup and alignment.  We really need to bring this up to speed, it has so much less coverage than tinyNode but we will do that in a separate scope.

* touchup and cleanup and alignment.  We really need to bring this up to speed, it has so much less coverage than tinyNode but we will do that in a separate scope.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
Co-authored-by: Bryan Haberberger <bryan.j.haberberger@slu.edu>
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