Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ FROM oven/bun:1.1.3-alpine
# Install dependencies
RUN apk add --no-cache nodejs npm git

# Clone the repository
RUN git clone --depth=1 https://github.com/queuelab/MapGPT /app

# Set the working directory
WORKDIR /app/MapGPT
WORKDIR /app

# Remove the .git directory
RUN rm -rf .git
# Copy local files to the container
COPY . .
Comment on lines +7 to +10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Leverage build cache: copy manifests first, then the rest.

COPY-ing the whole context before bun install defeats layer caching. Copy manifests first, install, then copy sources. Also consider a .dockerignore to exclude node_modules/.next/.git.

-WORKDIR /app
-
-# Copy local files to the container
-COPY . .
+WORKDIR /app
+
+# Copy manifests first for better caching
+COPY package.json bun.lockb* ./
+RUN bun install --frozen-lockfile || bun install
+
+# Then copy the rest of the source
+COPY . .

Additionally add a .dockerignore:

.git
.next
node_modules
dist
build
coverage
*.log
🤖 Prompt for AI Agents
In Dockerfile around lines 7 to 10, copying the entire context before installing
dependencies prevents Docker layer caching; change the Dockerfile to first COPY
only package manifest files (package.json, bun.lockb / package-lock.json /
yarn.lock as applicable), run bun install, then COPY the rest of the source
files and build; additionally add a .dockerignore at repository root excluding
.git, .next, node_modules, dist, build, coverage and *.log to keep the build
context small and speed up caching.


# Verify the presence of package.json
RUN if [ ! -f package.json ]; then echo "package.json not found"; exit 1; fi
Expand Down
7 changes: 6 additions & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,15 @@

