Skip to content

fix(public-links): the Edit dialog keeps the expiry it was given, and can remove it (#3584) - #3842

Merged
dolho merged 2 commits into
devfrom
fix/3584-public-link-expiry
Oct 22, 2026
Merged

dolho merged 2 commits into
devfrom
fix/3584-public-link-expiry

Conversation

@dolho

@dolho dolho commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Untouched Save no longer moves the expiry. The Edit dialog's datetime-local input shows and returns local wall-clock time, with no time zone. The dialog loaded the stored UTC string's characters into it (slice(0, 16)) and read the value back as local. So every untouched Save shifted the expiry by the browser's UTC offset: east of UTC a link expired early, west of UTC late.
    • The dialog now shows the stored instant in local time, through the new utils/timestamps.toDatetimeLocalInput.
    • It sends the expiry only when you change it. An untouched Save omits it, so the stored value stays byte-identical even though the input keeps only minutes.
  • An expiry can be removed. Clearing the field sends expires_at: null. PUT /api/agents/{name}/public-links/{id} now tells "sent as null or empty" (clear it) apart from "not sent" (keep it) via model_fields_set, so a rename or the enable toggle never clears an expiry. db.update_public_link gains clear_expiry.

Changes

  • Frontend: src/frontend/src/components/PublicLinksPanel.vue (editLink, saveLink) and src/frontend/src/utils/timestamps.js (toDatetimeLocalInput).
  • Backend:
    • src/backend/routers/public_links.py (update_public_link)
    • src/backend/db/public_links.py and the database.py facade (clear_expiry)
  • Tests: src/frontend/tests/unit/publicLinkExpiry.spec.js (19), tests/unit/test_3584_public_link_clear_expiry.py (9), and a registry entry.

Test Plan

  • npx vitest run tests/unit/publicLinkExpiry.spec.js: 19 pass.
    • The helper round-trips the stored instant in UTC, Paris, Los Angeles, Kolkata and Auckland, and shows local wall-clock time.
    • The dialog is mounted, and its PUT payload is checked: an untouched Save sends no expires_at in all five zones; clearing the field sends null; a typed value is sent as its UTC instant.
  • cd tests && pytest unit/test_3584_public_link_clear_expiry.py unit/test_3583_public_link_expiry.py: 25 pass.
    • On real SQLite, a clear removes the expiry, a rename or toggle keeps it, and a new value replaces it.
    • Through the real handler, a value sent as null or empty clears it, a value left out is kept, and a value sent is stored.
  • Mutations: reverting PublicLinksPanel.vue turns 7 frontend tests red; reverting the router turns 6 backend tests red.
  • Full frontend npm run test:unit: 387 files / 6149 tests, ratchets included.
  • Manual: in a browser outside UTC, create a link with an expiry, then:
    • Edit → Save twice: the shown expiry is unchanged.
    • Edit → clear the field → Save: the expiry is gone.

Fixes #3584

🤖 Generated with Claude Code

… can remove it (#3584)

The datetime-local input has no time zone: it shows and returns local
wall-clock time. editLink loaded the stored UTC string's own characters
(slice(0, 16)) and saveLink read the value back as local, so every
untouched Save moved the expiry by the browser's UTC offset (east of UTC a
link expired early, west of UTC late). A cleared field sent nothing, and
the update read a missing expires_at as "unchanged", so an expiry could not
be removed.

- utils/timestamps.toDatetimeLocalInput shows the stored instant in local
  time; the dialog sends the expiry only when it was changed (an untouched
  Save omits it), as null when cleared, and as the UTC instant otherwise.
- PUT /public-links/{id}: an expires_at the request SENT as null or empty
  clears the expiry (model_fields_set); one left out is kept, so a rename
  or the enable toggle never clears it. db.update_public_link takes
  clear_expiry.

Mutations: reverting PublicLinksPanel.vue turns 7 frontend tests red
(untouched Save in five zones, local display, clearing); reverting the
router turns 6 backend tests red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dolho dolho added the ui PR touches the frontend UI — triggers Playwright e2e tests label Oct 20, 2026
@dolho
dolho requested a review from obasilakis October 22, 2026 09:02

@obasilakis obasilakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

API contract is right: model_fields_set means null/"" clears expiry and a missing field keeps it; the toggle sends {enabled} only; no MCP caller. Frontend sends expiry only when changed, null when cleared, UTC/local conversion correct. Backend: 9 pass on the branch, 6 fail with dev's router. Frontend spec not run locally.

Minor:

  • docs/memory/feature-flows/public-agent-links.md:290 — add a line on the new PUT semantics (null clears, missing keeps).

@dolho
dolho merged commit a532be1 into dev Oct 22, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants