Skip to content

docs: add Hapvida M365 auth server deploy handoff#48

Closed
namastex888 wants to merge 1 commit into
mainfrom
docs/hapvida-m365-auth-server-handoff
Closed

docs: add Hapvida M365 auth server deploy handoff#48
namastex888 wants to merge 1 commit into
mainfrom
docs/hapvida-m365-auth-server-handoff

Conversation

@namastex888
Copy link
Copy Markdown
Contributor

@namastex888 namastex888 commented Jun 3, 2026

Adds the full deploy-manager handoff for hosting the dedicated Hapvida M365 Workit auth server in OCI HV, including required Entra values, runtime envs, Kubernetes template, validation checklist, and the exact request Bernardo needs to answer.

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added comprehensive deployment documentation for the Hapvida M365 Auth Server, including architecture overview, security hardening guidelines, Kubernetes deployment templates, Docker configuration, environment setup requirements, operational procedures, and validation checklist to support the deployment handoff.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

A new deployment handoff document establishes the complete setup and validation process for deploying a dedicated Workit auth server in Hapvida's OCI environment to support one-click Microsoft 365 OAuth login with read-only scopes, including Docker/Kubernetes templates, Entra configuration, validation checklist, and handoff requirements.

Changes

Hapvida M365 Auth Server Deployment Handoff

Layer / File(s) Summary
Overview and Target Architecture
docs/plans/2026-06-02-hapvida-m365-auth-server-deploy-handoff.md
Document introduces the purpose of replacing the shared public callback relay with a Hapvida-controlled Workit auth server. References security hardening in the merged Workit PR, lists new auth endpoints, and defines the target deployment shape including required public URL and Microsoft redirect URI format.
Configuration and Runtime Setup
docs/plans/2026-06-02-hapvida-m365-auth-server-deploy-handoff.md
Enumerates required environment variables (public base URL, Entra IDs, broker admin token) with callback URL derivation details. Provides Docker multi-stage/distroless build instructions. Supplies Kubernetes Deployment and Service manifests with readiness/liveness probes, secret-based environment variables, and ingress routing guidance distinguishing externally reachable vs restricted endpoints.
Microsoft Entra Configuration and Team Instructions
docs/plans/2026-06-02-hapvida-m365-auth-server-deploy-handoff.md
Details Microsoft Entra App Registration setup (app type, platform, exact redirect URI, delegated Graph read-only permissions). Includes Portuguese operational instructions for collecting Entra IDs and clarifying that broker token is created by the deploy manager, not from personal user secrets.
Deployment Validation and Handoff
docs/plans/2026-06-02-hapvida-m365-auth-server-deploy-handoff.md
Post-deployment instructions for generating user login links. Includes validation checklist covering health checks, unauthenticated session rejection, authenticated session creation with bearer token, and expected OAuth redirect/scopes. Lists operational considerations for token storage, replica affinity, and acceptance criteria. Specifies minimal values to return to the Workit/KHAW team with security constraints around broker token sharing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A handoff so clear, a path well-charred,
From Workit to Hapvida, no longer hard,
With Docker, Kubernetes, Entra bright,
M365 OAuth now flows just right,
One-click login hops through the night! 🌙

🚥 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 'docs: add Hapvida M365 auth server deploy handoff' directly and clearly summarizes the main change: adding documentation for deploying a Hapvida M365 authentication server. It is concise, specific, and accurately reflects the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/hapvida-m365-auth-server-handoff

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 and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a deployment handoff document for the Hapvida M365 Auth Server, outlining configuration, environment variables, and deployment manifests. Feedback points out a discrepancy in the Kubernetes deployment template, which defaults to two replicas despite the operational notes warning that in-memory session storage requires a single replica or sticky sessions to avoid authentication failures.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

name: workit-auth-server
namespace: hapvida-ai
spec:
replicas: 2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The deployment template defaults to replicas: 2. However, as noted in Section 11 (Operational notes), the auth server stores session state in-memory, meaning multiple replicas without sticky sessions will cause authentication failures (e.g., if /m365/start and /m365/callback hit different pods). To ensure a safe out-of-the-box deployment, it is recommended to default the template to replicas: 1.

Suggested change
replicas: 2
replicas: 1

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

Reviewed commit: d403f7d59c

ℹ️ 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 "@codex address that feedback".

name: workit-auth-server
namespace: hapvida-ai
spec:
replicas: 2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Set replicas to 1 unless sticky routing is configured

This template is likely to be copied as-is, but the same document later notes that M365 sessions/tokens are stored in memory and that /m365/start, /m365/callback, and /token/{state} can hit different pods without sticky routing. With replicas: 2 and a normal non-sticky ingress, a user can create the session on one pod and then be redirected/callback to another pod that does not have that state, causing intermittent login failures. Make the template default to replicas: 1 or explicitly include sticky-session configuration here.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@docs/plans/2026-06-02-hapvida-m365-auth-server-deploy-handoff.md`:
- Line 219: The default replica count currently set to "replicas: 2" conflicts
with the note that sessions/tokens are stored in-memory; change the
deployment/template default to a single replica and add a clear note near the
"replicas" setting (and in the session-storage section) explaining that
in-memory sessions require either sticky sessions or an external session store
before scaling replicas >1; reference and update the "replicas" entry and the
session-storage/sessions or tokens documentation so readers know to switch to
sticky sessions or an external store (e.g., Redis) before raising replicas.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: c740d17e-a6ec-4b27-bdc8-d9bf0a33d735

📥 Commits

Reviewing files that changed from the base of the PR and between 9ed729e and d403f7d.

📒 Files selected for processing (1)
  • docs/plans/2026-06-02-hapvida-m365-auth-server-deploy-handoff.md

name: workit-auth-server
namespace: hapvida-ai
spec:
replicas: 2
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 | ⚡ Quick win

Align default replica count with session-storage constraints.

The template default replicas: 2 conflicts with your own operational note that sessions/tokens are in-memory and safest first deploy is single replica unless sticky sessions are guaranteed. This can cause OAuth state/token retrieval to land on different pods and fail intermittently.

Suggested doc fix
-  replicas: 2
+  replicas: 1
 ## 6. Kubernetes/OCI deployment example
 Use this as a template. Replace placeholders before applying.
+For initial rollout, keep `replicas: 1` unless ingress sticky sessions are enabled (or session state is externalized).
📝 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
replicas: 2
replicas: 1
Suggested change
replicas: 2
## 6. Kubernetes/OCI deployment example
Use this as a template. Replace placeholders before applying.
For initial rollout, keep `replicas: 1` unless ingress sticky sessions are enabled (or session state is externalized).
🤖 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 `@docs/plans/2026-06-02-hapvida-m365-auth-server-deploy-handoff.md` at line
219, The default replica count currently set to "replicas: 2" conflicts with the
note that sessions/tokens are stored in-memory; change the deployment/template
default to a single replica and add a clear note near the "replicas" setting
(and in the session-storage section) explaining that in-memory sessions require
either sticky sessions or an external session store before scaling replicas >1;
reference and update the "replicas" entry and the session-storage/sessions or
tokens documentation so readers know to switch to sticky sessions or an external
store (e.g., Redis) before raising replicas.

@namastex888 namastex888 closed this Jun 3, 2026
@namastex888 namastex888 deleted the docs/hapvida-m365-auth-server-handoff branch June 3, 2026 01:21
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.

2 participants