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
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user