Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/auth/dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Re-export auth dependencies from middleware
from .middleware import get_current_user, require_auth, require_admin_key

__all__ = ['get_current_user', 'require_auth', 'require_admin_key']
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS match_explanations (
FOREIGN KEY (match_id) REFERENCES matches(id)
);

CREATE INDEX idx_match_explanations_match_id ON match_explanations(match_id);
CREATE INDEX IF NOT EXISTS idx_match_explanations_match_id ON match_explanations(match_id);

-- Matching Weights Configuration
-- Allows communities to adjust matching priorities
Expand Down
52 changes: 28 additions & 24 deletions app/models/ancestor_voting.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,18 @@ class GhostReputationAllocation:

# Status
status: AllocationStatus
refunded: bool = False
refund_reason: Optional[str] = None

# Timestamps
# Timestamps (required)
allocated_at: datetime
veto_deadline: datetime

# Optional fields with defaults
refunded: bool = False
refund_reason: Optional[str] = None
refunded_at: Optional[datetime] = None
completed_at: Optional[datetime] = None

# Anti-abuse: veto window
veto_deadline: datetime
vetoed: bool = False
vetoed_by: Optional[str] = None
veto_reason: Optional[str] = None
Expand Down Expand Up @@ -119,19 +121,21 @@ class UserDepartureRecord:

# Departure details
departure_type: DepartureType
departure_reason: Optional[str]

# Reputation transfer
final_reputation: float
memorial_fund_id: Optional[str]

# Metadata (required)
departed_at: datetime

# Optional fields
departure_reason: Optional[str] = None
memorial_fund_id: Optional[str] = None

# Data handling
private_data_purged: bool = False
purged_at: Optional[datetime] = None
public_contributions_retained: bool = True

# Metadata
departed_at: datetime
recorded_by: Optional[str] = None # Who recorded the departure


Expand All @@ -141,26 +145,29 @@ class AllocationPriority:
id: str
allocation_id: str

# Priority factors
# Calculated score (required)
priority_score: int

# Metadata (required)
calculated_at: datetime

# Priority factors (optional with defaults)
is_new_member: bool = False # <3 months
has_low_reputation: bool = False
is_controversial: bool = False
is_marginalized_identity: bool = False # Self-disclosed

# Calculated score
priority_score: int

# Metadata
calculated_at: datetime


@dataclass
class MemorialImpactTracking:
"""Impact metrics for a Memorial Fund."""
id: str
fund_id: str

# Impact metrics
# Metadata (required)
last_updated: datetime

# Impact metrics (optional with defaults)
total_allocated: float = 0.0
total_refunded: float = 0.0
proposals_boosted: int = 0
Expand All @@ -171,9 +178,6 @@ class MemorialImpactTracking:
new_members_helped: int = 0
controversial_proposals_boosted: int = 0

# Metadata
last_updated: datetime


@dataclass
class AllocationAuditLog:
Expand All @@ -186,8 +190,8 @@ class AllocationAuditLog:
actor_id: str
actor_role: str # 'steward', 'system'

# Context
details: Optional[str] = None # JSON with additional context

# Timestamp
# Timestamp (required)
logged_at: datetime

# Context (optional)
details: Optional[str] = None # JSON with additional context
8 changes: 5 additions & 3 deletions app/models/care_outreach.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ class CareVolunteer:

# Capacity - they're human, they have limits
currently_supporting: int # Max 2-3 at a time
max_capacity: int = 3

# Support for the supporter
# Support for the supporter (required)
supervision_partner_id: str # Someone who checks in on THEM

# When they joined and last check-in
# When they joined (required)
joined_at: datetime

# Optional with defaults
max_capacity: int = 3
last_supervision: Optional[datetime] = None

@property
Expand Down
92 changes: 47 additions & 45 deletions app/models/mycelial_strike.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ class WarlordAlert:

# Source
reporting_node_fingerprint: str
reporting_user_id: Optional[str]

# Propagation
trusted_source: bool = True
propagation_count: int = 0

# Lifecycle
# Lifecycle (required)
created_at: datetime
expires_at: datetime # 7 days default

# Optional fields
reporting_user_id: Optional[str] = None
trusted_source: bool = True
propagation_count: int = 0
cancelled: bool = False
cancelled_by: Optional[str] = None
cancellation_reason: Optional[str] = None
Expand Down Expand Up @@ -111,17 +111,17 @@ class LocalStrike:

# Status
status: StrikeStatus
automatic: bool = True

# Behavior tracking
behavior_score_at_start: float
current_behavior_score: float

# Timestamps
# Timestamps (required)
activated_at: datetime
deactivated_at: Optional[datetime] = None

