feat(ops): URL param parsing + chip-state-from-URL (A3c, final A3)#556
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔒 Security Scan ResultsPlease check the workflow logs for details. |
A3c of docs/specs/ops-workflows-page-refinement/. Final piece of the A3 implementation. Mirror of Specs page A3c (PR #539). What changes in workflows_refined.js: - New readURLState() — parses ?bucket=…&q=… on init. Bucket values are filtered against VALID_BUCKETS so invalid params fall through to defaults (no zero-chip lockout). Search value is taken verbatim. - New bucketsAreDefault() — returns true when all 7 buckets are on. Used by syncURL() to keep "clean" URLs short. - New syncURL() — called after every state change (chip toggle, search input). Uses history.replaceState so toggles don't pollute the back button. Defaults are normalized OUT of the URL — share a link from default state and you get bare /workflows. - syncChipsToState() — new helper called in init() AFTER readURLState(). The server-rendered HTML has all chips chip-active; URL params may have flipped some off. This brings visual state in line with the logical state on first paint. - init() reorders: readURLState → syncChipsToState → wireChips → wireSearch → set input.value → applyFilters. Chip handlers now also call syncURL() after applyFilters(). URL schema: ?bucket=review,audit → only review + audit chips active ?q=security → search prefilled with "security" ?bucket=review&q=auth → combine both (no params) → defaults (all 7 buckets, empty search) Bucket values are sorted in the URL for stability (toggle order doesn't affect the generated link). Older browsers silently fall through to default state if URL or history APIs are unavailable — no UX regression. Tests (9 new): tests/unit/ops/test_workflows_refined_js.py gains a TestURLStateSurface class covering: - readURLState / syncURL / bucketsAreDefault on the public namespace - ?bucket= parsing (searchParams.get("bucket")) - ?q= parsing (searchParams.get("q")) - replaceState used (not pushState) — no history pollution - Defaults removed from URL (delete("bucket") + delete("q")) - syncURL called from chip + search handlers (>= 2 occurrences) - init() calls readURLState() All 60 Workflows-page tests pass (A2 + A3a + A3b + A3c combined). Spec progression now complete: - A1 — module (#552) - A2 — route (#553) - A3a — chips + pill + JS (#554) - A3b — kebab menu (#555) - A3c — URL params (this PR — final A3) After this stack merges, the /workflows route fully mirrors the just-shipped /specs page UX. Worth a v7.3.1 patch when combined with Phase 6 of sdk-error-message-fidelity (#551, merged). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42385dc to
9ceccb4
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A3c — final A3. URL param parsing + chip-state-from-URL. Mirror of Specs page A3c (PR #539).
After this PR merges, the entire Workflows page refinement is shipped.
URL schema
/workflows/workflows?bucket=review,auditreview+auditchips active/workflows?q=securitysecurity/workflows?bucket=review&q=authDefaults are normalized OUT of the URL — share a link from default state and you get bare
/workflows. Bucket values are sorted in the URL for stability.How it works
readURLState()?bucket=…&q=…on init. Invalid bucket names filter to defaults (no zero-chip lockout).bucketsAreDefault()syncURL()history.replaceStateso toggles don't pollute the back button.syncChipsToState()readURLState→syncChipsToState→wireChips→wireSearch→applyFilters. Chip + search handlers now callsyncURL()afterapplyFilters().Tests (9 new)
TestURLStateSurfaceclass intest_workflows_refined_js.py:readURLState/syncURL/bucketsAreDefaulton the public namespacesearchParams.get("bucket")+searchParams.get("q")source-grephistory.replaceStateused (not pushState)delete("bucket")+delete("q"))syncURL()called from chip + search handlers (≥2 occurrences)init()callsreadURLState()Test plan
Spec progression — FINAL
Worth a v7.3.1 patch when combined with Phase 6 of sdk-error-message-fidelity (#551, merged). Or v7.4.0 minor if there's other unreleased value to bundle.