Repository navigation
Delphi shadow: lists that add runs laying out every comment, or every comment but the moderated-out ones - #3462
Merged
Merged
Conversation
Every shadow run embeds every comment of its conversation and lays out, clusters and names the comments of one rule. Until now the only rule was participant_visible/1, what participants are shown. This adds two siblings: - all_comments/1: every comment, unmoderated, moderated in and moderated out; - all_but_moderated_out/1: every comment but the moderated-out ones, whatever strict moderation says. Each rule is one function in the input bundle contract's table (RULES), with its twin in polismath/selection.py and a golden file holding both languages to the same comments and digest. A conversation's rule is chosen by two new scheduler settings, DELPHI_SHADOW_ALL_COMMENTS and DELPHI_SHADOW_ALL_BUT_MODERATED_OUT, lists of conversation codes read as DELPHI_SHADOW_BENCHMARK is; a code in both is refused at startup by its position. Listed in neither, a conversation keeps participant_visible/1, and with both empty every run, admission and log line is what it was. The rule is an input of the run: the scheduler resolves the lists on its read login, asks for the census under the conversation's rule, and the admission's key and run record (config_effective.selection and shadow.selection, digest and count) follow from it. The selection digest carries the rule's name, so a conversation moved to another rule is never taken as unchanged and runs again at its next turn. No schema change; no new query on any pool the participation path uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two lists no longer choose a conversation's single rule; they add runs. Every conversation the shadow runs is still run under participant_visible/1 exactly as before, with the same keys, state entries and log lines. A code on DELPHI_SHADOW_ALL_COMMENTS or DELPHI_SHADOW_ALL_BUT_MODERATED_OUT (or on both) also gets a run under that rule, after the sets' own runs. Each (conversation, rule) is its own job: - it publishes in its own scope (delphi:all_comments, delphi:all_but_moderated_out), so no rule's results replace another's; - its "unchanged, no rerun needed" decision is read from its newest run in delphi_jobs, by the history index, never from the scheduler's state file; - its admission key is the selection digest plus the newest run it follows. A crash and restart reuses the same key and job, and a selection that changed and changed back runs as a new job rather than getting the superseded one back from the queue's binding; - a run of it still queued when the scheduler lost track of it is taken up and watched, not run a second time beside it; - its rerun window is measured by the database's own clock. The resolved codes only nominate. Each admission checks, in the census snapshot, that a code of the list still names the conversation; when none does, nothing is queued and the codes are resolved again. A code may now be on both lists. A repeated code, or a second code of a conversation already on the same list, is one run, counted in the rules log line. A failed resolution no longer holds back any other run. No schema change: the scope is free text in the existing admission function, and the history is read from existing columns on the shadow's read login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Delphi Coverage Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What a person observes: nothing, until a deployment lists a conversation. Then, besides its usual shadow run (the comments participants are shown), that conversation gets another shadow run for each list it is on: one laying out every comment, one laying out every comment but the moderated-out ones, or both. Nothing serves shadow runs, so no page changes.
The rules. Two new comment rules beside
participant_visible/1:all_comments/1: unmoderated, moderated in and moderated out;all_but_moderated_out/1: unmoderated and moderated in, whatever strict moderation says.Each is one function in the input bundle contract's rule table, with its Python twin and a golden file.
The settings.
DELPHI_SHADOW_ALL_COMMENTSandDELPHI_SHADOW_ALL_BUT_MODERATED_OUT: lists of conversation codes read asDELPHI_SHADOW_BENCHMARKis, empty by default. With both empty, every run is exactly as before. A code may be on both.Each (conversation, rule) is its own job:
delphi:all_comments,delphi:all_but_moderated_out), so results never replace another rule's;The key includes the run it follows, so a selection that changes and changes back runs again rather than reusing a superseded job. A run already queued when the scheduler lost track of it is watched, not repeated.
A stale code queues nothing. Before admitting a run, the scheduler checks, in the same database snapshot as the comment census, that a listed code still names the conversation. If none does, nothing is queued and the codes are read again.
No schema change. No query on any pool the participation path uses: the new reads are on the shadow's own read login, by existing indexes, with the existing timeouts, and none is made when both lists are empty.
Tests:
Checks run locally before opening: every check the changed paths trigger (36), on the second commit: 33 passed, among them the queue, job-graph, contract, server integration and E2E checks and the polis-api check; one known-red shard of the Delphi Python tests (a shared-table race unrelated to this change); the nginx upstream contract test failed once and passed when re-run alone; the CLI differential's local harness could not find its binary on the machine used (a harness fault, not a test result), so the hosted run of that check is its witness here.
Reviewed independently twice; the second review, of the fix round that made the lists add runs rather than choose one rule, found no remaining defect and confirmed the default byte for byte against the base on 14 observations.
🤖 Generated with Claude Code