Skip to content

Upgrade Babel runtime for optional chaining support - #5

Open
evghenimelnic wants to merge 1 commit into
mainfrom
codex/create-online-chat-system-q0kgzr
Open

Upgrade Babel runtime for optional chaining support#5
evghenimelnic wants to merge 1 commit into
mainfrom
codex/create-online-chat-system-q0kgzr

Conversation

@evghenimelnic

Copy link
Copy Markdown
Owner

Summary

  • switch the static client to Babel Standalone 7 via CDN so modern JSX/ESNext features compile correctly in the browser
  • restore optional chaining usage in the notification card now that Babel handles it
  • document the Babel runtime alongside the rest of the frontend stack in the README

Testing

  • python -m compileall app

https://chatgpt.com/codex/tasks/task_e_68e2dc54ec58832eac05775e82694a53

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ 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

Comment thread app/database.py
Comment on lines +34 to +35
def get_collection(name: str) -> Any:
"""Return a Mongo collection by name."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Badge Import typing.Any in database helper

The get_collection annotation references Any but the symbol is never imported. Because annotations are evaluated when the module is imported, loading app.database raises NameError: name 'Any' is not defined, preventing the FastAPI application from starting. Add from typing import Any (or drop the annotation) so the module can be imported.

Useful? React with 👍 / 👎.

Comment thread app/services/messages.py
Comment on lines +64 to +71
cursor = messages.find(query).sort("created_at", -1).limit(limit)
history: list[Dict[str, Any]] = []
async for item in cursor:
event_time = item.get("event_time")
item["id"] = _serialize_id(item.pop("_id"))
item["created_at"] = item["created_at"].isoformat()
if event_time:
item["event_time"] = event_time.isoformat()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard string event_time values when serialising history

Messages saved from the UI send event_time as a plain ISO string. fetch_history assumes the field is a datetime object and unconditionally calls event_time.isoformat(). When a message with a string timestamp exists, this branch raises AttributeError and the /common/… or /rooms/…/history endpoints fail. Parse event_time to a datetime before storing or skip the .isoformat() call when it is already a string.

Useful? React with 👍 / 👎.

Comment on lines +64 to +74
async def list_subscriptions(user_id: str) -> list[Dict[str, Any]]:
"""Return all subscriptions for user."""

collection = get_collection("subscriptions")
cursor = collection.find({"user_id": user_id}).sort("created_at", -1)
subscriptions: list[Dict[str, Any]] = []
async for item in cursor:
item["id"] = _serialize_id(item.pop("_id"))
if item.get("when_start"):
item["when_start"] = item["when_start"].isoformat()
if item.get("when_end"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Parse subscription time filters from strings before formatting

During subscription creation the when_start and when_end values are written straight from the payload (UI submits datetime-local strings). Later, list_subscriptions assumes these fields are datetime objects and calls .isoformat() on them. When a user specifies time bounds, this results in AttributeError and the listing/matching code fails. Convert the incoming strings to datetime before persistence or guard against strings when serialising.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant