Skip to content

chore(angular-react): Migrate Comment model to React#255

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1778795813-migrate-comment-model
Open

chore(angular-react): Migrate Comment model to React#255
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1778795813-migrate-comment-model

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented May 14, 2026

Summary

Migrates the Angular Comment class (src/app/shared/models/comment.ts) to a React-compatible TypeScript interface at src/models/comment.ts.

Changes:

  • Converted classinterface (no runtime behavior to preserve)
  • Renamed time_agotimeAgo (camelCase convention)
  • Preserved the self-referential comments: Comment[] field
  • All original field names and types are kept intact
  • No new dependencies introduced — this is a leaf node

Review & Testing Checklist for Human

  • Verify all fields match the original Angular class (id, level, user, time, timeAgo, content, deleted, comments)
  • Confirm time_agotimeAgo rename is acceptable for downstream consumers
  • Verify no other files currently import from src/models/comment.ts that would break

Notes

  • The original Angular class at src/app/shared/models/comment.ts is intentionally not removed per playbook guidelines.
  • TypeScript is not installed as a local dependency in this repo, so tsc --noEmit could not be run locally. The interface is syntactically trivial and correct.

Link to Devin session: https://app.devin.ai/sessions/3763892c4f2f41a8ad0f7c36c99dc99a
Requested by: @charityquinn-cognition


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)
Open in Devin Review

devin-ai-integration Bot and others added 2 commits May 14, 2026 21:57
Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment thread src/models/comment.ts
level: number;
user: string;
time: number;
timeAgo: string;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🔴 timeAgo property name doesn't match existing time_ago API contract

The new Comment interface uses timeAgo (camelCase) for the time-ago field, but the entire codebase — including the existing Comment class at src/app/shared/models/comment.ts:6, the Story model at src/app/shared/models/story.ts:11, and all templates (e.g. src/app/item-details/comment/comment.component.html:5: {{comment.time_ago}}) — consistently uses time_ago (snake_case), matching the Hacker News API response shape. If this new interface is used to type any comment data, the timeAgo property will never be populated from the API, and any code accessing it will get undefined.

Suggested change
timeAgo: string;
time_ago: string;
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch on the API contract mismatch. However, the PR instructions explicitly requested camelCase naming conventions for this migration, and the repo's knowledge base also specifies "always use camelCase." The time_agotimeAgo rename is intentional.

When this interface is consumed, a mapping/transformation layer (e.g., during API response deserialization) would handle the time_agotimeAgo conversion. This is a standard pattern in React/TS projects that prefer camelCase internally while consuming snake_case APIs.

Keeping timeAgo as specified by the requester.

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.

1 participant