Skip to content

feat(agent-service): add Mastra thread rollback APIs and undo test app - #5675

Draft
solittlework wants to merge 1 commit into
mainfrom
spike/CS-5132
Draft

feat(agent-service): add Mastra thread rollback APIs and undo test app#5675
solittlework wants to merge 1 commit into
mainfrom
spike/CS-5132

Conversation

@solittlework

Copy link
Copy Markdown
Contributor

Adds thread list/messages/clear/rollback endpoints on AgentBroker, mock-agent for local undo demos, ai-undo-app, and rollback docs.

Adds thread list/messages/clear/rollback endpoints on AgentBroker,
mock-agent for local undo demos, ai-undo-app, and rollback docs.

@github-actions github-actions 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.

🟡 Clean Code Review — Issues found!

There are some items in the code that need to be reviewed:

🟡 30 warning(s) that should be reviewed
🟢 30 suggestion(s) for improvement

Please review the inline comments on the changed lines for details.

Comment thread ai-undo-app/src/App.tsx
);
}

function LoginPage() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Clean Code — Rule 2.3 WARNING

The LoginPage function exceeds the recommended function length of 50 lines, making it harder to read and maintain.

💡 Suggestion: Consider extracting parts of the LoginPage logic, such as the form or error handling, into smaller components or helper functions.

To suppress: add // clean-code-ignore: 2.3 on this line

Comment thread ai-undo-app/src/App.tsx
);
}

function ChatPage() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Clean Code — Rule 2.3 WARNING

The ChatPage function exceeds the recommended function length of 50 lines, making it harder to read and maintain.

💡 Suggestion: Consider extracting parts of the ChatPage logic, such as the header or error banner, into smaller components.

To suppress: add // clean-code-ignore: 2.3 on this line

Comment thread ai-undo-app/src/App.tsx
return <Navigate to="/chat" replace />;
}

const onSubmit = async (event: FormEvent) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Clean Code — Rule 2.10 WARNING

The onSubmit function in LoginPage handles both form submission and error handling, which are two distinct responsibilities.

💡 Suggestion: Consider extracting the error handling logic into a separate function to improve clarity and maintainability.

To suppress: add // clean-code-ignore: 2.10 on this line


const AuthContext = createContext<AuthState | null>(null);

export function AuthProvider({ children }: { children: ReactNode }) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Clean Code — Rule 2.3 WARNING

The AuthProvider function exceeds the recommended maximum function length of 50 lines.

💡 Suggestion: Consider extracting the useEffect logic or other parts of the function into smaller, reusable helper functions to improve readability and maintainability.

To suppress: add // clean-code-ignore: 2.3 on this line

const [displayName, setDisplayName] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);

useEffect(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Clean Code — Rule 2.4 WARNING

The conditional logic inside the useEffect hook is complex and could benefit from being extracted into a named helper function.

💡 Suggestion: Extract the logic inside the useEffect hook into a separate function, such as initializeAuthState, to improve readability and reusability.

To suppress: add // clean-code-ignore: 2.4 on this line

Comment thread ai-undo-app/src/App.tsx
import { getStoredRealm } from './auth/keycloak';
import { ChatBox } from './chat/ChatBox';

function LoadingScreen() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean Code — Positive Feedback PRAISE

The LoadingScreen component is simple, focused, and reusable, adhering to the single responsibility principle.

Comment thread ai-undo-app/src/App.tsx
return <Navigate to="/chat" replace />;
}

const onSubmit = async (event: FormEvent) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean Code — Positive Feedback PRAISE

The onSubmit function in LoginPage is well-structured, with clear error handling and state management.

Comment thread ai-undo-app/src/App.tsx
);
}

export default function App() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean Code — Positive Feedback PRAISE

The App component is cleanly structured with clear routing logic, making it easy to understand and maintain.

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