Skip to content

Changeset comment feature + notes comment feature#88

Merged
jeffmaki merged 16 commits into
developfrom
jeff-notes
Jul 23, 2026
Merged

Changeset comment feature + notes comment feature#88
jeffmaki merged 16 commits into
developfrom
jeff-notes

Conversation

@jeffmaki

@jeffmaki jeffmaki commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

AZDO #3967 and #3966

Summary

  • Implemented changeset and note “discussion” posting in components/review/Discussion.vue, including:
    • Changeset submission flow that re-fetches comments afterward so the UI reflects the new comment (with server timestamps)
    • Note submission flow that appends the new comment optimistically on success (without re-fetching)
    • Error handling via toast notifications that preserves the user’s draft text on failure and prevents adding the failed comment
  • Refactored the discussion UI’s message construction:
    • Extracted note comment → ChatMessage mapping into a helper used by refreshNote()
    • Updated changeset comment refresh to always derive messages from osmClient.getChangesetComments (relying on it to return an empty array when appropriate)
  • Updated OSM client comment submission in services/osm.ts:
    • Send comment text via URL query parameters (text=...) instead of multipart FormData for changeset comments
    • Added OsmApiClient.postNoteComment(...) to post note comments via the JSON endpoint (also using a query param) and return the updated note
  • Expanded automated coverage:
    • Unit tests for getChangesetComments (including date typing and empty-array behavior)
    • Unit tests verifying comment posting uses the expected text= URL encoding for both changeset and note endpoints
    • E2E tests validating optimistic note append on success, and toast + draft preservation + no message append on failure
  • Adjusted dev/proxy and environment setup to support local development reliably:
    • Nuxt devServer.host set to 0.0.0.0
    • Reworked nitro.devProxy into object-based route rules (with changeOrigin) and expanded proxied SPA backends (adding /new-api, /osm, /tdei, /tdei-user, while removing /workspaces)
    • Broadened Vite server.allowedHosts patterns
    • Updated .env.example and README.md to reflect the new devProxy routing approach
  • CI and repo hygiene tweaks:
    • Switched CI dependency install from npm ci to npm install
    • Updated .gitignore to ignore Claude-related paths

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3eaeb7c6-5831-4f06-a975-3e9017e5c6a5

📥 Commits

Reviewing files that changed from the base of the PR and between d395901 and b54c182.

