Repository navigation
Conversation
Removed extra from error
…he-current-refresh-session
|
I asked AI. The answer seems to make sense: This causes the method to log errors and throw, which makes the tests fail. The failing assertions are the ones that expect either: But in CI, those required variables are effectively absent, so the “all vars are found” case still throws, which is why the job exits with code 1. I'll try to add those missing env variables, though I'm not sure about PORT variable. |
|
I have added now the missing environment variables to physical server onto dev instance. Now the build might succeed. |
|
I added first those environment variables onto prod instance only, now they're on main and dev, too. |
|
Still fails, PORT seems to be the problem. Does server not have PORT in env? |
|
I'll check, PORT might be missing |
|
The teacher API was missing new environment variables, my bad. Now they're added there, too. |
|
According to AI: " GitHub Actions tests do not use the Docker Compose environment variables from the physical server. The new refresh variables must also be added to the Jest test environment in the file:
For example, in the context of JWT configurations: Use the same valid format for the refresh values as in the application’s environment settings. The PORT error is intentional in this test because the test sets the |
|
Into the PR should be added to |
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
|
Nice work! It passed all the tests 👍 |
tickBit
left a comment
There was a problem hiding this comment.
Overall excellent work 👍 !
I asked also AI about this PR since it concerns security.
Two small changes to db schema (those are AI's suggestions):
-
profile_idshould use one consistent type across the schema and payloads. The schema currently usesObjectId, while several payloads treat it asstring, which makes the type contract harder to reason about and can lead to subtle runtime bugs. -
Add a compound index on
{ session_id: 1, revokedAt: 1 }(and likelyprofile_idas well if it’s used in those lookups). The rotation/logout flow does repeated lookups and updates against the same session family, and without this index the collection will become more expensive as it grows.
Those changes keep the overall design intact while reducing type risk and query overhead.
tickBit
left a comment
There was a problem hiding this comment.
The compound indexes are correct now.
I would like to see still the following changes:
// schema
@Prop({ type: MongooseSchema.Types.ObjectId, ref: ModelName.PROFILE, required: true })
profile_id: Types.ObjectId;
// dto
export class SessionPayload {
_id: ObjectId;
session_id: string;
profile_id: ObjectId;
refreshToken: string;
refreshTokenExpires: number;
}
|
Hopefully my previous comment gives the idea, I'm after : ) |
|
Is profile_id supposed to be ObjectId or string? Previous change request to string, new one ObjectId? |
I've been confused about those things myself time to time.
I'm doing many things at once, so sorry for confusion : ) |
tickBit
left a comment
There was a problem hiding this comment.
I think this is good to go. Good work 👍
Fingers crossed, that it gets into the physical server next : )
Brief description
Added Session to handle refresh token rotation.
Change list
Session
Sign in
Refresh
Logout
Other