Skip to content

date and file functions - #269

Merged
raphael-goetz merged 2 commits into
mainfrom
#265-date-and-file-functions
Aug 1, 2026
Merged

date and file functions#269
raphael-goetz merged 2 commits into
mainfrom
#265-date-and-file-functions

Conversation

@raphael-goetz

Copy link
Copy Markdown
Member

Resolves: #265

@raphael-goetz raphael-goetz self-assigned this Aug 1, 2026
Copilot AI review requested due to automatic review settings August 1, 2026 15:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new standard-library runtime function sets for date handling and file payload inspection, addressing Issue #265 (“Implement new Functions: Date & Files”) by expanding the taurus-core runtime function catalog.

Changes:

  • Registers new std::date::* functions for creating, parsing, and formatting DATE values (microseconds since Unix epoch, UTC).
  • Adds std::file::size for computing decoded byte size of base64-encoded FILE payloads.
  • Introduces chrono as a workspace dependency used by the new date handlers.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/taurus-core/src/runtime/functions/mod.rs Wires the new date and file function sets into the runtime registry.
crates/taurus-core/src/runtime/functions/date.rs Implements std::date::* handlers (now/from/from_text/from_unix/format) with unit tests.
crates/taurus-core/src/runtime/functions/file.rs Implements std::file::size with unit tests.
crates/taurus-core/Cargo.toml Adds chrono dependency for taurus-core.
Cargo.toml Adds workspace chrono dependency configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +37
use base64::Engine;
use tucana::shared::{Struct, value::Kind};

pub(crate) const FUNCTIONS: &[FunctionRegistration] =
&[FunctionRegistration::eager("std::file::size", size, 1)];

fn size(
args: &[Argument],
_ctx: &mut ValueStore,
_run: &mut crate::handler::registry::ThunkRunner<'_>,
) -> Signal {
args!(args => file: Struct);

// `throwsError: false` — a missing/malformed `value` field reports size 0
// rather than failing.
let byte_len = match file.fields.get("value").and_then(|v| v.kind.as_ref()) {
Some(Kind::StringValue(base64_value)) => base64::prelude::BASE64_STANDARD
.decode(base64_value)
.map(|bytes| bytes.len())
.unwrap_or(0),
_ => 0,
};

Signal::Success(value_from_i64(byte_len as i64))
}
Comment on lines +80 to +87
let (Ok(day), Ok(hour), Ok(minute), Ok(second)) = (
u32::try_from(day),
u32::try_from(hour),
u32::try_from(minute),
u32::try_from(second),
) else {
return fail("day, hour, minute and second must be non-negative");
};
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

GitLab Pipeline Action

General information

Link to pipeline: https://gitlab.com/code0-tech/development/taurus/-/pipelines/2724026451

Status: Passed
Duration: 1 minutes

Job summaries

docs:preview

Documentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/15659433759/artifacts/out/index.html

@raphael-goetz
raphael-goetz merged commit cba15b3 into main Aug 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement new Functions

2 participants