📒 Files selected for processing (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

📝 Walkthrough

Walkthrough

Comment posting now reports failures while preserving drafts, refreshes changeset discussions, and optimistically updates note discussions. OSM client requests use encoded query parameters, note parsing is refactored, and Nuxt development proxy settings are expanded.

Changes

Comment flow updates

Layer / File(s) Summary
OSM comment client behavior
services/osm.ts, test/unit/services/osm.test.ts
Note conversion uses a typed helper; comment endpoints send URL-encoded query text, and note posting supports returning an updated note. Tests cover retrieval and request encoding.
Discussion refresh and send flow
components/review/Discussion.vue, test/e2e/review.spec.ts
Discussion sending now reports errors, retains failed drafts, refreshes changesets, and optimistically appends note comments. End-to-end tests cover success and failure cases.

Development server routing

Layer / File(s) Summary
Development proxy configuration
nuxt.config.ts, .env.example, README.md
The dev server binds to all interfaces, proxy routes use changeOrigin, additional backend prefixes are supported, and setup documentation describes proxy-based development.

Development workflow maintenance

Layer / File(s) Summary
CI and local tooling configuration
.github/workflows/ci.yml, .gitignore
CI dependency installation uses npm install, and Claude-related paths are ignored.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: susrisha, mashb

Poem

A bunny sent a note with care,
Kept the draft when bugs were there.
Fresh comments hopped into the view,
While proxy paths grew broad and true.
“Thump, thump!”—the changes flew!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change set: adding and improving changeset and notes comment functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jeffmaki
jeffmaki requested review from cyrossignol and removed request for cyrossignol July 10, 2026 21:42
@jeffmaki
jeffmaki marked this pull request as draft July 10, 2026 21:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 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 `@nuxt.config.ts`:
- Around line 31-32: Remove the newly added trailing commas from the devServer
configuration and the additional changed entries around the corresponding
configuration block in nuxt.config.ts, following the project’s
no-trailing-commas style.
- Around line 52-56: Update the Vite server configuration in nuxt.config.ts to
remove allowedHosts: true and keep host validation enabled by using the default
empty list or an explicit allowlist. Support additional tunnel hosts through the
__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS environment variable.

In `@services/osm.ts`:
- Around line 59-78: Guard against missing comments in noteFeatureToEntity by
defaulting properties.comments to an empty array before iterating. Update the
comments access in the loop and returned OsmNote so undefined feature properties
or comments never cause iteration to throw.
- Around line 462-501: Remove the duplicate postNoteComment method in
services/osm.ts. Keep the Promise<void> implementation that posts the encoded
text query parameter, and delete or rename the later JSON-returning
implementation so only one method with this signature remains.
🪄 Autofix (Beta)

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

Run ID: b8f25c48-b8f8-4be4-b6f1-cfb7157f534b

📥 Commits

Reviewing files that changed from the base of the PR and between bc945e3 and d32973a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • components/review/Discussion.vue
  • nuxt.config.ts
  • services/osm.ts
  • test/e2e/review.spec.ts
  • test/unit/services/osm.test.ts

Comment thread nuxt.config.ts
Comment thread nuxt.config.ts Outdated
Comment thread services/osm.ts
Comment on lines +59 to +78
function noteFeatureToEntity(feature: Feature): OsmNote {
const geometry = feature.geometry as Point;
const properties = feature.properties ?? { };

for (const comment of properties.comments) {
comment.date = new Date(comment.date);
}

notes.push({
id: properties.id,
status: properties.status,
lat: geometry.coordinates[1] ?? 0,
lon: geometry.coordinates[0] ?? 0,
created_at: new Date(properties.date_created),
comments: properties.comments,
});
for (const comment of properties.comments) {
comment.date = new Date(comment.date);
}

return notes;
return {
id: properties.id,
status: properties.status,
lat: geometry.coordinates[1] ?? 0,
lon: geometry.coordinates[0] ?? 0,
created_at: new Date(properties.date_created),
comments: properties.comments,
};
}

function notesGeoJsonToEntities(geoJson: FeatureCollection): OsmNote[] {
return geoJson.features.map(noteFeatureToEntity);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Guard against undefined properties.comments

When feature.properties is undefined, the ?? { } fallback yields an empty object, but properties.comments is then undefined and for (const comment of undefined) throws a TypeError. Add a defensive fallback to [].

🛡️ Proposed fix
 function noteFeatureToEntity(feature: Feature): OsmNote {
   const geometry = feature.geometry as Point;
   const properties = feature.properties ?? { };
 
-  for (const comment of properties.comments) {
+  for (const comment of properties.comments ?? []) {
     comment.date = new Date(comment.date);
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function noteFeatureToEntity(feature: Feature): OsmNote {
const geometry = feature.geometry as Point;
const properties = feature.properties ?? { };
for (const comment of properties.comments) {
comment.date = new Date(comment.date);
}
notes.push({
id: properties.id,
status: properties.status,
lat: geometry.coordinates[1] ?? 0,
lon: geometry.coordinates[0] ?? 0,
created_at: new Date(properties.date_created),
comments: properties.comments,
});
for (const comment of properties.comments) {
comment.date = new Date(comment.date);
}
return notes;
return {
id: properties.id,
status: properties.status,
lat: geometry.coordinates[1] ?? 0,
lon: geometry.coordinates[0] ?? 0,
created_at: new Date(properties.date_created),
comments: properties.comments,
};
}
function notesGeoJsonToEntities(geoJson: FeatureCollection): OsmNote[] {
return geoJson.features.map(noteFeatureToEntity);
function noteFeatureToEntity(feature: Feature): OsmNote {
const geometry = feature.geometry as Point;
const properties = feature.properties ?? { };
for (const comment of properties.comments ?? []) {
comment.date = new Date(comment.date);
}
return {
id: properties.id,
status: properties.status,
lat: geometry.coordinates[1] ?? 0,
lon: geometry.coordinates[0] ?? 0,
created_at: new Date(properties.date_created),
comments: properties.comments,
};
}
function notesGeoJsonToEntities(geoJson: FeatureCollection): OsmNote[] {
return geoJson.features.map(noteFeatureToEntity);
🤖 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 `@services/osm.ts` around lines 59 - 78, Guard against missing comments in
noteFeatureToEntity by defaulting properties.comments to an empty array before
iterating. Update the comments access in the loop and returned OsmNote so
undefined feature properties or comments never cause iteration to throw.

Comment thread services/osm.ts Outdated
@jeffmaki
jeffmaki marked this pull request as ready for review July 10, 2026 21:58
jeffmaki added 2 commits July 16, 2026 15:55
Removed reminders about environment tags and added information on local dev server setup.
Removed reminders about environment tags and added information on local
dev server setup.
Comment thread .github/workflows/ci.yml
# types + eslint typegen that both `lint` and `typecheck` rely on.
- name: Install dependencies
run: npm ci
run: npm install

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why not keep ci? Wasn't it designed for this environment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses the .lock file to avoid having to re-resolve the dependencies, so it's ideal to use here, but when I dev on my Mac and this runs on Linux the versions of the dependencies aren't the same unf.

Comment thread services/osm.ts Outdated
Comment on lines +462 to +464
// The OSM API reads the comment `text` from the query string, not a request
// body — a multipart body is ignored (the backend then 401s the write).
await this._post(`changeset/${changesetId}/comment?text=${encodeURIComponent(message)}`, undefined, {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you double-check Claude here? The docs suggest that the post body is correct (and there is no 401). Maybe the backend proxy is tripping something up?

https://wiki.openstreetmap.org/wiki/API_v0.6#Comment:_POST_/api/0.6/changeset/#id/comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll double-check this, but it works as written right now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment was wrong, I removed it, code is right tho

@susrisha

Copy link
Copy Markdown
Collaborator

Is there anything pending for this to be merged? @jeffmaki

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
nuxt.config.ts (1)

40-45: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Rewrite the dev-proxy mounts to strip the public prefix. VITE_*_URL points clients at /api/v1/, /new-api/v1/, /tdei/v1/, /tdei-user/v1/, and /osm/, but these proxy targets still need to map to upstream paths like /api/v1/ and /. Add explicit path rewriting (or equivalent proxy config) for all five prefixes so requests don’t land on duplicated paths such as /api/api/v1/... or /api/tdei/v1/....

🤖 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 `@nuxt.config.ts` around lines 40 - 45, Update the devProxy entries for /api,
/new-api, /osm, /tdei, and /tdei-user to strip each public mount prefix before
forwarding, while preserving the upstream base paths (/api/v1/ for API services
and / for OSM). Ensure requests do not produce duplicated prefixes such as
/api/api/v1 or /api/tdei/v1.
🤖 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 @.github/workflows/ci.yml:
- Line 31: Replace the npm install command in the CI workflow with npm ci to
enforce the committed package-lock.json and fail on manifest or lockfile
divergence. Keep the existing dependency installation step otherwise unchanged.

In `@nuxt.config.ts`:
- Around line 54-58: Update the allowedHosts configuration in nuxt.config.ts to
remove the broad '.local' and '.internal' entries, retaining only the exact
organization and tunnel hosts required for the dev server. Direct developers to
use __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS for any per-developer host additions.

In `@README.md`:
- Around line 13-16: Update the README proxy documentation to refer to the
nitro.devProxy configuration instead of a devServer section, clarify that the
commented lines 47-49 are local proxy targets, and change “setup” to “set up” or
“is set up” as grammatically appropriate.

---

Outside diff comments:
In `@nuxt.config.ts`:
- Around line 40-45: Update the devProxy entries for /api, /new-api, /osm,
/tdei, and /tdei-user to strip each public mount prefix before forwarding, while
preserving the upstream base paths (/api/v1/ for API services and / for OSM).
Ensure requests do not produce duplicated prefixes such as /api/api/v1 or
/api/tdei/v1.
🪄 Autofix (Beta)

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

Run ID: a9171050-0165-4f59-9fb6-0bb562dbc845

📥 Commits

Reviewing files that changed from the base of the PR and between d32973a and d395901.

📒 Files selected for processing (9)
  • .env.example
  • .github/workflows/ci.yml
  • .gitignore
  • README.md
  • components/review/Discussion.vue
  • nuxt.config.ts
  • services/osm.ts
  • test/e2e/review.spec.ts
  • test/unit/services/osm.test.ts
💤 Files with no reviewable changes (1)
  • services/osm.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/unit/services/osm.test.ts
  • test/e2e/review.spec.ts
  • components/review/Discussion.vue

Comment thread .github/workflows/ci.yml
# types + eslint typegen that both `lint` and `typecheck` rely on.
- name: Install dependencies
run: npm ci
run: npm install

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep CI lockfile-deterministic.

npm install weakens the repository’s existing CI contract: unlike npm ci, it can reconcile/update the lockfile rather than failing when manifests and the lockfile diverge. That allows CI to validate a dependency tree different from the committed one; restore npm ci, or document and verify the platform-specific dependency rationale separately.

#!/usr/bin/env bash
set -euo pipefail

test -f package-lock.json
npm install --dry-run --ignore-scripts
git diff --exit-code -- package-lock.json
🤖 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 @.github/workflows/ci.yml at line 31, Replace the npm install command in the
CI workflow with npm ci to enforce the committed package-lock.json and fail on
manifest or lockfile divergence. Keep the existing dependency installation step
otherwise unchanged.

Comment thread nuxt.config.ts
Comment thread README.md Outdated
@jeffmaki

Copy link
Copy Markdown
Contributor Author

Yes, I want to address that latest round of Rabbit comments please. I'll merge after that.

@jeffmaki
jeffmaki merged commit 21216bf into develop Jul 23, 2026
2 checks passed
@jeffmaki
jeffmaki deleted the jeff-notes branch July 23, 2026 16:45
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.

3 participants