Skip to content

chore(topology): resolve projection TBDs, conflicts, and missing rules - #502

Merged
Sinity merged 1 commit into
masterfrom
feature/chore/topology-projection-cleanup
Apr 27, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/chore/topology-projection-cleanup

Conversation

@Sinity

@Sinity Sinity commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the projection-cleanup prerequisite for the architecture series. Resolves 39 TBD cells and 3 target conflicts in docs/plans/topology-target.yaml so verify-topology and render-topology-status produce honest per-issue progress numbers. No code moves.

Problem

The generated topology projection had:

  • 39 TBD cells (30 in polylogue/showcase/, 9 in polylogue/lib/) with no target rule.
  • 3 target conflicts where two source paths claimed the same destination:
    • lib/conversation/models.py ← attachment_models.py + conversation_models.py
    • storage/repository/archive/reads.py ← repository_action_reads.py + repository_archive_reads.py
    • storage/repository/archive/conversations.py ← repository_archive_conversations.py + repository_write_conversations.py

These prevented verify-topology from scoring per-issue progress honestly and let two refactor PRs accidentally claim the same destination.

Solution

Six edits to devtools/build_topology_projection.py, all to placement rules. The YAML is regenerated; no source code is moved.

  1. Storage conflict splits in STORAGE_PREFIX_TO_SUBPACKAGE:

    • repository_action_ → storage/repository/action/ (was storage/repository/archive/)
    • repository_write_ → storage/repository/archive/writes/ (was storage/repository/archive/)
  2. Lib conflict split in LIB_PREFIX_TO_SUBPACKAGE:

    • attachment_ → lib/attachment/ (was lib/conversation/)
  3. New LIB_PREFIX_TO_SUBPACKAGE rules for the 9 refactor(lib): group lib by domain cluster #424 lib TBDs:

    • phase_, projection_, projections, provider_
  4. New LIB_ROOT_PRIMITIVES entries for 2 standalone lib primitives:

    • pricing.py, payload_coercion.py
  5. New SHOWCASE_MOVES table for the 30 refactor: retire public audit qa showcase surfaces #413 showcase TBDs, classified per the issue body — substrate to polylogue/scenarios/, runner machinery to devtools/lab_runner/, reporting to devtools/lab_report/, lab corpus to devtools/lab_corpus/. Files leave the projection on move (target paths under devtools/ are forward-looking annotations).

  6. New TARGET_TO_ISSUE entries for lib/phase/, lib/projection/, lib/provider/, lib/attachment/ so they attribute to refactor(lib): group lib by domain cluster #424.

Verification

python3 devtools/build_topology_projection.py
  Wrote 641 rows. TBD: 0.

devtools verify --quick
  ruff format ... ok
  ruff check ... ok
  mypy ... ok
  render-all ... ok
  verify-topology ... ok
  verify-file-budgets ... ok
  verify-test-ownership ... ok
  verify-migrations ... ok
  verify-cross-cuts ... ok
  all checks passed

Per-issue dashboard after this PR:

Issue Cells At target Pending Conflicts
#403 16 0 16 0
#413 30 0 30 0
#414 8 0 8 0
#424 64 0 64 0
#425 63 0 63 0
#426 15 0 15 0

TBDs: 39 → 0. Conflicts: 3 → 0.

Risks and Follow-ups

This PR contains no code moves and changes only generator placement rules + the regenerated YAML/dashboard. Subsequent move PRs land files at these targets:

Ref #429 (executable topology), #424, #425, #413.

@coderabbitai

coderabbitai Bot commented Apr 26, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 21 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 62b61b1f-4f36-48c5-aef5-70c0d2756483

📥 Commits

Reviewing files that changed from the base of the PR and between 2f094c8 and 4b2629b.

📒 Files selected for processing (3)
  • devtools/build_topology_projection.py
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/chore/topology-projection-cleanup

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

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

Sinity added a commit that referenced this pull request Apr 27, 2026
#505)

## Summary

