Skip to content

Move first-party HX push URL decisions to client-side to protect cacheability#11

Open
DmitryMatv wants to merge 2 commits intomainfrom
t3code/remove-push-url-cache-split
Open

Move first-party HX push URL decisions to client-side to protect cacheability#11
DmitryMatv wants to merge 2 commits intomainfrom
t3code/remove-push-url-cache-split

Conversation

@DmitryMatv
Copy link
Owner

Summary

  • Moves first-party history/push URL targeting from server inference to client-side hx-push-url updates in classifier.ts.
  • Keeps fragment requests cache-safe by removing push_url from loader/form params and avoiding HX-Current-URL-driven server behavior.
  • Adds explicit hidden track_usage=true to the classifier form and preserves history-disabled initial loader behavior.
  • Refactors URL/history helpers in app/web.py (build_clean_classifier_url, resolve_push_url_enabled, resolve_page_title_enabled) and aligns title OOB behavior with explicit flags.
  • Expands frontend and backend test coverage for canonical params, push URL behavior, title swaps, and rendered page contracts.
  • Documents cache/history gotchas in AGENTS.md to prevent regressions.

Testing

  • Added/updated unit tests in app/assets/ts/classifier.test.ts for canonical form params, loader params, and dynamic hx-push-url behavior.
  • Added backend fragment history contract checks in tests/test_web_fragment_history.py for omitted/explicit push URL and title OOB behavior.
  • Added page rendering contract checks in tests/test_web_helpers.py for form/loader attributes and canonical hx-vals.
  • Not run in this PR-writing context.

- Keep fragment params canonical by removing `push_url` from loader/form payloads
- Set `hx-push-url="false"` in template and compute clean first-party history targets in `classifier.ts`
- Stop inferring history updates from `HX-Current-URL` server-side; honor explicit flags only
- Expand TS/Python tests to lock in cache-safe history/title behavior
Copy link

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

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: 56a2445f8c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- stop client-side slug/push-url prediction and navigate submits to `/{classifier}/search`
- add server-side query/version/top_k normalization plus canonical 301/303 redirects
- update TS/Python tests for NFC + whitespace normalization and canonical URL behavior
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