Repository navigation
Test log isolation, stale references, DCA stop distance, manifest name refusal (#964 #967 #973 #974) - #978
Merged
Conversation
…the checkout's logs/ (#964) configure_logging opens the relative logs/keel.log against the cwd, so every CLI test loading a config without a logging: section left a file in the checkout that the next run's timeline export read back as an empty engine log. An autouse fixture now chdirs into tmp_path and pins KEEL_HOME there; a per-test guard fails the test that touches <repo>/logs by name. The export tests pin their own log path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…has no distance (#973) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ll (#974) Extracts rules.validated_row_params from add_rule_row; apply runs it per entry and skips a refused entry. The rules.kind-via-rule_id verdict hardening is ruled out in _kind_never_brackets' docstring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lly (#967) keel balances citation, dead server._REFRESH_SEC and its two citations, render_lines' browser view, gates.py's seven -> eight and LAST of four -> seven checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly (#967) payload._order_payload is payload._order_row_payload; server.needs_database and server.ROUTES were deleted with the renderer at #540, so the prose now says so instead of pointing at them. test_a_cited_web_module_attribute_exists resolves every backticked keel.web module.name in keel/**/*.py by import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…en import this tree, gates.py counts agree (#978) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Gatekeeper: READY at d1f8a0a. Not merged; the owner merges. Rounds
Verification at d1f8a0a
Follow-up and merge note
|
eaitbrahim
added a commit
that referenced
this pull request
Oct 12, 2026
#978's prose test counted do_POST's refusing guards; #977 made do_POST a drain wrapper around _post, so the walk never reached _gated_action and main went red. The count is unchanged (four + two + the phrase = seven), so only the test moves. Mutation-checked: dropping the Sec-Fetch-Site guard from _post fails it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #964
Closes #967
Closes #973
Closes #974
Summary
#964: the test suite no longer leaves
logs/keel.login the checkoutconfigure_loggingopenslogging.file(default: the relative pathlogs/keel.log) against the cwd. Many CLI tests load a config that has nologging:section, so this was not one bad test. A bisect plugin foundtests/commands/test_dca_cli.pyas the first writer.tests/conftest.py::_run_in_tmp_path, runs every test from its owntmp_pathand setsKEEL_HOMEto that same folder._the_checkouts_logs_are_untouched, records the files under<repo>/logsand<invocation cwd>/logs(size and mtime) before each test. If either changed afterwards, it fails that test by name.logging.file. A probe that put an empty file at that path made 3 tests fail, so the pinned path is the one the export actually reads. The composite-kind test now asserts exact kinds instead of "may or may not appear".--config <repo>/config.yaml.test_research_recordfinds its module through__file__..envtest unsetsKEEL_HOME.#973:
positionsreads the stop throughstatus.recorded_stopstop_distanceandstop_distance_pctare nowNonefor a DCA tranche that storesinitial_stop"0" (or below).PositionRow.initial_stopkeeps the stored value, because Holdings' paper reading (shown_stop) names that 0.positions.pyanddoctor.py.#974:
scripts/rule_manifest.py applyrefuses the paramskeel rules addrefusesadd_rule_rowmoved into a new function,rules.validated_row_params. It covers unknown kind, type mismatches, unknown kwargs, the rule's own validation, non-finite values and dropped params, which includesname.applyruns it on every manifest entry. A refused entry printsREFUSED: kind:product: <the same words add_rule_row prints>and is not written; the other entries still apply, and the exit code is 1.deploy/live-rules.jsonstill applies cleanly.#967: stale references corrected, each pinned by a test that reads the code
_common.record_cash_posture_refutationnamedkeel balancesandkeel brokers list. It now names the real callers that pass no repo; a test resolves everykeel ...it cites through click.server._REFRESH_SECis deleted. Its two citations (events.py,api.py) now point atmain.js'sPOLL_MS. Tests check that every private constant inkeel/web/*.pyis read somewhere in its module, and that any`server._CONST`cited anywhere inkeel/exists.capabilities.render_linesno longer mentions a browser view. A test requires its docstring to name every module that imports it.gates.py: "the other seven" is now "eight", and the count is derived fromCAPABILITIES. "LAST of four checks" is now "seven". That count is taken from the AST ofdo_POSTand_gated_action(their top-levelif notguards, plus the phrase), and each guard function must be named in the docstring.Rulings
tmp_pathwithKEEL_HOMEpinned, and a per-test guard watcheslogs/. Fixing one test at a time would miss the next CLI test someone writes. PinningKEEL_HOMEkeeps a lookup from the baretmp_pathfrom falling through to the operator's real app-data folder. The guard runs per test so the offending test is named without a bisect.__file__. Also, an outside process writing to the checkout'slogs/during a run would fail whichever test was running at that moment.positions.rule_name, notrules.kindviarule_id. Changing it means threadingrule_idthroughOpenPositionStatusandPositionRow, plus 4 call sites inpayload.pyandpulse.pythat parallel PRs are editing. Unattributed tranches have norule_idanyway. The reason is now written in_kind_never_brackets' docstring.do_POSTalready uses: four checks on every write, including the/api/prefix. The unknown-key 404 and the body-shape check are not counted.do_POSTby the parallel halt/serve PR will fail this test until that PR updates the docstring. That is intended.Verification
ruff check keel tests packages: clean.ruff format --check .: clean.mypy(bare): clean, 509 files.logs/deletion in between: 8319 passed, 3 skipped both times, and nologs/afterwards. Before the fix, a full run leftlogs/keel.logbehind; with an emptylogs/keel.logand the old conftest, the two header tests fail, as tests: suite leaves logs/keel.log in CWD; next run fails test_timeline_export header tests #964 reports.initial_stop"0").keel statuslists that tranche asrule=dca (no stop by design).gather_positionsgivesstop_distance=None; origin/main gave64715.98(the full mark, pct 1).keel positionsis only theclosegroup and lists no table.🤖 Generated with Claude Code