Skip to content

Comments

Feat/1966 archive space simple#1968

Merged
DSanich merged 9 commits intomainfrom
feat/1966-archive-space-simple
Feb 25, 2026
Merged

Feat/1966 archive space simple#1968
DSanich merged 9 commits intomainfrom
feat/1966-archive-space-simple

Conversation

@DSanich
Copy link
Member

@DSanich DSanich commented Feb 24, 2026

Summary by CodeRabbit

  • New Features

    • Archive Mode toggle in space creation/configuration and Archive Mode UI.
    • Archived state shown on space cards and space header labels.
    • Option to hide/show archived spaces in listings.
  • Improvements

    • Archived spaces excluded from network discovery and recommended lists by default.
    • Removed the "Archive Space (Coming Soon)" action from settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

Adds an "archived" space flag across schema, types, server queries, utilities, and UI; filters and UI now respect archived state; removes the "Archive Space (Coming Soon)" settings action. Introduces omitArchived query option and isSpaceArchived utility.

Changes

Cohort / File(s) Summary
Flags & Schema
packages/storage-postgres/src/schema/flags.ts, packages/core/src/categories/types.ts
Added 'archived' to SPACE_FLAGS, expanding the SpaceFlags union.
Server Queries / API
packages/core/src/space/server/queries.ts, packages/core/src/space/server/web3/get-all-spaces.ts
Added omitArchived?: boolean to query props and integrated filtering to exclude archived spaces when requested; get-all-spaces also enriches spaces and filters by isSpaceArchived when omitArchived is true.
Core Utils / Exports
packages/core/src/space/utils.ts, packages/core/src/space/index.ts
Added isSpaceArchived(space) utility and re-exported space utils from the space index.
UI: Space Cards & Labels
packages/epics/src/spaces/components/space-card.tsx, .../space-card-with-discoverability.tsx, .../space-mode-label.tsx
Propagated isArchived prop; SpaceModeLabel now treats archived in live logic, caption, and uses error colorVariant for archived.
UI: Space Lists / Filters
packages/epics/src/spaces/components/my-filtered-spaces.tsx, .../explore-spaces.tsx
Added hide/omit-archived filtering and UI control; replaced usages with non-archived subsets where appropriate.
UI: Create / Manage Space
packages/epics/src/spaces/components/create-space-form.tsx
Added archived flag handling, toggleArchived, validation updates, and mutual exclusion with sandbox/demo modes.
Web App Pages & Settings
apps/web/src/app/[lang]/dho/[id]/_components/select-settings-action.tsx, apps/web/src/app/[lang]/my-spaces/page.tsx, apps/web/src/app/[lang]/network/page.tsx, apps/web/src/app/[lang]/dho/[id]/layout.tsx
Removed "Archive Space (Coming Soon)" action; pass isArchived to SpaceCard/SpaceModeLabel where applicable; set omitArchived: true on network spaces query.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant UI as Web UI
  participant Server as Core Server
  participant DB as Postgres

  User->>UI: Toggle archive / enable "hide archived"
  UI->>Server: GET spaces?omitArchived=true or POST create/update (flags include 'archived')
  Server->>DB: SELECT ... WHERE NOT flags @> ARRAY['archived'] OR INSERT/UPDATE flags
  DB-->>Server: Return filtered rows / confirm write
  Server-->>UI: Return spaces (with memberCount) or updated space
  UI-->>User: Render cards with isArchived -> "Archived" caption / colorVariant
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • evgenibir
  • sergey3bv

Poem

🐰 I nibbled flags and toggles bright,
I hid old corners from the light,
Cards now whisper "Archived" in red,
Filters tuck them softly to bed,
A happy rabbit hops off light and spry.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat/1966 archive space simple' clearly identifies the main feature being added: space archiving functionality, and is concise and specific.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/1966-archive-space-simple

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
Contributor

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/web/src/app/[lang]/my-spaces/page.tsx (1)

36-39: ⚠️ Potential issue | 🟡 Minor

Archived spaces will appear in the "Spaces you might like" carousel

