Skip to content

feat(home-feed): emitFeedEvent helper + same-id action in-place [JARVIS-512]#25586

Merged
alex-nork merged 1 commit into
mainfrom
alex-nork/jarvis-512-emit-feed-event
Apr 14, 2026
Merged

feat(home-feed): emitFeedEvent helper + same-id action in-place [JARVIS-512]#25586
alex-nork merged 1 commit into
mainfrom
alex-nork/jarvis-512-emit-feed-event

Conversation

@alex-nork

@alex-nork alex-nork commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Second step of JARVIS-512, stacked on #25584 (merged).

  • New emit-feed-event.ts — the "force-write, not taught-write" entry point for background jobs. emitFeedEvent({ source, title, summary, ... }) persists an assistant-authored action item with opinionated defaults (type, author, priority, no expiry) so instrumented jobs have a single grep target. Optional dedupKey derives a deterministic emit:<source>:<dedupKey> id so repeat emits for the same logical signal update in place instead of appending duplicates.
  • Same-id action in-place update in the writer's mergeIncoming. Matches the thread in-place semantics. Distinct-id actions still append without collapsing by (type, source) — the append-without-replace behavior from feat(home-feed): action append semantics + per-source cap [JARVIS-512] #25584 is preserved for the normal case.

No background jobs are instrumented yet — that's the next PR. This one just lands the helper + writer support so the instrumentation PR is a pure set of import { emitFeedEvent } from ... callsite additions.

Test plan

  • bun test src/home/ — 144/144 pass (new: 6 emit-feed-event tests, 1 writer same-id test)
  • bun run typecheck — clean
  • bun run lint — clean
  • Covers: defaults, dedupKey determinism + in-place update, no-dedupKey distinct ids, explicit expiresAt, priority override, schema validation failure

🤖 Generated with Claude Code


Open with Devin

…IS-512]

New assistant/src/home/emit-feed-event.ts — the "force-write" entry
point for background jobs to append activity-log entries. Opinionated
defaults: type=action, author=assistant, source required, no
expiresAt by default, priority 50 (above platform baseline, below
assistant nudge default). Optional dedupKey derives a deterministic
"emit:<source>:<dedupKey>" id so repeat emits for the same logical
event update in place instead of appending duplicates.

To support dedupKey end-to-end, teach the writer's mergeIncoming to
treat same-id action items as an in-place update (matching thread
semantics). Distinct-id actions still append without collapsing by
(type, source).

Tests cover: defaults + persistence, dedupKey determinism + in-place
update, no-dedupKey distinct ids, expiresAt round-trip, priority
override, schema validation failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alex-nork alex-nork merged commit 9ba1c09 into main Apr 14, 2026
12 checks passed
@alex-nork alex-nork deleted the alex-nork/jarvis-512-emit-feed-event branch April 14, 2026 18:53

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff1d679919

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +107 to +108
function deterministicId(source: FeedItemSource, dedupKey: string): string {
return `emit:${source}:${dedupKey}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Sanitize dedupKey before building deterministic IDs

The deterministic ID path uses the raw dedupKey (emit:<source>:<dedupKey>), but feed item IDs are later used as URL path segments (PATCH /v1/home/feed/:id and POST /v1/home/feed/:id/actions/:actionId). If a caller provides a key with reserved path characters (notably /), the item can be written and returned by GET but becomes unreliable to patch/act on because routing splits that segment. Since dedup keys are expected to come from external event identifiers, this should be normalized to a URL-safe form (or hashed/validated) before composing the ID.

Useful? React with 👍 / 👎.

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