Skip to content

Promote edge to stable: bulk upload refuses non-moderators first; Delphi math step and Ollama labels fixed; CLI fixes - #3096

Merged
colinmegill merged 6 commits into
stablefrom
edge
Oct 17, 2026
Merged

colinmegill merged 6 commits into
stablefrom
edge

Conversation

@colinmegill

Copy link
Copy Markdown
Member

Server: POST /api/v3/comments-bulk refuses a non-moderator before resolving a participant (a refused caller no longer becomes a member of an invite-only conversation). Delphi: the math step launches with python -P (FULL_PIPELINE jobs no longer fail at it); the Ollama provider binds a client to its endpoint. CLI only: setup wizard with several initial statements, admission model matches Node (and CI runs the table), tests never touch the macOS Keychain, input checked before credentials, site text cleaned before printing, accepted invites keep their token. No schema change.

colinmegill and others added 6 commits October 17, 2026 01:58
…rites a participant (#3090)

POST /api/v3/comments-bulk created the caller's participant row in parallel
with the moderator check, so a refused, signed-in caller was left as an
existing member of the conversation. The invite-only gate admits existing
members, so that caller's next vote or comment in an invite-only conversation
was accepted. Any account could do this, since a first sign-in creates the
local user. The moderator check now runs first and the participant is resolved
only for a moderator.

A new integration test sends the refused upload as a signed-in non-moderator
to an invite-only conversation and requires that no participant is written and
that the caller's vote is still refused; both fail against the previous
handler. The moderator upload paths are unchanged (seed and vote-path
recordings pass).


Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…s a client to its endpoint (#3091)

* delphi: launch the math step with python -P

run_delphi.py started polismath/run_math_pipeline.py as a script, which puts
the polismath folder first on sys.path. polismath/types.py and polismath/queue/
then shadow the standard library's types and queue, and the first standard
library import of types (logging -> re -> enum) fails with a circular import,
so the math stage exits 1 and the job fails. Python's -P flag leaves the
script's folder off sys.path.

A test checks that every script run_delphi.py launches from a folder holding a
standard-library module name is launched with -P, and that the math pipeline
starts that way. It fails against the previous launch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

* delphi: the Ollama provider binds a client to its endpoint

OllamaProvider set `ollama.client.api_base` for any endpoint other than
localhost, but the ollama package has no module-level `client`, so the
constructor raised AttributeError and topic naming fell back to keyword labels
on every compose stack (whose endpoint is http://ollama:11434), while the stored
label still named the model. It now uses ollama.Client(host=endpoint), whose
chat and list match the calls the provider already makes.

The topic-naming tests use a fake provider; a new test constructs the real one
with a non-default endpoint. It fails against the previous constructor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…e credentials (#3092)

On a Mac, a CLI test without a saved credential fell through to the older
Keychain lookup for the default profile, so test runs reached the person's real
saved sign-in and showed Keychain dialogs. POLIS_KEYCHAIN=off now keeps every
credential in the owner-only file store without calling the Keychain;
polis-cli/.cargo/config.toml sets it for every process cargo starts, the test
launchers that clear POLIS_* variables set it again, and the real-Keychain cases
run only with POLIS_TEST_KEYCHAIN=1.

`polis api` checked its path only inside the request, after the credential was
read, and participant export and conversation close/reopen created the client
before checking their inputs, so with a locked Keychain an invalid argument
exited 3 (credential store) instead of 2, or failed a read that needed no
credential. The request path checks are now a public check_request() that the
api command runs first, and those commands validate before creating the client.

A new test makes the credential store unreadable without the Keychain (a
world-writable credential directory) and requires exit 2 for invalid input; it
fails against the previous code. The whole CLI entry point passes on a Mac with
the Keychain switched off.


Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… read (#3094)

The setup wizard confirmed each initial statement with
GET /api/v3/comments?tids=N&moderation=true and expected exactly one row, but
Node's moderation list ignores tids and returns every statement, so any setup
with two or more initial statements stopped at the second one (exit 7), leaving
a closed, invite-only conversation. The wizard now posts every statement, then
reads the moderation list in pages and confirms each statement's number, text,
approval and active state.

A mock that answers like Node covers three statements and a missing one; the
live setup test now uses three statements. Against a local stack, a 40-statement
setup completes and opens.


Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…; CI runs the admission table (#3093)

* contracts: the admission model follows Node's external-ID rules again

Node now checks the external-ID allow-list on every join, vote and comment for
any request whose external ID is its identity, before resolving that identity,
and treats a changed or unknown external ID, or a token from another owner, as
a new identity. The model still predicted that known identities bypass the list
and that a changed ID kept its participant: against live Node, 472 of the
2,400 admission cells disagreed. predict() now encodes both rules and all 2,400
cells match. The setup summary and the setup document describe the current
behaviour, including seed authority.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

* ci: run the setup admission table so the model cannot drift from Node

scripts/test-setup-admission.sh generates the contract's predictions for every
entry path, action and setting, runs the observer against the sealed local
Node stack, and fails on any mismatch. It reuses the images the CLI comparison
builds, and the comparison workflow now runs it after the command comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

* contracts: rustfmt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…s its token (#3095)

Normal output printed a top-level "help" or "table" string exactly as received,
and commands that pass the site's JSON through (api, conversation view, report
and Delphi reads) let a site write escape sequences to the terminal: clearing
the screen, faking output, or setting the clipboard where the terminal allows
it. Preformatted text now goes through one cleaner that keeps line breaks and
tabs and drops every other control character and every invisible formatting
character. The vote prompt uses the same set of invisible characters as the
conversation table.

`polis join --invite` checked the receipt's login code before saving the issued
participant token, so a missing or malformed code discarded the token while the
one-time invite was already spent. The token is now saved first, as vote and
comment already do, and the command still exits 7. Readiness joins keep saving
only after the response is proved to be for the conversation.

New tests cover a passed-through help text with escape, bell, C1, zero-width and
bidirectional characters, and an accepted invite without a usable login code;
both fail against the previous code.


Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Delphi Coverage Report

File Stmts Miss Cover
polismath/init.py 2 0 100%
polismath/benchmarks/bench_pca.py 128 107 16%
polismath/benchmarks/bench_repness.py 81 65 20%
polismath/benchmarks/bench_update_votes.py 38 28 26%
polismath/benchmarks/benchmark_utils.py 34 0 100%
polismath/components/init.py 1 0 100%
polismath/components/config.py 165 70 58%
polismath/conversation/init.py 2 0 100%
polismath/conversation/conversation.py 1291 264 80%
polismath/conversation/group_vote_counts.py 38 2 95%
polismath/conversation/manager.py 131 42 68%
polismath/database/init.py 1 0 100%
polismath/database/dynamodb.py 392 176 55%
polismath/database/postgres.py 414 95 77%
polismath/delphi_storage/init.py 1 0 100%
polismath/delphi_storage/codec.py 295 22 93%
polismath/delphi_storage/embedding_spool.py 58 6 90%
polismath/delphi_storage/golden_corpus.py 60 9 85%
polismath/delphi_storage/import_report.py 51 3 94%
polismath/delphi_storage/legacy_import.py 171 16 91%
polismath/delphi_storage/postgres.py 49 22 55%
polismath/delphi_storage/production_import.py 612 131 79%
polismath/delphi_storage/resource.py 179 32 82%
polismath/delphi_storage/scan_pacing.py 77 0 100%
polismath/delphi_storage/writer.py 193 18 91%
polismath/empty_output.py 29 2 93%
polismath/engine_adapter.py 317 265 16%
polismath/job_child/init.py 356 52 85%
polismath/job_child/census.py 101 8 92%
polismath/pca_kmeans_rep/init.py 5 0 100%
polismath/pca_kmeans_rep/clusters.py 257 38 85%
polismath/pca_kmeans_rep/corr.py 98 17 83%
polismath/pca_kmeans_rep/group_k_smoother.py 28 0 100%
polismath/pca_kmeans_rep/legacy_kmeans.py 197 8 96%
polismath/pca_kmeans_rep/pca.py 162 19 88%
polismath/pca_kmeans_rep/repness.py 226 5 98%
polismath/poller/init.py 4 0 100%
polismath/poller/admission.py 318 15 95%
polismath/poller/backfill.py 936 32 97%
polismath/poller/capacity.py 485 27 94%
polismath/poller/capacity_queue.py 248 13 95%
polismath/poller/coordinator_bridge.py 317 317 0%
polismath/poller/math_writer.py 113 3 97%
polismath/poller/promotion.py 112 4 96%
polismath/poller/readiness.py 368 13 96%
polismath/poller/rebuild_child.py 133 5 96%
polismath/poller/service.py 665 52 92%
polismath/poller/worker_pool.py 140 0 100%
polismath/queue/executor.py 223 111 50%
polismath/regression/init.py 4 0 100%
polismath/regression/clojure_comparer.py 188 20 89%
polismath/regression/comparer.py 891 640 28%
polismath/regression/datasets.py 135 27 80%
polismath/regression/recorder.py 36 27 25%
polismath/regression/utils.py 130 85 35%
polismath/replay/init.py 2 0 100%
polismath/replay/attribution_capture.py 49 0 100%
polismath/replay/axis_continuity.py 347 24 93%
polismath/replay/certify.py 999 59 94%
polismath/replay/crosslang.py 128 2 98%
polismath/replay/decision_ties.py 55 8 85%
polismath/replay/diagnostics.py 50 7 86%
polismath/replay/driver.py 73 1 99%
polismath/replay/dsn_admission.py 36 1 97%
polismath/replay/equiv_query.py 10 0 100%
polismath/replay/event_ingress.py 95 1 99%
polismath/replay/fixture_bundle.py 815 62 92%
polismath/replay/fixture_config.py 266 11 96%
polismath/replay/fixture_extract.py 285 12 96%
polismath/replay/fixture_generate.py 103 1 99%
polismath/replay/fixture_samples.py 157 14 91%
polismath/replay/fixture_selection.py 119 0 100%
polismath/replay/fixture_survey.py 147 11 93%
polismath/replay/legacy_pca.py 29 17 41%
polismath/replay/polarity.py 319 25 92%
polismath/replay/poller_equiv.py 776 99 87%
polismath/replay/prodclone.py 193 2 99%
polismath/replay/real_data.py 146 10 93%
polismath/replay/schedule.py 205 10 95%
polismath/replay/served_math.py 159 4 97%
polismath/replay/shard_bench.py 189 65 66%
polismath/replay/stagecompare.py 890 161 82%
polismath/replay/stages.py 256 40 84%
polismath/replay/stepcompare.py 86 1 99%
polismath/replay/store.py 120 11 91%
polismath/replay/tie_capture.py 107 19 82%
polismath/replay/types.py 71 6 92%
polismath/run_math_pipeline.py 284 93 67%
polismath/tools/engine_rebuild.py 230 11 95%
polismath/types.py 22 0 100%
polismath/utils/cli_flags.py 15 0 100%
polismath/utils/clj_hash.py 44 0 100%
polismath/utils/env_flags.py 13 0 100%
polismath/utils/general.py 63 39 38%
polismath/utils/output_profile.py 66 2 97%
polismath/utils/serialization.py 10 5 50%
polismath/utils/vote_convention.py 159 5 97%
umap_narrative/501_calculate_comment_extremity.py 113 38 66%
umap_narrative/502_calculate_priorities.py 136 103 24%
umap_narrative/700_datamapplot_for_layer.py 507 507 0%
umap_narrative/701_static_datamapplot_for_layer.py 310 310 0%
umap_narrative/702_consensus_divisive_datamapplot.py 435 275 37%
umap_narrative/801_narrative_report_batch.py 666 455 32%
umap_narrative/803_check_batch_status.py 268 148 45%
umap_narrative/llm_factory_constructor/init.py 2 0 100%
umap_narrative/llm_factory_constructor/model_provider.py 232 106 54%
umap_narrative/narrative_data.py 178 65 63%
umap_narrative/numerical_stages.py 54 25 54%
umap_narrative/polismath_commentgraph/init.py 1 0 100%
umap_narrative/polismath_commentgraph/cli.py 268 268 0%
umap_narrative/polismath_commentgraph/core/init.py 3 3 0%
umap_narrative/polismath_commentgraph/core/clustering.py 108 108 0%
umap_narrative/polismath_commentgraph/core/embedding.py 104 104 0%
umap_narrative/polismath_commentgraph/lambda_handler.py 219 219 0%
umap_narrative/polismath_commentgraph/schemas/init.py 2 0 100%
umap_narrative/polismath_commentgraph/schemas/dynamo_models.py 160 9 94%
umap_narrative/polismath_commentgraph/tests/conftest.py 17 17 0%
umap_narrative/polismath_commentgraph/tests/test_clustering.py 74 74 0%
umap_narrative/polismath_commentgraph/tests/test_embedding.py 55 55 0%
umap_narrative/polismath_commentgraph/tests/test_storage.py 87 87 0%
umap_narrative/polismath_commentgraph/utils/init.py 9 7 22%
umap_narrative/polismath_commentgraph/utils/converter.py 283 237 16%
umap_narrative/polismath_commentgraph/utils/group_data.py 332 289 13%
umap_narrative/polismath_commentgraph/utils/storage.py 609 489 20%
umap_narrative/reset_conversation.py 162 53 67%
umap_narrative/run_pipeline.py 342 212 38%
umap_narrative/topic_naming.py 148 11 93%
Total 25758 8026 69%

@colinmegill
colinmegill merged commit d6aee77 into stable Oct 17, 2026
55 of 57 checks passed
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