/* Mobile layout specific styles */
@media (max-width: 1024px) {
body {
overflow: auto;
height: auto;
}
Comment on lines +85 to +88
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Mobile body scroll: consider scroll chaining control.

Enabling body scroll fixes the issue, but can cause nested-scroll bounce on iOS. Add overscroll-behavior-y: contain; to body for a smoother experience.

Apply:

   body {
     overflow: auto;
     height: auto;
+    overscroll-behavior-y: contain;
   }
📝 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
body {
overflow: auto;
height: auto;
}
body {
overflow: auto;
height: auto;
overscroll-behavior-y: contain;
}
🤖 Prompt for AI Agents
In app/globals.css around lines 85 to 88, the body rules only set overflow and
height which can allow nested-scroll bounce on iOS; add overscroll-behavior-y:
contain to the body selector so vertical scroll chaining is prevented and nested
scrolling behaves smoothly. Update the body rule to include that property
alongside the existing overflow and height settings.


.mobile-layout-container {
display: flex;
flex-direction: column;
height: 100vh;
min-height: 100vh;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use dynamic viewport units to avoid 100vh bugs under mobile browser UI.

Prefer 100dvh with 100vh fallback to keep the input reachable when the URL bar collapses/expands.

-    min-height: 100vh;
+    /* Fallback then dynamic viewport for mobile */
+    min-height: 100vh;
+    min-height: 100dvh;
📝 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
min-height: 100vh;
/* Fallback then dynamic viewport for mobile */
min-height: 100vh;
min-height: 100dvh;
🤖 Prompt for AI Agents
In app/globals.css around line 93, replace the single min-height: 100vh; with a
fallback+preferred pair so mobile browsers use dynamic viewport units: keep
min-height: 100vh; first, then add min-height: 100dvh; after it (fallback first,
100dvh last so supported browsers prefer the dynamic value).

width: 100%;
background-color: hsl(var(--background));
}
Expand Down
6 changes: 3 additions & 3 deletions components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ export function Chat({ id }: ChatProps) {
<div className="mobile-icons-bar">
<MobileIconsBar />
</div>
<div className="mobile-chat-input-area">
<ChatPanel messages={messages} input={input} setInput={setInput} />
</div>
<div className="mobile-chat-messages-area">
{showEmptyScreen ? (
<EmptyScreen
Expand All @@ -96,6 +93,9 @@ export function Chat({ id }: ChatProps) {
<ChatMessages messages={messages} />
)}
</div>
<div className="mobile-chat-input-area">
<ChatPanel messages={messages} input={input} setInput={setInput} />
</div>
</div>
</MapDataProvider>
);
Expand Down
1 change: 1 addition & 0 deletions dev.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$ next dev
Binary file added jules-scratch/verification/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions jules-scratch/verification/verify_mobile_scroll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from playwright.sync_api import sync_playwright, expect

Comment on lines +1 to +2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add missing imports used by error handling and env-based selector.

 from playwright.sync_api import sync_playwright, expect
+import os
+import sys
+import traceback
📝 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
from playwright.sync_api import sync_playwright, expect
from playwright.sync_api import sync_playwright, expect
import os
import sys
import traceback
🤖 Prompt for AI Agents
In jules-scratch/verification/verify_mobile_scroll.py lines 1-2, the file uses
environment-based selectors and exception handling but doesn't import the
modules required for those operations; add imports for os (to read environment
variables), traceback (to format/log exception details) and TimeoutError from
playwright.sync_api (to catch Playwright timeout exceptions) at the top of the
file so env-based selector lookups and error handling work correctly.

def run(playwright):
browser = playwright.chromium.launch(headless=True)
context = browser.new_context(
viewport={'width': 375, 'height': 667},
is_mobile=True,
user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
)
Comment on lines +5 to +9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use a built‑in mobile device profile (or add has_touch/device scale).

Built‑ins ensure consistent emulation (UA, viewport, deviceScaleFactor, hasTouch, etc.).

-    context = browser.new_context(
-        viewport={'width': 375, 'height': 667},
-        is_mobile=True,
-        user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
-    )
+    iphone = playwright.devices["iPhone 12"]
+    context = browser.new_context(**iphone)
📝 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
context = browser.new_context(
viewport={'width': 375, 'height': 667},
is_mobile=True,
user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
)
iphone = playwright.devices["iPhone 12"]
context = browser.new_context(**iphone)
🤖 Prompt for AI Agents
In jules-scratch/verification/verify_mobile_scroll.py around lines 5 to 9,
replace the ad-hoc context creation with use of a built-in Playwright mobile
device profile (or at minimum add deviceScaleFactor and hasTouch) so the
emulation includes UA, viewport, deviceScaleFactor and touch support; import or
reference the appropriate device (e.g., the iPhone profile) from
playwright.devices and pass it to browser.new_context (or extend the current
dict with deviceScaleFactor and hasTouch) to ensure consistent mobile emulation
across runs.

page = context.new_page()

try:
page.goto("http://localhost:3000")

# Wait for the page to load by looking for a known element
expect(page.locator('.mobile-layout-container')).to_be_visible(timeout=30000)

# Take a screenshot
page.screenshot(path="jules-scratch/verification/verification.png")
Comment on lines +12 to +19
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

Actually verify the mobile scroll fix and chat input reachability.

Right now we only assert container visibility. Also assert page is scrollable and that we can reach the chat input (selector via env for stability).

-    try:
-        page.goto("http://localhost:3000")
-
-        # Wait for the page to load by looking for a known element
-        expect(page.locator('.mobile-layout-container')).to_be_visible(timeout=30000)
-
-        # Take a screenshot
-        page.screenshot(path="jules-scratch/verification/verification.png")
+    try:
+        page.goto("http://localhost:3000", wait_until="domcontentloaded")
+        page.set_default_timeout(30000)
+
+        # Wait for known layout container
+        expect(page.locator(".mobile-layout-container")).to_be_visible()
+
+        # Verify page is scrollable on mobile
+        is_scrollable = page.evaluate("""() => {
+            const el = document.scrollingElement || document.documentElement || document.body;
+            return el.scrollHeight > el.clientHeight;
+        }""")
+        if not is_scrollable:
+            raise AssertionError("Page is not scrollable on mobile viewport")
+
+        # Scroll to bottom to reach chat input area
+        page.evaluate("window.scrollTo(0, document.body.scrollHeight)")
+
+        # Optionally verify chat input visibility if provided
+        chat_sel = os.getenv("CHAT_INPUT_SELECTOR")  # e.g., [data-testid='chat-input']
+        if chat_sel:
+            chat = page.locator(chat_sel)
+            chat.scroll_into_view_if_needed()
+            expect(chat).to_be_visible()
+
+        # Take a screenshot
+        os.makedirs("jules-scratch/verification", exist_ok=True)
+        page.screenshot(path="jules-scratch/verification/verification.png")

🏁 Script executed:

#!/bin/bash
# Set your app's stable chat input selector before running, e.g.:
# export CHAT_INPUT_SELECTOR="[data-testid='chat-input']"
python jules-scratch/verification/verify_mobile_scroll.py

Length of output: 244


Ensure Playwright is installed and configured before running the script
The verification script currently fails with ModuleNotFoundError: No module named 'playwright'. Add playwright (and any peer dependencies) to your project’s test/dev requirements (e.g., requirements-dev.txt), and instruct contributors or CI to run:

pip install -r requirements-dev.txt
playwright install

before executing verify_mobile_scroll.py.

🤖 Prompt for AI Agents
In jules-scratch/verification/verify_mobile_scroll.py around lines 12 to 19, the
script fails with ModuleNotFoundError because Playwright is not declared as a
test/dev dependency; add "playwright" (and any required peer deps like
"playwright-python" if used or specific browser drivers) to your test/dev
requirements file (e.g., requirements-dev.txt) and update CONTRIBUTING/CI docs
to run pip install -r requirements-dev.txt and then run playwright install
before executing the script; ensure CI job steps include these two commands so
the environment has Playwright and its browsers available.

Comment on lines +18 to +19
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Prevent screenshot write failures: create the output directory first.

Without creating jules-scratch/verification, page.screenshot will fail.

-        # Take a screenshot
-        page.screenshot(path="jules-scratch/verification/verification.png")
+        # Take a screenshot
+        os.makedirs("jules-scratch/verification", exist_ok=True)
+        page.screenshot(path="jules-scratch/verification/verification.png")

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In jules-scratch/verification/verify_mobile_scroll.py around lines 18 to 19, the
code calls page.screenshot(path="jules-scratch/verification/verification.png")
without ensuring the output directory exists, which will cause write failures;
before taking the screenshot, create the directory (e.g., use
os.makedirs("jules-scratch/verification", exist_ok=True)) and then proceed to
call page.screenshot so the file can be written successfully.


except Exception as e:
print(f"An error occurred: {e}")
# Take a screenshot even if there is an error to help with debugging
page.screenshot(path="jules-scratch/verification/error.png")
Comment on lines +21 to +24
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Make failures visible in CI: print stack trace, save error screenshot reliably, and exit non‑zero.

Currently errors only print a short message; the process still exits 0 if nothing else fails.

-    except Exception as e:
-        print(f"An error occurred: {e}")
-        # Take a screenshot even if there is an error to help with debugging
-        page.screenshot(path="jules-scratch/verification/error.png")
+    except Exception as e:
+        # Ensure directory exists before saving artifacts
+        os.makedirs("jules-scratch/verification", exist_ok=True)
+        # Capture error screenshot and full traceback
+        page.screenshot(path="jules-scratch/verification/error.png")
+        traceback.print_exc()
+        sys.exit(1)

Committable suggestion skipped: line range outside the PR's diff.


finally:
browser.close()
Comment on lines +26 to +27
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Close the context explicitly before closing the browser.

Not strictly required, but makes teardown clearer and future‑proof.

     finally:
-        browser.close()
+        try:
+            context.close()
+        finally:
+            browser.close()
📝 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
finally:
browser.close()
finally:
try:
context.close()
finally:
browser.close()
🤖 Prompt for AI Agents
In jules-scratch/verification/verify_mobile_scroll.py around lines 26 to 27, the
finally block closes the browser directly but does not explicitly close the
browser context; modify the teardown to close the context before closing the
browser (i.e., call context.close() or await context.close() as appropriate for
the sync/async API you’re using) and then call browser.close(); ensure you
handle None checks (if context may be undefined) and keep the finally structure
so both resources are cleaned up in order.


with sync_playwright() as playwright:
run(playwright)
Comment on lines +29 to +30
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid side effects on import: add a main guard.

Running Playwright on import is risky (e.g., when tools import this module). Gate execution with a main guard.

-with sync_playwright() as playwright:
-    run(playwright)
+if __name__ == "__main__":
+    with sync_playwright() as playwright:
+        run(playwright)
📝 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
with sync_playwright() as playwright:
run(playwright)
if __name__ == "__main__":
with sync_playwright() as playwright:
run(playwright)
🤖 Prompt for AI Agents
In jules-scratch/verification/verify_mobile_scroll.py around lines 29-30, the
module executes Playwright at import time via "with sync_playwright() as
playwright: run(playwright)"; to fix, remove that top-level execution and wrap
it in a main guard by placing the Playwright invocation inside an if __name__ ==
'__main__': block (call run from there), ensuring run remains a callable
function exported for importers and that no side-effectful code runs on import.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"license": "Apache-2.0",
"scripts": {
"dev": "next dev --turbo",
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand Down Expand Up @@ -65,7 +65,6 @@
"next-themes": "^0.3.0",
"open-codex": "^0.1.30",
"pg": "^8.16.2",
"QCX": ".",
"radix-ui": "^1.3.4",
"react": "^19.1.0",
"react-dom": "^19.1.0",
Expand Down