Side A fixes a real runtime bug (NameError on missing API base URL) that would crash the OAuth callback, providing a concrete correctness fix. Side B is a minor cleanup removing dead code and adjusting a test's assertions, which is reasonable but lower-impact than fixing an actual crash-causing bug.
constitution · epochs · watch · epoch 3
c_4ed2e2cca39b (tommy-mor) vs c_cf0a514b261a (tommy-mor)
download prompt · raw event · cmp_c0608af1538916
council reasoning
A fixes a real NameError by defining the missing GITHUB_API_BASE_URL default used in the OAuth path, restoring a broken auth flow. B only deletes a dead zero-ratio early-return already enforced at parse/handler layers and adjusts a test—useful hygiene, but not a functional bugfix.
Side A fixes a concrete runtime bug by defining `GITHUB_API_BASE_URL` with a default and normalizing it, preventing a `NameError` when the OAuth callback references the setting. Side B mainly removes a supposedly redundant zero-ratio guard and updates tests to reflect the new behavior (registering items/pairs while skipping zero-weight edges), which is more of a cleanup/behavior adjustment than a clear bug fix.
sides
A — c_4ed2e2cca39b (tommy-mor)
message
[0d3270d1] Fix GitHub OAuth callback NameError on missing API base URL. Co-authored-by: Cursor <cursoragent@cursor.com>
diff preview
diff --git a/constitution.py b/constitution.py
index f819007252f435680b8356fb4da83469b21e33af..4dd5b9dfbba231d46289c490f91b1dd5b1018bcf 100644
--- a/constitution.py
+++ b/constitution.py
@@ -119,6 +119,9 @@ JSONL_PATH = pathlib.Path(os.environ.get("JSONL_PATH", "/data/ledger.jsonl"))
GITHUB_CLIENT_ID = os.environ.get("GITHUB_CLIENT_ID", "")
GITHUB_CLIENT_SECRET = os.environ.get("GITHUB_CLIENT_SECRET", "")
+GITHUB_API_BASE_URL = os.environ.get(
+ "GITHUB_API_BASE_URL", "https://api.github.com"
+).rstrip("/")
OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY", "")
OPENROUTER_BASE_URL = os.environ.get("OPENROUTER_BASE_URL", "https://openrouter.ai").rstrip("/")
B — c_cf0a514b261a (tommy-mor)
message
[047b82bd] Remove redundant zero-ratio guard from reducer. Zeros are already rejected at the DSL parser and browser handler; the guard in apply_vote was dead code. The negative clamping stays since add_edge_weight already skips weight-0 edges correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
diff preview
diff --git a/server/src/reducer.rs b/server/src/reducer.rs
index 0e36979abe0f051493038ff7e652efc7f7a0ac80..efbf7f67ff24c7a2989102fe62879b2794a27c5f 100644
--- a/server/src/reducer.rs
+++ b/server/src/reducer.rs
@@ -112,11 +112,6 @@ impl GroupState {
if vote.ratio_right < 0 {
vote.ratio_right = 0;
}
- if vote.ratio_left == 0 || vote.ratio_right == 0 {
- // Zero on either side produces no valid edge; drop before registering items or pair.
- return;
- }
-
let a_idx = self.ensure_item(&vote.a);
let b_idx = self.ensure_item(&vote.b);
diff --git a/server/tests/basic.rs b/server/tests/basic.rs
index 08159f4a7f0850fd165817a4a1af4f31ced2ad76..1748769ccf7196b2d81cf556d5368c7e723f6a4e 100644
--- a/server/tests/basic.rs
+++ b/server/tests/basic.rs
@@ -533,7 +533,7 @@ fn dsl_parse_rejects_zero_zero_vote_ratio() {
#[test]
fn reducer_negative_ratio_clamped_to_zero() {
let _state = ReducerState::default();
- // GroupState::apply_vote clamps negatives to 0; when either side is 0 the vote is dropped.
+ // apply_vote clamps negatives to 0; add_edge_weight skips zero-weight edges.
let mut group = GroupState::new();
group.apply_vote(slugsocial_server::reducer::VoteData {
ts: 1,
@@ -546,10 +546,9 @@ fn reducer_negative_ratio_clamped_to_zero() {
delegate: Some("00000000-0000-0000-0000-000000000000:test:local/test".to_string()),
thread_tag: "t".to_string(),
});
- // Nothing registered: zero-clamped vote is dropped before ensure_item.
- assert!(group.idx_to_item.is_empty());
+ // Items and pair are registered; edges are absent because weight 0 is skipped.
+ assert_eq!(group.idx_to_item.len(), 2);
assert!(group.edges.is_empty());
- assert!(group.voted_pairs.is_empty());
}
Hardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.