Skip to content

refactor(archive): move action events out of lib - #638

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/archive-action-event-naming
May 1, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/archive-action-event-naming

Conversation

@Sinity

@Sinity Sinity commented May 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Move archive-domain action-event semantics from polylogue/lib/action_event/ to polylogue/archive/action_event/.

Problem

Action-event extraction and tool-call normalization describe archive meaning, but the old lib path kept that domain semantics in the generic utility bucket. This is part of the cleanup tracked in #635 to make names and placement match the product architecture.

Solution

Renamed the action-event semantic package into polylogue/archive/action_event/, updated all imports and path-bearing tests, and adjusted topology ownership from lib-action-event to archive-action-event. Storage action-event persistence remains in polylogue/storage/action_events/.

Verification

  • pytest -q tests/unit/sources/test_tool_aliases.py tests/unit/archive/test_query_runtime_matching.py tests/unit/core/test_repo_identity.py tests/unit/cli/test_query_support_runtime.py tests/unit/storage/test_fts5.py tests/unit/storage/test_store_ops.py -> 142 passed
  • devtools verify-topology -> realized=697 declared=697 blocking=False
  • devtools render-all --check -> generated surfaces in sync
  • ruff check polylogue/archive/action_event polylogue/archive/query/runtime_matching.py polylogue/cli/query_semantic.py polylogue/cli/query_stats.py polylogue/pipeline/services/ingest_worker.py polylogue/storage/action_events/rows.py polylogue/storage/repository/action/reads.py tests/unit/archive/test_query_runtime_matching.py tests/unit/cli/test_query_support_runtime.py tests/unit/core/test_repo_identity.py tests/unit/sources/test_tool_aliases.py tests/unit/storage/test_fts5.py -> all checks passed
  • push hook devtools verify --quick -> all checks passed

Ref #635

Summary by CodeRabbit

  • Refactor
    • Reorganized internal module structure by relocating action-event components to a new location. Updated all associated import paths throughout the codebase and corresponding test files to reference the new structure. All functionality remains unchanged.

Copilot AI review requested due to automatic review settings May 1, 2026 15:24
@coderabbitai

coderabbitai Bot commented May 1, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR relocates the action_event module from polylogue.lib.action_event to polylogue.archive.action_event, updating topology projections and all dependent import paths across the codebase to reference the new location.

Changes

Cohort / File(s) Summary
Topology Projection & Configuration
devtools/build_topology_projection.py, docs/plans/topology-target.yaml
Updated placement rules and TARGET_TO_OWNER mapping to classify action_event modules under polylogue/archive/action_event/ instead of polylogue/lib/action_event/, changing owner assignment from lib-action-event to archive-action-event.
Archive Action Event Modules
polylogue/archive/action_event/action_events.py, polylogue/archive/action_event/fields.py
Updated internal imports to reference polylogue.archive.action_event instead of polylogue.lib.action_event for helper functions like build_search_text, extract_branch_names, and _clean_str.
Library Modules
polylogue/lib/conversation/attribution.py, polylogue/lib/semantic/facts.py, polylogue/lib/semantic/models.py, polylogue/lib/semantic/support.py
Updated ActionEvent type and helper function imports from polylogue.lib.action_event to polylogue.archive.action_event.
CLI & Query Modules
polylogue/cli/query_semantic.py, polylogue/cli/query_stats.py, polylogue/archive/query/runtime_matching.py
Updated ActionEvent type-checking imports to reference the archive action_event module.
Pipeline & Storage Modules
polylogue/pipeline/services/ingest_worker.py, polylogue/products/resume.py, polylogue/storage/action_events/rows.py, polylogue/storage/repository/action/reads.py
Updated imports of ActionEvent and related function definitions to source from polylogue.archive.action_event.
Protocols & Type Definitions
polylogue/protocols.py
Updated ActionEvent type import within TYPE_CHECKING block to reference archive module.
Unit Tests
tests/unit/archive/test_query_runtime_matching.py, tests/unit/cli/test_query_exec.py, tests/unit/cli/test_query_support_runtime.py, tests/unit/core/test_repo_identity.py, tests/unit/sources/test_tool_aliases.py, tests/unit/storage/test_fts5.py
Updated test imports and test data payloads to reference ActionEvent from archive module and use updated command paths reflecting the new module location.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Suggested labels

type:refactor, area:storage, area:cli, area:pipeline, area:qa

Poem

🐰 Hop, hop, the action events now hop away,
From lib's old nest to archive's grand display,
With imports repointed and topology clear,
Our modules are organized, far and near! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: moving action events from the lib directory to the archive directory.
Description check ✅ Passed The description includes all required sections: Summary, Problem, Solution, and Verification with comprehensive details; Changelog appropriately notes this is a refactor requiring no entry.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/archive-action-event-naming

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

