Skip to content

fix(activity): plain sentences, not JSON and event codes (#140) - #147

Merged
ibrahimroshdy merged 1 commit into
mainfrom
fix/activity-sentences
Oct 16, 2026
Merged

ibrahimroshdy merged 1 commit into
mainfrom
fix/activity-sentences

Conversation

@ibrahimroshdy

Copy link
Copy Markdown
Collaborator

Closes #140.

Activity and History now read as plain sentences.

What changes for a person

  • Every action is a sentence, in five languages: "Discarded a draft", "Undid a capture", "Made 24 blank labels", "Made an insurance report for Home", "Captured Bosch drill, 18 V from a photo", "Added a photo to Desk lamp".
  • Map arrangements in words, one line per change: put on the map (in a room), took off, put X on Y, took X off Y, moved, turned, changed shape, resized, changed a room's kind or floor. More than five changes read "Arranged the map: N changes", with Show.
  • Only fields people care about. No ids, row versions, counters, digits, locale or raw filters. A report shows "12 things" and "With photos"; a trashed place shows what was inside it.
  • New is new. A field set from nothing shows its value, with no "empty →".
  • One row per action. An upload folds into the capture, attachment or claim row that used it. A capture's extraction joins the capture row.
  • The same applies in a thing's and a place's History.

How it works

  • @kept/shared AUDIT_ACTIONS lists every action the server writes. audited() accepts only these. The server's English map and the web's sentence map are both Record<SummaryKey, …>, so a new action without a sentence fails the typecheck. Tests also render every key in English and Arabic. event stays only for actions this build doesn't know.
  • history/arrange.ts compares the stored before/after layouts node by node. Names are resolved as the caller, so a node the reader can't see reads "a thing" or "a place". Shapes, room kinds and floors travel as codes and are said in the map's own words. summaryLines carries the result, and the layout diff is removed from the response.
  • Folding happens in the page query, so cursors never split a pair. An upload is hidden when a later event in the same location names its file within a day. An extraction is hidden when it comes within 30 minutes of its capture, and the capture row shows the extraction's diff, redacted for the same reader. The audit table is unchanged.
  • components/history/fields.ts is the field table: a hidden set, an id pattern, and entities whose sentence says it all.
  • D253 is in the spec.

Tested

  • Server:
    • Summary completeness for every action, plus refinements, lines, and the arrangement diff (put on, host change, shape change, rooms, more than five, unseen names).
    • Integration tests through /activity: the layout is never sent, another location's names are never sent, an upload folds, an extraction folds, and a report reads by the location's name.
    • Full suite: 3510 passed, 2 failed. One failure was an extraction history test that this change affects; it is updated and now passes. The other was a timing test, "200 moves under a second" (1.10 s under load), which passes when run alone.
  • Web:
    • Field table tests.
    • Every summary and line renders in English and Arabic.
    • Activity tests for sentences, Show/Hide, new-is-new, no JSON or UUIDs, and Arabic RTL with logical CSS.
  • Checks: lint, typecheck, drift, check-i18n, check-logical-css and the docs build all pass.

Every audit action has a sentence of its own in five languages. The
action list lives in @kept/shared; audited(), the server's English and
the web's sentences are typed by it, so a new action without a sentence
fails the typecheck.

A map arrangement is said change by change ("Put HD webcam on Corner
desk"), more than five behind Show, and its layout JSON is no longer
sent. Ids, versions, counters, digits, locale and filters are hidden; a
report's things and photos become lines. A field set from nothing shows
its value without "empty". An upload folds into the row that used it,
and a capture's extraction into the capture (D253).

Closes #140

Signed-off-by: Ibrahim Roshdy <22573766+ibrahimroshdy@users.noreply.github.com>
@ibrahimroshdy
ibrahimroshdy merged commit ca480d8 into main Oct 16, 2026
21 checks passed
@ibrahimroshdy
ibrahimroshdy deleted the fix/activity-sentences branch October 16, 2026 13:23
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activity: plain sentences, not JSON and event codes

1 participant