Skip to content

A source's settings carry a switch that lets its documents decay - #25

Merged
gedaiu merged 1 commit into
re-devfrom
feat/source-decay-form
Oct 22, 2026
Merged

gedaiu merged 1 commit into
re-devfrom
feat/source-decay-form

Conversation

@gedaiu

@gedaiu gedaiu commented Oct 22, 2026

Copy link
Copy Markdown

The web form for RC-003 (a source may decay). Until now the option could only be set with PATCH (#19); the source settings dialog now has it.

What is in it.

  • A "Let documents decay" switch in a source's settings, for every source kind. On, it shows the four numbers (keep at most, score halves every, rank lower after, never delete newer than) with the backend's defaults and a hint saying what happens: the lowest-scoring old documents are deleted once a day and can be restored.
  • Save sends decay only when it changed: the whole object when switched on or edited, null when switched off, nothing otherwise. A hand-written {} is read with the defaults and is not rewritten by an unrelated save.
  • A number out of the backend's range (decayIssue, same rules as DecaySettings::validate) marks its label and keeps Save disabled.
  • SourceView.decay and DecaySettings in api.ts; English and Chinese strings; one line in docs/design/sources.md.
  • The logic is in a pure sourceDecay.ts with its test, the fields in SourceDecayFields.tsx, and Library.tsx only wires it in.

Tests. 16 for the helper (defaults, range, what a save sends), 3 rendering the fields (off shows only the switch, on shows four inputs with saved values, a bad field's label is marked). Web: tsc --noEmit, vitest run (334 passed), the style guard and vite build pass.

Not verified. I have not looked at it in a browser against a running server; please click through the dialog once. Create does not take decay (set it after creating).

🤖 Generated with Claude Code

@gedaiu
gedaiu merged commit ab39c21 into re-dev Oct 22, 2026
6 checks 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.

1 participant