vercel / vercel/vercel-plugin

SessionStart dedup reset reads hook_event_name instead of source; regression fixtures mirror the mismatch

Open
#169 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
287
Forks
58
Avg merge
1d 1h
Merged PRs (30d)
17

Description

At commit 7b0a6f61b254b0149bb644cadfb588a5c46df0c2 (0.48.2), the Claude Code branch of hooks/src/session-start-seen-skills.mts:87 compares input.hook_event_name with clear/compact.

Claude Code's documented SessionStart payload uses hook_event_name: "SessionStart" and source: "clear" or "compact":
https://code.claude.com/docs/en/hooks#sessionstart-input

For example:

{"hook_event_name":"SessionStart","source":"clear","session_id":"synthetic-session"}

Static inspection shows that this payload cannot satisfy the current reset predicate. The generated hooks/session-start-seen-skills.mjs uses the same field. This is a schema mismatch found by inspection, not a report of an observed live-session failure.

Six fixtures in tests/session-start-seen-skills.test.ts at lines 136, 164, 190, 216, 256 and 294 currently put clear/compact/startup in hook_event_name, mirroring the implementation's mismatch.

Proposed change:

  • Add source?: string to the input type and read input?.source ?? "" in the Claude branch.
  • Preserve the Cursor early return and the existing nonempty session_id condition.
  • Update the six fixtures to use hook_event_name: "SessionStart" with the corresponding source.
  • Regenerate the distributed .mjs through the repository's build process.

Requested regression coverage:

  • clear/compact reset only the intended session's dedup artifacts, preserve a different session's artifacts, and permit reinjection.
  • startup/resume/fork/unknown or missing source preserve existing artifacts.
  • Missing/empty session_id and legacy hook_event_name-only clear/compact payloads do not reset artifacts.
  • Preserve Cursor behavior.

Validation so far: the existing two-hunk source patch matches the pinned source in an in-memory textual check; six fixture replacements were prepared as text. No repository scripts, hooks, build or tests were executed. The test helper runs the generated .mjs, so a source-only edit is insufficient for runtime validation. This fix makes an existing deletion branch reachable; its isolation and deletion scope should be verified before release.

Source:
https://github.com/vercel/vercel-plugin/blob/7b0a6f61b254b0149bb644cadfb588a5c46df0c2/hooks/src/session-start-seen-skills.mts#L87
Tests:
https://github.com/vercel/vercel-plugin/blob/7b0a6f61b254b0149bb644cadfb588a5c46df0c2/tests/session-start-seen-skills.test.ts#L136

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with hooks/src/session-start-seen-skills.mts and tests/session-start-seen-skills.test.ts, then inspect the generated hooks/session-start-seen-skills.mjs used by the test helper. Run the repository's build process and focused tests; done means the six fixtures use the documented fields, regression coverage verifies session isolation and source handling, and generated output is updated without changing Cursor behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, devtools, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.