Skip to content

[DAP-17] TaskConf AAD Part 2A: Mandatory task_info and Interval task validity - #4684

Merged
jcjones merged 6 commits into
mainfrom
jcj/dap-17-taskconf-aad-part-2
Jul 2, 2026
Merged

[DAP-17] TaskConf AAD Part 2A: Mandatory task_info and Interval task validity#4684
jcjones merged 6 commits into
mainfrom
jcj/dap-17-taskconf-aad-part-2

Conversation

@jcjones

@jcjones jcjones commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Provisions the task data the HPKE-AAD TaskConfiguration will need (Part 3), with no AAD changes yet.

  • task_info is now a mandatory, persisted Vec<u8> (non-empty, <=255 bytes) rather than an Option that serde silently dropped. In the DB it's BYTEA NOT NULL; serde/API forms carry it as an unpadded base64url; taskprov passes the real value from its TaskConfiguration.

  • Task validity is represented as a single Option<Interval> all the way to the DB: the task_end column becomes task_duration, and the API/serde forms are task_start + task_duration. Half-open intervals are now unrepresentable, as we all wanted. Report-admission checks derive start/end from the interval, and just for safety I added that the PATCH task-end path returns 400 when end is < task_start.

Part 2B will change url::Url to janus_messages::Url for our in-DB representations, to keep from causing AAD errors with URL normalization business. That turns out to be a nice standalone task.

Closes #4625.

…validity

Provisions the task data the HPKE-AAD TaskConfiguration will need (Part 3),
with no AAD changes yet.

- task_info is now a mandatory, persisted Vec<u8> (non-empty, <=255 bytes)
  rather than an Option that serde silently dropped. In the DB it's BYTEA
  NOT NULL; serde/API forms carry it as an unpadded base64url; taskprov passes
  the real value from its TaskConfiguration.

- Task validity is represented as a single Option<Interval> all the way to
  the DB: the task_end column becomes task_duration, and the API/serde forms
  are task_start + task_duration. Half-open intervals are now unrepresentable,
  as we all wanted.  Report-admission checks derive start/end from the interval,
  and just for safety I added that the PATCH task-end path returns 400 when end
  is < task_start.

Part 2B will change url::Url to janus_messages::Url for our in-DB representations,
to keep from causing AAD errors with URL normalization business. That turns out to
be a nice standalone task.

Closes #4625.
@jcjones jcjones added this to the draft-ietf-ppm-dap-17 milestone Jun 30, 2026
@jcjones
jcjones marked this pull request as ready for review June 30, 2026 22:44
@jcjones
jcjones requested a review from a team as a code owner June 30, 2026 22:44
@jcjones jcjones added the allow-changed-migrations Override the ci-migrations check to allow migrations that have changed. label Jun 30, 2026
@jcjones

jcjones commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Whoops, how'd I miss that test. Lemme work this out.

@jcjones
jcjones marked this pull request as draft June 30, 2026 23:27
@jcjones
jcjones marked this pull request as ready for review June 30, 2026 23:39
Comment thread db/00000000000001_initial_schema.up.sql Outdated
Comment thread aggregator_core/src/task.rs Outdated
Comment thread aggregator_core/src/datastore.rs Outdated
Comment on lines 839 to 849
/// Sets or unsets the end date of a task.
///
/// Because the task's validity interval is stored as a (start, duration) pair and a half-open
/// interval is not representable, the requested end is translated into a new `task_duration`:
///
/// * `Some(end)`: `task_duration` is recomputed as `end - task_start`, leaving `task_start`
/// unchanged. If the task has no `task_start`, both columns remain NULL (the interval cannot
/// be set without a start), which is a no-op.
/// * `None`: both `task_start` and `task_duration` are cleared, removing the interval entirely.
#[tracing::instrument(skip(self), err(level = Level::DEBUG))]
pub async fn update_task_end(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This API actually poses a problem now, because it gets incorporated into the task's AAD. Changing the duration midstream would change the AAD, and break decryption of reports. We use this API as the backend for disabling or deleting a task from the control plane currently (not entirely sure which). I think we need to get rid of update_task_end() and introduce some new implementation-specific task field that we can modify to reimplement this feature.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm playing with adding a deactivate_at time outside the task configuration, as an Option that we can set via API and it just ... deactivates then. If we set it to now or the past, it's instant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@divergentdave please take a look at aacea12 and see what you think!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread aggregator_api/src/routes.rs Outdated
Comment thread aggregator_api/src/routes.rs Outdated
jcjones and others added 2 commits July 1, 2026 13:55
Co-authored-by: David Cook <divergentdave@gmail.com>
When we get to part 3, the task validity interval is in the HPKE-AAD TaskConfiguration,
so it must be immutable: mutating it would change the AAD and break decryption of
already-uploaded reports.

Remove update_task_end() and the PATCH task-end path. Task disable/expire now uses
a new deactivate_at column that is not part of the TaskConfiguration, so it can
change freely without affecting AADs.

NOTE: open a divviup-api issue to switch task disabling to use deactivate_at.
Comment thread aggregator/src/aggregator/aggregation_job_init.rs Outdated
Comment thread db/00000000000001_initial_schema.up.sql Outdated
@jcjones
jcjones merged commit 5854060 into main Jul 2, 2026
8 checks passed
@jcjones
jcjones deleted the jcj/dap-17-taskconf-aad-part-2 branch July 2, 2026 17:43
@jcjones jcjones mentioned this pull request Aug 3, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-changed-migrations Override the ci-migrations check to allow migrations that have changed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change Task Start/Duration to Interval representation

2 participants