allSpaces is fetched without omitArchived: true. Since the new archive flow sets flags: ['archived'] (not isArchived boolean), the existing eq(spaces.isArchived, false) filter in findAllSpaces does not cover flag-archived spaces. The network/explore page correctly passes omitArchived: true, but this carousel does not — resulting in archived spaces appearing in recommendations (with the Archived badge, but still surfaced as suggestions).

Unless surfacing archived spaces in recommendations is intentional, add omitArchived: true:

🔧 Proposed fix
 const [allSpaces, mySpaces] = await Promise.all([
-  getAllSpaces({ parentOnly: false, omitSandbox: true }),
+  getAllSpaces({ parentOnly: false, omitSandbox: true, omitArchived: true }),
   getAllSpaces({ search: query, parentOnly: false }),
 ]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/app/`[lang]/my-spaces/page.tsx around lines 36 - 39, The "Spaces
you might like" carousel fetches allSpaces via getAllSpaces without omitting
archived entries, so archived spaces (flagged via flags:['archived']) are
showing up; update the call that sets allSpaces (the first getAllSpaces
invocation) to include omitArchived: true so it filters out archived spaces
(aligning with the network/explore page behavior and the filtering logic in
findAllSpaces).
packages/core/src/space/server/queries.ts (1)

52-61: ⚠️ Potential issue | 🟠 Major

Dual archiving fields create a subtle footgun

findAllSpaces always applies eq(spaces.isArchived, false) (line 54), but the new Archive Mode in create-space-form.tsx only sets flags: ['archived'] — it does not touch the isArchived boolean column. This means the hard-coded boolean filter does not cover flag-archived spaces; omitArchived: true must be explicitly passed to exclude them.

This omitArchived = false default silently allows flag-archived spaces through. Callers that omit the flag (e.g., the allSpaces query in my-spaces/page.tsx) will receive archived spaces without any TypeScript warning. Additionally, findAllSpacesByMemberId and findAllSpacesByWeb3SpaceIds both use only eq(spaces.isArchived, false) with no flags-based filtering — spaces archived via flags will appear in those results, compensated only by client-side filtering in MyFilteredSpaces.

Consider either:

  1. Keeping the two fields in sync in the space-update mutation (set isArchived = true when flags gains 'archived'), which makes the always-on eq(spaces.isArchived, false) sufficient and omitArchived redundant, or
  2. Defaulting omitArchived to true so the safer behavior is the default.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/space/server/queries.ts` around lines 52 - 61,
findAllSpaces currently hard-codes eq(spaces.isArchived, false) but defaults
omitArchived = false, which lets flag-archived rows slip through; fix by making
the safer default and/or keeping fields in sync: set omitArchived default to
true in the findAllSpaces signature and ensure the WHERE clause includes the
flags-based exclusion (not(sql`${spaces.flags} @> '["archived"]'::jsonb`)) when
omitArchived is true; also update findAllSpacesByMemberId and
findAllSpacesByWeb3SpaceIds to apply the same flags-based filter; additionally,
in the space-update mutation (and create-space-form.tsx workflow) ensure that
when flags gains or loses 'archived' you also set isArchived = true/false to
keep the boolean column in sync.
packages/epics/src/spaces/components/space-mode-label.tsx (1)

9-16: ⚠️ Potential issue | 🔴 Critical

isArchived is missing from the SpaceModeLabel call in layout.tsx

Since isArchived: boolean is now required in SpaceModeLabelProps, the component call in apps/web/src/app/[lang]/dho/[id]/layout.tsx:164 is incomplete. It passes isSandbox and isDemo derived from spaceFromDb.flags, but omits isArchived. Following the pattern from space-card-with-discoverability.tsx, pass:

isArchived={spaceFromDb.flags?.includes('archived') ?? false}

Also verify space-card.tsx:157 correctly passes all required props (it currently does).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/epics/src/spaces/components/space-mode-label.tsx` around lines 9 -
16, SpaceModeLabel is now typed to require isArchived in SpaceModeLabelProps but
the call in layout.tsx (where SpaceModeLabel is invoked with isSandbox and
isDemo derived from spaceFromDb.flags) omits it; update that component call to
pass isArchived using the same pattern as space-card-with-discoverability.tsx,
e.g. set isArchived to spaceFromDb.flags?.includes('archived') ?? false so the
SpaceModeLabelProps requirements are satisfied (also confirm space-card.tsx
already passes all required props).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/epics/src/spaces/components/create-space-form.tsx`:
- Around line 337-346: toggleArchived currently updates flags but forgets to
clear category validation errors when switching into 'archived' mode; update the
toggleArchived callback (mirror the behavior in toggleSandbox) to call
form.clearErrors('categories') whenever you set the next flags to include
'archived' (i.e., when activating archive mode) and then call
form.setValue('flags', next, { shouldDirty: true, shouldValidate: true }).

---

Outside diff comments:
In `@apps/web/src/app/`[lang]/my-spaces/page.tsx:
- Around line 36-39: The "Spaces you might like" carousel fetches allSpaces via
getAllSpaces without omitting archived entries, so archived spaces (flagged via
flags:['archived']) are showing up; update the call that sets allSpaces (the
first getAllSpaces invocation) to include omitArchived: true so it filters out
archived spaces (aligning with the network/explore page behavior and the
filtering logic in findAllSpaces).

In `@packages/core/src/space/server/queries.ts`:
- Around line 52-61: findAllSpaces currently hard-codes eq(spaces.isArchived,
false) but defaults omitArchived = false, which lets flag-archived rows slip
through; fix by making the safer default and/or keeping fields in sync: set
omitArchived default to true in the findAllSpaces signature and ensure the WHERE
clause includes the flags-based exclusion (not(sql`${spaces.flags} @>
'["archived"]'::jsonb`)) when omitArchived is true; also update
findAllSpacesByMemberId and findAllSpacesByWeb3SpaceIds to apply the same
flags-based filter; additionally, in the space-update mutation (and
create-space-form.tsx workflow) ensure that when flags gains or loses 'archived'
you also set isArchived = true/false to keep the boolean column in sync.

In `@packages/epics/src/spaces/components/space-mode-label.tsx`:
- Around line 9-16: SpaceModeLabel is now typed to require isArchived in
SpaceModeLabelProps but the call in layout.tsx (where SpaceModeLabel is invoked
with isSandbox and isDemo derived from spaceFromDb.flags) omits it; update that
component call to pass isArchived using the same pattern as
space-card-with-discoverability.tsx, e.g. set isArchived to
spaceFromDb.flags?.includes('archived') ?? false so the SpaceModeLabelProps
requirements are satisfied (also confirm space-card.tsx already passes all
required props).

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fd9424 and d8019cf.

📒 Files selected for processing (11)
  • apps/web/src/app/[lang]/dho/[id]/_components/select-settings-action.tsx
  • apps/web/src/app/[lang]/my-spaces/page.tsx
  • apps/web/src/app/[lang]/network/page.tsx
  • packages/core/src/categories/types.ts
  • packages/core/src/space/server/queries.ts
  • packages/epics/src/spaces/components/create-space-form.tsx
  • packages/epics/src/spaces/components/my-filtered-spaces.tsx
  • packages/epics/src/spaces/components/space-card-with-discoverability.tsx
  • packages/epics/src/spaces/components/space-card.tsx
  • packages/epics/src/spaces/components/space-mode-label.tsx
  • packages/storage-postgres/src/schema/flags.ts
💤 Files with no reviewable changes (1)
  • apps/web/src/app/[lang]/dho/[id]/_components/select-settings-action.tsx

Copy link
Contributor

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/app/[lang]/dho/[id]/layout.tsx (1)

90-90: ⚠️ Potential issue | 🟡 Minor

Archived spaces appear unlabeled in "Spaces you might like".

Two gaps in this PR:

  1. Line 90getAllSpaces omits sandboxes via omitSandbox: true but doesn't pass omitArchived: true, so archived spaces leak into the discovery carousel. (Compare with apps/web/src/app/[lang]/network/page.tsx which correctly uses omitArchived: true.)
  2. Lines 204–206SpaceCard receives isSandbox and isDemo but not isArchived, so archived spaces render without the badge — unlike the current space's treatment at line 168.

Resolve by either filtering them out or passing the prop (or both):

🔧 Proposed fix
- const spaces = await getAllSpaces({ parentOnly: false, omitSandbox: true });
+ const spaces = await getAllSpaces({ parentOnly: false, omitSandbox: true, omitArchived: true });

And if archived spaces should still appear with a badge instead of being hidden:

  isSandbox={space.flags?.includes('sandbox') ?? false}
  isDemo={space.flags?.includes('demo') ?? false}
+ isArchived={space.flags?.includes('archived') ?? false}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/app/`[lang]/dho/[id]/layout.tsx at line 90, The discovery
carousel is showing archived spaces because getAllSpaces is called with
omitSandbox: true but not omitArchived; update the call to getAllSpaces({
parentOnly: false, omitSandbox: true, omitArchived: true }) so archived spaces
are excluded, and/or propagate the archived state into the card UI by passing
the space.isArchived value into SpaceCard (add isArchived={space.isArchived}
where SpaceCard is rendered) and ensure SpaceCard's props/markup render the
archived badge when isArchived is true so archived spaces are visibly labeled if
you choose to keep them.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/web/src/app/`[lang]/dho/[id]/layout.tsx:
- Line 90: The discovery carousel is showing archived spaces because
getAllSpaces is called with omitSandbox: true but not omitArchived; update the
call to getAllSpaces({ parentOnly: false, omitSandbox: true, omitArchived: true
}) so archived spaces are excluded, and/or propagate the archived state into the
card UI by passing the space.isArchived value into SpaceCard (add
isArchived={space.isArchived} where SpaceCard is rendered) and ensure
SpaceCard's props/markup render the archived badge when isArchived is true so
archived spaces are visibly labeled if you choose to keep them.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8019cf and d5f887c.

📒 Files selected for processing (1)
  • apps/web/src/app/[lang]/dho/[id]/layout.tsx

Copy link
Contributor

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/src/app/`[lang]/dho/[id]/layout.tsx:
- Around line 169-171: The isArchived prop is incorrectly derived from
spaceMembers which is set to 0 on fetch/fallback errors; change the logic in the
layout where isArchived is computed to rely only on
spaceFromDb.flags.includes('archived') (remove the "|| spaceMembers === 0"
clause) and instead handle the members-failure case separately (e.g., keep
spaceMembers undefined/null on error or introduce an explicit membersFetchFailed
flag) so member-fetch failures do not mark spaces as archived; update any
related UI/error paths that depended on spaceMembers===0 to use the new failure
indicator.

In `@packages/core/src/space/server/web3/get-all-spaces.ts`:
- Around line 39-43: The mapping in enrichedSpaces sets memberCount: 0 when
web3SpaceId is null which causes isSpaceArchived to treat missing Web3 data as
archived; instead stop forcing memberCount to 0 (leave it undefined or null) and
update the filtering logic in isSpaceArchived (or the omitArchived branch) to
explicitly check web3SpaceId === null and treat those as "unknown/not archived"
rather than archived—apply the same change for the other case at the
corresponding block (lines referenced around the second instance).

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f686a21 and b146cb9.

📒 Files selected for processing (8)
  • apps/web/src/app/[lang]/dho/[id]/layout.tsx
  • apps/web/src/app/[lang]/my-spaces/page.tsx
  • packages/core/src/space/index.ts
  • packages/core/src/space/server/web3/get-all-spaces.ts
  • packages/core/src/space/utils.ts
  • packages/epics/src/spaces/components/explore-spaces.tsx
  • packages/epics/src/spaces/components/my-filtered-spaces.tsx
  • packages/epics/src/spaces/components/space-card-with-discoverability.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/epics/src/spaces/components/my-filtered-spaces.tsx

Copy link
Member

@evgenibir evgenibir left a comment

Choose a reason for hiding this comment

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

Looks good

@DSanich DSanich merged commit bac92a3 into main Feb 25, 2026
7 checks passed
@DSanich DSanich deleted the feat/1966-archive-space-simple branch February 25, 2026 06:25
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