Add draft retention and test coverage for northwind integration#3
Merged
Conversation
mirror-core.js now fetches the sha announced in UPSTREAM_HEAD and mirrors it when it is newer than the cloned default-branch HEAD (the fast-double- push race that let announced and built commit diverge). A stale slot — trigger_cap upstream is manual, so the slot lags — no longer pins the nightly to an old core: the newer commit wins, unfetchable shas fall back to HEAD with a warning. Also refreshes run/input/core to upstream 70d176d. The CDS draft store was append-only with no cleanup, so z2ui5_t_01 grew without bound in production. z2ui5_t_01 rows now carry a managed createdAt; srv/draft-retention.js deletes rows older than Z2UI5_DRAFT_TTL_HOURS (default 24h, 0 disables) once at startup and hourly (unref'd timer). Covered by two new jest tests (13 total, all green). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXSCVM7CSVZ3Yo9eM4cG6d
…ross builds The blind string rewrite and the lock merge had no guardrails — a broken result only surfaced in the downstream npm ci. assemble now fails itself when the rewritten package.json is invalid or still references run/input/core, when the lock's abap2UI5 entry does not link ./core, or when the core-lock merge comes up empty. The top-level wipe also deleted core/node_modules (the app lock installs the core deps inside the vendored core/), so every re-assemble silently broke the preserved install until the next full npm ci. The install is now stashed across the wipe like the top-level node_modules — assemble; npm test works repeatedly without reinstalling. Verified: 13/13 jest green after two consecutive assembles on one install. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXSCVM7CSVZ3Yo9eM4cG6d
The READ handler in z2ui5-service.js was the only untested code path in
src/. The new test mocks cds.connect.to('northwind') and asserts the query
is forwarded exactly once and the remote rows come back through the
AdminService projection. 14/14 jest green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXSCVM7CSVZ3Yo9eM4cG6d
The rebase+push in the commit step had no retry — a concurrent push to main between the two commands failed the whole nightly. Up to three rebase+push attempts with backoff now. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXSCVM7CSVZ3Yo9eM4cG6d
Mirrors the new "Downstream JS Port Contract" section in upstream
abap2UI5's AGENTS.md: asserts the engine seam surface (roundtrip,
bootstrap_html, set_store, register_app_dir, ui5_resources_dir,
WEBAPP_DIR), the draft-store injection point and app-class registry, and a
real handler roundtrip answering the {S_FRONT.APP, 36-char draft id} wire
shape — so a core update that moves a seam fails this suite instead of
breaking the CAP app or the web build silently. 17/17 green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXSCVM7CSVZ3Yo9eM4cG6d
…alysis-13d0nm # Conflicts: # run/input/UPSTREAM_COMMIT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds draft retention logic to clean up expired rows in the draft store, implements test coverage for the northwind OData integration, and updates the mirror script to handle upstream deletions properly.
Key Changes
Draft Retention (
src/srv/draft-retention.js): New module that deletes expired draft rows fromcap2ui5.z2ui5_t_01based on a configurable TTL, keeping the append-only store from growing unbounded in production.Test Coverage:
src/test/draft-retention.test.jsto verify expired draft cleanup behaviorsrc/test/northwind.test.jsto test the NorthwindCustomers READ handler forwarding to the remote OData serviceSchema Update (
src/db/schema.cds): AddedcreatedAttimestamp field toz2ui5_t_01entity to support draft retention TTL calculations.Mirror Script Enhancement (
scripts/mirror-core.js): Improved upstream synchronization to properly handle deletions from the core repository, with better documentation of the trigger mechanism.CI/CD Update (
.github/workflows/update_cap.yml): Enhanced the mirror update workflow to handle rebase conflicts and improve commit handling.Upstream Sync: Updated
run/input/UPSTREAM_COMMITto reflect latest core snapshot (70d176d), which includes removal of several utility modules that are no longer needed.Implementation Details
The draft retention mechanism works by:
The test suite validates both the cleanup logic and the remote service integration pattern used by the z2ui5-service handler.
https://claude.ai/code/session_01RXSCVM7CSVZ3Yo9eM4cG6d