Skip to content

[codex] Model template links as secondary artifacts#95

Open
brendan-m-murphy wants to merge 2 commits into
mainfrom
codex/88-secondary-artifact-operations
Open

[codex] Model template links as secondary artifacts#95
brendan-m-murphy wants to merge 2 commits into
mainfrom
codex/88-secondary-artifact-operations

Conversation

@brendan-m-murphy
Copy link
Copy Markdown
Contributor

Summary

  • Add an internal secondary artifact operation interface and a concrete template-link secondary artifact.
  • Replace the add-operation record_post_processor callback with ordered secondary artifact operations coordinated by AddOperationRunner.
  • Move template symlink record updates and audit emission into the runner path, while keeping the existing low-level replica materializer behavior.
  • Remove Catalog._create_template_link_replica and the unused private _run_add_operation wrapper.

Architecture Checkpoint

  • Catalog no longer materializes template links directly.
  • CatalogApplication decides which required secondary operations are needed for UUID-primary managed files.
  • AddOperationRunner owns the order: primary record staging, secondary artifact operations, after_record_write, then commit.
  • Template symlink metadata remains backward compatible via the existing template_replica_* and template_resolved_* fields.

Tests

  • uv run ruff check src/ogcat/secondary_artifacts.py src/ogcat/operation_runner.py src/ogcat/catalog_application.py src/ogcat/catalog.py tests/test_add_operation_lifecycle.py tests/test_replicas.py
  • uv run ruff format --check src/ogcat/secondary_artifacts.py src/ogcat/operation_runner.py src/ogcat/catalog_application.py src/ogcat/catalog.py tests/test_add_operation_lifecycle.py tests/test_replicas.py
  • uv run pyright src/ogcat/secondary_artifacts.py src/ogcat/operation_runner.py src/ogcat/catalog_application.py src/ogcat/catalog.py
  • uv run pytest tests/test_add_operation_lifecycle.py tests/test_replicas.py tests/test_add.py tests/test_hooks.py -q
  • uv run pytest

Review agent also inspected rollback/order risks and found no issues.

@brendan-m-murphy brendan-m-murphy marked this pull request as ready for review May 15, 2026 14:39
Copilot AI review requested due to automatic review settings May 15, 2026 14:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR moves template-link replica creation into the add-operation runner as ordered secondary artifact operations, keeping Catalog focused on facade responsibilities while centralizing add lifecycle orchestration.

Changes:

  • Adds a secondary artifact operation interface and template-link implementation.
  • Updates AddOperationRunner and CatalogApplication to schedule and run secondary artifacts.
  • Removes older Catalog-owned template replica/post-processing paths and updates tests/docs.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ogcat/secondary_artifacts.py Adds secondary artifact result/protocol and template-link operation.
src/ogcat/operation_runner.py Runs secondary artifact operations after record staging and applies metadata/audit updates.
src/ogcat/catalog_application.py Schedules template-link secondary operations for UUID-primary managed files.
src/ogcat/catalog.py Removes older Catalog-local template replica and add wrapper helpers.
tests/test_replicas.py Adds direct coverage for template-link secondary artifact materialization/rollback.
tests/test_add_operation_lifecycle.py Verifies secondary operation scheduling for UUID vs template primaries.
docs/architecture.md Documents secondary artifact operations in the runner lifecycle.

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

Comment thread src/ogcat/secondary_artifacts.py Outdated
Comment on lines +48 to +51
@property
def required(self) -> bool:
"""Whether operation failure should fail the add operation."""
...
Comment thread src/ogcat/secondary_artifacts.py Outdated
Comment on lines +97 to +103
naming_metadata_updates={
"template_replica_path": str(materialized.target_path),
"template_replica_relative_path": materialized.catalog_relative_path,
"template_replica_storage_relative_path": materialized.storage_relative_path,
"template_resolved_directory": materialized.resolved_directory,
"template_resolved_filename": materialized.resolved_filename,
},
Comment on lines +446 to +450
persisted = self._run_secondary_artifacts(
add_plan=add_plan,
record=persisted,
set_phase=set_phase,
)
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