Side A fixes a real data-correctness bug (pinned Reddit posts polluting imports) with a clear implementation and an accompanying regression test verifying both 'stickied' and 'pinned' fields are handled. Side B's fix is plausible (defining a missing GITHUB_API_BASE_URL constant to avoid a NameError) but the diff shows no test and no context of where/how the variable is actually used, making its correctness harder to verify.
constitution · epochs · watch · epoch 3
c_bc8c17a00ed7 (tommy-mor) vs c_4ed2e2cca39b (tommy-mor)
download prompt · raw event · cmp_91dfc80ab6f18b
council reasoning
B fixes a real NameError by defining the missing GITHUB_API_BASE_URL used in the OAuth callback, restoring broken auth. A only filters stickied/pinned Reddit listing children (with a small helper and unit test), which is a useful import refinement but not a correctness fix on a critical path.
Side A changes subreddit import behavior to intentionally exclude stickied/pinned posts by adding a dedicated check in `parse_children`, documents the behavior, and adds a regression test covering both `stickied` and `pinned` flags. Side B fixes a real runtime issue by defining `GITHUB_API_BASE_URL` with a default, preventing a NameError in the OAuth callback, but it is a smaller configuration fix without accompanying tests or broader behavioral improvements.
sides
A — c_bc8c17a00ed7 (tommy-mor)
message
[03cd8f2e] Skip pinned Reddit posts when importing subreddit listings. Co-authored-by: Cursor <cursoragent@cursor.com>
diff preview
diff --git a/server/src/reddit.rs b/server/src/reddit.rs
index f409764c1e1f36216f1b08107043c2eab905694c..fa5577f8ee0a8c53ff4dbec988a90a5d2fc3cdee 100644
--- a/server/src/reddit.rs
+++ b/server/src/reddit.rs
@@ -661,6 +661,7 @@ pub fn map_children_url(id: &ItemId, api_base: &str) -> String {
/// Parse a subreddit listing payload into `(child_id, child_payload)` entries.
/// Each child id is the post's permalink under `reddit.com/…`, and the payload
/// is the raw `{kind, data}` listing element (persisted per child).
+/// Pinned / stickied posts are skipped.
fn parse_children(_parent: &ItemId, payload: &Value) -> Vec<(ItemId, Value)> {
let mut out = Vec::new();
let children = match payload.pointer("/data/children").and_then(|c| c.as_array()) {
@@ -668,6 +669,9 @@ fn parse_children(_parent: &ItemId, payload: &Value) -> Vec<(ItemId, Value)> {
None => return out,
};
for child in children {
+ if child_is_pinned(child) {
+ continue;
+ }
let permalink = match child.pointer("/data/permalink").and_then(|p| p.as_str()) {
Some(p) if !p.is_empty() => p,
_ => continue,
@@ -680,6 +684,15 @@ fn parse_children(_parent: &ItemId, payload: &Value) -> Vec<(ItemId, Value)> {
out
}
+fn child_is_pinned(child: &Value) -> bool {
+ let data = match child.get("data") {
+ Some(d) => d,
+ None => return false,
+ };
+ data.get("stickied").and_then(|v| v.as_bool()) == Some(true)
+ || data.get("pinned").and_then(|v| v.as_bool()) == Some(true)
+}
+
fn parse_reddit_view(id: &ItemId, v: &Value) -> Option<crate::reducer::EntityData> {
let segments: Vec<&str> = id.as_str().split('/').collect();
@@ -853,4 +866,46 @@ mod tests {
Some("http://v3.redgifs.com/watch/impossibleprestigioushedgehog")
);
}
+
+ #[test]
+ fn parse_children_skips_pinned_posts() {
+ let payload = serde_json::json!({
+ "kind": "Listing",
+ "data": {
+ "children": [
+ {
+ "kind": "t3",
+ "data": {
+ "title": "Official rules (pinned)",
+ "permalink": "/r/rust/comments/pin/official_rules/",
+ "stickied": true
+ }
+ },
+ {
+ "kind": "t3",
+ "data": {
+ "title": "Also pinned via pinned field",
+ "permalink": "/r/rust/comments/pin2/also_pinned/",
+ "pinned": true
+ }
+ },
+ {
+ "kind": "t3",
+ "data": {
+ "title": "Normal post",
+ "permalink": "/r/rust/comments/aaa/normal_post/",
+ "stickied": false
+ }
+ }
+ ]
+ }
+ });
+ let parent = ItemId::from_url("https://reddit.com/r/rust").unwrap();
+ let children = parse_children(&parent, &payload);
+ assert_eq!(children.len(), 1);
+ assert_eq!(
+ children[0].0.as_str(),
+ "https://reddit.com/r/rust/comments/aaa"
+ );
+ }
}
B — 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("/")
Hardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.