complete category-scoped values, rules, and report parity

- Add category-bound date and numeric values
- Complete rule execution and conflict handling
- Expand Markdown and HTML report output
This commit is contained in:
Chili Palmer
2026-08-20 21:01:02 +02:00
parent cb0e480b79
commit 16150b5a8f
19 changed files with 2519 additions and 419 deletions

View File

@@ -70,7 +70,8 @@ Research URLs:
- [x] `.agnd` SQLite documents, schema migration metadata, foreign keys, WAL,
transactions, integrity-friendly soft deletion, and automatic checkpoints.
- [x] Items with free text, note, priority, When, Done, alarm, numeric value,
- [x] Items with free text, note, priority, When, Done, alarm, independent
category-scoped numeric/date values,
recurring schedule, creation/update timestamps, manual order, and prerequisite
links. Completion advances recurring work and carries alarms and filing forward.
- [x] Categories with hierarchy, inheritance in queries, kinds (standard, date,
@@ -136,28 +137,21 @@ Research URLs:
## Supported with a modern interpretation
- [x] Numeric calculations currently use one optional `numeric_value` per item and
expose five named aggregate modes: `sum`, `avg`, `count`, `min`, and `max`
(`model/enums.rs` `Aggregate`, `ui.rs` `aggregate_value`). Sum, average, minimum,
and maximum operate on the populated values in a section. Count currently counts
every item in the section, whereas Lotus Count counted populated entries in the
numeric column. The names therefore align with Lotus, but the data model,
category scoping, Count semantics, formatting, and presentation do not yet have
full parity.
- [x] Conditions / actions: each `CategoryRule` pairs a parsed condition
expression (`filter.rs` `Predicate`: text/note containment, category membership,
priority and numeric-value comparison, done / has-note / has-date / due-within /
overdue / alarm / recurring) with a deterministic action (`RuleActionKind`:
assign, exclude, priority, value, when, alarm, repeat, done). This is a useful
modern predicate-to-mutation engine, but it is not yet a faithful implementation
of Lotus conditions and actions. Re-evaluation on item change is currently tied
to automatic filing, and a conditional assignment is not withdrawn when its
predicate becomes false. `Done` overlaps one Lotus Special action; rule-driven
export and discard are missing.
- [x] Numeric calculations use independent itemnumeric-category values and
category-bound view columns. Count, Total, Average, Minimum, and Maximum follow
populated-cell semantics per section; formatting and `% of total` are column
properties. The retired `items.numeric_value` column remains only as a migration
bridge for version-4 documents and older API callers.
- [x] Conditions and actions follow separate Lotus lifecycles. Conditions maintain
reversible conditional assignments to their own categories; actions fire once
on source-category entry and make explicit persistent changes. Category-scoped
date/numeric ranges and actions, removal, Done/export/discard Special actions,
scoped Utilities Execute, and inspectable non-convergence state are supported.
- [x] Printing: view-aware Markdown and styled HTML reports are the portable
print/preview foundation, alongside CSV and JSON data exports. Markdown and HTML
currently omit aggregate rows, percentage-of-total columns, numeric formatting,
and other report-layout fidelity listed below.
include live-view aggregate rows, percentage-of-total columns, portable numeric
formatting, relative widths/alignment, print CSS, metadata, and optional headers
and footers.
- [x] Backups: SQLite durability is supplemented by explicit/manual and
backup-on-open `.agnd.bak` snapshots after a full WAL checkpoint. Ordinary
filesystem backup tools also work on `.agnd` files.
@@ -174,60 +168,60 @@ file-format compatibility are not parity goals.
### Numeric data and calculations
- [ ] Store a separate value for every itemnumeric-category assignment instead of
the current single `items.numeric_value` scalar. Preserve explicit, automatic,
and conditional assignment provenance while doing so.
- [ ] Bind numeric view columns to a specific numeric category so several values,
- [x] Store a separate value for every itemnumeric-category assignment rather
than relying on the legacy `items.numeric_value` scalar. Preserve explicit,
automatic, and conditional assignment provenance while doing so.
- [x] Bind numeric view columns to a specific numeric category so several values,
such as Hours, Rate, Cost, and Budget, can coexist on one item and be displayed,
filtered, sorted, edited, and aggregated independently.
- [ ] Scope numeric conditions and numeric actions to a chosen numeric category,
- [x] Scope numeric conditions and numeric actions to a chosen numeric category,
with inside/outside minimum and maximum ranges and assignment removal.
- [ ] Match Lotus aggregate semantics per numeric column and per section: Count
- [x] Match Lotus aggregate semantics per numeric column and per section: Count
populated numeric entries rather than rows, and calculate Total, Average,
Minimum, and Maximum from that column's values only.
- [ ] Add per-numeric-column display properties: label or currency symbol, decimal
- [x] Add per-numeric-column display properties: label or currency symbol, decimal
places, thousands separator, negative-number style, and full-precision storage
independent of rounded display.
- [ ] Implement `Display % of total` as a derived, non-editable companion column
- [x] Implement `Display % of total` as a derived, non-editable companion column
calculated within each section.
- [ ] Make macro highlight context cell-aware. `#HIGHLIGHT_VALUE` must expose the
- [x] Make macro highlight context cell-aware. `#HIGHLIGHT_VALUE` must expose the
highlighted numeric, date, text, category, or item value so Agenda-style macro
arithmetic can operate on document data rather than only on item text.
### Conditions and actions
- [ ] Separate Lotus-style conditions from actions. A condition creates a live
- [x] Separate Lotus-style conditions from actions. A condition creates a live
conditional assignment to its own category; an action creates an explicit,
persistent assignment or value change after an item enters its source category.
- [ ] Withdraw conditional assignments automatically when their Text, Assignment,
- [x] Withdraw conditional assignments automatically when their Text, Assignment,
Date, or Numeric condition becomes false, while preserving explicit assignments.
- [ ] Re-evaluate affected rules whenever their inputs change, independently of the
- [x] Re-evaluate affected rules whenever their inputs change, independently of the
automatic text-filing preference.
- [ ] Implement category-scoped Assignment, Date, and Numeric conditions with the
- [x] Implement category-scoped Assignment, Date, and Numeric conditions with the
original positive/negative and inside/outside-range behavior.
- [ ] Implement Assignment, Date, and Numeric actions with explicit persistence,
- [x] Implement Assignment, Date, and Numeric actions with explicit persistence,
including assignment removal and category-specific date and numeric values.
- [ ] Complete Special actions: designate as done, export to a selected structured
destination, and discard. `Done` exists today; export and discard do not.
- [ ] Add a user-facing re-evaluation command equivalent to Utilities `Execute`,
- [x] Complete Special actions: designate as done, export to a selected structured
destination, and discard.
- [x] Add a user-facing re-evaluation command equivalent to Utilities `Execute`,
scoped to the current item, marked items, section, view, or whole document. This
means applying rules to existing data, not executing an external process.
- [ ] Surface circular or conflicting rules as inspectable document state instead
- [x] Surface circular or conflicting rules as inspectable document state instead
of only returning a non-convergence error.
### Markdown, HTML, and modern printing
- [ ] Emit calculation-label footer rows and results for every configured aggregate
- [x] Emit calculation-label footer rows and results for every configured aggregate
in every Markdown and HTML section, using the same values as the live view.
- [ ] Emit `% of total` companion columns when enabled and keep percentage values
- [x] Emit `% of total` companion columns when enabled and keep percentage values
consistent between the TUI, Markdown, and HTML.
- [ ] Apply each numeric column's label/currency, decimal, separator, and negative
- [x] Apply each numeric column's label/currency, decimal, separator, and negative
formatting consistently in Markdown and HTML reports.
- [ ] Preserve configured column alignment and relative widths in HTML and use
- [x] Preserve configured column alignment and relative widths in HTML and use
appropriate Markdown alignment markers where Markdown can represent them.
- [ ] Add print-focused HTML styling: repeated table headers, sensible page breaks,
- [x] Add print-focused HTML styling: repeated table headers, sensible page breaks,
section continuity, note wrapping, and optional document/view headers and footers.
- [ ] Include report metadata needed to understand an export: document description,
- [x] Include report metadata needed to understand an export: document description,
view name, active filters, and generation time, without changing data-only CSV
and JSON exports into presentation formats.
@@ -244,11 +238,6 @@ file-format compatibility are not parity goals.
## Near-term plan
1. Implement per-numeric-category values and category-bound numeric columns.
2. Correct conditional-assignment lifecycle and separate conditions from explicit
actions.
3. Complete aggregate, percentage, numeric-formatting, Markdown, and HTML report
parity.
4. Add desktop alarm integration and in-application snooze controls.
5. Add encrypted documents and secure unlock handling.
6. Add property-based tests for complex hierarchy, rule, and numeric combinations.
1. Add desktop alarm integration and in-application snooze controls.
2. Add encrypted documents and secure unlock handling.
3. Add property-based tests for complex hierarchy, rule, and numeric combinations.