Seed the general board the CLI's default post names

d03c9a550a35 · AtlantisPleb · · parent fdde772dd67e

Seed the general board the CLI's default post names

openagents forum post defaults to --board general and the command
reference documents that default, but no board by that slug existed,
so the documented command failed with not_found. A guarded data
migration seeds it; the test environment opts out because its
fixtures own their board set. Closes #244.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1mRkPGYmTVvMKqAzmQvy5
Co-Authored-By
Claude Fable 5 <noreply@anthropic.com>
Closes
#244

Deploy story

What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.

Not deployed through the forge lane

No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.

Changed files

  • modified config/test.exs
  • added priv/repo/migrations/20260825113454_seed_general_forum_board.exs

Diff

2 files changed, +39 -0

config/test.exs modified +4

@@ -6,6 +6,10 @@ config :openagents, :repository_provisioner_enabled, false

6 6
7 7
config :openagents, :runtime_environment, :test
8 8
9
# Test fixtures create the forum boards each test needs; the seed migration
10
# stays out of their way. See SeedGeneralForumBoard.
11
config :openagents, :seed_forum_boards, false
12
9 13
# Configure your database
10 14
#
11 15
# The MIX_TEST_PARTITION environment variable can be used
priv/repo/migrations/20260825113454_seed_general_forum_board.exs added +35

@@ -0,0 +1,35 @@

1
defmodule OpenAgents.Repo.Migrations.SeedGeneralForumBoard do
2
  use Ecto.Migration
3
4
  # The CLI's `forum post` defaults to --board general, and the help and
5
  # command reference both document that default, but the imported board set
6
  # never included a board by that slug, so the documented command failed
7
  # with not_found (#244). Seeding the board makes the documented default
8
  # real wherever the migrations run.
9
  #
10
  # The test environment opts out (`:seed_forum_boards`): its fixtures create
11
  # the boards each test needs, and a pre-seeded row would collide with every
12
  # setup that inserts the general board itself.
13
  def up do
14
    if Application.get_env(:openagents, :seed_forum_boards, true) do
15
      execute """
16
      INSERT INTO forum_forums
17
        (id, slug, title, description, visibility, discoverability, locked,
18
         topic_count, post_count, inserted_at, updated_at)
19
      VALUES
20
        (gen_random_uuid(), 'general', 'General',
21
         'General discussion. The default board for new topics.',
22
         'public', 'listed', false, 0, 0, now(), now())
23
      ON CONFLICT (slug) DO NOTHING
24
      """
25
    end
26
  end
27
28
  # Only an empty general board rolls back; one that gathered topics stays.
29
  def down do
30
    execute """
31
    DELETE FROM forum_forums
32
    WHERE slug = 'general' AND topic_count = 0 AND post_count = 0
33
    """
34
  end
35
end

This page updates live while a promote is in flight · changelog