Add codebase review plans: simplification, LOC reduction, and bug fixes - #211
Draft
1aeo wants to merge 5 commits into
Draft
Add codebase review plans: simplification, LOC reduction, and bug fixes#2111aeo wants to merge 5 commits into
1aeo wants to merge 5 commits into
Conversation
Co-authored-by: 1aeo <1aeo@users.noreply.github.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Co-authored-by: 1aeo <1aeo@users.noreply.github.com>
…burst-limit formatting Co-authored-by: 1aeo <1aeo@users.noreply.github.com>
…C, tie-breaking, dynamic step count, rare-country fix Co-authored-by: 1aeo <1aeo@users.noreply.github.com>
Co-authored-by: 1aeo <1aeo@users.noreply.github.com>
1aeo
added a commit
that referenced
this pull request
Jul 9, 2026
LOC reduction: delete dead code and merge verbatim duplication (plan 2 of #211)
1aeo
added a commit
that referenced
this pull request
Jul 9, 2026
Bug fixes: all 9 phases of the bug-fix plan (plan 3 of #211)
1aeo
added a commit
that referenced
this pull request
Jul 9, 2026
Simplification: all 9 phases + audit fix + slow-suite restoration (plan 1 of #211)
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.
Summary
Thorough review of the codebase (all
allium/lib/modules,allium/allium.py, templates, and tests), delivered as three separate execution plans underdocs/development/plans/:simplification-plan.md— 9 phases reducing architectural complexity (single escaping strategy, one error-handling layer, one API registry, progress-stack collapse,Relaysfacade removal, page-writer unification, utils consolidation, template dedup, de-layering), each gated on a byte-identical output diff.loc-reduction-plan.md— 6 batches of mechanical deletion (~1,200–1,400 production Python lines + ~500–650 template lines), every symbol grep-verified as dead or verbatim-duplicated before removal.bug-fix-plan.md— 9 phases fixing verified and suspected bugs, ordered by risk and expected HTML impact.Explicitly out of scope: the consensus-health pipeline (
fetch_consensus_health,get_consensus_health_data, theconsensus_health_dataattach, and the reader stub inrelays.py) and thefetch_collector_datawrapper are kept. The simplification plan folds consensus-health into the unified API registry as a disabled/optional entry instead of deleting it.Recorded decisions (options weighed in the bug-fix plan):
markupsafe.Markupsoautoescapestops double-escaping them while remaining the safety net for raw fields. No|safein templates.total_offlinecomputed in Python, template arithmetic removed (Jinja2 is slower — templates render precomputed values).v3_pct_of_total(leaderboards, tier, adopter flag, contact sentence) andv3_migration_progress_pct(mixed-migration pill); the ambiguousv3_relay_percentageis deleted so every consumer picks semantics explicitly.total_stepsdynamically from the API worker registry andsite_generatorpage definitions instead of hard-coded literals.datetime.now(timezone.utc)+parse_onionoo_timestamp()for host-timezone-independent output.ip_utils.safe_parse_ip_address, preferring the IPv4 entry for latency probes (latent bug — zero expected output change).burst-limit: format as a data volume (bytes), not a rate — per proposal 328/dir-spec,BandwidthBurstis a token-bucket size, not bytes/sec.GEOPOLITICAL_CLASSIFICATIONSsets so zero-relay countries are scored as intended; diff on rare-country surfaces reviewed rather than assumed noise-floor.Every plan mandates the output comparison workflow: generate a full-API baseline (
python3 allium/allium.py --out allium/www_baseline --apis all --progress) before changes, regenerate after, and diff withcompare_outputs.py.Key verified findings baked into the plans
autoescape=Trueplus Python pre-escaped*_escapedfields double-escapes; verified in generated output (misc/all.html: 1,275 occurrences;index.html: 71;top500.html: 61 — e.g.&lt;admin AT my-mail dot rocks&gt;renders as literal<...>text).handle_http_errorsreceives display names ("onionoo details") but cache files are keyedonionoo_details.json.page_writer.py; and more.Workflow verification (in this environment)
--apis allbaseline run completes (~3.5 min, ~7 GB RSS, 61/61 steps)python3 compare_outputs.py --quiet— 28,339 common files; measured back-to-back noise floor of ~25 content-diff files (relay uptime ticking, root timestamps), now documented as the acceptance gate in all three plans