# Override
# Optional fields
automatic: bool = True
deactivated_at: Optional[datetime] = None
overridden_by: Optional[str] = None
override_reason: Optional[str] = None
overridden_at: Optional[datetime] = None
Expand All @@ -140,12 +140,12 @@ class StrikeEvidence:
# Source
collected_by: str # Node fingerprint

# Weight
reliability_score: float = 1.0

# Timestamp
# Timestamp (required)
collected_at: datetime

# Weight (optional)
reliability_score: float = 1.0


@dataclass
class StrikePropagation:
Expand All @@ -159,34 +159,38 @@ class StrikePropagation:

# Trust
trust_score: float
accepted: bool = True
rejection_reason: Optional[str] = None

# Timestamp
# Timestamp (required)
propagated_at: datetime

# Optional
accepted: bool = True
rejection_reason: Optional[str] = None


@dataclass
class BehaviorTracking:
"""Tracking of user behavior for strike de-escalation."""
id: str
user_id: str
strike_id: Optional[str]

# Behavior metrics
exchanges_given: int = 0
exchanges_received: int = 0
offers_posted: int = 0
needs_posted: int = 0

# Calculated score
# Calculated score (required)
behavior_score: float # 0-10, higher is better

# Tracking period
# Tracking period (required)
period_start: datetime
period_end: datetime
last_updated: datetime

# Optional
strike_id: Optional[str] = None

# Behavior metrics (optional with defaults)
exchanges_given: int = 0
exchanges_received: int = 0
offers_posted: int = 0
needs_posted: int = 0


@dataclass
class StrikeDeescalationLog:
Expand All @@ -211,22 +215,22 @@ class StrikeOverrideLog:
"""Log of steward overrides."""
id: str

# What was overridden
strike_id: Optional[str]
alert_id: Optional[str]

# Override details
action: OverrideAction
override_by: str # Steward user ID
reason: str

# Before/after snapshots
before_state: Optional[Dict[str, Any]]
after_state: Optional[Dict[str, Any]]

# Timestamp
# Timestamp (required)
overridden_at: datetime

# What was overridden (optional)
strike_id: Optional[str] = None
alert_id: Optional[str] = None

# Before/after snapshots (optional)
before_state: Optional[Dict[str, Any]] = None
after_state: Optional[Dict[str, Any]] = None


@dataclass
class UserStrikeWhitelist:
Expand All @@ -240,26 +244,27 @@ class UserStrikeWhitelist:

# Scope
scope: str # 'all', 'specific_abuse_type'
abuse_type: Optional[AbuseType]

# Duration
# Timestamp (required)
whitelisted_at: datetime

# Optional
abuse_type: Optional[AbuseType] = None
is_permanent: bool = False
expires_at: Optional[datetime] = None

# Timestamp
whitelisted_at: datetime


@dataclass
class StrikeNetworkStats:
"""Aggregate statistics for the strike network."""
id: str

# Timeframe
# Timeframe (required)
period_start: datetime
period_end: datetime
calculated_at: datetime

# Alert metrics
# Alert metrics (optional with defaults)
total_alerts_created: int = 0
total_alerts_propagated: int = 0
total_alerts_cancelled: int = 0
Expand All @@ -275,6 +280,3 @@ class StrikeNetworkStats:

# Effectiveness
behavior_improvement_count: int = 0

# Timestamp
calculated_at: datetime
7 changes: 7 additions & 0 deletions app/models/sanctuary.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,13 @@ class Config:
SANCTUARY_MIN_TRUST = 0.8 # High trust required for HIGH sensitivity resources
SANCTUARY_MEDIUM_TRUST = 0.6 # Medium trust for MEDIUM sensitivity

# Trust thresholds for various sanctuary operations
TRUST_THRESHOLDS = {
"steward_actions": 0.7,
"high_sensitivity": SANCTUARY_MIN_TRUST,
"medium_sensitivity": SANCTUARY_MEDIUM_TRUST,
}


# Auto-purge timers
SANCTUARY_MATCH_PURGE_HOURS = 24 # Purge matches 24 hours after completion
Expand Down
4 changes: 4 additions & 0 deletions cookies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

4 changes: 4 additions & 0 deletions discovery_search/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
app_path = Path(__file__).parent.parent / "app"
sys.path.insert(0, str(app_path))

# Also add the root directory to path for proper imports
root_path = Path(__file__).parent.parent
sys.path.insert(0, str(root_path))

from .database import init_discovery_db, close_discovery_db
from .api import discovery_router
from .api.discovery import init_discovery_services
Expand Down
2 changes: 1 addition & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"postcss": "^8.4.32",
"postcss": "^8.5.6",
"tailwindcss": "^3.3.6",
"typescript": "^5.3.3",
"vite": "^5.0.8"
Expand Down
6 changes: 6 additions & 0 deletions frontend/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Loading