Skip to content

docs: catch a misplaced document from the response, not the request - #37

Merged
jackielii merged 1 commit into
mainfrom
docs/catch-from-response
Oct 17, 2026
Merged

jackielii merged 1 commit into
mainfrom
docs/catch-from-response

Conversation

@jackielii

Copy link
Copy Markdown
Owner

Follow-up to v0.9.0 from eos's adoption feedback.

  • Removes the retargetNavigation and borrowedRegions middleware recipes from docs/rendering.md. Both judged by the request target before Props ran, and eos hit false results with each:
    • a region's controls targeting by selector (hx-target:inherited="closest tbody") were retargeted to body;
    • pages handling a borrowed id with t.Is, and actions answering for another page's region, were reported.
  • Adds "Catching it: decide from the response": the linter, a test guard middleware (eos's pagetest guard), and the htmx 4 htmx:after:request listener. eos confirmed the listener in a real-Chrome test.
  • rendering_examples_test.go pins the guard verbatim. It flags a whole document answering a request for a region, and leaves alone: an own region, a borrowed id handled by Is, a selector target with a fragment Page, an action answering for another page's region, and body.
  • docs/lint.md shows the t.Is(Q.M) replacement for a hand-written HX-Target comparison.

Docs and tests only; no release needed.

https://claude.ai/code/session_01Dp3Jmu2ePyCME2yG9yd672

The retargetNavigation and borrowedRegions recipes judged by the request
target before Props ran. eos found both wrong in practice: a region's
controls targeting by selector (closest tbody) got retargeted to body,
and pages handling a borrowed id with t.Is, or actions answering for
another page's region, were reported. Only the response tells.

Replace them with eos's response-based checks: a test guard middleware
(a whole document answering a request for a region) and the htmx 4
after:request listener, now confirmed in a real browser. Pin the guard
in rendering_examples_test.go, including the cases eos hit. Show the
t.Is replacement for a hand-written HX-Target comparison in lint.md.

Claude-Session: https://claude.ai/code/session_01Dp3Jmu2ePyCME2yG9yd672
@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.32%. Comparing base (1859832) to head (43ae8fa).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #37   +/-   ##
=======================================
  Coverage   95.32%   95.32%           
=======================================
  Files          17       17           
  Lines        1754     1754           
=======================================
  Hits         1672     1672           
  Misses         49       49           
  Partials       33       33           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jackielii
jackielii merged commit 97b0f9d into main Oct 17, 2026
16 checks passed
@jackielii
jackielii deleted the docs/catch-from-response branch October 19, 2026 10:44
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