Skip to content

Deep-key cost checks exclude unrelated heap collection - #878

Closed
zlareb1 wants to merge 3 commits into
mainfrom
fix/toml-wide-integer-cost-gc
Closed

zlareb1 wants to merge 3 commits into
mainfrom
fix/toml-wide-integer-cost-gc

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Both changed files are byte-identical to main after the cost check landed in #874 and the route census landed in #881. This PR is closed as incorporated. Its earlier failed checks remain failures; closure does not claim a merge of this head.

Related: #881

Related: #874

Changelog category (leave one):

  • CI Fix or Improvement

Why

The deep-key CPU ratio test deliberately installs a tracer to detect repeated prefix copying. Its timer also includes garbage collection of the process heap, whose contents depend on earlier tests. An observation run recorded a full collection inside a timed sample. That demonstrates measurement contamination; it does not establish the cause of the earlier failed ratio.

Scope and risk

Use the existing untraced() context to collect before timing and pause GC, then install the required tracer inside it. The inner finally clears that tracer; the outer context restores the original tracer and GC state, including an already-disabled collector.

The same inputs, three CPU samples, strict eightfold ratio and final path assertion remain. The deliberate tracer stays active during every timed call, preserving sensitivity to quadratic prefix copying. The production traversal and temporary parent entries are acyclic.

The related route-census repair also builds a fresh authenticated application in an isolated interpreter, with optional OAuth-connect routes disabled. Its original classifications and all four assertions remain unchanged. This removes the census's dependence on a cached app built under another configuration.

Compatibility, rollout and rollback

  • Wire and storage: no changes.
  • Operator steps: none.
  • Rollback: reverting restores the prior test measurement.

Tests

  • The changed cost node and existing collector-restoration test pass in the focused local check.
  • Scoped Ruff, formatting and diff checks pass. Full suites run in GitHub CI and must pass before merge.
pytest -q -n0 tests/unit/test_document_extraction.py::test_the_wide_integer_check_is_linear_in_a_deep_table_of_long_keys tests/unit/test_code_fixtures.py::test_untraced_leaves_the_collector_as_it_found_it
  • The directly changed route census passed in 6.86 seconds on source identical to this composition. AST comparison confirms its complete original assertion body is unchanged. No application lifespan or listener starts. The earlier route-census CI failure remains a failure; the exact first-import configuration is unproven.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated: An agent wrote the change; independent source diagnosis checked the measurement semantics. Fresh whole-diff review and final-head CI are required before merge.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Final-head CI passes.
  • Fresh independent whole-diff review has no findings or nits.
  • No production, generated, schema, plugin, frontend or configuration change.
  • No assertion, workload, trace requirement or timing bound is relaxed.
  • Public text follows repository copy rules.
  • Commits are signed off.

Keep the deliberate trace function inside the existing CPU measurement context so collections of prior test heaps do not enter the ratio. Preserve every input and assertion.

Signed-off-by: zlareb1 <[email protected]>
Assemble the real app in an isolated interpreter with explicit route settings. Keep every existing route classification and tenancy assertion.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1 zlareb1 closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant