test(ci): repair 3 pre-existing test failures on main - #286
Closed
samxu01 wants to merge 1 commit into
Closed
Conversation
These have been red-barring every PR for the last week — fixes catch the
test fixtures up to recent legitimate refactors of the production code.
1. podController.test.js — 4 failures
- createPod / removeMember / joinPod populate assertions: controller
added `isBot` to the `members` populate signature
(`'username profilePicture isBot'`); update both expectations.
- joinPod 403 third-person guard: controller now does
`require('../services/agentIdentityService').DM_POD_TYPES_GUARD`
at runtime per ADR-001 §3.10. The test-level mock of
agentIdentityService omitted the guard set, so the require returned
`{}` and `.has()` threw before reaching the 403 path. Add
`DM_POD_TYPES_GUARD: new Set(['agent-room', 'agent-dm'])` to the
mock so the test exercises the real guard.
- joinPod regular-pod regression test: same root cause; same fix.
2. dmService.test.ts — 2 failures
- f9ff990 changed agent-room labels from `<runtime> (<instance>)`
to the User.botMetadata.displayName chain. Tests still asserted the
old format. Update the fixture to set displayName, replace the
stale "names the room with instanceId suffix" test with two
intent-aligned ones (displayName overrides function args; instanceId
is the fallback when displayName missing and instanceId is non-default).
3. registry.list-agents-config.test.js — 1 timeout (10s)
- GET /pods/:podId/agents calls User.find, dmService.canViewPod, and
AgentIdentityService.buildAgentUsername. None were jest-mocked in
this test, so User.find queued forever against an unconnected real
Mongoose model and the test timed out at 10s. Add the three mocks.
All three failures are stale-test, not stale-code — production behavior
is correct; tests just hadn't kept up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Squash-merged locally to preserve Sam Xu attribution. Closing. |
samxu01
added a commit
that referenced
this pull request
May 3, 2026
Test & Coverage was red on every PR since #275 due to stale fixtures, not stale code. Three test files updated: 1. podController.test.js — populate signatures now include `isBot`; add DM_POD_TYPES_GUARD to agentIdentityService jest mock so joinPod's runtime require resolves the ADR-001 §3.10 guard. 2. dmService.test.ts — agent-room labels now come from User.botMetadata .displayName (per f9ff990) instead of `<runtime> (<instance>)`. Update fixture and replace one stale test with two intent-aligned ones (displayName overrides args; instanceId is fallback). 3. registry.list-agents-config.test.js — add jest mocks for User, dmService, agentIdentityService so the 10s timeout (Mongoose User.find against unconnected DB) goes away. Pure test repair, zero production changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
`Test & Coverage` has red-barred every PR since #275 due to three test files that drifted from legitimate production refactors:
What
podController.test.js
dmService.test.ts
registry.list-agents-config.test.js
Test plan
🤖 Generated with Claude Code