Refs: origin/master..HEAD
Changed paths: 24

Affected Domains

  • architecture_discipline — 2 claim(s), maturity growing
  • unclassified — 6 claim(s), maturity seed

Required Gates

  • devtools verify-manifests — structural manifest changed
  • devtools affected-obligations --path devtools/build_topology_projection.py — refresh structural obligation routing
  • devtools verify-topology — topology projection changed
  • devtools affected-obligations --path docs/plans/topology-target.yaml — refresh structural obligation routing
  • pytest tests/unit/cli — CLI command surface changed
  • pytest tests/unit/proof/test_evidence_runners.py — CLI proof runners exercise command output
  • devtools render-cli-reference --check — CLI reference is generated from command help
  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit
  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • none for affected domains

Oracle / Cost

  • oracle mix: {"construction_sanity": 184, "drift_check": 2}
  • cost tier: {"static": 180, "unit": 6}
  • stale evidence: 186
  • manual review cells: 0

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.

Pull request overview

Moves archive-domain action-event semantics out of the generic polylogue/lib area into the archive domain boundary (polylogue/archive), aligning package placement with the architecture cleanup tracked in #635.

Changes:

  • Relocated action-event semantics to polylogue/archive/action_event/ and updated all Python imports accordingly.
  • Updated tests that embed path-bearing tool-call commands to reference the new module path.
  • Updated topology ownership/projection inputs to reflect the new package location.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/storage/test_fts5.py Updates embedded command string to new archive action-event path.
tests/unit/sources/test_tool_aliases.py Updates import for canonical_tool_name to archive action-event package.
tests/unit/core/test_repo_identity.py Updates ActionEvent import to archive action-event package.
tests/unit/cli/test_query_support_runtime.py Updates ActionEvent import to archive action-event package.
tests/unit/cli/test_query_exec.py Updates embedded command string to new archive action-event path.
tests/unit/archive/test_query_runtime_matching.py Updates ActionEvent import to archive action-event package.
polylogue/storage/repository/action/reads.py Updates ActionEvent import used by storage repository reads.
polylogue/storage/action_events/rows.py Updates imports for action-event hydration/building to archive package.
polylogue/protocols.py Updates TYPE_CHECKING ActionEvent import for protocol typing.
polylogue/products/resume.py Updates import for tool-call normalization helper to archive package.
polylogue/pipeline/services/ingest_worker.py Updates TYPE_CHECKING and runtime imports for action-event building during ingest.
polylogue/lib/semantic/support.py Updates tool-call extraction import to archive package.
polylogue/lib/semantic/models.py Updates ActionEvent import to archive package.
polylogue/lib/semantic/facts.py Updates ActionEvent/builder imports to archive package.
polylogue/lib/conversation/attribution.py Updates ActionEvent import to archive package.
polylogue/cli/query_stats.py Updates TYPE_CHECKING ActionEvent import to archive package.
polylogue/cli/query_semantic.py Updates TYPE_CHECKING ActionEvent import to archive package.
polylogue/archive/query/runtime_matching.py Updates TYPE_CHECKING ActionEvent import to archive package.
polylogue/archive/action_event/parsing.py Adds parsing/normalization helpers under the new archive action-event package.
polylogue/archive/action_event/fields.py Updates helper import to reference new archive-local parsing module.
polylogue/archive/action_event/action_events.py Updates imports to archive-local fields/parsing modules and re-exports tool-call builder.
polylogue/archive/action_event/init.py Introduces the new archive action-event package marker.
docs/plans/topology-target.yaml Reassigns topology ownership entries from lib action-event to archive action-event.
devtools/build_topology_projection.py Updates topology projection rules to map action-event modules to archive ownership.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Actionable comments posted: 1

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

Inline comments:
In `@devtools/build_topology_projection.py`:
- Line 210: The new mapping ("polylogue/archive/action_event/",
"archive-action-event") is never matched because classify() has a generic branch
that routes all "polylogue/archive/*" to owner "stable" before the specific
entry is considered; update classify() so the specific prefix for
"polylogue/archive/action_event/" is checked before the generic
"polylogue/archive/" rule (or move the tuple into the earlier/more-specific
mapping list used by classify()). Ensure you reference the tuple
("polylogue/archive/action_event/", "archive-action-event") and the classify()
function when making the change so the specific owner takes precedence over the
generic archive branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5f0feaac-03c7-414c-967a-3dc7a6532227

📥 Commits

Reviewing files that changed from the base of the PR and between b555505 and b85c73f.

