Skip to content

Add draft retention and test coverage for northwind integration#3

Merged
oblomov-dev merged 6 commits into
mainfrom
claude/repo-review-analysis-13d0nm
Jul 18, 2026
Merged

Add draft retention and test coverage for northwind integration#3
oblomov-dev merged 6 commits into
mainfrom
claude/repo-review-analysis-13d0nm

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

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 from cap2ui5.z2ui5_t_01 based on a configurable TTL, keeping the append-only store from growing unbounded in production.

  • Test Coverage:

    • Added src/test/draft-retention.test.js to verify expired draft cleanup behavior
    • Added src/test/northwind.test.js to test the NorthwindCustomers READ handler forwarding to the remote OData service
  • Schema Update (src/db/schema.cds): Added createdAt timestamp field to z2ui5_t_01 entity 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_COMMIT to 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:

  1. Querying for rows older than the configured TTL (default 7 days)
  2. Deleting expired draft records while preserving active ones
  3. Running as a scheduled job to maintain table performance

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

claude added 6 commits July 17, 2026 23:42
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
@oblomov-dev
oblomov-dev merged commit 806593e into main Jul 18, 2026
1 check passed
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