refactor: rule references cite bookspec ids
Every B-n citation in crates/, docs/, deploy/, scripts/ and .github/ now names its bookspec id BS-<area>-<n> (D-68), via scripts/rewrite-rule-refs.py: the map is parsed from docs/spec/rules.md's index, rules.md-prefixed and bare forms are rewritten, sub-references (rule 11, item 7, INVARIANT 2) survive, and plan/, docs/spec/rules.md and docs/spec/claims/ are untouched. Program-output string literals that cited a rule were reverted by hand so user-visible output and its goldens are unchanged; DatedRule.catalog, metadata no output prints, now holds BS-1099-1. One SOURCE line that cited only 'R-?' now also cites BS-statement-5. Co-Authored-By: Muse Wonder 1.0
This commit is contained in:
1 parent
7a177a3cfc
commit
489360f598
221 files changed
+1706
-1580
No files matched your search
@@ -470,7 +470,7 @@ impl App {
|
||||
///
|
||||
/// ```text
|
||||
/// GOAL: the viewer shows what the agent was told it shows.
|
||||
/// SOURCE: rules.md B-30 (one default period; a start after the end is
|
||||
/// SOURCE: BS-period-3 (one default period; a start after the end is
|
||||
/// refused, never swapped); plan/served.md P3 defect 15.
|
||||
/// INVARIANTS:
|
||||
/// 1. A target's dates are taken as the server resolved them, an
|
||||
|
||||
@@ -151,7 +151,7 @@ mod tests {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// INVARIANT 2's cash flow items (rules.md B-14 rule 12, D-35): a
|
||||
/// INVARIANT 2's cash flow items (BS-statement-3 rule 12, D-35): a
|
||||
/// sale of equipment for an IOU is a Todo naming the entry, with the
|
||||
/// statement's fix; equipment bought on an operating card is Info; a
|
||||
/// sale for cash asks nothing.
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct EntryInfo {
|
||||
pub status: EntryStatus,
|
||||
/// Total debits; None when they can't be summed exactly (a draft's
|
||||
/// lines are as an earlier version journaled them, of any size:
|
||||
/// rules.md B-28).
|
||||
/// BS-entry-4).
|
||||
pub amount: Option<Decimal>,
|
||||
/// Accounts touched, debits first: "6300 Software".
|
||||
pub accounts: Vec<AccountId>,
|
||||
@@ -182,10 +182,10 @@ pub fn period_month(period: &str) -> Option<(i32, u32)> {
|
||||
/// 4. open_invoices = Σ what each of its customer record's invoices
|
||||
/// owes today (Books::owed_today: read from the ledger lines tagged
|
||||
/// with it, so a reversed payment or a void counts as it should,
|
||||
/// rules.md B-38); open_bills the same for its vendor record's bills.
|
||||
/// BS-arap-2); open_bills the same for its vendor record's bills.
|
||||
/// 4a. Each of 3 and 4 is None when it can't be summed exactly (a
|
||||
/// document is restored as an earlier version journaled it, of any
|
||||
/// size: rules.md B-28), never a wrong number.
|
||||
/// size: BS-entry-4), never a wrong number.
|
||||
/// 5. form_1099: its vendor record's line in Books::vendor_1099(year)
|
||||
/// (the server's books.vendor_1099), when it has a vendor record in
|
||||
/// that report and the report can be made (the year's threshold is
|
||||
@@ -222,7 +222,7 @@ pub struct PartyInfo {
|
||||
/// ```text
|
||||
/// GOAL: say when monthly depreciation hasn't been run, without crying
|
||||
/// wolf over the month still under way.
|
||||
/// SOURCE: docs/spec/rules.md B-15 (monthly straight-line depreciation);
|
||||
/// SOURCE: BS-asset-1 (monthly straight-line depreciation);
|
||||
/// CONVENTION (a month's depreciation is posted when the month
|
||||
/// ends: ledger-store dates it the month's last day).
|
||||
/// INVARIANTS:
|
||||
@@ -355,7 +355,7 @@ pub enum PartyPeriod {
|
||||
/// get back?" (owner, 2026-10-15) with the books' own numbers.
|
||||
/// SOURCE: ledger_core::parties::activity_with (paid, received, in kind)
|
||||
/// and ledger_core::parties::flow (what for), with Books::money
|
||||
/// and Books::members, as PartyInfo uses them; rules.md B-35.
|
||||
/// and Books::members, as PartyInfo uses them; BS-partner-3.
|
||||
/// INVARIANTS:
|
||||
/// 1. paid, received: Books::activity(party, span)'s, exactly: basis
|
||||
/// cash (money), books.party's default. paid_in_kind and
|
||||
@@ -919,8 +919,8 @@ impl Books {
|
||||
}
|
||||
|
||||
/// What omitted dates mean today, for these books: the one rule the
|
||||
/// server's report tools, `books.show` and the viewer share (rules.md
|
||||
/// B-30).
|
||||
/// server's report tools, `books.show` and the viewer share (
|
||||
/// BS-period-3).
|
||||
pub fn periods(&self) -> ledger_core::calendar::PeriodDefaults {
|
||||
ledger_core::calendar::period_defaults(&self.settings.company, self.today)
|
||||
}
|
||||
@@ -938,7 +938,7 @@ impl Books {
|
||||
}
|
||||
|
||||
/// The period a report or register opens on when nobody chose one:
|
||||
/// the fiscal year to date (rules.md B-30), as the agent's report
|
||||
/// the fiscal year to date (BS-period-3), as the agent's report
|
||||
/// tools give it for no dates.
|
||||
pub fn default_period(&self) -> (NaiveDate, NaiveDate) {
|
||||
self.periods().statement_range()
|
||||
@@ -1320,7 +1320,7 @@ impl Books {
|
||||
}
|
||||
|
||||
/// A document as of today: what it is, read from the ledger lines
|
||||
/// tagged with it (ledger_core::Ledger::doc_state, rules.md B-38), the
|
||||
/// tagged with it (ledger_core::Ledger::doc_state, BS-arap-2), the
|
||||
/// figures books.ar_aging and books.party read. One dated after today
|
||||
/// (a post-dated bill) is read as of its own date: what it will owe
|
||||
/// when it is issued, so the forward-looking views keep it; it is
|
||||
@@ -1763,7 +1763,7 @@ impl Books {
|
||||
/// their capital (a reimbursement with a distribution) leaves out the
|
||||
/// money that wasn't theirs.
|
||||
/// What moved in kind isn't what money paid for: when the party's part
|
||||
/// has property in it (rules.md B-35), the property lines (asset
|
||||
/// has property in it (BS-partner-3), the property lines (asset
|
||||
/// accounts neither cash nor receivables, the K-1 worksheet's test)
|
||||
/// stay out, so a property contribution, and its reversal, show
|
||||
/// nothing, and a distribution of money and equipment shows the
|
||||
@@ -2011,8 +2011,8 @@ impl Books {
|
||||
///
|
||||
/// Every month the span touches is one activity scan, so callers clip
|
||||
/// the span to the months they show ([`Books::last_months`]): books
|
||||
/// an earlier version wrote may run from chrono's first day (rules.md
|
||||
/// B-28). Chrono's last month ends the walk, never a panic.
|
||||
/// an earlier version wrote may run from chrono's first day (
|
||||
/// BS-entry-4). Chrono's last month ends the walk, never a panic.
|
||||
pub fn party_months(&self, party: PartyId, span: (NaiveDate, NaiveDate)) -> Vec<PartyMonth> {
|
||||
let mut out = Vec::new();
|
||||
let mut m = span.0.with_day(1);
|
||||
|
||||
@@ -242,12 +242,12 @@ pub fn build(dir: &Path, today: NaiveDate) -> Result<(), StoreError> {
|
||||
Some("depreciation"),
|
||||
)?;
|
||||
let bank_fees = acct(&mut s, "6900", "Bank Fees", Expense, None)?;
|
||||
// The projects (classes with their facts, rules.md B-37).
|
||||
// The projects (classes with their facts, BS-statement-5).
|
||||
let client_class = s.add_project(
|
||||
"Client work",
|
||||
&ledger_core::ProjectFacts {
|
||||
// Its invoices' lines and the contractors it pays are tagged
|
||||
// to it (rules.md B-37 item 8), so its snapshot is its
|
||||
// to it (BS-statement-5 item 8), so its snapshot is its
|
||||
// revenue less its direct costs.
|
||||
description: Some(
|
||||
"Design work for the studio's clients: every client invoice, and the contractors who work on it."
|
||||
@@ -306,7 +306,7 @@ pub fn build(dir: &Path, today: NaiveDate) -> Result<(), StoreError> {
|
||||
.map(|n| s.add_customer(n))
|
||||
.collect::<Result<_, _>>()?;
|
||||
// Work on spec for a customer, hoping they adopt it: its costs are
|
||||
// expenses, and nothing is receivable (rules.md B-37 item 4).
|
||||
// expenses, and nothing is receivable (BS-statement-5 item 4).
|
||||
let tidepool_started = start + Months::new(13);
|
||||
let tidepool = s.add_project(
|
||||
"Tidepool app",
|
||||
|
||||
@@ -31,8 +31,8 @@ pub fn money(d: Decimal) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// What the viewer shows for a figure the books can't compute (rules.md
|
||||
/// B-28: an earlier version's draft lines, shares, or bases past exact
|
||||
/// What the viewer shows for a figure the books can't compute (
|
||||
/// BS-entry-4: an earlier version's draft lines, shares, or bases past exact
|
||||
/// arithmetic): said in words, never a number.
|
||||
pub const CANT_COMPUTE: &str = "too large to compute";
|
||||
|
||||
@@ -233,7 +233,7 @@ mod tests {
|
||||
use std::str::FromStr;
|
||||
|
||||
/// money_or / dollars_or: a figure as money_ or dollars does, and one
|
||||
/// the books can't compute in words, never a number (rules.md B-28).
|
||||
/// the books can't compute in words, never a number (BS-entry-4).
|
||||
#[test]
|
||||
fn a_figure_or_why_not() {
|
||||
let v = Decimal::new(-123_456, 2);
|
||||
|
||||
@@ -31,7 +31,7 @@ pub struct State {
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub enum RegisterRange {
|
||||
/// What a register opens on when nobody chose dates: the fiscal year
|
||||
/// to date (rules.md B-30, `Books::default_period`), its opening
|
||||
/// to date (BS-period-3, `Books::default_period`), its opening
|
||||
/// balance carried in.
|
||||
#[default]
|
||||
Default,
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
//! `depreciation_schedule`, `Asset::basis_figures`), what is posted too
|
||||
//! (`Ledger::accumulated_posted`, its runs). Book value is what the books
|
||||
//! carry (cost less the depreciation posted), never the schedule's figure,
|
||||
//! which sits beside it as "scheduled" (B-24). Book value and the federal
|
||||
//! which sits beside it as "scheduled" (BS-asset-3). Book value and the federal
|
||||
//! tax figures sit side by side and are never confused: book cost is what
|
||||
//! was paid or, for a member's contribution, its fair market value; the
|
||||
//! §723 basis, the depreciable basis and the §704(c) built-in gain follow
|
||||
//! the basis rule (docs/spec/rules.md B-25).
|
||||
//! the basis rule (BS-asset-4).
|
||||
|
||||
use super::page;
|
||||
use crate::app::Shell;
|
||||
|
||||
@@ -182,7 +182,7 @@ fn runway(ui: &mut Ui, b: &Books) {
|
||||
return;
|
||||
}
|
||||
// Exact or refused: books near the arithmetic's limit show a
|
||||
// note, never a crash (rules.md B-28).
|
||||
// note, never a crash (BS-entry-4).
|
||||
let Some(net) = ledger_core::kernel::total_try(&months, |&(_, _, i, o)| {
|
||||
ledger_core::kernel::Amount::checked_sub(i, o)
|
||||
})
|
||||
@@ -335,7 +335,7 @@ fn coming_up(ui: &mut Ui, b: &Books, shell: &mut Shell<'_>) {
|
||||
let Some(inv) = b.ledger.get_invoice(id) else {
|
||||
continue;
|
||||
};
|
||||
// As of today, from the lines tagged with it (rules.md B-38): a
|
||||
// As of today, from the lines tagged with it (BS-arap-2): a
|
||||
// reversed payment reopens it, a void closes it.
|
||||
let state = b.doc_today(ledger_core::DocRef::Invoice(id));
|
||||
let balance = crate::books::owed_of(&state);
|
||||
|
||||
@@ -224,7 +224,7 @@ pub fn detail(ui: &mut Ui, b: &Books, e: &EntryInfo, shell: &mut Shell<'_>) {
|
||||
widgets::amount_cell(ui, "Credit", amt_w, p.muted, false, false);
|
||||
});
|
||||
// None: past exact arithmetic (a draft line an earlier
|
||||
// version journaled, of any size: rules.md B-28).
|
||||
// version journaled, of any size: BS-entry-4).
|
||||
let (mut dr, mut cr) = (Some(Decimal::ZERO), Some(Decimal::ZERO));
|
||||
for line in entry.lines() {
|
||||
ui.horizontal(|ui| {
|
||||
@@ -302,7 +302,7 @@ pub fn detail(ui: &mut Ui, b: &Books, e: &EntryInfo, shell: &mut Shell<'_>) {
|
||||
ui.add_space(18.0);
|
||||
|
||||
// The invoice or bill it records: its lines as the document
|
||||
// gives them, each project a link (rules.md B-37 item 8).
|
||||
// gives them, each project a link (BS-statement-5 item 8).
|
||||
if let Some(doc) = document_of(b, e.id) {
|
||||
section(ui, &doc.title);
|
||||
document_lines(ui, &doc, &class_names, total_w, amt_w, shell);
|
||||
@@ -681,7 +681,7 @@ pub fn render(ui: &mut Ui, b: &Books, a: &Attachment, shell: &mut Shell<'_>, wid
|
||||
}
|
||||
}
|
||||
|
||||
/// A party's part of an entry in words (rules.md B-35): which way it
|
||||
/// A party's part of an entry in words (BS-partner-3): which way it
|
||||
/// went and how much ("paid $64.00", "received $740.00, in kind"), what of
|
||||
/// it is still owed, the share it came from when the entry names several
|
||||
/// ("(50%)", "(derived)"), and a reversal said as one ("paid $1,480.00
|
||||
@@ -756,7 +756,7 @@ mod tests {
|
||||
/// A tagged line keeps its project tag inside its cell, in a narrow
|
||||
/// pane too: the name is cut to leave the tag room, so the amounts
|
||||
/// stay in their columns (an invoice's revenue line and its document
|
||||
/// line, each tagged; rules.md B-37 item 8).
|
||||
/// line, each tagged; BS-statement-5 item 8).
|
||||
#[test]
|
||||
fn a_tagged_line_keeps_its_amounts_in_their_column() {
|
||||
use ledger_core::arap::DocumentLine;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Invoices and bills: what customers owe the company (money in) and what
|
||||
//! it owes vendors (money out), each figure derived from the document's
|
||||
//! ledger lines that stand (rules.md B-38), the list tied to the
|
||||
//! receivables or payables account (B-23); and one document's page, with
|
||||
//! ledger lines that stand (BS-arap-2), the list tied to the
|
||||
//! receivables or payables account (BS-ledger-8); and one document's page, with
|
||||
//! its lines and its timeline. Read only (D-28): the agent issues, pays
|
||||
//! and voids them.
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ pub fn show_list(ui: &mut Ui, b: &Books, shell: &mut Shell<'_>) {
|
||||
});
|
||||
}
|
||||
|
||||
/// The party's totals with property in kind (basis all, rules.md B-35
|
||||
/// The party's totals with property in kind (basis all, BS-partner-3
|
||||
/// item 4), when it gave or took any in the period: "With property
|
||||
/// contributed or distributed: paid $X, received $Y". None when nothing
|
||||
/// moved in kind (the cash totals are then the whole story).
|
||||
@@ -775,7 +775,7 @@ pub fn show_party(ui: &mut Ui, b: &Books, id: PartyId, shell: &mut Shell<'_>) {
|
||||
r.context_menu(|ui| widgets::copy_item(ui, "Copy amount", &v.to_string()));
|
||||
}
|
||||
});
|
||||
// Basis all (rules.md B-35 item 4): property in kind, when any.
|
||||
// Basis all (BS-partner-3 item 4): property in kind, when any.
|
||||
if let Some(text) = in_kind_text(&flow) {
|
||||
ui.add_space(6.0);
|
||||
ui.add(
|
||||
@@ -1194,7 +1194,7 @@ fn records_card(ui: &mut Ui, b: &Books, party: &Party, info: &PartyInfo, go: &mu
|
||||
);
|
||||
}
|
||||
|
||||
/// The projects for or with the party (rules.md B-37), by name: status
|
||||
/// The projects for or with the party (BS-statement-5), by name: status
|
||||
/// and net to date; a row opens its project.
|
||||
fn projects_card(ui: &mut Ui, b: &Books, ids: &[ledger_core::ClassId], go: &mut Option<Route>) {
|
||||
let p = pal(ui.ctx());
|
||||
@@ -1416,7 +1416,7 @@ fn documents_card(ui: &mut Ui, b: &Books, info: &PartyInfo, go: &mut Option<Rout
|
||||
docs.sort_by(|a, b| b.1.cmp(&a.1).then(a.0.cmp(&b.0)));
|
||||
for (name, date, due, state, total, balance, entry) in docs {
|
||||
// Late and its status as of today, from the ledger
|
||||
// lines tagged with it (rules.md B-38; P4b.2 gap 10):
|
||||
// lines tagged with it (BS-arap-2; P4b.2 gap 10):
|
||||
// a reversed payment makes it owed again, a void
|
||||
// never late.
|
||||
let late = matches!(state, Ok(Some(st)) if st.overdue_days > 0);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! Projects: every class, with its facts (what it is, where it stands, who
|
||||
//! it is for), and one project completely: its snapshot (revenue, direct
|
||||
//! costs, contribution before overhead and its margin, to date or this
|
||||
//! fiscal year, rules.md B-37 item 7), revenue and costs by month with the
|
||||
//! fiscal year, BS-statement-5 item 7), revenue and costs by month with the
|
||||
//! running net, costs by category and by account, its entries, documents,
|
||||
//! decisions and history (rules.md B-37). Every figure is ledger-core's (`project_figures`,
|
||||
//! decisions and history (BS-statement-5). Every figure is ledger-core's (`project_figures`,
|
||||
//! `project_to_date`, `project_entries`), the same the server's
|
||||
//! `books.projects` and `books.project` return; this module only arranges
|
||||
//! them, and never writes.
|
||||
@@ -29,7 +29,7 @@ use rust_decimal::Decimal;
|
||||
pub struct State {
|
||||
/// Only projects with this status (None: every one).
|
||||
pub status: Option<ProjectStatus>,
|
||||
/// A project's snapshot shows this fiscal year to date (B-30's
|
||||
/// A project's snapshot shows this fiscal year to date (BS-period-3's
|
||||
/// omitted dates), not to date.
|
||||
pub fiscal: bool,
|
||||
}
|
||||
@@ -419,7 +419,7 @@ impl Snap {
|
||||
}
|
||||
|
||||
/// The note on contribution: what it counts and what it leaves out.
|
||||
pub const CONTRIBUTION_NOTE: &str = "Revenue less this project's direct costs: every expense line tagged to it, fixed and variable alike (what management accounting calls a segment margin, not a variable-cost contribution margin). Company overhead that isn't tagged to a project (rent, software, insurance, the owner's time) isn't counted, so a project in the black can still leave the company in the red. A management-accounting view (rules.md B-37 item 7), not a GAAP figure.";
|
||||
pub const CONTRIBUTION_NOTE: &str = "Revenue less this project's direct costs: every expense line tagged to it, fixed and variable alike (what management accounting calls a segment margin, not a variable-cost contribution margin). Company overhead that isn't tagged to a project (rent, software, insurance, the owner's time) isn't counted, so a project in the black can still leave the company in the red. A management-accounting view (B-37 item 7), not a GAAP figure.";
|
||||
|
||||
/// The snapshot: a header with where it stands to date and the to date /
|
||||
/// fiscal year switch, then its tiles (`shown`: to date, or for `year`,
|
||||
@@ -730,7 +730,7 @@ pub struct PageFigures {
|
||||
/// The by-month chart's span ([`chart_span`]) and figures, when
|
||||
/// anything tagged is posted.
|
||||
pub months: Option<((NaiveDate, NaiveDate), ledger_core::ProjectFigures)>,
|
||||
/// The fiscal year to date (B-30's omitted dates, as `books.project`),
|
||||
/// The fiscal year to date (BS-period-3's omitted dates, as `books.project`),
|
||||
/// only when the snapshot shows it.
|
||||
pub year: Option<ledger_core::ProjectFigures>,
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ use std::collections::BTreeMap;
|
||||
|
||||
/// The range a report covers. The default (a report nobody chose dates
|
||||
/// for) is the fiscal year to date: what an omitted date means
|
||||
/// everywhere (rules.md B-30, `Books::default_period`; a test pins that
|
||||
/// everywhere (BS-period-3, `Books::default_period`; a test pins that
|
||||
/// they agree).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
|
||||
pub enum Range {
|
||||
@@ -408,7 +408,7 @@ fn column_ranges(st: &State, b: &Books) -> Vec<(NaiveDate, NaiveDate, String)> {
|
||||
|
||||
/// The period compared against, if any: None too when it falls before
|
||||
/// chrono's first day (a range from the books' first entry, which an
|
||||
/// earlier version may have dated there: rules.md B-28).
|
||||
/// earlier version may have dated there: BS-entry-4).
|
||||
fn prior(st: &State, s: NaiveDate, e: NaiveDate) -> Option<(NaiveDate, NaiveDate)> {
|
||||
match st.compare {
|
||||
Compare::None => None,
|
||||
@@ -1079,7 +1079,7 @@ fn tax(b: &Books, s: NaiveDate, e: NaiveDate) -> Table {
|
||||
t
|
||||
}
|
||||
|
||||
/// A report the books can't compute (rules.md B-28: books an earlier
|
||||
/// A report the books can't compute (BS-entry-4: books an earlier
|
||||
/// version wrote may hold amounts past exact arithmetic): no figures, and a
|
||||
/// note saying why, never a guess.
|
||||
fn cant_compute(mut t: Table, why: &ledger_core::LedgerError) -> Table {
|
||||
@@ -1518,8 +1518,8 @@ fn report(ui: &mut Ui, b: &Books, kind: ReportKind, shell: &mut Shell<'_>, picke
|
||||
let e = widgets::date_picker(ui, "to", e);
|
||||
// The human's own pickers: a "from" set past the "to" reads
|
||||
// as the two in order. Never a books.show target's dates:
|
||||
// App::show takes only a resolved range in order (rules.md
|
||||
// B-30) and ignores any other, so this never changes what the
|
||||
// App::show takes only a resolved range in order (
|
||||
// BS-period-3) and ignores any other, so this never changes what the
|
||||
// agent was told the viewer shows.
|
||||
st.range = Range::Custom(s.min(e), e.max(s));
|
||||
}
|
||||
@@ -1555,7 +1555,7 @@ fn report(ui: &mut Ui, b: &Books, kind: ReportKind, shell: &mut Shell<'_>, picke
|
||||
|
||||
let (s, e) = st.range.dates(b);
|
||||
// A split over a range from the books' first entry, which an earlier
|
||||
// version may have dated thousands of years back (rules.md B-28),
|
||||
// version may have dated thousands of years back (BS-entry-4),
|
||||
// would be more columns than anyone can read or the frame can build:
|
||||
// shown as one total, with a note saying so.
|
||||
let split_note = splittable
|
||||
@@ -2282,8 +2282,8 @@ fn vendor_1099(ui: &mut Ui, b: &Books, year: i32, shell: &mut Shell<'_>) {
|
||||
let w = match b.vendor_1099_worksheet(year) {
|
||||
Ok(w) => w,
|
||||
Err(e) => {
|
||||
// Never guess a threshold or the cash accounts (rules.md
|
||||
// B-19): say why there's no worksheet, in the engine's words.
|
||||
// Never guess a threshold or the cash accounts (
|
||||
// BS-1099-1): say why there's no worksheet, in the engine's words.
|
||||
ui.label(RichText::new(e).color(p.muted));
|
||||
return;
|
||||
}
|
||||
@@ -2719,7 +2719,7 @@ mod tests {
|
||||
// The figures, by hand: the loan (not a financing setting) is an
|
||||
// operating receipt, 2,500.00; what the members paid personally
|
||||
// (85.00 and 216.40, 301.40) is borrowed from them through 2100
|
||||
// and spent (D-42, rules.md B-14 rule 11); the members'
|
||||
// and spent (D-42, BS-statement-3 rule 11); the members'
|
||||
// contributions are financing, each named (1,200.00 and 800.00);
|
||||
// the reimbursement repays 2100 (301.40); the tablet is disclosed
|
||||
// (630.00), the reversed laptop gone.
|
||||
|
||||
@@ -618,8 +618,8 @@ pub fn fit_font(
|
||||
|
||||
/// A date picker for `d` (`id` its egui id salt), returning the date
|
||||
/// picked. The picker's calendar holds years -9999 through 9999; a date
|
||||
/// outside them (books an earlier version wrote may hold one, rules.md
|
||||
/// B-28) is shown as text and kept, never truncated into another year.
|
||||
/// outside them (books an earlier version wrote may hold one,
|
||||
/// BS-entry-4) is shown as text and kept, never truncated into another year.
|
||||
pub fn date_picker(ui: &mut Ui, id: &str, d: chrono::NaiveDate) -> chrono::NaiveDate {
|
||||
use chrono::Datelike;
|
||||
let jiff_date = i16::try_from(d.year())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! The viewer's figures at the edges P0 review round 4 checked (rules.md
|
||||
//! B-28): the party period of a year chrono can't hold, the party chart's
|
||||
//! The viewer's figures at the edges P0 review round 4 checked (
|
||||
//! BS-entry-4): the party period of a year chrono can't hold, the party chart's
|
||||
//! last months, one party's part of a split entry, an amortization
|
||||
//! schedule due, and the page state tests set.
|
||||
//!
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! ```text
|
||||
//! GOAL: Tobin, Mo or the CPA, on an older viewer, learn to update it,
|
||||
//! not that the books are damaged.
|
||||
//! SOURCE: rules.md B-27; plan/served.md 5.1 (the viewer reads the journal
|
||||
//! SOURCE: BS-format-1; plan/served.md 5.1 (the viewer reads the journal
|
||||
//! directly, so it meets the same gate).
|
||||
//! ```
|
||||
|
||||
@@ -66,7 +66,7 @@ fn rate() -> serde_json::Value {
|
||||
}
|
||||
|
||||
/// The last line can't be checked: the viewer says so, and never that the
|
||||
/// books are not damaged (rules.md B-27).
|
||||
/// books are not damaged (BS-format-1).
|
||||
fn says_newer_or_damaged(text: &str) {
|
||||
assert!(text.starts_with("Journal line"), "{text}");
|
||||
assert!(text.contains("or the line is damaged"), "{text}");
|
||||
|
||||
@@ -141,7 +141,7 @@ fn a_members_page_shows_the_same_capital_before_and_after_a_close() {
|
||||
assert_eq!(closing, [Decimal::new(3, 2), Decimal::new(3, 2)]);
|
||||
}
|
||||
|
||||
/// A member's page in a yen book splits in whole yen (B-3, B-13), as the
|
||||
/// A member's page in a yen book splits in whole yen (BS-ledger-1, BS-partner-1), as the
|
||||
/// closes and the statement do. Ann and Bo at 50% each. "Owed to them"
|
||||
/// (CapitalStatement INVARIANT 5): 101 yen due to the members, 50.5 each
|
||||
/// exactly, the tied yen to Ann, listed first: Ann 51, Bo 50. Property
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//! Books an earlier wanderbooks wrote open in the viewer, and every page
|
||||
//! renders over them, never a panic (rules.md B-28: posted is forever; a
|
||||
//! renders over them, never a panic (BS-entry-4: posted is forever; a
|
||||
//! figure the books can't compute is said, never guessed).
|
||||
//!
|
||||
//! ```text
|
||||
//! GOAL: the viewer shows books written under older rules, whatever they
|
||||
//! hold that the commands now refuse.
|
||||
//! SOURCE: rules.md B-28; DECISION (P0 review round 4: replay accepts what
|
||||
//! SOURCE: BS-entry-4; DECISION (P0 review round 4: replay accepts what
|
||||
//! main 188c90ea accepted, and derived figures refuse rather than
|
||||
//! panic).
|
||||
//! INVARIANTS:
|
||||
@@ -508,7 +508,7 @@ fn books_that_keep_no_settings_read_no_file_beside_them() {
|
||||
}
|
||||
}
|
||||
|
||||
/// rules.md B-37: the classes an earlier version wrote read as projects
|
||||
/// BS-statement-5: the classes an earlier version wrote read as projects
|
||||
/// with the default facts (active, kind not recorded), listed by name,
|
||||
/// their figures ledger-core's.
|
||||
#[test]
|
||||
|
||||
@@ -282,7 +282,7 @@ fn fixture(tag: &str) -> Fixture {
|
||||
let e = pay(&mut s, d(2026, 1, 20), "Old Co", cash, 12_300);
|
||||
s.set_entry_party(e, Some(old)).unwrap();
|
||||
s.update_party(old, PartyField::Archived(true)).unwrap();
|
||||
// What the members advanced is money (rules.md B-35 item 5): Due to
|
||||
// What the members advanced is money (BS-partner-3 item 5): Due to
|
||||
// Shareholders is a financing account; the cash account stays the
|
||||
// books' (the settings file names both).
|
||||
journal_settings(
|
||||
@@ -353,10 +353,10 @@ fn each_partys_totals_are_the_books_numbers() {
|
||||
assert_eq!(sam.threshold_1099, Some(r.threshold));
|
||||
// Cash counts (1,000 + the bill's 500); what the owner paid for the
|
||||
// company through the financing account waits on how they paid
|
||||
// (rules.md B-19); the card's charge is no payment out of cash.
|
||||
// (BS-1099-1); the card's charge is no payment out of cash.
|
||||
assert_eq!(line.paid, cents(150_000));
|
||||
assert_eq!(line.undetermined, cents(30_000));
|
||||
// Party totals count all of it as paid to Sam (B-35 item 9): the
|
||||
// Party totals count all of it as paid to Sam (BS-partner-3 item 9): the
|
||||
// 1099's buckets, and the card's 200 (no business card is recorded,
|
||||
// so the worksheet lists it nowhere).
|
||||
assert_eq!(
|
||||
@@ -935,7 +935,7 @@ fn party_money_by_period_and_what_for() {
|
||||
assert_eq!(line.paid, cents(50_000));
|
||||
// 2026: the cash 1,000 and the bill's 500 paid count; the owner's
|
||||
// 300 through the financing account waits on how it was paid
|
||||
// (rules.md B-19); the card's 200 is no payment out of cash.
|
||||
// (BS-1099-1); the card's 200 is no payment out of cash.
|
||||
let (line, _) = b.party_1099(f.sam, 2026).unwrap();
|
||||
assert_eq!(line.paid, cents(150_000));
|
||||
assert_eq!(line.undetermined, cents(30_000));
|
||||
@@ -1270,7 +1270,7 @@ fn entries_list_every_party_with_its_resolved_share() {
|
||||
vec![(m.tobin, Some(cents(5_000))), (m.mo, Some(cents(5_000)))]
|
||||
);
|
||||
assert_eq!(e.party.as_deref(), Some("Tobin Harlow & Morgan Ellis"));
|
||||
// Property (rules.md B-35): what moved each member's capital, signed
|
||||
// Property (BS-partner-3): what moved each member's capital, signed
|
||||
// as their own account shows it: received, in kind (before P3 it read
|
||||
// +600.00, the sign of a payment).
|
||||
let e = b.entry(m.property).unwrap();
|
||||
@@ -1423,7 +1423,7 @@ fn show(dir: &Path, route: Route) -> Harness<'static, App> {
|
||||
h
|
||||
}
|
||||
|
||||
/// The viewer shows the tools' numbers (rules.md B-35): a member's party
|
||||
/// The viewer shows the tools' numbers (BS-partner-3): a member's party
|
||||
/// flow is books.party's activity on both bases, labelled cash basis, with
|
||||
/// the in-kind line under it; the entry page says each part in words, a
|
||||
/// property contribution "received $600.00, in kind" and its reversal
|
||||
@@ -1490,7 +1490,7 @@ fn the_party_page_shows_the_basis_and_in_kind() {
|
||||
}
|
||||
|
||||
/// The viewer's what-for reads a reversal as parties::flow does, the
|
||||
/// opposite of its original (rules.md B-35 item 3; design §1.4): a member
|
||||
/// opposite of its original (BS-partner-3 item 3; design §1.4): a member
|
||||
/// paying the card from their own funds (Dr card / Cr 2100), tagged with
|
||||
/// the issuer, then reversed, is nothing on the issuer's page, paid or
|
||||
/// what for. Its lines alone read as a second payment.
|
||||
@@ -1534,7 +1534,7 @@ fn a_reversed_member_card_payment_is_nothing_on_the_issuers_page() {
|
||||
assert_eq!(flow.what_for, vec![], "the breakdown nets to nothing");
|
||||
}
|
||||
|
||||
/// Screenshots of the party pages and the entry pages B-35 changed, for
|
||||
/// Screenshots of the party pages and the entry pages BS-partner-3 changed, for
|
||||
/// eyes: set `SHOT_DIR`.
|
||||
#[test]
|
||||
fn party_basis_screenshots() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Projects in the viewer (rules.md B-37): the list and a project's page
|
||||
//! Projects in the viewer (BS-statement-5): the list and a project's page
|
||||
//! show ledger-core's figures; rows, links and bars open what they name;
|
||||
//! the journal, books.show and the party page know projects.
|
||||
|
||||
@@ -603,7 +603,7 @@ fn a_long_party_name_keeps_to_its_card() {
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------- the snapshot (B-37 item 7)
|
||||
// ------------------------------------------------- the snapshot (BS-statement-5 item 7)
|
||||
|
||||
/// Books holding one project of `kind`, started `started_on`, with
|
||||
/// `posts`: (date, debit code, credit code, cents), the line that isn't
|
||||
@@ -991,7 +991,7 @@ fn the_chart_runs_from_the_start_or_first_entry_and_caps() {
|
||||
);
|
||||
}
|
||||
|
||||
/// The fiscal year switch shows books.project's default period (B-30's
|
||||
/// The fiscal year switch shows books.project's default period (BS-period-3's
|
||||
/// omitted dates: the fiscal year to date), and switching writes nothing.
|
||||
#[test]
|
||||
fn the_fiscal_year_switch_shows_the_default_period() {
|
||||
@@ -1253,7 +1253,7 @@ proptest::proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// rules.md B-37 item 8: an invoice's or bill's page (its entry's) lists
|
||||
/// BS-statement-5 item 8: an invoice's or bill's page (its entry's) lists
|
||||
/// the document's lines, each project a link that opens it; an untagged
|
||||
/// line has none. The entry's own lines show the tagged revenue or cost
|
||||
/// line too.
|
||||
@@ -1372,8 +1372,8 @@ fn an_invoice_and_a_bill_show_each_lines_project() {
|
||||
}
|
||||
}
|
||||
|
||||
/// The demo's "Client work" project carries every client invoice (rules.md
|
||||
/// B-37 item 8): its revenue to date is the invoices' total, its direct
|
||||
/// The demo's "Client work" project carries every client invoice (
|
||||
/// BS-statement-5 item 8): its revenue to date is the invoices' total, its direct
|
||||
/// costs the contractors tagged to it.
|
||||
#[test]
|
||||
fn the_demos_client_work_counts_every_client_invoice() {
|
||||
|
||||
@@ -154,7 +154,7 @@ fn day(y: i32, m: u32, d: u32) -> chrono::NaiveDate {
|
||||
chrono::NaiveDate::from_ymd_opt(y, m, d).unwrap()
|
||||
}
|
||||
|
||||
/// Defect 15, repros 1.1.1-1.1.2 (rules.md B-30): a target the viewer
|
||||
/// Defect 15, repros 1.1.1-1.1.2 (BS-period-3): a target the viewer
|
||||
/// can't honour is ignored whole, never swapped or guessed: a start after
|
||||
/// the end (an earlier writer's, or a hand-edited ops/show.jsonl), text
|
||||
/// that isn't a date, an unknown split or comparison. The page, the
|
||||
@@ -206,7 +206,7 @@ fn show_never_swaps_an_inverted_target_defect_15() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Defect 16, repro 1.1.4 (rules.md B-30): a report target with only an
|
||||
/// Defect 16, repro 1.1.4 (BS-period-3): a report target with only an
|
||||
/// end covers that end's fiscal year to it (2025-01-01 to 2025-06-30, not
|
||||
/// the swapped 2025-06-30 to 2026-01-01); with no dates, the default (the
|
||||
/// fiscal year to date, named "Year to date"); dates that are a preset's
|
||||
|
||||
@@ -1065,7 +1065,7 @@ fn small_books(tag: &str) -> Small {
|
||||
.add_account("1000", "Checking", AccountType::Asset, None, false)
|
||||
.unwrap();
|
||||
// Mapped to the return, so books with nothing else to do have
|
||||
// nothing in Needs attention (rules.md B-32 lists every expense
|
||||
// nothing in Needs attention (BS-ledger-11 lists every expense
|
||||
// account without a category, used or not).
|
||||
let rent = store
|
||||
.add_account_with_tax(
|
||||
|
||||
@@ -84,7 +84,7 @@ fn build(plan: &Plan, tag: &str) -> (TestDir, Source, ledger_core::Ledger) {
|
||||
.collect();
|
||||
// As replay posts them: random lines land on receivables and payables
|
||||
// by hand, as books an earlier version wrote can hold them (the
|
||||
// control guard, rules.md B-38, refuses them as new work), and the
|
||||
// control guard, BS-arap-2, refuses them as new work), and the
|
||||
// overview must still read them.
|
||||
ledger_core::parties::replaying(|| {
|
||||
for &(back, dr, cr, cents) in &plan.entries {
|
||||
@@ -169,7 +169,7 @@ proptest! {
|
||||
fy = fy - Months::new(12);
|
||||
}
|
||||
prop_assert_eq!(b.fiscal_ytd(), (fy, t));
|
||||
// One default period everywhere (rules.md B-30): what a report or
|
||||
// One default period everywhere (BS-period-3): what a report or
|
||||
// register opens on is the fiscal year to date, the server's
|
||||
// resolver's own answer for no dates, and party totals count this
|
||||
// calendar year.
|
||||
@@ -700,7 +700,7 @@ fn more_origins_and_parties() {
|
||||
assert!(!r.missing_receipt, "a remittance isn't a hand-made entry");
|
||||
}
|
||||
|
||||
/// Defect 8, repros 1.4.2 and 1.4.3 (rules.md B-32): Needs attention lists
|
||||
/// Defect 8, repros 1.4.2 and 1.4.3 (BS-ledger-11): Needs attention lists
|
||||
/// every revenue and expense account without a tax category, with
|
||||
/// activity or not: one never used, one used only last fiscal year; never
|
||||
/// a header, an account with a category, or an asset. Info under warn,
|
||||
@@ -791,7 +791,7 @@ fn needs_attention_flags_every_uncategorized_pl_account_defect_8() {
|
||||
assert!(item(&b).is_none());
|
||||
}
|
||||
|
||||
/// "Show all dates" is every date (P3 settled in design, rules.md B-30):
|
||||
/// "Show all dates" is every date (P3 settled in design, BS-period-3):
|
||||
/// the register's and the reports' all-dates range runs from the first
|
||||
/// posted entry through the later of today and the last, so an entry
|
||||
/// dated after today is never left out of it (as party totals' "All time"
|
||||
|
||||
Reference in new issue
Block a user