Skip to content

revert: agent/user profile Creatives (Subsystem A) and creator-admin share#1438

Merged
sh1nj1 merged 3 commits into
mainfrom
revert/agent-profile-creative
Jul 24, 2026
Merged

revert: agent/user profile Creatives (Subsystem A) and creator-admin share#1438
sh1nj1 merged 3 commits into
mainfrom
revert/agent-profile-creative

Conversation

@sh1nj1

@sh1nj1 sh1nj1 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Reverts both merged PRs of the agent/user profile Creative feature so the design can be reworked from scratch.

Both reverts applied cleanly with no conflicts, newest first.

What this removes

  • HasProfileCreative concern and the after_create_commit hook that created a profile Creative per user
  • Creative.profile_for / profile_creative_if_present, the kind discriminator and its promoted column
  • The four backfill/promotion migrations and the partial unique index on profile Creatives
  • User#effective_system_prompt — every reader (AI agent service, message builder, orchestration arbiter and context builder, typo corrector, agent type classifier, completions API, admin view, AI settings form) goes back to the system_prompt column
  • The creator-admin CreativeShare grant and its backfill migration

Verification

  • Full migration replay on a scratch DB: clean, max(version) = 20260724000000, creatives has no kind column and no profile unique index — matches the reverted db/schema.rb
  • engines/collavre/test/models 370 runs, test/services + test/controllers 1215 runs, engines/collavre_completion_api/test 12 runs — 0 failures
  • Rubocop clean on all changed Ruby files

Note for existing databases

The revert deletes the migration files but does not undo migrations that already ran. Prod is unaffected — deploy.yml is manual-trigger only and has not run since 2026-07-15, so these migrations never shipped. Local development databases that already migrated will keep the kind column plus NO FILE rows in schema_migrations; recreate them (db:drop db:create db:migrate db:seed) to avoid schema drift.

sh1nj1 added 2 commits July 24, 2026 17:09
…1437)"

This reverts commit 969da43276b7f6d0e0d63c53e0dbe6b4a45f8fef.
Copilot AI review requested due to automatic review settings July 24, 2026 08:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...vre/app/services/collavre/orchestration/arbiter.rb 50.00% 1 Missing ⚠️
...s/collavre/app/services/collavre/typo_corrector.rb 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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

Copy link
Copy Markdown

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: 810f247036

ℹ️ 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".

# save that omits it makes the row undiscoverable and a duplicate is created.
# ---------------------------------------------------------------------------
BUILTIN_RESERVED_METADATA_KEYS = %w[markdown_source content_type editor kind].freeze
BUILTIN_RESERVED_METADATA_KEYS = %w[markdown_source content_type editor].freeze

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 Preserve inbox kind during metadata updates

When an inbox Creative is updated through update_metadata with a payload that omits kind (for example a stale/API payload, or a user removing it from the metadata editor), this list no longer preserves the existing data["kind"]. The save then makes the row stop matching Creative.inboxes/inbox?, so later Creative.inbox_for(user) won't find the existing inbox and will create a duplicate, breaking inbox-specific notification/topic behavior for that user.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Verified — the mechanism is real, and fixed in 18e05b5e. One correction on framing: this is a pre-existing bug, not a regression this revert introduces.

data["kind"] == "inbox" and the Creative.inboxes scope both predate #1412, and kind was not in BUILTIN_RESERVED_METADATA_KEYS before it (25184c9f^ line 12: %w[markdown_source content_type editor]). #1412 added kind there as an independent fix that happened to ride along with the profile-creative work. So the revert restores the pre-#1412 state faithfully — including this bug.

But the chain you describe is real and live on main today: update_metadata replaces data wholesale and only carries over reserved keys, so a payload omitting kind drops the row out of Creative.inboxesinbox_for no longer finds it → duplicate inbox → that user's inbox notifications and Main-topic behavior split across two rows.

Since the reservation is orthogonal to the design being rolled back, I kept it rather than re-introducing the bug: once the profile/skill discriminators are reverted, kind only ever takes the value "inbox", so reserving it is exactly the inbox-preserving semantic and carries none of the reverted design. This is a deliberate one-word deviation from a pure revert, called out in the commit message.

Regression test (update_metadata preserves the inbox kind so the inbox stays discoverable): creates the user's inbox, PATCHes metadata with a payload omitting kind, asserts the row still matches inbox?, that unrelated keys still save, and that inbox_for returns the same id with no new inbox row. RED without the reservation (inbox creative lost data["kind"] on a metadata save), GREEN with it. Engine models + controllers: 831 runs, 0 failures; rubocop clean.

The revert of #1412 also removed "kind" from BUILTIN_RESERVED_METADATA_KEYS,
but that entry was an independent fix for a pre-existing inbox bug, not part
of the profile-creative design being rolled back.

`update_metadata` replaces `data` wholesale and only carries over reserved
keys. `kind` is the discriminator `inbox?` and `Creative.inboxes` match on, so
a payload that omits it (a stale metadata popup, or an API client) drops the
row out of `Creative.inboxes`; `inbox_for` then no longer finds the existing
inbox and creates a duplicate, splitting that user's inbox notifications and
topics.

`kind` only takes the value "inbox" once the profile/skill discriminators are
reverted, so reserving it is exactly the inbox-preserving semantic and carries
none of the reverted design.

Regression test: a metadata save omitting "kind" leaves the inbox discoverable
and `inbox_for` returns the same row.
Copilot AI review requested due to automatic review settings July 24, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sh1nj1
sh1nj1 merged commit 191bb5d into main Jul 24, 2026
12 checks passed
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.

3 participants