Task 4086: Set changeset hashtags in Rapid manager - #104
Conversation
Pass a task-specific changeset hashtag from the editor into the RapidManager and include it in the map URL hash. Editor: introduce changesetTag (#tm-<project>-<task>), pass it to manager.init and manager.switchWorkspace, and append it (URL-encoded) as the hashtags parameter in generated hashes. RapidManager: add #setInitialChangesetHashtags to update the Rapid context's initialHashParams (adding or deleting the hashtags entry) and call it from init and switchWorkspace. Tests: adjust test setup (resetAsync, urlhash.initialHashParams) and add a unit test asserting that initializing/switching workspaces replaces the initial changeset hashtag as expected.
📝 WalkthroughWalkthroughThe task editor derives a task-specific changeset hashtag and passes it to Rapid during initialization and workspace switching. Rapid updates its initial URL hash parameters and validates the required hash API. ChangesTask changeset hashtag propagation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/unit/services/rapid.test.ts (1)
97-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover removal of a previous task hashtag.
This test covers only supplied hashtags. Add a call without the third argument and assert that
initialHashParamsno longer hashashtags. This protects the path that removes task state before the manager is used without a task tag.Proposed test addition
await manager.switchWorkspace(1763, null, '`#tm-39-3`'); expect(initialHashParams.get('hashtags')).toBe('`#tm-39-3`'); + + await manager.switchWorkspace(1763, null); + + expect(initialHashParams.has('hashtags')).toBe(false); });Run
run-tests.shafter this test change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/unit/services/rapid.test.ts` around lines 97 - 103, Add coverage in the existing manager initialization/workspace-switch test for removal of task hashtag state: after the current hashtag assertions, invoke the relevant manager method without the third hashtag argument, then assert initialHashParams no longer contains “hashtags”. Run run-tests.sh to verify the updated test.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@services/rapid.ts`:
- Around line 88-89: Remove trailing commas from the specified changed
TypeScript: both changesetHashtags parameter declarations in services/rapid.ts
(lines 88-89 and 121-123), the final initialHashParams entry in
test/unit/services/rapid.test.ts (lines 28-30), and the final array entry and
constructor argument in test/unit/services/rapid.test.ts (lines 67-74).
---
Nitpick comments:
In `@test/unit/services/rapid.test.ts`:
- Around line 97-103: Add coverage in the existing manager
initialization/workspace-switch test for removal of task hashtag state: after
the current hashtag assertions, invoke the relevant manager method without the
third hashtag argument, then assert initialHashParams no longer contains
“hashtags”. Run run-tests.sh to verify the updated test.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c38d3ebb-f00d-4628-9f55-4c5599660708
📒 Files selected for processing (3)
pages/workspace/[id]/projects/[projectId]/tasks/[taskId]/editor.vueservices/rapid.tstest/unit/services/rapid.test.ts
Add RapidInitialHashParams type and isRapidInitialHashParams type guard to safely detect Map-like initialHashParams. Use optional chaining when reading initialHashParams and check it with the guard before using it to prevent runtime errors. Change two RapidManager method signatures to return Promise<void> and give #setInitialChangesetHashtags an explicit void return type. Update e2e test to mock systems.urlhash.initialHashParams as a Map so the new guard passes.
susrisha
left a comment
There was a problem hiding this comment.
Adds the changesetHashtags based on the project and task. This is approved
Stop appending the &hashtags=<changesetTag> parameter in generateInitialHash within editor.vue. The changes remove the encoded changesetTag from both the customImagery and default return paths, simplifying the generated map hash and avoiding inclusion of the hashtags parameter in the URL.
Add a 'Hashtags' field to the changeset metadata in Details.vue, mapping to changeset.tags?.hashtags so hashtags from OSM changesets are surfaced in the review details UI.
DevBoard Task
https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/4086/
Changes implemented
#tm-{projectId}-{taskNumber}#tm-39-2hashtagsURL parameter on initial load.Impacted areas for testing
hashtagstag contains the expected value.Manual verification
Verified the Rapid
changeset/createrequest payload for project45, task127.Screenshots
Summary
#tm-{projectId}-{taskNumber}.hashtagsURL parameter during initialization and task switching.initialHashParamsbefore use.hashtagsfrom generated map hashes while retaining Rapid’s initial hashtag parameters.