📒 Files selected for processing (24)
  • devtools/build_topology_projection.py
  • docs/plans/topology-target.yaml
  • polylogue/archive/action_event/__init__.py
  • polylogue/archive/action_event/action_events.py
  • polylogue/archive/action_event/fields.py
  • polylogue/archive/action_event/parsing.py
  • polylogue/archive/query/runtime_matching.py
  • polylogue/cli/query_semantic.py
  • polylogue/cli/query_stats.py
  • polylogue/lib/conversation/attribution.py
  • polylogue/lib/semantic/facts.py
  • polylogue/lib/semantic/models.py
  • polylogue/lib/semantic/support.py
  • polylogue/pipeline/services/ingest_worker.py
  • polylogue/products/resume.py
  • polylogue/protocols.py
  • polylogue/storage/action_events/rows.py
  • polylogue/storage/repository/action/reads.py
  • tests/unit/archive/test_query_runtime_matching.py
  • tests/unit/cli/test_query_exec.py
  • tests/unit/cli/test_query_support_runtime.py
  • tests/unit/core/test_repo_identity.py
  • tests/unit/sources/test_tool_aliases.py
  • tests/unit/storage/test_fts5.py

("polylogue/lib/raw_payload/", "lib-raw-payload"),
("polylogue/lib/artifact_taxonomy/", "lib-artifact-taxonomy"),
("polylogue/lib/action_event/", "lib-action-event"),
("polylogue/archive/action_event/", "archive-action-event"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

archive-action-event owner mapping is currently unreachable.

You added ("polylogue/archive/action_event/", "archive-action-event"), but classify() still routes all polylogue/archive/* files to owner: "stable" in the generic archive branch, so this new owner never takes effect.

Proposed fix
@@
-    elif rel.startswith("polylogue/archive/"):
+    elif rel.startswith("polylogue/archive/action_event/"):
+        target = rel
+        owner = "archive-action-event"
+        reason = "archive-domain action-event semantics"
+    elif rel.startswith("polylogue/archive/"):
         target = rel
         owner = "stable"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@devtools/build_topology_projection.py` at line 210, The new mapping
("polylogue/archive/action_event/", "archive-action-event") is never matched
because classify() has a generic branch that routes all "polylogue/archive/*" to
owner "stable" before the specific entry is considered; update classify() so the
specific prefix for "polylogue/archive/action_event/" is checked before the
generic "polylogue/archive/" rule (or move the tuple into the
earlier/more-specific mapping list used by classify()). Ensure you reference the
tuple ("polylogue/archive/action_event/", "archive-action-event") and the
classify() function when making the change so the specific owner takes
precedence over the generic archive branch.

@Sinity
Sinity merged commit c895264 into master May 1, 2026
19 checks passed
@Sinity
Sinity deleted the feature/refactor/archive-action-event-naming branch May 1, 2026 15:37
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Move archive-domain action-event semantics from
`polylogue/lib/action_event/` to `polylogue/archive/action_event/`.

## Problem

Action-event extraction and tool-call normalization describe archive
meaning, but the old `lib` path kept that domain semantics in the
generic utility bucket. This is part of the cleanup tracked in #635 to
make names and placement match the product architecture.

## Solution

Renamed the action-event semantic package into
`polylogue/archive/action_event/`, updated all imports and path-bearing
tests, and adjusted topology ownership from `lib-action-event` to
`archive-action-event`. Storage action-event persistence remains in
`polylogue/storage/action_events/`.

## Verification

- `pytest -q tests/unit/sources/test_tool_aliases.py
tests/unit/archive/test_query_runtime_matching.py
tests/unit/core/test_repo_identity.py
tests/unit/cli/test_query_support_runtime.py
tests/unit/storage/test_fts5.py tests/unit/storage/test_store_ops.py` ->
142 passed
- `devtools verify-topology` -> `realized=697 declared=697
blocking=False`
- `devtools render-all --check` -> generated surfaces in sync
- `ruff check polylogue/archive/action_event
polylogue/archive/query/runtime_matching.py
polylogue/cli/query_semantic.py polylogue/cli/query_stats.py
polylogue/pipeline/services/ingest_worker.py
polylogue/storage/action_events/rows.py
polylogue/storage/repository/action/reads.py
tests/unit/archive/test_query_runtime_matching.py
tests/unit/cli/test_query_support_runtime.py
tests/unit/core/test_repo_identity.py
tests/unit/sources/test_tool_aliases.py tests/unit/storage/test_fts5.py`
-> all checks passed
- push hook `devtools verify --quick` -> all checks passed

Ref #635

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Reorganized internal module structure by relocating action-event
components to a new location. Updated all associated import paths
throughout the codebase and corresponding test files to reference the
new structure. All functionality remains unchanged.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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