Skip to content

[Task] Replace use-session-hash-scroll source snapshot with behavior test #528

@Astro-Han

Description

@Astro-Han

Goal

Replace the use-session-hash-scroll source-string snapshot assertion with a behavior test for the hash-scroll contract.

When this is done, Windows advisory CI should no longer fail because of LF/CRLF differences, and the test should verify behavior instead of source-code shape.

Scope

In scope:

  • Replace the source-code toContain() assertion in use-session-hash-scroll.test.ts with a behavior-focused test.
  • Cover the hash-scroll contract:
    • when the URL hash points to an already-rendered message, the code scrolls to that message directly
    • it does not call onMessageNavigation
    • it does not emit duplicate navigation for the same already-rendered message path

Out of scope:

  • Do not only normalize CRLF as the final fix unless a temporary release unblocker is needed.
  • Do not introduce AST parsing just to keep testing source shape.
  • Do not change product behavior.

Relevant files or context

Problem:

  • Windows advisory CI fails in unit-windows-app because use-session-hash-scroll.test.ts reads source code and checks an LF-only string with toContain().
  • On Windows, source content can include CRLF, so the assertion fails.
  • This is not a product regression and not introduced by feat(sidebar): project rename and remove from sidebar #517. It exposes test debt: the test verifies implementation shape instead of behavior.

Likely file:

  • packages/app/src/pages/session/use-session-hash-scroll.test.ts

Verification

  • Run the targeted unit test that covers use-session-hash-scroll.
  • Confirm the test passes on Windows advisory CI.
  • Confirm the new test fails if the already-rendered-message hash-scroll path incorrectly calls fallback navigation.

Execution mode

Agent can implement directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low prioritytaskNarrow execution, audit, spike, migration, tracking, or upstream follow-up work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions