Skip to content

refactor: session/origin vocabulary sweep + public-surface static audit (#1810) - #1852

Merged
Sinity merged 3 commits into
masterfrom
feature/cleanup/session-origin-sweep
Jun 13, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/cleanup/session-origin-sweep

Conversation

@Sinity

@Sinity Sinity commented Jun 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Coherent first slice of the schema-v1 session/origin terminology sweep: renames the stale /c/{conversation_id} HTML reader route to /s/{session_id} across the daemon web shell, and adds a path-aware static audit (tools/cleanup/polylogue_public_surface_audit.sh, #1850) that fails CI when stale schema-v1 vocabulary reappears on a public surface. This is intentionally partial — see Deferred below; it is being merged as the first reviewable slice so the branch can clear the worktree for follow-up work from clean master.

Problem

Schema-v1 fixed Polylogue's public vocabulary to session and origin, but the daemon still served the legacy /c/{conversation_id} reader route (JS regex, link construction, and HTTP dispatch), and nothing prevented stale conversation/conversation_id/provider_meta terms or the dead route from reappearing on public surfaces (README, hand-authored docs, web reader, API, CLI). The audit on origin/master finds 8 public-surface hits (the /c/ reader route in web_shell*.py plus 3 stale /c/{id} references in docs/visual-evidence.md).

Solution

  • Route rename (polylogue/daemon/http.py, web_shell*.py): /c/{id} → /s/{id}; getConvIdFromURL → getSessionIdFromURL; all link/href/pushState/hash sites updated. No compatibility alias (pre-release, single-user — delete+replace).
  • Static audit (tools/cleanup/polylogue_public_surface_audit.sh, Polylogue: stale vocabulary and command-surface static audit #1850): ripgrep-based, path-aware. Fails on conversation/conversation_id/conversationId/provider_meta//c/ literals in public surfaces (root README, non-historical docs, daemon web, API, CLI), names each file:line with replacement guidance. Allowlists provider-wire parsers (polylogue/sources/**), internal storage/core/schema, tests, historical/tombstone docs (audits/retro/design/plans), and docs/providers/** (external wire notes). Supports an inline polylogue-audit: allow <reason> marker. Deliberately does not police bare provider (deferred internal rename) or blocks (Rename content_blocks -> blocks in runtime models and tests (post-#1743) #1791). Wired into the devtools verify --quick non-pytest gate set.
  • Doc fix (docs/visual-evidence.md): /c/{id} → /s/{id} (stale after the route rename).
  • Tests: positive/negative route tests (/s/{id} serves the shell; /c/{id} is 404, no alias); audit tests (clean tree passes; conversation_id/legacy-route/provider_meta fail; provider-wire allowlist; inline-allow marker).
  • Inherited fix (fix(tests): commit): annotated 9 pre-existing var-annotated mypy errors in three daemon test stub classes that were red on master and blocked the pre-push gate. Not part of the sweep; zero behavior change.

Verification

tools/cleanup/polylogue_public_surface_audit.sh   # origin/master: 8 hits → branch: clean (0)
devtools verify --quick                            # 15/15 gates exit 0 (incl. new public-surface-audit; mypy now 0 errors)
pytest tests/unit/devtools/test_public_surface_audit.py   # 7 passed
pytest tests/unit/daemon/test_web_reader.py -k "session_deep_link or legacy_conversation"   # 2 passed

Baseline before this branch: devtools verify --quick was 13/14 (mypy red with 9 inherited errors). Final: 15/15 green.

Before / after stale terms (public surfaces)

Surface master branch
/c/ reader route literals (polylogue/ py) 1 dispatch + JS/link sites 0
/c/{id} in docs/visual-evidence.md 3 0
audit verdict FAIL (8 hits) CLEAN

Deferred (next agent, from clean master)

  • Deep provider → origin internal rename (~6024 hits in storage/query/schema behind origin↔provider boundary translation). Schema-migration-scale; public JSON/query API already speaks origin. Audit allowlists these paths. Ref #1835.
  • provider_meta restructure into typed origin-specific fields. Field is used in ~40 internal files; the audit only polices it on public text surfaces. (#1790 does not resolve to an issue in this repo — GraphQL 404 — so its plan could not be consulted.)
  • content_blocks → blocks (Rename content_blocks -> blocks in runtime models and tests (post-#1743) #1791) — separate ~133-file mechanical rename with its own plan; out of session/origin scope. Audit does not police blocks.
  • #1835 broader items not in this slice: removing stale root command names from docs/help (show/open/messages/raw/export/bulk-export/recent/count/stats), the fate of polylogue/rendering/* and polylogue/templates/*, and proof/QA/showcase confidence-language cleanup.
  • browser-extension/README.md generic/external-product conversation prose (anchored out of the README glob; separate component surface).

Ref #1810 #1835 #1850

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added public surface audit tool to verify consistency of public-facing documentation and API references.
  • Updates

    • Web reader session routes changed from /c/{id} to /s/{id}.
    • Documentation updated to reflect new route structure.
    • Legacy conversation routes now return HTTP 404.
  • Tests

    • Added verification tests for new session deep-link routes.
    • Added comprehensive public surface audit test coverage.

Sinity and others added 3 commits June 13, 2026 12:32
Problem
-------
Schema-v1 fixed Polylogue's public vocabulary to `session` and `origin`, but
nothing prevents stale `conversation`/`conversation_id`, the legacy `/c/{id}`
reader route, or `provider_meta` from reappearing on public surfaces (README,
hand-authored docs, daemon web reader, API, CLI). The route rename in the
prior commit also left three stale `/c/{id}` references in docs.

What changed
------------
- tools/cleanup/polylogue_public_surface_audit.sh: path-aware ripgrep audit
  that fails on stale schema-v1 tokens in public surfaces, with replacement
  guidance per hit. Allowlists provider-wire parsers, internal storage/core,
  tests, historical/tombstone docs, and docs/providers (external wire notes);
  supports an inline `polylogue-audit: allow` marker for external-format docs.
  It deliberately does not police bare `provider` (deferred internal rename,
  Ref #1835) or `blocks` (Ref #1791).
- devtools/verify.py: wired the audit into the non-pytest gate set so it runs
  in `devtools verify --quick` and the default tier.
- tests/unit/devtools/test_public_surface_audit.py: positive (clean tree),
  negative (conversation_id / legacy route / provider_meta), provider-wire
  allowlist, and inline-allow-marker coverage.
- docs/visual-evidence.md: `/c/{id}` -> `/s/{id}` (stale after the route rename).

Ref #1810 #1835 #1850

Co-Authored-By: Claude <[email protected]>
The pre-push verify gate was red on master with 9 `var-annotated` errors in
three daemon test stub classes (backend/config/voyage_api_key/auth_token set to
None without a declared type). These are inherited (not caused by the
session/origin sweep) but block the pre-push gate; annotating the stubs with
their obvious optional types clears mypy with no behavior change.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR migrates the reader and daemon from legacy conversation-based routing (/c/{id}) to session-based routing (/s/{id}), updates all embedded web-shell JavaScript link generation and URL parsing to use the new routes, adds comprehensive documentation and visual evidence updates, and introduces a new public-surface audit tool to detect stale schema-v1 vocabulary terms and prevent regression.

Changes

Schema v1 to v2 Vocabulary Migration and Public Surface Audit

Layer / File(s) Summary
Route Contract and Verification Gate
polylogue/daemon/http.py, devtools/verify.py
HTTP _dispatch_get now routes GET /s/<id> (instead of /c/<id>) as unauthenticated web-shell endpoint; build_verify_steps() adds new public-surface-audit verification gate.
Web Shell Client-Side Routing
polylogue/daemon/web_shell.py
Replaces getConvIdFromURL() with getSessionIdFromURL() helper to parse /s/<id> paths from browser URL; popstate handler and initial session boot sequence use new helper.
Web Shell Feature Component Links
polylogue/daemon/web_shell_attachments.py, polylogue/daemon/web_shell_paste.py, polylogue/daemon/web_shell_similar.py, polylogue/daemon/web_shell_workspace.py
Attachment library, paste browser, similar inspector, and workspace embedded JavaScript all update generated anchor and hash-route links from /c/ to /s/ session routes.
Web Reader Route Validation Tests
tests/unit/daemon/test_web_reader.py
Two new smoke tests verify new /s/{session_id} route serves web shell with correct client-side route helpers and legacy /c/{conversation_id} returns 404.
Public Surface Audit Script and Test Suite
tools/cleanup/polylogue_public_surface_audit.sh, tests/unit/devtools/test_public_surface_audit.py
New Bash audit script scans public surfaces for stale vocabulary (conversation, conversation_id, provider_meta, /c/ routes) using ripgrep; comprehensive test suite validates detection of violations, correct guidance reporting, allow-listed exceptions (provider-wire parsers, inline markers), and live-repo pass.
Documentation and Visual Evidence Updates
docs/visual-evidence.md, tests/visual/test_reader_dom_smoke.py
Documentation coverage table and page-structure bullets updated to reference /s/{id} session routes; visual smoke tests fetch shell HTML from /s/ endpoints for deeplink, cost-panel, and insights tests, and evidence manifests record new session routes.
Test Type Annotations (Supporting)
tests/unit/daemon/test_maintenance_endpoints.py, tests/unit/daemon/test_schema_preflight.py, tests/unit/daemon/test_similarity_endpoint.py
Stub and test-double attributes receive explicit str | None and object | None type annotations; no runtime or assertion changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • Sinity/polylogue#1835: Directly implements the same public routing replacement (replacing /c/{conversation_id} with /s/{session_id} and legacy terminology across daemon, web-shell, and documentation).
  • Sinity/polylogue#1850: Directly related; this PR implements the public-surface audit script and CI gate mentioned in that issue.
  • Sinity/polylogue#1810: The main issue tracking schema-v1 terminology sweep; this PR implements the full migration of routes, client-side routing, docs, and audit mechanism described in that issue.

Possibly related PRs

  • Sinity/polylogue#1279: Both PRs extend devtools/verify.py's build_verify_steps() to add new non-commit verification gates (main adds public-surface-audit, related adds verify-witness-coverage).
  • Sinity/polylogue#1047: Main PR's route migration from /c/{id} to /s/{id} directly updates the visual DOM evidence tests and reader expectations that were established by PR #1047.

Suggested labels

type:refactor, area:qa

Poem

🐰 Conversations once wore the /c/ coat of old,
Now sessions dance in /s/ paths, bright and bold!
From JavaScript to docs, the audit stands guard,
Catching stale vocab whispers—not too hard.
Hop along to cleaner schemas, the future's here! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.52% 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 Title clearly identifies the main changes: session/origin vocabulary refactor and addition of a public-surface static audit. Both are accurately reflected in the changeset.
Description check ✅ Passed Description includes all required template sections: Summary, Problem, Solution, Verification (with exact commands), Changelog guidance (skip note), and Risks/Follow-ups (Deferred section). Well-structured and comprehensive.
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/cleanup/session-origin-sweep

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.

github-actions Bot pushed a commit that referenced this pull request Jun 13, 2026
@Sinity
Sinity merged commit 42a6486 into master Jun 13, 2026
12 of 16 checks passed
@Sinity
Sinity deleted the feature/cleanup/session-origin-sweep branch June 13, 2026 10:47

@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: 63dac12da9

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

Comment thread devtools/verify.py Resolved
Sinity added a commit that referenced this pull request Jun 13, 2026
## Summary

Adds the public-surface stale-vocabulary audit to the CI `lint` job so
stale schema-v1 terminology cannot be reintroduced on a public surface
and pass CI.

## Problem

The audit (`tools/cleanup/polylogue_public_surface_audit.sh`) landed in
#1852 and runs in `devtools verify` / the pre-push hook, but **CI never
invoked it**. A PR reintroducing `conversation`/`conversation_id`,
`provider_meta`, or the legacy `/c/` reader route on the README, public
docs, daemon web reader, API layer, or CLI would pass CI. #1850 requires
the audit to run in fast CI.

## Solution

One step added to the CI `lint` job (after the ruff checks): `bash
tools/cleanup/polylogue_public_surface_audit.sh`. The audit is
path-aware — it excludes provider-wire parsers (`polylogue/sources/**`),
internal storage/core, tests/fixtures, and historical/tombstone docs
(`docs/{audits,retro,design,plans,providers}/**`) — and exits non-zero
naming `file:line` + the replacement term. `ripgrep` is preinstalled on
GitHub `ubuntu-latest`.

## Verification

- `devtools verify-ci-workflows` → `16 workflow files checked, no
errors`
- `bash tools/cleanup/polylogue_public_surface_audit.sh` → `clean (no
stale schema-v1 vocabulary on public surfaces)`

Closes #1850

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sinity added a commit that referenced this pull request Jun 13, 2026
#1867)

## Summary
Rename the `read --view conversation` token to `transcript` to remove
stale "conversation" vocabulary that #1863 reintroduced on public CLI
surfaces, restoring the session/origin vocabulary policy from the
#1810/#1852 sweep.

## Problem
#1863 shipped `read --view conversation`. The public-surface audit
(`tools/cleanup/polylogue_public_surface_audit.sh`, #1852) flags
`conversation` as stale schema-v1 vocabulary on both
`polylogue/cli/query_verbs.py` and the generated
`docs/cli-reference.md`. The audit **false-passed in CI** — the
Ubuntu-image ripgrep silently mishandles the audit's `rg` invocation
(the #1854/#1855 shelled-binary-in-CI fragility) — so the violation
landed on master uncaught. It deterministically fails the local pre-push
gate (nix ripgrep), blocking every subsequent push.

## Solution
- Rename the read view token `conversation` → `transcript` in
`query_verbs.py` (`_READ_VIEWS`, help text, comment). The view has no
distinct dispatch branch — it shares the summary fallthrough render path
— so this is a pure token rename, no behavior change.
- Regenerate `docs/cli-reference.md` and the `help-read.txt` showcase
baseline.

## Verification
- `tools/cleanup/polylogue_public_surface_audit.sh` → exit 0 (`clean (no
stale schema-v1 vocabulary on public surfaces)`)
- `mypy --strict polylogue/cli/query_verbs.py` → clean
- `ruff check` → clean
- `pytest tests/unit/cli -k "help or read or view"` → 433 passed, 4
snapshots passed

## Follow-up
The CI audit's ripgrep false-pass is a real gap (CI did not catch this
violation). The lint job's `rg` invocation hardening against the runner
image is tracked separately (#1855 class).
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 54.F055 / P1: stale at the checked revision: The quick-verifier step builder and exact legacy label expectation have been replaced. The current test asserts the static gate contract, including gate lint, rather than the obsolete list ending in verify-test-clock-hygiene (tests/unit/devtools/test_verify.py:106).

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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.

1 participant