fix(generation): persist a subject reuse key so interrupted runs can be topped up (#1089)

Analysed against c666529c10 files changedby sloemo01
Open PR on GitHub

Change-risk score

9.5out of 10Elevated
Repository health
4.0to4.3base against this head

This change sits in the top third of this repository's own risk distribution, the band worth reviewing closely. It is riskier than 83% of this repository's own commits.

The largest health movement is in core.py, down 1.6. 3 contracts changed, called by 59 symbols in files this PR does not touch.

Files changed
10
in this diff
Contracts changed
3
removed or signature
Outside callers
59
not in this diff
Findings added
13
14 resolved

Blast radius on the repo map

Every file in the repository, grouped into its own directories and sized by lines. The ones this PR changes are lit, and everything that imports them is marked.

packagestestsapi-clientclicoreserveruivscodewebunitsrcsrc/repowis…src/repowise/coresrc/repowise/server__tests__srcsrcwebviewsrccligenerationhealthingestionpersiste…servertest_pro…workspaceagent_targ…commandsanalysisgenerationingestionworkspacemcp_serverroutersc4graphworkspacecomponen…mcp
changed, health fellchanged, health rosechanged, health heldimports a changed fileuntouchedchanged by this PR

Drawing 3,402 of 3,821 files at a readable size, grouped by directory and sized by lines of code. 10 changed here reach 21 more by import. 419 are too small to see at this width, which is what the frame below is for.

Inside packages

api-clientclicoreserveruivscodewebsrcsrc/repowise/clisrc/repowise/coresrc/repowise/server__tests__srcsrcwebviewsrcagent_targetscommandsanalysisgenerationingestionpersistencepipelineprovidersworkspacemcp_serverroutershealthsrcappcomponen…augment…healthcrudpr…kg_cu…parser…pa…_a…tool_hea…to…rep…do…do…gra…com…co…ts…de…CHAN…sy…

2,524 files, 7 changed by this PR and 21 that import one. This PR changes 8 files in total, spread across more than one top-level directory. Click any directory above to frame it instead.

Changed

Contracts this PR changes

Only symbols that were removed or had their signature changed. An added symbol has no prior callers, and a body-only change leaves the caller's contract intact, so neither is a finding.

upsert_pagesignature changedpackages/core/src/repowise/core/persistence/crud/pages.py:234

41 callers outside this PR, 1 inside it.

tests/integration/test_persistence.py::TestVersionHistory::test_idempotent_reupsert_is_nooptests/integration/test_persistence.py::TestVersionHistory::test_version_history_after_re_generationtests/unit/cli/test_doctor_embed_recipe.py::_build_repotests/unit/cli/test_doctor_fts_drift.py::_build_drifted_repotests/unit/cli/test_doctor_information_floor.py::_build_repotests/unit/cli/test_doctor_resume_stub.py::_build_repotests/unit/cli/test_doctor_store_reconciliation.py::_build_repotests/unit/cli/test_doctor_vector_decisions.py::_insert_pagetests/unit/generation/test_concept_index_reaches_search.py::_indextests/unit/generation/test_file_vocabulary.py::_indextests/unit/generation/test_question_text_reaches_search.py::_indextests/unit/generation/test_stub_fallback_never_overwrites.py::test_a_written_page_still_retires_the_row_it_supersedestests/unit/generation/test_stub_fallback_never_overwrites.py::test_keeping_the_prose_still_lets_the_page_movetests/unit/generation/test_stub_fallback_never_overwrites.py::test_prose_page_is_not_recorded_as_a_stubtests/unit/generation/test_stub_fallback_never_overwrites.py::test_stub_does_not_overwrite_existing_prosetests/unit/generation/test_stub_fallback_never_overwrites.py::test_stub_members_do_not_retire_the_page_whose_generation_failedtests/unit/generation/test_stub_fallback_never_overwrites.py::test_stub_over_existing_prose_creates_no_version_churntests/unit/persistence/test_coordinator_health.py::_insert_pagetests/unit/persistence/test_crud.py::test_get_page_versions_returns_ordered_desctests/unit/persistence/test_crud.py::test_get_stale_pages_returns_only_staletests/unit/persistence/test_crud.py::test_list_page_idstests/unit/persistence/test_crud.py::test_list_pages_excludes_tombstones_when_askedtests/unit/persistence/test_crud.py::test_list_pages_filters_by_page_typetests/unit/persistence/test_crud.py::test_list_pages_paginationtests/unit/persistence/test_crud.py::test_list_pages_returns_all_for_repotests/unit/persistence/test_crud.py::test_upsert_page_creates_version_1tests/unit/persistence/test_crud.py::test_upsert_page_creates_version_on_second_upserttests/unit/persistence/test_crud.py::test_upsert_page_increments_version_fieldtests/unit/persistence/test_crud.py::test_upsert_page_preserves_created_attests/unit/persistence/test_cycle_page_convergence.py::_add_scc_pagetests/unit/persistence/test_mark_stale_pages.py::_seed_pagetests/unit/persistence/test_page_hierarchy_migration.py::legacy_storetests/unit/persistence/test_page_hierarchy_migration.py::test_an_upgraded_store_accepts_hierarchy_writestests/unit/persistence/test_page_tree_sync.py::_addtests/unit/persistence/test_page_upsert_refresh.py::_upserttests/unit/persistence/test_related_backfill.py::_insert_pagetests/unit/persistence/test_search_fts_columns.py::_seed_pagetests/unit/pipeline/test_tombstone_absent_files.py::_seedtests/unit/pipeline/test_tombstone_fts_removal.py::_seedtests/unit/server/test_repos.py::test_export_wiki_returns_zipand 1 more, above the 40 stored per symbol
_call_providersignature changedpackages/core/src/repowise/core/generation/page_generator/core.py:405

13 callers outside this PR.

tests/unit/generation/test_page_generator.py::test_a_first_time_page_is_not_marked_as_self_repairedtests/unit/generation/test_page_generator.py::test_a_repaired_page_is_marked_as_self_repairedtests/unit/generation/test_page_generator.py::test_artifact_violation_is_retried_once_and_recoverstests/unit/generation/test_page_generator.py::test_cache_disabled_increments_every_calltests/unit/generation/test_page_generator.py::test_cache_hit_does_not_increment_call_counttests/unit/generation/test_page_generator.py::test_corrective_retry_names_the_broken_rule_and_keeps_the_requesttests/unit/generation/test_page_generator.py::test_invalid_provider_output_raises_and_is_not_cachedtests/unit/generation/test_page_generator.py::test_prior_page_reuse_bypasses_fresh_output_validationtests/unit/generation/test_page_generator.py::test_provider_request_forwards_reasoning_configtests/unit/generation/test_page_generator.py::test_repo_output_limit_reaches_provider_requesttests/unit/generation/test_page_generator.py::test_retry_carries_the_discarded_attempt_s_tokenstests/unit/generation/test_page_generator.py::test_second_violation_gives_up_rather_than_loopingtests/unit/generation/test_page_generator.py::test_token_limit_is_not_retried
run_repo_generationsignature changedpackages/cli/src/repowise/cli/commands/init_cmd/generation.py:251

5 callers outside this PR, 4 inside it.

tests/unit/cli/test_init_failure_reporting.py::TestStubsAreNotCountedTwice::_runtests/unit/cli/test_init_failure_reporting.py::test_recorded_cost_includes_the_knowledge_graph_enrichmenttests/unit/cli/test_init_failure_reporting.py::test_run_repo_generation_reports_failurestests/unit/cli/test_init_failure_reporting.py::test_run_repo_generation_uses_exact_job_id_when_providedtests/unit/cli/test_init_failure_reporting.py::test_run_repo_generation_zero_failures

What this PR added, and what it took away

Introduced findings are the ones inside the lines this PR added, not the file's existing ones. The resolved column is the only place in the product that lists them.

Introduced (13)
  • highgod class
    packages/core/src/repowise/core/generation/page_generator/core.py:158

    PageGenerator is a god class: 384 lines across 16 methods, including a brain method (_call_provider, CCN 16)

  • mediumnested complexity
    packages/core/src/repowise/core/generation/page_generator/core.py:405

    _call_provider nests 4 levels deep

  • mediumdry violation
    tests/unit/generation/test_reuse_gate.py:183

    51% of file duplicated; worst clone shares 22 lines with tests/unit/generation/test_reuse_gate.py

  • mediumdry violation
    tests/unit/persistence/test_content_hash_roundtrip.py:61

    29% of file duplicated; worst clone shares 12 lines with tests/unit/persistence/test_content_hash_roundtrip.py

  • mediumduplicated assertion block
    tests/unit/generation/test_reuse_gate.py:141

    assertion block at lines 141-144 is duplicated in tests/unit/generation/test_reuse_gate.py

  • mediumduplicated assertion block
    tests/unit/generation/test_reuse_gate.py:172

    assertion block at lines 172-173 is duplicated in tests/unit/generation/test_reuse_gate.py

  • mediumduplicated assertion block
    tests/unit/generation/test_reuse_gate.py:203

    assertion block at lines 203-204 is duplicated in tests/unit/generation/test_reuse_gate.py

  • mediumduplicated assertion block
    tests/unit/generation/test_reuse_gate.py:230

    assertion block at lines 230-232 is duplicated in tests/unit/generation/test_reuse_gate.py

  • lowerror handling
    packages/core/src/repowise/core/generation/page_generator/core.py:389

    broad `except Exception` catches unrelated errors and can hide bugs

  • lowbumpy road
    packages/core/src/repowise/core/pipeline/scoped_generation.py:183

    execute_scoped_generation has 3 nested blocks at the same level (bumpy road)

  • lowprimitive obsession
    tests/unit/generation/test_reuse_gate.py:50

    _module_page takes 5 parameters

  • lowerror handling
    packages/core/src/repowise/core/pipeline/scoped_generation.py:234

    broad `except Exception` catches unrelated errors and can hide bugs

  • lowerror handling
    packages/cli/src/repowise/cli/commands/upgrade_flow.py:223

    broad `except Exception` catches unrelated errors and can hide bugs

Resolved (14)
  • function hotspot
    packages/core/src/repowise/core/generation/page_generator/core.py
  • function hotspot
    packages/core/src/repowise/core/pipeline/scoped_generation.py
  • dry violation
    packages/core/src/repowise/core/pipeline/scoped_generation.py
  • function hotspot
    packages/cli/src/repowise/cli/commands/init_cmd/command.py
  • dry violation
    packages/cli/src/repowise/cli/commands/init_cmd/command.py
  • brain method
    packages/cli/src/repowise/cli/commands/init_cmd/generation.py
  • function hotspot
    packages/cli/src/repowise/cli/commands/init_cmd/generation.py
  • function hotspot
    packages/cli/src/repowise/cli/commands/upgrade_flow.py
  • dry violation
    packages/cli/src/repowise/cli/commands/upgrade_flow.py
  • churn risk
    packages/cli/src/repowise/cli/commands/upgrade_flow.py
  • brain method
    packages/core/src/repowise/core/generation/page_generator/pertype.py
  • function hotspot
    packages/core/src/repowise/core/generation/page_generator/pertype.py
  • function hotspot
    packages/core/src/repowise/core/persistence/crud/pages.py
  • churn risk
    packages/core/src/repowise/core/persistence/crud/pages.py

Who else knows this code

The primary author of each changed file by share of its recent commits, mined from git history. Advisory: it says who has context, not who must review.

  • packages/core/src/repowise/core/generation/page_generator/core.pyRaghav Chamadiya 78% of 26 commits
  • packages/cli/src/repowise/cli/commands/upgrade_flow.pyRaghav Chamadiya 85% of 18 commits
  • packages/cli/src/repowise/cli/commands/init_cmd/command.pyRaghav Chamadiya 91% of 56 commits
  • tests/unit/cli/test_generation_persist.pyRaghav Chamadiya 100% of 2 commits
  • tests/unit/generation/test_structural_salt.pyRaghav Chamadiya 71% of 2 commits

Tests that cover this change

Test files that import a file this PR changes. Not a coverage measurement: it is the import graph, so it says which tests are worth running, not which lines they reach.

  • packages/core/src/repowise/core/analysis/test_impact.py
  • packages/core/src/repowise/core/analysis/test_reachability.py
  • tests/integration/persistence/test_embed_batch_pg.py
  • tests/unit/cli/test_full_upgrade_lock.py
  • tests/unit/persistence/test_page_tree_wiring.py
  • tests/unit/generation/test_stub_fallback_never_overwrites.py
  • tests/unit/cli/test_edenai_reachability.py
  • tests/unit/cli/test_editor_setup.py
  • tests/unit/cli/test_health_rescore_gate.py
  • tests/unit/cli/test_workspace_deterministic.py
  • tests/unit/cli/test_workspace_init_dry_run.py
  • tests/unit/cli/test_file_page_volume_prompt.py
  • tests/unit/cli/test_init_failure_reporting.py
  • tests/unit/server/test_generate.py
  • tests/unit/generation/test_onboarding.py
  • tests/unit/generation/test_page_generator.py
  • tests/unit/generation/test_provenance.py
  • tests/unit/generation/test_onboarding_glossary.py

3 changed files have no test importing them.

Get this on your own pull requests

This page came from an index of repowise-dev/repowise. No model calls, no configuration, and it refreshes on every push. Install the bot and every pull request gets one of these.