Master CI has been red since 6b5c392 (#489) due to 14 unrelated test
failures. This PR fixes them all in one mechanical pass so the
architecture-series PRs (#502 and follow-ups) can land.

## Problem

Failures span four root causes:

1. **Python 3.11 / pydantic TypedDict.** Pydantic 2.12+ refuses
`typing.TypedDict` on Python < 3.12. 19 modules declare TypedDict
subclasses; they all need to import from `typing_extensions`.
2. **MCP mutation tests don't mock the new resolve_id pre-check.**
Mutation tools resolve the conversation_id via the query store before
mutating; tests only patched `_get_tag_store`, so resolve_id returned
None and the tools short-circuited with "conversation not found".
3. **Schema/contract drift.** `_clamp_limit` caps at 1000 but tests
still echo unbounded inputs. `get_stats_by` gained an enum on `group_by`
but the witness wasn't regenerated. `bulk_tag_conversations` switched to
`bulk_add_tags(ids, tags)` but the test still asserts N×M `add_tag`
awaits.
4. **Env-sensitive logging test.** `configure_logging` honors
`POLYLOGUE_FORCE_PLAIN`; CI sets that env to `1`, so
`ConsoleRenderer(colors=True)` is unreachable from inside CI.

## Solution

Six targeted fixes:

1. Switch 19 files from `typing.TypedDict` to
`typing_extensions.TypedDict`. Add `typing-extensions>=4.7` to
`pyproject.toml` (works on all supported Pythons).
2. Add `resolved_id` parameter to `make_query_store_mock` and patch
`_get_query_store` in affected mutation tests (`add_tag`, `remove_tag`,
`set_metadata`, `delete_metadata`, `delete_conversation`).
3. Update `_clamp_limit` parametrized cases (5000/10001/99999 → 1000);
regen `tests/data/witnesses/mcp-tool-schemas.json`; rewrite bulk_tag
test to assert on `bulk_add_tags`.
4. Add `patch.dict("os.environ")` + `env.pop("POLYLOGUE_FORCE_PLAIN")`
to the logging test.
5. Refresh syrupy `test_terminal_snapshots.ambr` (same drift as #503;
included here to make the unit suite green standalone).

## Verification

```
POLYLOGUE_FORCE_PLAIN=1 pytest tests/unit/mcp/ \
  tests/unit/test_logging_runtime.py \
  tests/unit/cli/test_terminal_snapshots.py --no-cov
→ all pass

devtools verify --quick
→ all checks passed (pre-push hook)
```

## Out of scope

`test_cli_tail_list_json_exposes_tail_provenance` is failing on a TOCTOU
warning from a parallel BlobStore fix (in `feature/fix/audit-final` /
d295503). Tracked there; not in this PR.

## Related

- #503 — baseline + syrupy refresh; this PR includes the syrupy bit
again so master test suite is green even without #503.
- #502 — topology projection cleanup; blocked on master CI being green.
- #489 — the merge that introduced the 14 failures (test code wasn't
updated alongside MCP authz/limits + clamp_limit + bulk_add_tags + the
show/export help text changes that landed across several merges).


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

## Summary by CodeRabbit

* **Documentation**
* Enhanced CLI help text for export and show commands with clearer
descriptions of conversation ID format handling and default output
behavior.
* Reordered MCP tool schema parameters with added validation
constraints.

* **Chores**
  * Added `typing-extensions>=4.7` as a runtime dependency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Problem
-------

The topology projection had 39 TBD cells (no target rule) and 3 target
collisions where two source paths claimed the same destination:

  - lib/conversation/models.py        (attachment_models.py + conversation_models.py)
  - storage/repository/archive/reads.py        (repository_action_reads.py + repository_archive_reads.py)
  - storage/repository/archive/conversations.py (repository_archive_conversations.py + repository_write_conversations.py)

These prevent verify-topology from honestly scoring per-issue progress
and let two refactor PRs accidentally claim the same target.

What changed
------------

1. Conflict splits in `STORAGE_PREFIX_TO_SUBPACKAGE`:
   - `repository_action_` -> `storage/repository/action/`
   - `repository_write_`  -> `storage/repository/archive/writes/`

2. Conflict split in `LIB_PREFIX_TO_SUBPACKAGE`:
   - `attachment_` -> `lib/attachment/` (was `lib/conversation/`)

3. New `LIB_PREFIX_TO_SUBPACKAGE` rules for the 9 #424 lib TBDs:
   - `phase_`, `projection_`, `projections`, `provider_`

4. New `LIB_ROOT_PRIMITIVES` entries for 2 standalone lib primitives:
   - `pricing.py`, `payload_coercion.py`

5. New explicit `SHOWCASE_MOVES` table for 30 #413 showcase TBDs,
   classified per the issue body (substrate -> polylogue/scenarios/;
   runner machinery -> devtools/lab_runner/; reporting -> devtools/lab_report/;
   lab corpus -> devtools/lab_corpus/).

6. New `TARGET_TO_ISSUE` entries for the new lib subpackages introduced
   above (`lib/phase/`, `lib/projection/`, `lib/provider/`, `lib/attachment/`).

After regenerating: TBDs drop 39 -> 0; target conflicts drop 3 -> 0;
every cell carries an explicit owner.

Verification
------------

  python3 devtools/build_topology_projection.py
    Wrote 641 rows. TBD: 0.
  devtools verify --quick
    all checks passed (verify-topology, verify-file-budgets,
    verify-test-ownership, verify-migrations, verify-cross-cuts).

No code moves; this PR only adjusts the topology generator and the
generated YAML + dashboard. Subsequent move PRs (per-issue) will land
files at the declared targets.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@Sinity
Sinity force-pushed the feature/chore/topology-projection-cleanup branch from 852d229 to 4b2629b Compare April 27, 2026 01:19
@Sinity
Sinity merged commit f2957e3 into master Apr 27, 2026
13 checks passed
@Sinity
Sinity deleted the feature/chore/topology-projection-cleanup branch April 27, 2026 01:31
@Sinity

Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

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

@Sinity
Sinity requested a review from Copilot May 1, 2026 01:54

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sinity added a commit that referenced this pull request May 7, 2026
#505)

## Summary

Master CI has been red since ddf212f (#489) due to 14 unrelated test
failures. This PR fixes them all in one mechanical pass so the
architecture-series PRs (#502 and follow-ups) can land.

## Problem

Failures span four root causes:

1. **Python 3.11 / pydantic TypedDict.** Pydantic 2.12+ refuses
`typing.TypedDict` on Python < 3.12. 19 modules declare TypedDict
subclasses; they all need to import from `typing_extensions`.
2. **MCP mutation tests don't mock the new resolve_id pre-check.**
Mutation tools resolve the conversation_id via the query store before
mutating; tests only patched `_get_tag_store`, so resolve_id returned
None and the tools short-circuited with "conversation not found".
3. **Schema/contract drift.** `_clamp_limit` caps at 1000 but tests
still echo unbounded inputs. `get_stats_by` gained an enum on `group_by`
but the witness wasn't regenerated. `bulk_tag_conversations` switched to
`bulk_add_tags(ids, tags)` but the test still asserts N×M `add_tag`
awaits.
4. **Env-sensitive logging test.** `configure_logging` honors
`POLYLOGUE_FORCE_PLAIN`; CI sets that env to `1`, so
`ConsoleRenderer(colors=True)` is unreachable from inside CI.

## Solution

Six targeted fixes:

1. Switch 19 files from `typing.TypedDict` to
`typing_extensions.TypedDict`. Add `typing-extensions>=4.7` to
`pyproject.toml` (works on all supported Pythons).
2. Add `resolved_id` parameter to `make_query_store_mock` and patch
`_get_query_store` in affected mutation tests (`add_tag`, `remove_tag`,
`set_metadata`, `delete_metadata`, `delete_conversation`).
3. Update `_clamp_limit` parametrized cases (5000/10001/99999 → 1000);
regen `tests/data/witnesses/mcp-tool-schemas.json`; rewrite bulk_tag
test to assert on `bulk_add_tags`.
4. Add `patch.dict("os.environ")` + `env.pop("POLYLOGUE_FORCE_PLAIN")`
to the logging test.
5. Refresh syrupy `test_terminal_snapshots.ambr` (same drift as #503;
included here to make the unit suite green standalone).

## Verification

```
POLYLOGUE_FORCE_PLAIN=1 pytest tests/unit/mcp/ \
  tests/unit/test_logging_runtime.py \
  tests/unit/cli/test_terminal_snapshots.py --no-cov
→ all pass

devtools verify --quick
→ all checks passed (pre-push hook)
```

## Out of scope

`test_cli_tail_list_json_exposes_tail_provenance` is failing on a TOCTOU
warning from a parallel BlobStore fix (in `feature/fix/audit-final` /
d295503). Tracked there; not in this PR.

## Related

- #503 — baseline + syrupy refresh; this PR includes the syrupy bit
again so master test suite is green even without #503.
- #502 — topology projection cleanup; blocked on master CI being green.
- #489 — the merge that introduced the 14 failures (test code wasn't
updated alongside MCP authz/limits + clamp_limit + bulk_add_tags + the
show/export help text changes that landed across several merges).


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

## Summary by CodeRabbit

* **Documentation**
* Enhanced CLI help text for export and show commands with clearer
descriptions of conversation ID format handling and default output
behavior.
* Reordered MCP tool schema parameters with added validation
constraints.

* **Chores**
  * Added `typing-extensions>=4.7` as a runtime dependency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request May 7, 2026
#502)

## Summary

Closes the projection-cleanup prerequisite for the architecture series.
Resolves 39 TBD cells and 3 target conflicts in
`docs/plans/topology-target.yaml` so `verify-topology` and
`render-topology-status` produce honest per-issue progress numbers. No
code moves.

## Problem

The generated topology projection had:

- **39 TBD cells** (30 in `polylogue/showcase/`, 9 in `polylogue/lib/`)
with no target rule.
- **3 target conflicts** where two source paths claimed the same
destination:
- `lib/conversation/models.py` ← `attachment_models.py` +
`conversation_models.py`
- `storage/repository/archive/reads.py` ← `repository_action_reads.py` +
`repository_archive_reads.py`
- `storage/repository/archive/conversations.py` ←
`repository_archive_conversations.py` +
`repository_write_conversations.py`

These prevented `verify-topology` from scoring per-issue progress
honestly and let two refactor PRs accidentally claim the same
destination.

## Solution

Six edits to `devtools/build_topology_projection.py`, all to placement
rules. The YAML is regenerated; no source code is moved.

1. **Storage conflict splits** in `STORAGE_PREFIX_TO_SUBPACKAGE`:
- `repository_action_` → `storage/repository/action/` (was
`storage/repository/archive/`)
- `repository_write_` → `storage/repository/archive/writes/` (was
`storage/repository/archive/`)

2. **Lib conflict split** in `LIB_PREFIX_TO_SUBPACKAGE`:
   - `attachment_` → `lib/attachment/` (was `lib/conversation/`)

3. **New `LIB_PREFIX_TO_SUBPACKAGE` rules** for the 9 #424 lib TBDs:
   - `phase_`, `projection_`, `projections`, `provider_`

4. **New `LIB_ROOT_PRIMITIVES` entries** for 2 standalone lib
primitives:
   - `pricing.py`, `payload_coercion.py`

5. **New `SHOWCASE_MOVES` table** for the 30 #413 showcase TBDs,
classified per the issue body — substrate to `polylogue/scenarios/`,
runner machinery to `devtools/lab_runner/`, reporting to
`devtools/lab_report/`, lab corpus to `devtools/lab_corpus/`. Files
leave the projection on move (target paths under `devtools/` are
forward-looking annotations).

6. **New `TARGET_TO_ISSUE` entries** for `lib/phase/`,
`lib/projection/`, `lib/provider/`, `lib/attachment/` so they attribute
to #424.

## Verification

```
python3 devtools/build_topology_projection.py
  Wrote 641 rows. TBD: 0.

devtools verify --quick
  ruff format ... ok
  ruff check ... ok
  mypy ... ok
  render-all ... ok
  verify-topology ... ok
  verify-file-budgets ... ok
  verify-test-ownership ... ok
  verify-migrations ... ok
  verify-cross-cuts ... ok
  all checks passed
```

Per-issue dashboard after this PR:

| Issue | Cells | At target | Pending | Conflicts |
| --- | --: | --: | --: | --: |
| #403 | 16 | 0 | 16 | 0 |
| #413 | 30 | 0 | 30 | 0 |
| #414 | 8 | 0 | 8 | 0 |
| #424 | 64 | 0 | 64 | 0 |
| #425 | 63 | 0 | 63 | 0 |
| #426 | 15 | 0 | 15 | 0 |

TBDs: 39 → 0. Conflicts: 3 → 0.

## Risks and Follow-ups

This PR contains no code moves and changes only generator placement
rules + the regenerated YAML/dashboard. Subsequent move PRs land files
at these targets:

- #414 (8 cells) is the smallest concrete first move, recommended next.
- #426, #403, #413 can run in parallel afterwards.
- #424, #425 should sequence by sub-cluster, since each is multi-PR.
- #420 and #431 still have no cells declared — separate prerequisite
work.

Ref #429 (executable topology), #424, #425, #413.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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