Repository navigation
night: fold: per-root field mapping and a rating value map - #116
Draft
harmoniqs-amico-agent[bot] wants to merge 4 commits into
Draft
harmoniqs-amico-agent[bot] wants to merge 4 commits into
harmoniqs-amico-agent[bot] wants to merge 4 commits into
Conversation
…ading — #97 Add RootConfig dataclass (fields + rating_values) and extend load_config to parse [[vault.root_configs]] array of tables from TOML. Each entry carries a path key; absent entries leave that root inheriting the global field mapping. Provides the config surface for per-root field mapping: a root may declare its own field slots and a value map (e.g. 'high' → 'core') without migrating notes.
#97 _effective_fields() merges per-root field overrides over the global mapping; _rating_values() returns the root's value map or empty dict. fold_roots passes these to _build_paper on a per-root basis. _build_paper is rewritten to: - dispatch on same_field (rating and why map to the same frontmatter key, e.g. both → 'relevance'): canonical enum > rating_values remap > sentence → why - separate-fields path: same ordering plus fallback to sentence-as-why when rating is not an enum value and why is absent - back-compat path: the literal 'relevance' field (only when not already mapped) still applies for notes that predate the per-root scheme - empty-string guard: blank rating still warns 'outside enum' (not 'sentence') Rankings are bit-identical for single-root configs with no root_configs entry.
inspect: _fold_lines() now emits one 'fold root-mapping: <path> (...)' line per root with a custom mapping when cfg carries root_configs. Roots that inherit the global mapping produce no extra line, so existing single-root output is unchanged. The line shape matches the stable fold [a-z-]+: .+ contract (line-shape test continues to pass). tests/test_per_root_mapping.py: 15 tests covering all four ACs: - AC1: root without per-root config inherits global; two-root fixture with differing schemas reads the right fields from each root - AC2: rating value map enum remapping (high→core, medium→useful, low→marginal) - AC3: sentence-valued rating field treated as why-line; no 'outside enum' warning - AC4: single-root parity gate — fold results and ranking scores are bit-identical - Config TOML loading roundtrip - inspect per-root mapping state lines (present / absent)
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 #97
Night-runner draft (notturno, amicissimo#531): implemented headlessly in a Modal sandbox, gates
echo gates-deferred-to-CIgreen. Ready for review — never auto-merged by this slice.