Skip to content

Add IsLocal and Domain helper columns to ActorEntity for indexed locality queries#21

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/start-mysql-library-implementation
Draft

Add IsLocal and Domain helper columns to ActorEntity for indexed locality queries#21
Copilot wants to merge 5 commits intomainfrom
copilot/start-mysql-library-implementation

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 8, 2026

The Actors table stores both local and remote actors, but distinguishing them required runtime actorId.StartsWith(baseUrl) string comparisons with no DB-level filter. GetAllLocalUsernamesAsync and CountLocalActorsAsync returned all rows and relied on the Username != 'sys' workaround.

Schema changes (ActorEntity / BrocaDbContext)

  • IsLocal bool (indexed) — set on save by checking actor.Id against the configured BaseUrl. Enables WHERE IsLocal = 1 instead of in-process URL filtering.
  • Domain varchar(255) (indexed) — hostname extracted from the actor ID URI. Enables domain-based queries (federation blocks, per-domain stats) without LIKE '%...' scans over the JSON blob.

Repository changes (MySqlActorRepository)

  • Injects IOptions<ActivityPubServerOptions> to compute locality at save time; warns when BaseUrl is unconfigured or an actor ID can't be parsed.
  • SaveActorAsync populates both fields on create and update.
  • GetAllLocalUsernamesAsync — changed from full-table scan to WHERE IsLocal = true.
  • CountLocalActorsAsync — changed from WHERE Username != 'sys' to WHERE IsLocal = true AND Username != 'sys', correctly excluding remote actors from the local user count.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh pr edit 21 --repo aluitink/Broca --base develop (http block)
  • https://api.github.com/repos/aluitink/Broca/pulls/21
    • Triggering command: /usr/bin/curl curl -s -X PATCH -H Authorization: ****** -H Accept: application/vnd.github&#43;json -H X-GitHub-Api-Version: 2022-11-28 REDACTED -d {&#34;base&#34;:&#34;develop&#34;} (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Start implementation

The user has attached the following file paths as relevant context:

  • .github/copilot-instructions.md
[Chronological Review: The conversation began with the user requesting a review of the project and planning for a MySQL persistence library. They specified the need for a schema based on current project requirements and mentioned using EF Core with a third-party MySQL driver. The user also expressed interest in including a MySQL database container for Docker. The user then requested to start the implementation of the library.]

[Intent Mapping:

  • "let's review this project and plan a my sql persistance library." - User wants to create a MySQL persistence library.
  • "We need a schema that makes sense based on the current requirements of our project." - User is looking for a relevant database schema.
  • "We are working in .NET so our library should probably user EfCore." - User indicates the technology stack.
  • "Ideally we could optionally include a mysql database container that hooks in well with our docker-compose." - User wants to integrate MySQL with Docker.]

[Technical Inventory:

  • .NET: The primary framework for the project.
  • EF Core: The chosen ORM for database interactions.
  • MySQL: The database system to be used.
  • Docker: The containerization platform for deployment.]

[Code Archaeology:

  • The user is currently working in the file /mnt/sdb/src/Broca/tests/Broca.ActivityPub.IntegrationTests/ServerToServerTests.cs, but no specific code changes have been documented yet in this session.]

[Progress Assessment:

  • Completed Tasks: User has outlined the requirements for the MySQL persistence library.
  • Partially Complete Work: The implementation of the library has been initiated but not yet detailed.]

[Context Validation: All necessary context for continuing the project has been captured, including technology choices and user goals.]

[Recent Commands Analysis:

  • Last Agent Commands: The user requested to "Start implementation."
  • Tool Results Summary: No specific tool results were generated from this command as it was a user request to initiate the implementation phase.
  • Pre-Summary State: The agent was actively discussing the implementation of a MySQL persistence library when the token budget was exceeded.
  • Operation Context: The commands executed were directly related to the user's goal of developing a persistence library for their project.]
1. Conversation Overview: - Primary Objectives: The user aims to create a MySQL persistence library for their .NET project, including a relevant schema and integration with Docker. - Session Context: The conversation has transitioned from planning the library to initiating its implementation. - User Intent Evolution: The user has moved from discussing requirements to actively requesting the start of the implementation phase.
  1. Technical Foundation:
  • .NET: The framework being used for the project.
  • EF Core: The ORM selected for database interactions.
  • MySQL: The database system intended for use.
  • Docker: The platform for containerization and deployment.
  1. Codebase Status:
  • /mnt/sdb/src/Broca/tests/Broca.ActivityPub.IntegrationTests/ServerToServerTests.cs:
    • Purpose: This file is part of the integration tests for the project.
    • Current State: No specific modifications have been made yet in this session.
    • Key Code Segments: Not applicable as no changes have been documented.
    • Dependencies: This file is likely dependent on the overall project structure and the new persistence library.
  1. Problem Resolution:
  • Issues Encountered: No specific technical problems have been documented yet.
  • Solutions Implemented: The user has outlined the requirements for the persistence library.
  • Debugging Context: No ongoing troubleshooting efforts have been noted.
  • Lessons Learned: No insights have been documented yet.
  1. Progress Tracking:
  • Completed Tasks: User has defined the requirements for the MySQL persistence library.
  • Partially Complete Work: The implementation has been requested but not yet detailed.
  • Validated Outcomes: No features or code have been confirmed working through testing yet.
  1. Active Work State:
  • Current Focus: The user is focused on starting the implementation of the MySQL persistence library.
  • Recent Context: The last few exchanges involved planning the library and requesting to start its implementation.
  • Working Code: No specific code snippets have been discussed recently.
  • Immediate Context: The user was preparing to begin the implementation of the persistence library.
  1. Recent Operations:
  • Last Agent Commands: User requested to "Start implementation."
  • Tool Results Summary: No specific results were generated from this command.
  • Pre-Summary State: The agent was discussing the implementation of the MySQL persistence library.
  • Operation Context: The recent commands were aimed at progressing towards the development of the persistence library.
  1. Continuati...

Created from VS Code.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: aluitink <3255752+aluitink@users.noreply.github.com>
Copilot AI changed the title [WIP] Start implementation of MySQL persistence library Add MySQL persistence driver via EF Core + Pomelo Mar 8, 2026
…persistent actor sync queue

Co-authored-by: aluitink <3255752+aluitink@users.noreply.github.com>
Copilot AI changed the title Add MySQL persistence driver via EF Core + Pomelo MySQL persistence: schema correctness fixes + provider-aware blobs + persistent actor sync queue Mar 8, 2026
…hema

Co-authored-by: aluitink <3255752+aluitink@users.noreply.github.com>
Copilot AI changed the title MySQL persistence: schema correctness fixes + provider-aware blobs + persistent actor sync queue MySQL persistence: proper relational schema with FK constraints, navigation properties, and structural fixes Mar 8, 2026
Co-authored-by: aluitink <3255752+aluitink@users.noreply.github.com>
Copilot AI changed the title MySQL persistence: proper relational schema with FK constraints, navigation properties, and structural fixes MySQL schema: FK constraints, navigation properties, and actor query helper fields Mar 8, 2026
Copilot AI changed the title MySQL schema: FK constraints, navigation properties, and actor query helper fields Add IsLocal and Domain helper columns to ActorEntity for indexed locality queries Mar 8, 2026
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